Commands now uses slices.
This commit is contained in:
parent
fbcc3021a8
commit
25d4585fbc
1 changed files with 233 additions and 235 deletions
|
@ -6,100 +6,100 @@ use data::message::Message;
|
||||||
/// List of all client commands as defined in [RFC 2812](http://tools.ietf.org/html/rfc2812)
|
/// List of all client commands as defined in [RFC 2812](http://tools.ietf.org/html/rfc2812)
|
||||||
#[stable]
|
#[stable]
|
||||||
#[deriving(Show, PartialEq)]
|
#[deriving(Show, PartialEq)]
|
||||||
pub enum Command {
|
pub enum Command<'a> {
|
||||||
// 3.1 Connection Registration
|
// 3.1 Connection Registration
|
||||||
/// PASS password
|
/// PASS password
|
||||||
PASS(String),
|
PASS(&'a str),
|
||||||
/// NICK nickname
|
/// NICK nickname
|
||||||
NICK(String),
|
NICK(&'a str),
|
||||||
/// USER user mode * realname
|
/// USER user mode * realname
|
||||||
USER(String, String, String),
|
USER(&'a str, &'a str, &'a str),
|
||||||
/// OPER name password
|
/// OPER name password
|
||||||
OPER(String, String),
|
OPER(&'a str, &'a str),
|
||||||
/// MODE nickname modes
|
/// MODE nickname modes
|
||||||
/// MODE channel modes [modeparams]
|
/// MODE channel modes [modeparams]
|
||||||
MODE(String, String, Option<String>),
|
MODE(&'a str, &'a str, Option<&'a str>),
|
||||||
/// SERVICE nickname reserved distribution type reserved info
|
/// SERVICE nickname reserved distribution type reserved info
|
||||||
SERVICE(String, String, String, String, String, String),
|
SERVICE(&'a str, &'a str, &'a str, &'a str, &'a str, &'a str),
|
||||||
/// QUIT Quit Message
|
/// QUIT Quit Message
|
||||||
QUIT(Option<String>),
|
QUIT(Option<&'a str>),
|
||||||
/// SQUIT server comment
|
/// SQUIT server comment
|
||||||
SQUIT(String, String),
|
SQUIT(&'a str, &'a str),
|
||||||
|
|
||||||
// 3.2 Channel operations
|
// 3.2 Channel operations
|
||||||
/// JOIN chanlist [chankeys]
|
/// JOIN chanlist [chankeys]
|
||||||
JOIN(String, Option<String>),
|
JOIN(&'a str, Option<&'a str>),
|
||||||
/// PART chanlist [Part Message]
|
/// PART chanlist [Part Message]
|
||||||
PART(String, Option<String>),
|
PART(&'a str, Option<&'a str>),
|
||||||
// MODE is already defined.
|
// MODE is already defined.
|
||||||
// MODE(String, String, Option<String>),
|
// MODE(&'a str, &'a str, Option<&'a str>),
|
||||||
/// TOPIC channel [topic]
|
/// TOPIC channel [topic]
|
||||||
TOPIC(String, Option<String>),
|
TOPIC(&'a str, Option<&'a str>),
|
||||||
/// NAMES [chanlist [target]]
|
/// NAMES [chanlist [target]]
|
||||||
NAMES(Option<String>, Option<String>),
|
NAMES(Option<&'a str>, Option<&'a str>),
|
||||||
/// LIST [chanlist [target]]
|
/// LIST [chanlist [target]]
|
||||||
LIST(Option<String>, Option<String>),
|
LIST(Option<&'a str>, Option<&'a str>),
|
||||||
/// INVITE nickname channel
|
/// INVITE nickname channel
|
||||||
INVITE(String, String),
|
INVITE(&'a str, &'a str),
|
||||||
/// KICK chanlist userlist [comment]
|
/// KICK chanlist userlist [comment]
|
||||||
KICK(String, String, Option<String>),
|
KICK(&'a str, &'a str, Option<&'a str>),
|
||||||
|
|
||||||
// 3.3 Sending messages
|
// 3.3 Sending messages
|
||||||
/// PRIVMSG msgtarget text to be sent
|
/// PRIVMSG msgtarget text to be sent
|
||||||
PRIVMSG(String, String),
|
PRIVMSG(&'a str, &'a str),
|
||||||
/// NOTICE msgtarget text
|
/// NOTICE msgtarget text
|
||||||
NOTICE(String, String),
|
NOTICE(&'a str, &'a str),
|
||||||
|
|
||||||
// 3.4 Server queries and commands
|
// 3.4 Server queries and commands
|
||||||
/// MOTD [target]
|
/// MOTD [target]
|
||||||
MOTD(Option<String>),
|
MOTD(Option<&'a str>),
|
||||||
/// LUSERS [mask [target]]
|
/// LUSERS [mask [target]]
|
||||||
LUSERS(Option<String>, Option<String>),
|
LUSERS(Option<&'a str>, Option<&'a str>),
|
||||||
/// VERSION [target]
|
/// VERSION [target]
|
||||||
VERSION(Option<String>),
|
VERSION(Option<&'a str>),
|
||||||
/// STATS [query [target]]
|
/// STATS [query [target]]
|
||||||
STATS(Option<String>, Option<String>),
|
STATS(Option<&'a str>, Option<&'a str>),
|
||||||
/// LINKS [[remote server] server mask]
|
/// LINKS [[remote server] server mask]
|
||||||
LINKS(Option<String>, Option<String>),
|
LINKS(Option<&'a str>, Option<&'a str>),
|
||||||
/// TIME [target]
|
/// TIME [target]
|
||||||
TIME(Option<String>),
|
TIME(Option<&'a str>),
|
||||||
/// CONNECT target server port [remote server]
|
/// CONNECT target server port [remote server]
|
||||||
CONNECT(String, String, Option<String>),
|
CONNECT(&'a str, &'a str, Option<&'a str>),
|
||||||
/// TRACE [target]
|
/// TRACE [target]
|
||||||
TRACE(Option<String>),
|
TRACE(Option<&'a str>),
|
||||||
/// ADMIN [target]
|
/// ADMIN [target]
|
||||||
ADMIN(Option<String>),
|
ADMIN(Option<&'a str>),
|
||||||
/// INFO [target]
|
/// INFO [target]
|
||||||
INFO(Option<String>),
|
INFO(Option<&'a str>),
|
||||||
|
|
||||||
// 3.5 Service Query and Commands
|
// 3.5 Service Query and Commands
|
||||||
/// SERVLIST [mask [type]]
|
/// SERVLIST [mask [type]]
|
||||||
SERVLIST(Option<String>, Option<String>),
|
SERVLIST(Option<&'a str>, Option<&'a str>),
|
||||||
/// SQUERY servicename text
|
/// SQUERY servicename text
|
||||||
SQUERY(String, String),
|
SQUERY(&'a str, &'a str),
|
||||||
|
|
||||||
// 3.6 User based queries
|
// 3.6 User based queries
|
||||||
/// WHO [mask ["o"]]
|
/// WHO [mask ["o"]]
|
||||||
WHO(Option<String>, Option<bool>),
|
WHO(Option<&'a str>, Option<bool>),
|
||||||
/// WHOIS [target] masklist
|
/// WHOIS [target] masklist
|
||||||
WHOIS(Option<String>, String),
|
WHOIS(Option<&'a str>, &'a str),
|
||||||
/// WHOWAS nicklist [count [target]]
|
/// WHOWAS nicklist [count [target]]
|
||||||
WHOWAS(String, Option<String>, Option<String>),
|
WHOWAS(&'a str, Option<&'a str>, Option<&'a str>),
|
||||||
|
|
||||||
// 3.7 Miscellaneous messages
|
// 3.7 Miscellaneous messages
|
||||||
/// KILL nickname comment
|
/// KILL nickname comment
|
||||||
KILL(String, String),
|
KILL(&'a str, &'a str),
|
||||||
/// PING server1 [server2]
|
/// PING server1 [server2]
|
||||||
PING(String, Option<String>),
|
PING(&'a str, Option<&'a str>),
|
||||||
/// PONG server [server2]
|
/// PONG server [server2]
|
||||||
PONG(String, Option<String>),
|
PONG(&'a str, Option<&'a str>),
|
||||||
/// ERROR error message
|
/// ERROR error message
|
||||||
ERROR(String),
|
ERROR(&'a str),
|
||||||
|
|
||||||
|
|
||||||
// 4 Optional Features
|
// 4 Optional Features
|
||||||
/// AWAY [text]
|
/// AWAY [text]
|
||||||
AWAY(Option<String>),
|
AWAY(Option<&'a str>),
|
||||||
/// REHASH
|
/// REHASH
|
||||||
REHASH,
|
REHASH,
|
||||||
/// DIE
|
/// DIE
|
||||||
|
@ -107,353 +107,351 @@ pub enum Command {
|
||||||
/// RESTART
|
/// RESTART
|
||||||
RESTART,
|
RESTART,
|
||||||
/// SUMMON user [target [channel]]
|
/// SUMMON user [target [channel]]
|
||||||
SUMMON(String, Option<String>, Option<String>),
|
SUMMON(&'a str, Option<&'a str>, Option<&'a str>),
|
||||||
/// USERS [target]
|
/// USERS [target]
|
||||||
USERS(Option<String>),
|
USERS(Option<&'a str>),
|
||||||
/// WALLOPS Text to be sent
|
/// WALLOPS Text to be sent
|
||||||
WALLOPS(String),
|
WALLOPS(&'a str),
|
||||||
/// USERHOST space-separated nicklist
|
/// USERHOST space-separated nicklist
|
||||||
USERHOST(Vec<String>),
|
USERHOST(Vec<&'a str>),
|
||||||
/// ISON space-separated nicklist
|
/// ISON space-separated nicklist
|
||||||
ISON(Vec<String>),
|
ISON(Vec<&'a str>),
|
||||||
|
|
||||||
// Non-RFC commands from InspIRCd
|
// Non-RFC commands from InspIRCd
|
||||||
/// SAJOIN nickname channel
|
/// SAJOIN nickname channel
|
||||||
SAJOIN(String, String),
|
SAJOIN(&'a str, &'a str),
|
||||||
/// SAMODE target modes [modeparams]
|
/// SAMODE target modes [modeparams]
|
||||||
SAMODE(String, String, Option<String>),
|
SAMODE(&'a str, &'a str, Option<&'a str>),
|
||||||
/// SANICK old nickname new nickname
|
/// SANICK old nickname new nickname
|
||||||
SANICK(String, String),
|
SANICK(&'a str, &'a str),
|
||||||
/// SAPART nickname reason
|
/// SAPART nickname reason
|
||||||
SAPART(String, String),
|
SAPART(&'a str, &'a str),
|
||||||
/// SAQUIT nickname reason
|
/// SAQUIT nickname reason
|
||||||
SAQUIT(String, String),
|
SAQUIT(&'a str, &'a str),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Command {
|
impl<'a> Command<'a> {
|
||||||
/// Converts a Command into a Message
|
/// Converts a Command into a Message
|
||||||
#[stable]
|
#[stable]
|
||||||
pub fn to_message(self) -> Message {
|
pub fn to_message(self) -> Message {
|
||||||
match self {
|
match self {
|
||||||
PASS(p) => Message::new(None, "PASS", None, Some(p[])),
|
PASS(p) => Message::new(None, "PASS", None, Some(p)),
|
||||||
NICK(n) => Message::new(None, "NICK", None, Some(n[])),
|
NICK(n) => Message::new(None, "NICK", None, Some(n)),
|
||||||
USER(u, m, r) => Message::new(None, "USER", Some(vec![u[], m[], "*"]), Some(r[])),
|
USER(u, m, r) => Message::new(None, "USER", Some(vec![u, m, "*"]), Some(r)),
|
||||||
OPER(u, p) => Message::new(None, "OPER", Some(vec![u[]]), Some(p[])),
|
OPER(u, p) => Message::new(None, "OPER", Some(vec![u]), Some(p)),
|
||||||
MODE(t, m, Some(p)) => Message::new(None, "MODE", Some(vec![t[], m[], p[]]), None),
|
MODE(t, m, Some(p)) => Message::new(None, "MODE", Some(vec![t, m, p]), None),
|
||||||
MODE(t, m, None) => Message::new(None, "MODE", Some(vec![t[], m[]]), None),
|
MODE(t, m, None) => Message::new(None, "MODE", Some(vec![t, m]), None),
|
||||||
SERVICE(n, r, d, t, re, i) => Message::new(None, "SERVICE",
|
SERVICE(n, r, d, t, re, i) => Message::new(None, "SERVICE",
|
||||||
Some(vec![n[], r[], d[], t[], re[]]), Some(i[])),
|
Some(vec![n, r, d, t, re]), Some(i)),
|
||||||
QUIT(Some(m)) => Message::new(None, "QUIT", None, Some(m[])),
|
QUIT(Some(m)) => Message::new(None, "QUIT", None, Some(m)),
|
||||||
QUIT(None) => Message::new(None, "QUIT", None, None),
|
QUIT(None) => Message::new(None, "QUIT", None, None),
|
||||||
SQUIT(s, c) => Message::new(None, "SQUIT", Some(vec![s[]]), Some(c[])),
|
SQUIT(s, c) => Message::new(None, "SQUIT", Some(vec![s]), Some(c)),
|
||||||
JOIN(c, Some(k)) => Message::new(None, "JOIN", Some(vec![c[], k[]]), None),
|
JOIN(c, Some(k)) => Message::new(None, "JOIN", Some(vec![c, k]), None),
|
||||||
JOIN(c, None) => Message::new(None, "JOIN", Some(vec![c[]]), None),
|
JOIN(c, None) => Message::new(None, "JOIN", Some(vec![c]), None),
|
||||||
PART(c, Some(m)) => Message::new(None, "PART", Some(vec![c[]]), Some(m[])),
|
PART(c, Some(m)) => Message::new(None, "PART", Some(vec![c]), Some(m)),
|
||||||
PART(c, None) => Message::new(None, "PART", Some(vec![c[]]), None),
|
PART(c, None) => Message::new(None, "PART", Some(vec![c]), None),
|
||||||
TOPIC(c, Some(t)) => Message::new(None, "TOPIC", Some(vec![c[]]), Some(t[])),
|
TOPIC(c, Some(t)) => Message::new(None, "TOPIC", Some(vec![c]), Some(t)),
|
||||||
TOPIC(c, None) => Message::new(None, "TOPIC", Some(vec![c[]]), None),
|
TOPIC(c, None) => Message::new(None, "TOPIC", Some(vec![c]), None),
|
||||||
NAMES(Some(c), Some(t)) => Message::new(None, "NAMES", Some(vec![c[]]), Some(t[])),
|
NAMES(Some(c), Some(t)) => Message::new(None, "NAMES", Some(vec![c]), Some(t)),
|
||||||
NAMES(Some(c), None) => Message::new(None, "NAMES", Some(vec![c[]]), None),
|
NAMES(Some(c), None) => Message::new(None, "NAMES", Some(vec![c]), None),
|
||||||
NAMES(None, _) => Message::new(None, "NAMES", None, None),
|
NAMES(None, _) => Message::new(None, "NAMES", None, None),
|
||||||
LIST(Some(c), Some(t)) => Message::new(None, "LIST", Some(vec![c[]]), Some(t[])),
|
LIST(Some(c), Some(t)) => Message::new(None, "LIST", Some(vec![c]), Some(t)),
|
||||||
LIST(Some(c), None) => Message::new(None, "LIST", Some(vec![c[]]), None),
|
LIST(Some(c), None) => Message::new(None, "LIST", Some(vec![c]), None),
|
||||||
LIST(None, _) => Message::new(None, "LIST", None, None),
|
LIST(None, _) => Message::new(None, "LIST", None, None),
|
||||||
INVITE(n, c) => Message::new(None, "INVITE", Some(vec![n[], c[]]), None),
|
INVITE(n, c) => Message::new(None, "INVITE", Some(vec![n, c]), None),
|
||||||
KICK(c, n, Some(r)) => Message::new(None, "KICK", Some(vec![c[], n[]]), Some(r[])),
|
KICK(c, n, Some(r)) => Message::new(None, "KICK", Some(vec![c, n]), Some(r)),
|
||||||
KICK(c, n, None) => Message::new(None, "KICK", Some(vec![c[], n[]]), None),
|
KICK(c, n, None) => Message::new(None, "KICK", Some(vec![c, n]), None),
|
||||||
PRIVMSG(t, m) => Message::new(None, "PRIVMSG", Some(vec![t[]]), Some(m[])),
|
PRIVMSG(t, m) => Message::new(None, "PRIVMSG", Some(vec![t]), Some(m)),
|
||||||
NOTICE(t, m) => Message::new(None, "NOTICE", Some(vec![t[]]), Some(m[])),
|
NOTICE(t, m) => Message::new(None, "NOTICE", Some(vec![t]), Some(m)),
|
||||||
MOTD(Some(t)) => Message::new(None, "MOTD", None, Some(t[])),
|
MOTD(Some(t)) => Message::new(None, "MOTD", None, Some(t)),
|
||||||
MOTD(None) => Message::new(None, "MOTD", None, None),
|
MOTD(None) => Message::new(None, "MOTD", None, None),
|
||||||
LUSERS(Some(m), Some(t)) => Message::new(None, "LUSERS", Some(vec![m[]]), Some(t[])),
|
LUSERS(Some(m), Some(t)) => Message::new(None, "LUSERS", Some(vec![m]), Some(t)),
|
||||||
LUSERS(Some(m), None) => Message::new(None, "LUSERS", Some(vec![m[]]), None),
|
LUSERS(Some(m), None) => Message::new(None, "LUSERS", Some(vec![m]), None),
|
||||||
LUSERS(None, _) => Message::new(None, "LUSERS", None, None),
|
LUSERS(None, _) => Message::new(None, "LUSERS", None, None),
|
||||||
VERSION(Some(t)) => Message::new(None, "VERSION", None, Some(t[])),
|
VERSION(Some(t)) => Message::new(None, "VERSION", None, Some(t)),
|
||||||
VERSION(None) => Message::new(None, "VERSION", None, None),
|
VERSION(None) => Message::new(None, "VERSION", None, None),
|
||||||
STATS(Some(q), Some(t)) => Message::new(None, "STATS", Some(vec![q[]]), Some(t[])),
|
STATS(Some(q), Some(t)) => Message::new(None, "STATS", Some(vec![q]), Some(t)),
|
||||||
STATS(Some(q), None) => Message::new(None, "STATS", Some(vec![q[]]), None),
|
STATS(Some(q), None) => Message::new(None, "STATS", Some(vec![q]), None),
|
||||||
STATS(None, _) => Message::new(None, "STATS", None, None),
|
STATS(None, _) => Message::new(None, "STATS", None, None),
|
||||||
LINKS(Some(r), Some(s)) => Message::new(None, "LINKS", Some(vec![r[]]), Some(s[])),
|
LINKS(Some(r), Some(s)) => Message::new(None, "LINKS", Some(vec![r]), Some(s)),
|
||||||
LINKS(None, Some(s)) => Message::new(None, "LINKS", None, Some(s[])),
|
LINKS(None, Some(s)) => Message::new(None, "LINKS", None, Some(s)),
|
||||||
LINKS(_, None) => Message::new(None, "LINKS", None, None),
|
LINKS(_, None) => Message::new(None, "LINKS", None, None),
|
||||||
TIME(Some(t)) => Message::new(None, "TIME", None, Some(t[])),
|
TIME(Some(t)) => Message::new(None, "TIME", None, Some(t)),
|
||||||
TIME(None) => Message::new(None, "TIME", None, None),
|
TIME(None) => Message::new(None, "TIME", None, None),
|
||||||
CONNECT(t, p, Some(r)) => Message::new(None, "CONNECT", Some(vec![t[], p[]]), Some(r[])),
|
CONNECT(t, p, Some(r)) => Message::new(None, "CONNECT", Some(vec![t, p]), Some(r)),
|
||||||
CONNECT(t, p, None) => Message::new(None, "CONNECT", Some(vec![t[], p[]]), None),
|
CONNECT(t, p, None) => Message::new(None, "CONNECT", Some(vec![t, p]), None),
|
||||||
TRACE(Some(t)) => Message::new(None, "TRACE", None, Some(t[])),
|
TRACE(Some(t)) => Message::new(None, "TRACE", None, Some(t)),
|
||||||
TRACE(None) => Message::new(None, "TRACE", None, None),
|
TRACE(None) => Message::new(None, "TRACE", None, None),
|
||||||
ADMIN(Some(t)) => Message::new(None, "ADMIN", None, Some(t[])),
|
ADMIN(Some(t)) => Message::new(None, "ADMIN", None, Some(t)),
|
||||||
ADMIN(None) => Message::new(None, "ADMIN", None, None),
|
ADMIN(None) => Message::new(None, "ADMIN", None, None),
|
||||||
INFO(Some(t)) => Message::new(None, "INFO", None, Some(t[])),
|
INFO(Some(t)) => Message::new(None, "INFO", None, Some(t)),
|
||||||
INFO(None) => Message::new(None, "INFO", None, None),
|
INFO(None) => Message::new(None, "INFO", None, None),
|
||||||
SERVLIST(Some(m), Some(t)) => Message::new(None, "SERVLIST", Some(vec![m[]]), Some(t[])),
|
SERVLIST(Some(m), Some(t)) => Message::new(None, "SERVLIST", Some(vec![m]), Some(t)),
|
||||||
SERVLIST(Some(m), None) => Message::new(None, "SERVLIST", Some(vec![m[]]), None),
|
SERVLIST(Some(m), None) => Message::new(None, "SERVLIST", Some(vec![m]), None),
|
||||||
SERVLIST(None, _) => Message::new(None, "SERVLIST", None, None),
|
SERVLIST(None, _) => Message::new(None, "SERVLIST", None, None),
|
||||||
SQUERY(s, t) => Message::new(None, "SQUERY", Some(vec![s[], t[]]), None),
|
SQUERY(s, t) => Message::new(None, "SQUERY", Some(vec![s, t]), None),
|
||||||
WHO(Some(s), Some(true)) => Message::new(None, "WHO", Some(vec![s[], "o"]), None),
|
WHO(Some(s), Some(true)) => Message::new(None, "WHO", Some(vec![s, "o"]), None),
|
||||||
WHO(Some(s), _) => Message::new(None, "WHO", Some(vec![s[]]), None),
|
WHO(Some(s), _) => Message::new(None, "WHO", Some(vec![s]), None),
|
||||||
WHO(None, _) => Message::new(None, "WHO", None, None),
|
WHO(None, _) => Message::new(None, "WHO", None, None),
|
||||||
WHOIS(Some(t), m) => Message::new(None, "WHOIS", Some(vec![t[], m[]]), None),
|
WHOIS(Some(t), m) => Message::new(None, "WHOIS", Some(vec![t, m]), None),
|
||||||
WHOIS(None, m) => Message::new(None, "WHOIS", Some(vec![m[]]), None),
|
WHOIS(None, m) => Message::new(None, "WHOIS", Some(vec![m]), None),
|
||||||
WHOWAS(n, Some(c), Some(t)) => Message::new(None, "WHOWAS", Some(vec![n[], c[]]), Some(t[])),
|
WHOWAS(n, Some(c), Some(t)) => Message::new(None, "WHOWAS", Some(vec![n, c]), Some(t)),
|
||||||
WHOWAS(n, Some(c), None) => Message::new(None, "WHOWAS", Some(vec![n[], c[]]), None),
|
WHOWAS(n, Some(c), None) => Message::new(None, "WHOWAS", Some(vec![n, c]), None),
|
||||||
WHOWAS(n, None, _) => Message::new(None, "WHOWAS", Some(vec![n[]]), None),
|
WHOWAS(n, None, _) => Message::new(None, "WHOWAS", Some(vec![n]), None),
|
||||||
KILL(n, c) => Message::new(None, "KILL", Some(vec![n[]]), Some(c[])),
|
KILL(n, c) => Message::new(None, "KILL", Some(vec![n]), Some(c)),
|
||||||
PING(s, Some(t)) => Message::new(None, "PING", Some(vec![s[]]), Some(t[])),
|
PING(s, Some(t)) => Message::new(None, "PING", Some(vec![s]), Some(t)),
|
||||||
PING(s, None) => Message::new(None, "PING", None, Some(s[])),
|
PING(s, None) => Message::new(None, "PING", None, Some(s)),
|
||||||
PONG(s, Some(t)) => Message::new(None, "PONG", Some(vec![s[]]), Some(t[])),
|
PONG(s, Some(t)) => Message::new(None, "PONG", Some(vec![s]), Some(t)),
|
||||||
PONG(s, None) => Message::new(None, "PONG", None, Some(s[])),
|
PONG(s, None) => Message::new(None, "PONG", None, Some(s)),
|
||||||
ERROR(m) => Message::new(None, "ERROR", None, Some(m[])),
|
ERROR(m) => Message::new(None, "ERROR", None, Some(m)),
|
||||||
AWAY(Some(m)) => Message::new(None, "AWAY", None, Some(m[])),
|
AWAY(Some(m)) => Message::new(None, "AWAY", None, Some(m)),
|
||||||
AWAY(None) => Message::new(None, "AWAY", None, None),
|
AWAY(None) => Message::new(None, "AWAY", None, None),
|
||||||
REHASH => Message::new(None, "REHASH", None, None),
|
REHASH => Message::new(None, "REHASH", None, None),
|
||||||
DIE => Message::new(None, "DIE", None, None),
|
DIE => Message::new(None, "DIE", None, None),
|
||||||
RESTART => Message::new(None, "RESTART", None, None),
|
RESTART => Message::new(None, "RESTART", None, None),
|
||||||
SUMMON(u, Some(t), Some(c)) => Message::new(None, "SUMMON", Some(vec![u[], t[]]), Some(c[])),
|
SUMMON(u, Some(t), Some(c)) => Message::new(None, "SUMMON", Some(vec![u, t]), Some(c)),
|
||||||
SUMMON(u, Some(t), None) => Message::new(None, "SUMMON", Some(vec![u[], t[]]), None),
|
SUMMON(u, Some(t), None) => Message::new(None, "SUMMON", Some(vec![u, t]), None),
|
||||||
SUMMON(u, None, _) => Message::new(None, "SUMMON", Some(vec![u[]]), None),
|
SUMMON(u, None, _) => Message::new(None, "SUMMON", Some(vec![u]), None),
|
||||||
USERS(Some(t)) => Message::new(None, "USERS", None, Some(t[])),
|
USERS(Some(t)) => Message::new(None, "USERS", None, Some(t)),
|
||||||
USERS(None) => Message::new(None, "USERS", None, None),
|
USERS(None) => Message::new(None, "USERS", None, None),
|
||||||
WALLOPS(t) => Message::new(None, "WALLOPS", None, Some(t[])),
|
WALLOPS(t) => Message::new(None, "WALLOPS", None, Some(t)),
|
||||||
USERHOST(u) => Message::new(None, "USERHOST", Some(u.iter().map(|s| s[]).collect()), None),
|
USERHOST(u) => Message::new(None, "USERHOST", Some(u), None),
|
||||||
ISON(u) => Message::new(None, "ISON", Some(u.iter().map(|s| s[]).collect()), None),
|
ISON(u) => Message::new(None, "ISON", Some(u), None),
|
||||||
SAJOIN(n, c) => Message::new(None, "SAJOIN", Some(vec![n[], c[]]), None),
|
SAJOIN(n, c) => Message::new(None, "SAJOIN", Some(vec![n, c]), None),
|
||||||
SAMODE(t, m, Some(p)) => Message::new(None, "SAMODE", Some(vec![t[], m[], p[]]), None),
|
SAMODE(t, m, Some(p)) => Message::new(None, "SAMODE", Some(vec![t, m, p]), None),
|
||||||
SAMODE(t, m, None) => Message::new(None, "SAMODE", Some(vec![t[], m[]]), None),
|
SAMODE(t, m, None) => Message::new(None, "SAMODE", Some(vec![t, m]), None),
|
||||||
SANICK(o, n) => Message::new(None, "SANICK", Some(vec![o[], n[]]), None),
|
SANICK(o, n) => Message::new(None, "SANICK", Some(vec![o, n]), None),
|
||||||
SAPART(c, r) => Message::new(None, "SAPART", Some(vec![c[]]), Some(r[])),
|
SAPART(c, r) => Message::new(None, "SAPART", Some(vec![c]), Some(r)),
|
||||||
SAQUIT(c, r) => Message::new(None, "SAQUIT", Some(vec![c[]]), Some(r[])),
|
SAQUIT(c, r) => Message::new(None, "SAQUIT", Some(vec![c]), Some(r)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Converts a Message into a Command
|
/// Converts a Message into a Command
|
||||||
#[stable]
|
#[stable]
|
||||||
pub fn from_message(m: Message) -> IoResult<Command> {
|
pub fn from_message(m: &'a Message) -> IoResult<Command<'a>> {
|
||||||
Ok(if let "PASS" = m.command[] {
|
Ok(if let "PASS" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() != 0 { return Err(invalid_input()) }
|
if m.args.len() != 0 { return Err(invalid_input()) }
|
||||||
PASS(m.suffix.unwrap())
|
PASS(m.suffix.as_ref().unwrap()[])
|
||||||
} else {
|
} else {
|
||||||
if m.args.len() != 1 { return Err(invalid_input()) }
|
if m.args.len() != 1 { return Err(invalid_input()) }
|
||||||
PASS(m.args[0].clone())
|
PASS(m.args[0][])
|
||||||
}
|
}
|
||||||
} else if let "NICK" = m.command[] {
|
} else if let "NICK" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() != 0 { return Err(invalid_input()) }
|
if m.args.len() != 0 { return Err(invalid_input()) }
|
||||||
NICK(m.suffix.unwrap())
|
NICK(m.suffix.as_ref().unwrap()[])
|
||||||
} else {
|
} else {
|
||||||
if m.args.len() != 1 { return Err(invalid_input()) }
|
if m.args.len() != 1 { return Err(invalid_input()) }
|
||||||
NICK(m.args[0].clone())
|
NICK(m.args[0][])
|
||||||
}
|
}
|
||||||
} else if let "USER" = m.command[] {
|
} else if let "USER" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() != 2 { return Err(invalid_input()) }
|
if m.args.len() != 2 { return Err(invalid_input()) }
|
||||||
USER(m.args[0].clone(), m.args[1].clone(), m.suffix.unwrap().clone())
|
USER(m.args[0][], m.args[1][], m.suffix.as_ref().unwrap()[])
|
||||||
} else {
|
} else {
|
||||||
if m.args.len() != 3 { return Err(invalid_input()) }
|
if m.args.len() != 3 { return Err(invalid_input()) }
|
||||||
USER(m.args[0].clone(), m.args[1].clone(), m.args[2].clone())
|
USER(m.args[0][], m.args[1][], m.args[2][])
|
||||||
}
|
}
|
||||||
} else if let "OPER" = m.command[] {
|
} else if let "OPER" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() != 1 { return Err(invalid_input()) }
|
if m.args.len() != 1 { return Err(invalid_input()) }
|
||||||
OPER(m.args[0].clone(), m.suffix.unwrap())
|
OPER(m.args[0][], m.suffix.as_ref().unwrap()[])
|
||||||
} else {
|
} else {
|
||||||
if m.args.len() != 2 { return Err(invalid_input()) }
|
if m.args.len() != 2 { return Err(invalid_input()) }
|
||||||
OPER(m.args[0].clone(), m.args[1].clone())
|
OPER(m.args[0][], m.args[1][])
|
||||||
}
|
}
|
||||||
} else if let "MODE" = m.command[] {
|
} else if let "MODE" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() != 2 { return Err(invalid_input()) }
|
if m.args.len() != 2 { return Err(invalid_input()) }
|
||||||
MODE(m.args[0].clone(), m.args[1].clone(), Some(m.suffix.unwrap().clone()))
|
MODE(m.args[0][], m.args[1][], Some(m.suffix.as_ref().unwrap()[]))
|
||||||
} else if m.args.len() == 3 {
|
} else if m.args.len() == 3 {
|
||||||
MODE(m.args[0].clone(), m.args[1].clone(), Some(m.args[2].clone()))
|
MODE(m.args[0][], m.args[1][], Some(m.args[2][]))
|
||||||
} else if m.args.len() == 2 {
|
} else if m.args.len() == 2 {
|
||||||
MODE(m.args[0].clone(), m.args[1].clone(), None)
|
MODE(m.args[0][], m.args[1][], None)
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if let "SERVICE" = m.command[] {
|
} else if let "SERVICE" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() != 5 { return Err(invalid_input()) }
|
if m.args.len() != 5 { return Err(invalid_input()) }
|
||||||
SERVICE(m.args[0].clone(), m.args[1].clone(), m.args[2].clone(), m.args[3].clone(),
|
SERVICE(m.args[0][], m.args[1][], m.args[2][], m.args[3][], m.args[4][], m.suffix.as_ref().unwrap()[])
|
||||||
m.args[4].clone(), m.suffix.unwrap().clone())
|
|
||||||
} else {
|
} else {
|
||||||
if m.args.len() != 6 { return Err(invalid_input()) }
|
if m.args.len() != 6 { return Err(invalid_input()) }
|
||||||
SERVICE(m.args[0].clone(), m.args[1].clone(), m.args[2].clone(), m.args[3].clone(),
|
SERVICE(m.args[0][], m.args[1][], m.args[2][], m.args[3][], m.args[4][], m.args[5][])
|
||||||
m.args[4].clone(), m.args[5].clone())
|
|
||||||
}
|
}
|
||||||
} else if let "QUIT" = m.command[] {
|
} else if let "QUIT" = m.command[] {
|
||||||
if m.args.len() != 0 { return Err(invalid_input()) }
|
if m.args.len() != 0 { return Err(invalid_input()) }
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
QUIT(Some(m.suffix.unwrap().clone()))
|
QUIT(Some(m.suffix.as_ref().unwrap()[]))
|
||||||
} else {
|
} else {
|
||||||
QUIT(None)
|
QUIT(None)
|
||||||
}
|
}
|
||||||
} else if let "SQUIT" = m.command[] {
|
} else if let "SQUIT" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() != 1 { return Err(invalid_input()) }
|
if m.args.len() != 1 { return Err(invalid_input()) }
|
||||||
SQUIT(m.args[0].clone(), m.suffix.unwrap().clone())
|
SQUIT(m.args[0][], m.suffix.as_ref().unwrap()[])
|
||||||
} else {
|
} else {
|
||||||
if m.args.len() != 2 { return Err(invalid_input()) }
|
if m.args.len() != 2 { return Err(invalid_input()) }
|
||||||
SQUIT(m.args[0].clone(), m.args[1].clone())
|
SQUIT(m.args[0][], m.args[1][])
|
||||||
}
|
}
|
||||||
} else if let "JOIN" = m.command[] {
|
} else if let "JOIN" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() == 0 {
|
if m.args.len() == 0 {
|
||||||
JOIN(m.suffix.unwrap().clone(), None)
|
JOIN(m.suffix.as_ref().unwrap()[], None)
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
JOIN(m.args[0].clone(), Some(m.suffix.unwrap().clone()))
|
JOIN(m.args[0][], Some(m.suffix.as_ref().unwrap()[]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
JOIN(m.args[0].clone(), None)
|
JOIN(m.args[0][], None)
|
||||||
} else if m.args.len() == 2 {
|
} else if m.args.len() == 2 {
|
||||||
JOIN(m.args[0].clone(), Some(m.args[1].clone()))
|
JOIN(m.args[0][], Some(m.args[1][]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if let "PART" = m.command[] {
|
} else if let "PART" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() == 0 {
|
if m.args.len() == 0 {
|
||||||
PART(m.suffix.unwrap().clone(), None)
|
PART(m.suffix.as_ref().unwrap()[], None)
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
PART(m.args[0].clone(), Some(m.suffix.unwrap().clone()))
|
PART(m.args[0][], Some(m.suffix.as_ref().unwrap()[]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
PART(m.args[0].clone(), None)
|
PART(m.args[0][], None)
|
||||||
} else if m.args.len() == 2 {
|
} else if m.args.len() == 2 {
|
||||||
PART(m.args[0].clone(), Some(m.args[1].clone()))
|
PART(m.args[0][], Some(m.args[1][]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if let "TOPIC" = m.command[] {
|
} else if let "TOPIC" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() == 0 {
|
if m.args.len() == 0 {
|
||||||
TOPIC(m.suffix.unwrap().clone(), None)
|
TOPIC(m.suffix.as_ref().unwrap()[], None)
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
TOPIC(m.args[0].clone(), Some(m.suffix.unwrap().clone()))
|
TOPIC(m.args[0][], Some(m.suffix.as_ref().unwrap()[]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
TOPIC(m.args[0].clone(), None)
|
TOPIC(m.args[0][], None)
|
||||||
} else if m.args.len() == 2 {
|
} else if m.args.len() == 2 {
|
||||||
TOPIC(m.args[0].clone(), Some(m.args[1].clone()))
|
TOPIC(m.args[0][], Some(m.args[1][]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if let "NAMES" = m.command[] {
|
} else if let "NAMES" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() == 0 {
|
if m.args.len() == 0 {
|
||||||
NAMES(Some(m.suffix.unwrap().clone()), None)
|
NAMES(Some(m.suffix.as_ref().unwrap()[]), None)
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
NAMES(Some(m.args[0].clone()), Some(m.suffix.unwrap().clone()))
|
NAMES(Some(m.args[0][]), Some(m.suffix.as_ref().unwrap()[]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if m.args.len() == 0 {
|
} else if m.args.len() == 0 {
|
||||||
NAMES(None, None)
|
NAMES(None, None)
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
NAMES(Some(m.args[0].clone()), None)
|
NAMES(Some(m.args[0][]), None)
|
||||||
} else if m.args.len() == 2 {
|
} else if m.args.len() == 2 {
|
||||||
NAMES(Some(m.args[0].clone()), Some(m.args[1].clone()))
|
NAMES(Some(m.args[0][]), Some(m.args[1][]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if let "LIST" = m.command[] {
|
} else if let "LIST" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() == 0 {
|
if m.args.len() == 0 {
|
||||||
LIST(Some(m.suffix.unwrap().clone()), None)
|
LIST(Some(m.suffix.as_ref().unwrap()[]), None)
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
LIST(Some(m.args[0].clone()), Some(m.suffix.unwrap().clone()))
|
LIST(Some(m.args[0][]), Some(m.suffix.as_ref().unwrap()[]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if m.args.len() == 0 {
|
} else if m.args.len() == 0 {
|
||||||
LIST(None, None)
|
LIST(None, None)
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
LIST(Some(m.args[0].clone()), None)
|
LIST(Some(m.args[0][]), None)
|
||||||
} else if m.args.len() == 2 {
|
} else if m.args.len() == 2 {
|
||||||
LIST(Some(m.args[0].clone()), Some(m.args[1].clone()))
|
LIST(Some(m.args[0][]), Some(m.args[1][]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if let "INVITE" = m.command[] {
|
} else if let "INVITE" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() != 1 { return Err(invalid_input()) }
|
if m.args.len() != 1 { return Err(invalid_input()) }
|
||||||
INVITE(m.args[0].clone(), m.suffix.unwrap())
|
INVITE(m.args[0][], m.suffix.as_ref().unwrap()[])
|
||||||
} else {
|
} else {
|
||||||
if m.args.len() != 2 { return Err(invalid_input()) }
|
if m.args.len() != 2 { return Err(invalid_input()) }
|
||||||
INVITE(m.args[0].clone(), m.args[1].clone())
|
INVITE(m.args[0][], m.args[1][])
|
||||||
}
|
}
|
||||||
} else if let "KICK" = m.command[] {
|
} else if let "KICK" = m.command[] {
|
||||||
if m.args.len() != 2 { return Err(invalid_input()) }
|
if m.args.len() != 2 { return Err(invalid_input()) }
|
||||||
KICK(m.args[0].clone(), m.args[1].clone(), m.suffix.clone())
|
KICK(m.args[0][], m.args[1][], m.suffix.as_ref().map(|s| s[]))
|
||||||
} else if let "PRIVMSG" = m.command[] {
|
} else if let "PRIVMSG" = m.command[] {
|
||||||
if !m.suffix.is_some() || m.args.len() != 1 { return Err(invalid_input()) }
|
if !m.suffix.is_some() || m.args.len() != 1 { return Err(invalid_input()) }
|
||||||
PRIVMSG(m.args[0].clone(), m.suffix.unwrap().clone())
|
PRIVMSG(m.args[0][], m.suffix.as_ref().unwrap()[])
|
||||||
} else if let "NOTICE" = m.command[] {
|
} else if let "NOTICE" = m.command[] {
|
||||||
if !m.suffix.is_some() || m.args.len() != 1 { return Err(invalid_input()) }
|
if !m.suffix.is_some() || m.args.len() != 1 { return Err(invalid_input()) }
|
||||||
NOTICE(m.args[0].clone(), m.suffix.unwrap().clone())
|
NOTICE(m.args[0][], m.suffix.as_ref().unwrap()[])
|
||||||
} else if let "MOTD" = m.command[] {
|
} else if let "MOTD" = m.command[] {
|
||||||
if m.args.len() != 0 { return Err(invalid_input()) }
|
if m.args.len() != 0 { return Err(invalid_input()) }
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
MOTD(Some(m.suffix.unwrap().clone()))
|
MOTD(Some(m.suffix.as_ref().unwrap()[]))
|
||||||
} else {
|
} else {
|
||||||
MOTD(None)
|
MOTD(None)
|
||||||
}
|
}
|
||||||
} else if let "LUSERS" = m.command[] {
|
} else if let "LUSERS" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() == 0 {
|
if m.args.len() == 0 {
|
||||||
LUSERS(Some(m.suffix.unwrap().clone()), None)
|
LUSERS(Some(m.suffix.as_ref().unwrap()[]), None)
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
LUSERS(Some(m.args[0].clone()), Some(m.suffix.unwrap().clone()))
|
LUSERS(Some(m.args[0][]), Some(m.suffix.as_ref().unwrap()[]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if m.args.len() == 0 {
|
} else if m.args.len() == 0 {
|
||||||
LUSERS(None, None)
|
LUSERS(None, None)
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
LUSERS(Some(m.args[0].clone()), None)
|
LUSERS(Some(m.args[0][]), None)
|
||||||
} else if m.args.len() == 2 {
|
} else if m.args.len() == 2 {
|
||||||
LUSERS(Some(m.args[0].clone()), Some(m.args[1].clone()))
|
LUSERS(Some(m.args[0][]), Some(m.args[1][]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if let "VERSION" = m.command[] {
|
} else if let "VERSION" = m.command[] {
|
||||||
if m.args.len() != 0 { return Err(invalid_input()) }
|
if m.args.len() != 0 { return Err(invalid_input()) }
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
VERSION(Some(m.suffix.unwrap().clone()))
|
VERSION(Some(m.suffix.as_ref().unwrap()[]))
|
||||||
} else {
|
} else {
|
||||||
VERSION(None)
|
VERSION(None)
|
||||||
}
|
}
|
||||||
} else if let "STATS" = m.command[] {
|
} else if let "STATS" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() == 0 {
|
if m.args.len() == 0 {
|
||||||
STATS(Some(m.suffix.unwrap().clone()), None)
|
STATS(Some(m.suffix.as_ref().unwrap()[]), None)
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
STATS(Some(m.args[0].clone()), Some(m.suffix.unwrap().clone()))
|
STATS(Some(m.args[0][]), Some(m.suffix.as_ref().unwrap()[]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if m.args.len() == 0 {
|
} else if m.args.len() == 0 {
|
||||||
STATS(None, None)
|
STATS(None, None)
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
STATS(Some(m.args[0].clone()), None)
|
STATS(Some(m.args[0][]), None)
|
||||||
} else if m.args.len() == 2 {
|
} else if m.args.len() == 2 {
|
||||||
STATS(Some(m.args[0].clone()), Some(m.args[1].clone()))
|
STATS(Some(m.args[0][]), Some(m.args[1][]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if let "LINKS" = m.command[] {
|
} else if let "LINKS" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() == 0 {
|
if m.args.len() == 0 {
|
||||||
LINKS(None, Some(m.suffix.unwrap().clone()))
|
LINKS(None, Some(m.suffix.as_ref().unwrap()[]))
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
LINKS(Some(m.args[0].clone()), Some(m.suffix.unwrap().clone()))
|
LINKS(Some(m.args[0][]), Some(m.suffix.as_ref().unwrap()[]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
|
@ -465,163 +463,163 @@ impl Command {
|
||||||
} else if let "TIME" = m.command[] {
|
} else if let "TIME" = m.command[] {
|
||||||
if m.args.len() != 0 { return Err(invalid_input()) }
|
if m.args.len() != 0 { return Err(invalid_input()) }
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
TIME(Some(m.suffix.unwrap().clone()))
|
TIME(Some(m.suffix.as_ref().unwrap()[]))
|
||||||
} else {
|
} else {
|
||||||
TIME(None)
|
TIME(None)
|
||||||
}
|
}
|
||||||
} else if let "CONNECT" = m.command[] {
|
} else if let "CONNECT" = m.command[] {
|
||||||
if m.args.len() != 2 { return Err(invalid_input()) }
|
if m.args.len() != 2 { return Err(invalid_input()) }
|
||||||
KICK(m.args[0].clone(), m.args[1].clone(), m.suffix.clone())
|
CONNECT(m.args[0][], m.args[1][], m.suffix.as_ref().map(|s| s[]))
|
||||||
} else if let "TRACE" = m.command[] {
|
} else if let "TRACE" = m.command[] {
|
||||||
if m.args.len() != 0 { return Err(invalid_input()) }
|
if m.args.len() != 0 { return Err(invalid_input()) }
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
TRACE(Some(m.suffix.unwrap().clone()))
|
TRACE(Some(m.suffix.as_ref().unwrap()[]))
|
||||||
} else {
|
} else {
|
||||||
TRACE(None)
|
TRACE(None)
|
||||||
}
|
}
|
||||||
} else if let "ADMIN" = m.command[] {
|
} else if let "ADMIN" = m.command[] {
|
||||||
if m.args.len() != 0 { return Err(invalid_input()) }
|
if m.args.len() != 0 { return Err(invalid_input()) }
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
TIME(Some(m.suffix.unwrap().clone()))
|
TIME(Some(m.suffix.as_ref().unwrap()[]))
|
||||||
} else {
|
} else {
|
||||||
TIME(None)
|
TIME(None)
|
||||||
}
|
}
|
||||||
} else if let "INFO" = m.command[] {
|
} else if let "INFO" = m.command[] {
|
||||||
if m.args.len() != 0 { return Err(invalid_input()) }
|
if m.args.len() != 0 { return Err(invalid_input()) }
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
TIME(Some(m.suffix.unwrap().clone()))
|
TIME(Some(m.suffix.as_ref().unwrap()[]))
|
||||||
} else {
|
} else {
|
||||||
TIME(None)
|
TIME(None)
|
||||||
}
|
}
|
||||||
} else if let "SERVLIST" = m.command[] {
|
} else if let "SERVLIST" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() == 0 {
|
if m.args.len() == 0 {
|
||||||
SERVLIST(Some(m.suffix.unwrap().clone()), None)
|
SERVLIST(Some(m.suffix.as_ref().unwrap()[]), None)
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
SERVLIST(Some(m.args[0].clone()), Some(m.suffix.unwrap().clone()))
|
SERVLIST(Some(m.args[0][]), Some(m.suffix.as_ref().unwrap()[]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if m.args.len() == 0 {
|
} else if m.args.len() == 0 {
|
||||||
SERVLIST(None, None)
|
SERVLIST(None, None)
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
SERVLIST(Some(m.args[0].clone()), None)
|
SERVLIST(Some(m.args[0][]), None)
|
||||||
} else if m.args.len() == 2 {
|
} else if m.args.len() == 2 {
|
||||||
SERVLIST(Some(m.args[0].clone()), Some(m.args[1].clone()))
|
SERVLIST(Some(m.args[0][]), Some(m.args[1][]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if let "SQUERY" = m.command[] {
|
} else if let "SQUERY" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() != 1 { return Err(invalid_input()) }
|
if m.args.len() != 1 { return Err(invalid_input()) }
|
||||||
SQUERY(m.args[0].clone(), m.suffix.unwrap())
|
SQUERY(m.args[0][], m.suffix.as_ref().unwrap()[])
|
||||||
} else {
|
} else {
|
||||||
if m.args.len() != 2 { return Err(invalid_input()) }
|
if m.args.len() != 2 { return Err(invalid_input()) }
|
||||||
SQUERY(m.args[0].clone(), m.args[1].clone())
|
SQUERY(m.args[0][], m.args[1][])
|
||||||
}
|
}
|
||||||
} else if let "WHO" = m.command[] {
|
} else if let "WHO" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() == 0 {
|
if m.args.len() == 0 {
|
||||||
WHO(Some(m.suffix.unwrap().clone()), None)
|
WHO(Some(m.suffix.as_ref().unwrap()[]), None)
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
WHO(Some(m.args[0].clone()), Some(m.suffix.unwrap()[] == "o"))
|
WHO(Some(m.args[0][]), Some(m.suffix.as_ref().unwrap()[] == "o"))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if m.args.len() == 0 {
|
} else if m.args.len() == 0 {
|
||||||
WHO(None, None)
|
WHO(None, None)
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
WHO(Some(m.args[0].clone()), None)
|
WHO(Some(m.args[0][]), None)
|
||||||
} else if m.args.len() == 2 {
|
} else if m.args.len() == 2 {
|
||||||
WHO(Some(m.args[0].clone()), Some(m.args[1][] == "o"))
|
WHO(Some(m.args[0][]), Some(m.args[1][] == "o"))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if let "WHOIS" = m.command[] {
|
} else if let "WHOIS" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() == 0 {
|
if m.args.len() == 0 {
|
||||||
WHOIS(None, m.suffix.unwrap().clone())
|
WHOIS(None, m.suffix.as_ref().unwrap()[])
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
WHOIS(Some(m.args[0].clone()), m.suffix.unwrap().clone())
|
WHOIS(Some(m.args[0][]), m.suffix.as_ref().unwrap()[])
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
WHOIS(None, m.args[0].clone())
|
WHOIS(None, m.args[0][])
|
||||||
} else if m.args.len() == 2 {
|
} else if m.args.len() == 2 {
|
||||||
WHOIS(Some(m.args[0].clone()), m.args[1].clone())
|
WHOIS(Some(m.args[0][]), m.args[1][])
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if let "WHOWAS" = m.command[] {
|
} else if let "WHOWAS" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() == 0 {
|
if m.args.len() == 0 {
|
||||||
WHOWAS(m.suffix.unwrap().clone(), None, None)
|
WHOWAS(m.suffix.as_ref().unwrap()[], None, None)
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
WHOWAS(m.args[0].clone(), None, Some(m.suffix.unwrap().clone()))
|
WHOWAS(m.args[0][], None, Some(m.suffix.as_ref().unwrap()[]))
|
||||||
} else if m.args.len() == 2 {
|
} else if m.args.len() == 2 {
|
||||||
WHOWAS(m.args[0].clone(), Some(m.args[1].clone()), Some(m.suffix.unwrap().clone()))
|
WHOWAS(m.args[0][], Some(m.args[1][]), Some(m.suffix.as_ref().unwrap()[]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
WHOWAS(m.args[0].clone(), None, None)
|
WHOWAS(m.args[0][], None, None)
|
||||||
} else if m.args.len() == 2 {
|
} else if m.args.len() == 2 {
|
||||||
WHOWAS(m.args[0].clone(), None, Some(m.args[1].clone()))
|
WHOWAS(m.args[0][], None, Some(m.args[1][]))
|
||||||
} else if m.args.len() == 3 {
|
} else if m.args.len() == 3 {
|
||||||
WHOWAS(m.args[0].clone(), Some(m.args[1].clone()), Some(m.args[2].clone()))
|
WHOWAS(m.args[0][], Some(m.args[1][]), Some(m.args[2][]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if let "KILL" = m.command[] {
|
} else if let "KILL" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() != 1 { return Err(invalid_input()) }
|
if m.args.len() != 1 { return Err(invalid_input()) }
|
||||||
KILL(m.args[0].clone(), m.suffix.unwrap())
|
KILL(m.args[0][], m.suffix.as_ref().unwrap()[])
|
||||||
} else {
|
} else {
|
||||||
if m.args.len() != 2 { return Err(invalid_input()) }
|
if m.args.len() != 2 { return Err(invalid_input()) }
|
||||||
KILL(m.args[0].clone(), m.args[1].clone())
|
KILL(m.args[0][], m.args[1][])
|
||||||
}
|
}
|
||||||
} else if let "PING" = m.command[] {
|
} else if let "PING" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() == 0 {
|
if m.args.len() == 0 {
|
||||||
PING(m.suffix.unwrap().clone(), None)
|
PING(m.suffix.as_ref().unwrap()[], None)
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
PING(m.args[0].clone(), Some(m.suffix.unwrap().clone()))
|
PING(m.args[0][], Some(m.suffix.as_ref().unwrap()[]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
PING(m.args[0].clone(), None)
|
PING(m.args[0][], None)
|
||||||
} else if m.args.len() == 2 {
|
} else if m.args.len() == 2 {
|
||||||
PING(m.args[0].clone(), Some(m.args[1].clone()))
|
PING(m.args[0][], Some(m.args[1][]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if let "PONG" = m.command[] {
|
} else if let "PONG" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() == 0 {
|
if m.args.len() == 0 {
|
||||||
PONG(m.suffix.unwrap().clone(), None)
|
PONG(m.suffix.as_ref().unwrap()[], None)
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
PONG(m.args[0].clone(), Some(m.suffix.unwrap().clone()))
|
PONG(m.args[0][], Some(m.suffix.as_ref().unwrap()[]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
PONG(m.args[0].clone(), None)
|
PONG(m.args[0][], None)
|
||||||
} else if m.args.len() == 2 {
|
} else if m.args.len() == 2 {
|
||||||
PONG(m.args[0].clone(), Some(m.args[1].clone()))
|
PONG(m.args[0][], Some(m.args[1][]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if let "ERROR" = m.command[] {
|
} else if let "ERROR" = m.command[] {
|
||||||
if m.suffix.is_some() && m.args.len() == 0 {
|
if m.suffix.is_some() && m.args.len() == 0 {
|
||||||
ERROR(m.suffix.unwrap().clone())
|
ERROR(m.suffix.as_ref().unwrap()[])
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if let "AWAY" = m.command[] {
|
} else if let "AWAY" = m.command[] {
|
||||||
if m.args.len() == 0 {
|
if m.args.len() == 0 {
|
||||||
AWAY(m.suffix.clone())
|
AWAY(m.suffix.as_ref().map(|s| s[]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
|
@ -646,98 +644,98 @@ impl Command {
|
||||||
} else if let "SUMMON" = m.command[] {
|
} else if let "SUMMON" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() == 0 {
|
if m.args.len() == 0 {
|
||||||
SUMMON(m.suffix.unwrap().clone(), None, None)
|
SUMMON(m.suffix.as_ref().unwrap()[], None, None)
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
SUMMON(m.args[0].clone(), Some(m.suffix.unwrap().clone()), None)
|
SUMMON(m.args[0][], Some(m.suffix.as_ref().unwrap()[]), None)
|
||||||
} else if m.args.len() == 2 {
|
} else if m.args.len() == 2 {
|
||||||
SUMMON(m.args[0].clone(), Some(m.args[1].clone()), Some(m.suffix.unwrap().clone()))
|
SUMMON(m.args[0][], Some(m.args[1][]), Some(m.suffix.as_ref().unwrap()[]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
SUMMON(m.args[0].clone(), None, None)
|
SUMMON(m.args[0][], None, None)
|
||||||
} else if m.args.len() == 2 {
|
} else if m.args.len() == 2 {
|
||||||
SUMMON(m.args[0].clone(), Some(m.args[1].clone()), None)
|
SUMMON(m.args[0][], Some(m.args[1][]), None)
|
||||||
} else if m.args.len() == 3 {
|
} else if m.args.len() == 3 {
|
||||||
SUMMON(m.args[0].clone(), Some(m.args[1].clone()), Some(m.args[2].clone()))
|
SUMMON(m.args[0][], Some(m.args[1][]), Some(m.args[2][]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if let "USERS" = m.command[] {
|
} else if let "USERS" = m.command[] {
|
||||||
if m.args.len() == 0 {
|
if m.args.len() == 0 {
|
||||||
USERS(m.suffix.clone())
|
USERS(m.suffix.as_ref().map(|s| s[]))
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
USERS(Some(m.args[0].clone()))
|
USERS(Some(m.args[0][]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if let "WALLOPS" = m.command[] {
|
} else if let "WALLOPS" = m.command[] {
|
||||||
if m.suffix.is_some() && m.args.len() == 0 {
|
if m.suffix.is_some() && m.args.len() == 0 {
|
||||||
WALLOPS(m.suffix.unwrap().clone())
|
WALLOPS(m.suffix.as_ref().unwrap()[])
|
||||||
} else if m.args.len() == 1 {
|
} else if m.args.len() == 1 {
|
||||||
WALLOPS(m.args[0].clone())
|
WALLOPS(m.args[0][])
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if let "USERHOST" = m.command[] {
|
} else if let "USERHOST" = m.command[] {
|
||||||
if m.suffix.is_none() {
|
if m.suffix.is_none() {
|
||||||
USERHOST(m.args.clone())
|
USERHOST(m.args.iter().map(|s| s[]).collect())
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if let "ISON" = m.command[] {
|
} else if let "ISON" = m.command[] {
|
||||||
if m.suffix.is_none() {
|
if m.suffix.is_none() {
|
||||||
USERHOST(m.args.clone())
|
USERHOST(m.args.iter().map(|s| s[]).collect())
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if let "SAJOIN" = m.command[] {
|
} else if let "SAJOIN" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() != 1 { return Err(invalid_input()) }
|
if m.args.len() != 1 { return Err(invalid_input()) }
|
||||||
SAJOIN(m.args[0].clone(), m.suffix.unwrap())
|
SAJOIN(m.args[0][], m.suffix.as_ref().unwrap()[])
|
||||||
} else {
|
} else {
|
||||||
if m.args.len() != 2 { return Err(invalid_input()) }
|
if m.args.len() != 2 { return Err(invalid_input()) }
|
||||||
SAJOIN(m.args[0].clone(), m.args[1].clone())
|
SAJOIN(m.args[0][], m.args[1][])
|
||||||
}
|
}
|
||||||
} else if let "SAMODE" = m.command[] {
|
} else if let "SAMODE" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() == 1 {
|
if m.args.len() == 1 {
|
||||||
SAMODE(m.args[0].clone(), m.suffix.unwrap().clone(), None)
|
SAMODE(m.args[0][], m.suffix.as_ref().unwrap()[], None)
|
||||||
} else if m.args.len() == 2 {
|
} else if m.args.len() == 2 {
|
||||||
SAMODE(m.args[0].clone(), m.args[1].clone(), Some(m.suffix.unwrap().clone()))
|
SAMODE(m.args[0][], m.args[1][], Some(m.suffix.as_ref().unwrap()[]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if m.args.len() == 2 {
|
} else if m.args.len() == 2 {
|
||||||
SAMODE(m.args[0].clone(), m.args[1].clone(), None)
|
SAMODE(m.args[0][], m.args[1][], None)
|
||||||
} else if m.args.len() == 3 {
|
} else if m.args.len() == 3 {
|
||||||
SAMODE(m.args[0].clone(), m.args[1].clone(), Some(m.args[2].clone()))
|
SAMODE(m.args[0][], m.args[1][], Some(m.args[2][]))
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
}
|
}
|
||||||
} else if let "SANICK" = m.command[] {
|
} else if let "SANICK" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() != 1 { return Err(invalid_input()) }
|
if m.args.len() != 1 { return Err(invalid_input()) }
|
||||||
SANICK(m.args[0].clone(), m.suffix.unwrap())
|
SANICK(m.args[0][], m.suffix.as_ref().unwrap()[])
|
||||||
} else {
|
} else {
|
||||||
if m.args.len() != 2 { return Err(invalid_input()) }
|
if m.args.len() != 2 { return Err(invalid_input()) }
|
||||||
SANICK(m.args[0].clone(), m.args[1].clone())
|
SANICK(m.args[0][], m.args[1][])
|
||||||
}
|
}
|
||||||
} else if let "SAPART" = m.command[] {
|
} else if let "SAPART" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() != 1 { return Err(invalid_input()) }
|
if m.args.len() != 1 { return Err(invalid_input()) }
|
||||||
SAPART(m.args[0].clone(), m.suffix.unwrap())
|
SAPART(m.args[0][], m.suffix.as_ref().unwrap()[])
|
||||||
} else {
|
} else {
|
||||||
if m.args.len() != 2 { return Err(invalid_input()) }
|
if m.args.len() != 2 { return Err(invalid_input()) }
|
||||||
SAPART(m.args[0].clone(), m.args[1].clone())
|
SAPART(m.args[0][], m.args[1][])
|
||||||
}
|
}
|
||||||
} else if let "SAQUIT" = m.command[] {
|
} else if let "SAQUIT" = m.command[] {
|
||||||
if m.suffix.is_some() {
|
if m.suffix.is_some() {
|
||||||
if m.args.len() != 1 { return Err(invalid_input()) }
|
if m.args.len() != 1 { return Err(invalid_input()) }
|
||||||
SAQUIT(m.args[0].clone(), m.suffix.unwrap())
|
SAQUIT(m.args[0][], m.suffix.as_ref().unwrap()[])
|
||||||
} else {
|
} else {
|
||||||
if m.args.len() != 2 { return Err(invalid_input()) }
|
if m.args.len() != 2 { return Err(invalid_input()) }
|
||||||
SAQUIT(m.args[0].clone(), m.args[1].clone())
|
SAQUIT(m.args[0][], m.args[1][])
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
|
|
Loading…
Reference in a new issue