From b6526465dd1b726bfbbb8a080403d89b330c01ad Mon Sep 17 00:00:00 2001 From: Aaron Weiss Date: Thu, 21 May 2015 22:07:36 -0400 Subject: [PATCH] Added IRCv3 ACCOUNT command for account-notify support. --- src/client/data/command.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/client/data/command.rs b/src/client/data/command.rs index 7a7ccb8..aa93a8d 100644 --- a/src/client/data/command.rs +++ b/src/client/data/command.rs @@ -144,9 +144,11 @@ pub enum Command { /// MEMOSERV message MEMOSERV(String), - // Capabilities extension to IRCv3 + // IRCv3 support /// CAP [*] COMMAND [*] :[param] CAP(Option, CapSubCommand, Option, Option), + /// ACCOUNT [account name] + ACCOUNT(String), } impl Into for Command { @@ -316,6 +318,8 @@ 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), } } } @@ -1038,6 +1042,19 @@ impl Command { } else { return Err(invalid_input()) } + } else if let "ACCOUNT" = &m.command[..] { + match m.suffix { + Some(ref suffix) => if m.args.len() == 0 { + Command::ACCOUNT(suffix.clone()) + } else { + return Err(invalid_input()) + }, + None => if m.args.len() == 1 { + Command::ACCOUNT(m.args[0].clone()) + } else { + return Err(invalid_input()) + } + } } else { return Err(invalid_input()) })