draft/pre-away: allow AWAY during CAP negotiation (before registration)
This commit is contained in:
parent
045e7d3ee7
commit
c641e23a81
2 changed files with 7 additions and 0 deletions
|
|
@ -78,6 +78,9 @@ impl Command for Away {
|
||||||
fn name(&self) -> &'static str {
|
fn name(&self) -> &'static str {
|
||||||
"AWAY"
|
"AWAY"
|
||||||
}
|
}
|
||||||
|
fn before_reg(&self) -> bool {
|
||||||
|
true // draft/pre-away: clients may set AWAY during CAP negotiation
|
||||||
|
}
|
||||||
fn handle(&self, s: &mut Server, uid: Uid, params: &[String]) -> CmdResult {
|
fn handle(&self, s: &mut Server, uid: Uid, params: &[String]) -> CmdResult {
|
||||||
let msg = params.first().cloned().filter(|m| !m.is_empty());
|
let msg = params.first().cloned().filter(|m| !m.is_empty());
|
||||||
let now_away = msg.is_some();
|
let now_away = msg.is_some();
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,7 @@ pub const SUPPORTED_CAPS: &[&str] = &[
|
||||||
"batch",
|
"batch",
|
||||||
"draft/chathistory",
|
"draft/chathistory",
|
||||||
"draft/message-redaction",
|
"draft/message-redaction",
|
||||||
|
"draft/pre-away",
|
||||||
"cap-notify",
|
"cap-notify",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -126,6 +127,7 @@ pub struct Caps {
|
||||||
pub batch: bool, // understands BATCH framing
|
pub batch: bool, // understands BATCH framing
|
||||||
pub chathistory: bool, // draft/chathistory — can request message history
|
pub chathistory: bool, // draft/chathistory — can request message history
|
||||||
pub message_redaction: bool, // draft/message-redaction — understands REDACT
|
pub message_redaction: bool, // draft/message-redaction — understands REDACT
|
||||||
|
pub pre_away: bool, // draft/pre-away — may set AWAY before registration
|
||||||
pub cap_notify: bool,
|
pub cap_notify: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -175,6 +177,7 @@ impl Caps {
|
||||||
"batch" => self.batch,
|
"batch" => self.batch,
|
||||||
"draft/chathistory" => self.chathistory,
|
"draft/chathistory" => self.chathistory,
|
||||||
"draft/message-redaction" => self.message_redaction,
|
"draft/message-redaction" => self.message_redaction,
|
||||||
|
"draft/pre-away" => self.pre_away,
|
||||||
"cap-notify" => self.cap_notify,
|
"cap-notify" => self.cap_notify,
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
|
|
@ -202,6 +205,7 @@ impl Caps {
|
||||||
"batch" => &mut self.batch,
|
"batch" => &mut self.batch,
|
||||||
"draft/chathistory" => &mut self.chathistory,
|
"draft/chathistory" => &mut self.chathistory,
|
||||||
"draft/message-redaction" => &mut self.message_redaction,
|
"draft/message-redaction" => &mut self.message_redaction,
|
||||||
|
"draft/pre-away" => &mut self.pre_away,
|
||||||
"cap-notify" => &mut self.cap_notify,
|
"cap-notify" => &mut self.cap_notify,
|
||||||
_ => return false,
|
_ => return false,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue