Clean up after #14. Updated test config script.

This commit is contained in:
Aaron Weiss 2015-02-17 13:20:59 -05:00
parent ced1b7fa9a
commit a820310b9c
2 changed files with 12 additions and 10 deletions

View file

@ -1 +1 @@
echo "{\"owners\": [\"test\"],\"nickname\": \"test\",\"username\": \"test\",\"realname\": \"test\",\"password\": \"\",\"server\": \"irc.test.net\",\"port\": 6667,\"use_ssl\": false,\"encoding\": \"UTF-8\",\"channels\": [\"#test\", \"#test2\"],\"options\": {}}" > client_config.json
echo "{\"owners\": [\"test\"],\"nickname\": \"test\",\"username\": \"test\",\"realname\": \"test\",\"password\": \"\",\"server\": \"irc.test.net\",\"port\": 6667,\"use_ssl\": false,\"encoding\": \"UTF-8\",\"channels\": [\"#test\", \"#test2\"],\"umodes\": \"+BR\",\"options\": {}}" > client_config.json

View file

@ -29,8 +29,6 @@ pub struct Config {
/// The bot's real name.
#[stable]
pub realname: Option<String>,
/// User modes to set on connect. Example: "+RB-x"
pub umodes: Option<String>,
/// The server to connect to.
#[stable]
pub server: Option<String>,
@ -51,6 +49,9 @@ pub struct Config {
/// A list of channels to join on connection.
#[stable]
pub channels: Option<Vec<String>>,
/// User modes to set on connect. Example: "+RB-x"
#[unstable]
pub umodes: Option<String>,
/// The text that'll be sent in response to CTCP USERINFO requests.
#[stable]
pub user_info: Option<String>,
@ -121,13 +122,6 @@ impl Config {
self.realname.as_ref().map(|s| &s[]).unwrap_or(self.nickname())
}
/// Gets the user modes set on connect specified in the configuration.
/// This defaults to an empty string when not specified.
#[stable]
pub fn umodes(&self) -> &str {
self.umodes.as_ref().map(|s| &s[]).unwrap_or("")
}
/// Gets the address of the server specified in the configuration.
/// This panics when not specified.
#[stable]
@ -174,6 +168,14 @@ impl Config {
self.channels.as_ref().map(|v| v.iter().map(|s| &s[]).collect()).unwrap_or(vec![])
}
/// Gets the user modes to set on connect specified in the configuration.
/// This defaults to an empty string when not specified.
#[unstable = "Feature is still relatively new."]
pub fn umodes(&self) -> &str {
self.umodes.as_ref().map(|s| &s[]).unwrap_or("")
}
/// Gets the string to be sent in response to CTCP USERINFO requests.
/// This defaults to an empty string when not specified.
#[unstable = "Feature is still relatively new."]