Added IRCv3 ACCOUNT command for account-notify support.
This commit is contained in:
parent
7bf6bf48e1
commit
b6526465dd
1 changed files with 18 additions and 1 deletions
|
@ -144,9 +144,11 @@ pub enum Command {
|
||||||
/// MEMOSERV message
|
/// MEMOSERV message
|
||||||
MEMOSERV(String),
|
MEMOSERV(String),
|
||||||
|
|
||||||
// Capabilities extension to IRCv3
|
// IRCv3 support
|
||||||
/// CAP [*] COMMAND [*] :[param]
|
/// CAP [*] COMMAND [*] :[param]
|
||||||
CAP(Option<String>, CapSubCommand, Option<String>, Option<String>),
|
CAP(Option<String>, CapSubCommand, Option<String>, Option<String>),
|
||||||
|
/// ACCOUNT [account name]
|
||||||
|
ACCOUNT(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Into<Message> for Command {
|
impl Into<Message> for Command {
|
||||||
|
@ -316,6 +318,8 @@ impl Into<Message> for Command {
|
||||||
Message::from_owned(None, string("CAP"), Some(vec![s.string(), c]), p),
|
Message::from_owned(None, string("CAP"), Some(vec![s.string(), c]), p),
|
||||||
Command::CAP(Some(k), s, Some(c), p) =>
|
Command::CAP(Some(k), s, Some(c), p) =>
|
||||||
Message::from_owned(None, string("CAP"), Some(vec![k, s.string(), 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 {
|
} else {
|
||||||
return Err(invalid_input())
|
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 {
|
} else {
|
||||||
return Err(invalid_input())
|
return Err(invalid_input())
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue