diff --git a/src/client/data/caps.rs b/src/client/data/caps.rs index b310644..fda05f3 100644 --- a/src/client/data/caps.rs +++ b/src/client/data/caps.rs @@ -8,6 +8,8 @@ pub enum Capability { MultiPrefix, /// [account-notify](http://ircv3.net/specs/extensions/account-notify-3.1.html) AccountNotify, + /// [away-notify](http://ircv3.net/specs/extensions/away-notify-3.1.html) + AwayNotify, } impl AsRef for Capability { @@ -15,6 +17,7 @@ impl AsRef for Capability { match *self { Capability::MultiPrefix => "multi-prefix", Capability::AccountNotify => "account-notify", + Capability::AwayNotify => "away-notify", } } } @@ -27,5 +30,6 @@ mod test { fn to_str() { assert_eq!(MultiPrefix.as_ref(), "multi-prefix"); assert_eq!(AccountNotify.as_ref(), "account-notify"); + assert_eq!(AwayNotify.as_ref(), "away-notify"); } } diff --git a/src/client/data/command.rs b/src/client/data/command.rs index aa93a8d..3ba9642 100644 --- a/src/client/data/command.rs +++ b/src/client/data/command.rs @@ -147,8 +147,12 @@ pub enum Command { // IRCv3 support /// CAP [*] COMMAND [*] :[param] CAP(Option, CapSubCommand, Option, Option), + + // IRCv3.1 extensions /// ACCOUNT [account name] ACCOUNT(String), + // AWAY is already defined as a send-only message. + //AWAY(Option), } impl Into for Command { @@ -267,8 +271,7 @@ impl Into for Command { Message::from_owned(None, string("PONG"), Some(vec![s]), Some(t)), Command::PONG(s, None) => Message::from_owned(None, string("PONG"), None, Some(s)), Command::ERROR(m) => Message::from_owned(None, string("ERROR"), None, Some(m)), - Command::AWAY(Some(m)) => Message::from_owned(None, string("AWAY"), None, Some(m)), - Command::AWAY(None) => Message::from_owned(None, string("AWAY"), None, None), + Command::AWAY(m) => Message::from_owned(None, string("AWAY"), None, m), Command::REHASH => Message::from_owned(None, string("REHASH"), None, None), Command::DIE => Message::from_owned(None, string("DIE"), None, None), Command::RESTART => Message::from_owned(None, string("RESTART"), None, None), @@ -318,6 +321,7 @@ impl Into for Command { Message::from_owned(None, string("CAP"), Some(vec![s.string(), c]), p), Command::CAP(Some(k), s, Some(c), p) => Message::from_owned(None, string("CAP"), Some(vec![k, s.string(), c]), p), + Command::ACCOUNT(a) => Message::from_owned(None, string("ACCOUNT"), Some(vec![a]), None), }