Struct irc::client::data::config::Config [] [src]

pub struct Config {
    pub owners: Option<Vec<String>>,
    pub nickname: Option<String>,
    pub nick_password: Option<String>,
    pub alt_nicks: Option<Vec<String>>,
    pub username: Option<String>,
    pub realname: Option<String>,
    pub server: Option<String>,
    pub port: Option<u16>,
    pub password: Option<String>,
    pub use_ssl: Option<bool>,
    pub cert_path: Option<String>,
    pub encoding: Option<String>,
    pub channels: Option<Vec<String>>,
    pub umodes: Option<String>,
    pub user_info: Option<String>,
    pub version: Option<String>,
    pub source: Option<String>,
    pub ping_time: Option<u32>,
    pub ping_timeout: Option<u32>,
    pub burst_window_length: Option<u32>,
    pub max_messages_in_burst: Option<u32>,
    pub should_ghost: Option<bool>,
    pub ghost_sequence: Option<Vec<String>>,
    pub use_mock_connection: Option<bool>,
    pub mock_initial_value: Option<String>,
    pub channel_keys: Option<HashMap<String, String>>,
    pub options: Option<HashMap<String, String>>,
}

Configuration data.

Fields

A list of the owners of the client by nickname (for bots).

The client's nickname.

The client's NICKSERV password.

Alternative nicknames for the client, if the default is taken.

The client's username.

The client's real name.

The server to connect to.

The port to connect on.

The password to connect to the server.

Whether or not to use SSL. Clients will automatically panic if this is enabled without SSL support.

The path to the SSL certificate for this server in DER format.

The encoding type used for this connection. This is typically UTF-8, but could be something else.

A list of channels to join on connection.

User modes to set on connect. Example: "+RB -x"

The text that'll be sent in response to CTCP USERINFO requests.

The text that'll be sent in response to CTCP VERSION requests.

The text that'll be sent in response to CTCP SOURCE requests.

The amount of inactivity in seconds before the client will ping the server.

The amount of time in seconds for a client to reconnect due to no ping response.

The length in seconds of a rolling window for message throttling. If more than max_messages_in_burst messages are sent within burst_window_length seconds, additional messages will be delayed automatically as appropriate. In particular, in the past burst_window_length seconds, there will never be more than max_messages_in_burst messages sent.

The maximum number of messages that can be sent in a burst window before they'll be delayed. Messages are automatically delayed as appropriate.

Whether the client should use NickServ GHOST to reclaim its primary nickname if it is in use. This has no effect if nick_password is not set.

The command(s) that should be sent to NickServ to recover a nickname. The nickname and password will be appended in that order after the command. E.g. ["RECOVER", "RELEASE"] means RECOVER nick pass and RELEASE nick pass will be sent in that order.

Whether or not to use a fake connection for testing purposes. You probably will never want to enable this, but it is used in unit testing for the irc crate.

The initial value used by the fake connection for testing. You probably will never need to set this, but it is used in unit testing for the irc crate.

A mapping of channel names to keys for join-on-connect.

A map of additional options to be stored in config.

Methods

impl Config
[src]

[src]

Loads a configuration from the desired path. This will use the file extension to detect which format to parse the file as (json, toml, or yaml). Using each format requires having its respective crate feature enabled. Only json is available by default.

[src]

Saves a configuration to the desired path. This will use the file extension to detect which format to parse the file as (json, toml, or yaml). Using each format requires having its respective crate feature enabled. Only json is available by default.

[src]

Determines whether or not the nickname provided is the owner of the bot.

[src]

Gets the nickname specified in the configuration. This will panic if not specified.

[src]

Gets the bot's nickserv password specified in the configuration. This defaults to an empty string when not specified.

[src]

Gets the alternate nicknames specified in the configuration. This defaults to an empty vector when not specified.

[src]

Gets the username specified in the configuration. This defaults to the user's nickname when not specified.

[src]

Gets the real name specified in the configuration. This defaults to the user's nickname when not specified.

[src]

Gets the address of the server specified in the configuration. This panics when not specified.

[src]

Gets the port of the server specified in the configuration. This defaults to 6667 (or 6697 if use_ssl is specified as true) when not specified.

[src]

Gets the server and port as a SocketAddr. This panics when server is not specified or the address is malformed.

[src]

Gets the server password specified in the configuration. This defaults to a blank string when not specified.

[src]

Gets whether or not to use SSL with this connection. This defaults to false when not specified.

[src]

Gets the path to the SSL certificate in DER format if specified.

[src]

Gets the encoding to use for this connection. This requires the encode feature to work. This defaults to UTF-8 when not specified.

[src]

Gets the channels to join upon connection. This defaults to an empty vector if it's not specified.

[src]

Gets the key for the specified channel if it exists in the configuration.

[src]

Gets the user modes to set on connect specified in the configuration. This defaults to an empty string when not specified.

[src]

Gets the string to be sent in response to CTCP USERINFO requests. This defaults to an empty string when not specified.

[src]

Gets the string to be sent in response to CTCP VERSION requests. This defaults to irc:version:env when not specified. For example, irc:0.12.0:Compiled with rustc

[src]

Gets the string to be sent in response to CTCP SOURCE requests. This defaults to https://github.com/aatxe/irc when not specified.

[src]

Gets the amount of time in seconds for the interval at which the client pings the server. This defaults to 180 seconds when not specified.

[src]

Gets the amount of time in seconds for the client to disconnect after not receiving a ping response. This defaults to 10 seconds when not specified.

[src]

The amount of time in seconds to consider a window for burst messages. The message throttling system maintains the invariant that in the past burst_window_length seconds, the maximum number of messages sent is max_messages_in_burst. This defaults to 8 seconds when not specified.

[src]

The maximum number of messages that can be sent in a burst window before they'll be delayed. Messages are automatically delayed until the start of the next window. The message throttling system maintains the invariant that in the past burst_window_length seconds, the maximum number of messages sent is max_messages_in_burst. This defaults to 15 messages when not specified.

[src]

Gets whether or not to attempt nickname reclamation using NickServ GHOST. This defaults to false when not specified.

[src]

Gets the NickServ command sequence to recover a nickname. This defaults to ["GHOST"] when not specified.

[src]

Looks up the specified string in the options map. This uses indexing, and thus panics when the string is not present. This will also panic if used and there are no options.

[src]

Gets whether or not to use a mock connection for testing. This defaults to false when not specified.

[src]

Gets the initial value for the mock connection. This defaults to false when not specified. This has no effect if use_mock_connection is not true.

Trait Implementations

impl Clone for Config
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Default for Config
[src]

[src]

Returns the "default value" for a type. Read more

impl PartialEq for Config
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl Debug for Config
[src]

[src]

Formats the value using the given formatter.