diff --git a/src/coremods/core_user.rs b/src/coremods/core_user.rs index 4735773..6c7e6ef 100644 --- a/src/coremods/core_user.rs +++ b/src/coremods/core_user.rs @@ -78,6 +78,9 @@ impl Command for Away { fn name(&self) -> &'static str { "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 { let msg = params.first().cloned().filter(|m| !m.is_empty()); let now_away = msg.is_some(); diff --git a/src/users.rs b/src/users.rs index b976dbe..0f146bc 100644 --- a/src/users.rs +++ b/src/users.rs @@ -99,6 +99,7 @@ pub const SUPPORTED_CAPS: &[&str] = &[ "batch", "draft/chathistory", "draft/message-redaction", + "draft/pre-away", "cap-notify", ]; @@ -126,6 +127,7 @@ pub struct Caps { pub batch: bool, // understands BATCH framing pub chathistory: bool, // draft/chathistory — can request message history 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, } @@ -175,6 +177,7 @@ impl Caps { "batch" => self.batch, "draft/chathistory" => self.chathistory, "draft/message-redaction" => self.message_redaction, + "draft/pre-away" => self.pre_away, "cap-notify" => self.cap_notify, _ => false, } @@ -202,6 +205,7 @@ impl Caps { "batch" => &mut self.batch, "draft/chathistory" => &mut self.chathistory, "draft/message-redaction" => &mut self.message_redaction, + "draft/pre-away" => &mut self.pre_away, "cap-notify" => &mut self.cap_notify, _ => return false, };