From e9066e3cba97474c008fc3defe908f3f1d393950 Mon Sep 17 00:00:00 2001 From: Aaron Weiss Date: Thu, 4 Jun 2015 15:14:28 -0400 Subject: [PATCH] Added MONITOR command for IRCv3.2 monitor extension. --- src/client/data/command.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/client/data/command.rs b/src/client/data/command.rs index b71c789..731cb49 100644 --- a/src/client/data/command.rs +++ b/src/client/data/command.rs @@ -155,6 +155,10 @@ pub enum Command { // AWAY(Option), // JOIN is already defined. // JOIN(String, Option, Option), + + // IRCv3.2 extensions + /// MONITOR command [nicklist] + MONITOR(String, Option) } impl Into for Command { @@ -326,6 +330,11 @@ impl Into for Command { Command::ACCOUNT(a) => Message::from_owned(None, string("ACCOUNT"), Some(vec![a]), None), + + Command::MONITOR(c, Some(t)) => + Message::from_owned(None, string("MONITOR"), Some(vec![c, t]), None), + Command::MONITOR(c, None) => + Message::from_owned(None, string("MONITOR"), Some(vec![c]), None), } } } @@ -1066,6 +1075,12 @@ impl Command { return Err(invalid_input()) } } + } else if let "MONITOR" = &m.command[..] { + if m.args.len() == 1 { + Command::MONITOR(m.args[0].clone(), m.suffix.clone()) + } else { + return Err(invalid_input()) + } } else { return Err(invalid_input()) })