add sender id to VerifiedSignalMessage
This commit is contained in:
@@ -471,7 +471,12 @@ impl Gateway {
|
||||
|
||||
self.handle_gateway_command(cmd).await
|
||||
} else if let Some(handler) = &self.message_handler {
|
||||
let msg = VerifiedSignalMessage::new(data.message.clone(), data.timestamp);
|
||||
let msg = VerifiedSignalMessage {
|
||||
message: data.message.clone(),
|
||||
timestamp: data.timestamp,
|
||||
sender_uuid: msg.source_uuid.clone(),
|
||||
group_id: data.group_info.as_ref().map(|g| g.group_id.clone()),
|
||||
};
|
||||
handler.handle_verified_signal_message(msg, &GatewayContext).await
|
||||
} else {
|
||||
Err((501u16, "No message handler configured".into()))
|
||||
|
||||
@@ -14,16 +14,10 @@ pub struct VerifiedSignalMessage {
|
||||
pub message: String,
|
||||
/// The timestamp of the message (milliseconds since Unix epoch).
|
||||
pub timestamp: u64,
|
||||
}
|
||||
|
||||
impl VerifiedSignalMessage {
|
||||
/// Create a new verified signal message.
|
||||
pub fn new(message: impl Into<String>, timestamp: u64) -> Self {
|
||||
Self {
|
||||
message: message.into(),
|
||||
timestamp,
|
||||
}
|
||||
}
|
||||
/// The UUID of the sender.
|
||||
pub sender_uuid: String,
|
||||
/// The group ID if this message was sent to a group.
|
||||
pub group_id: Option<String>,
|
||||
}
|
||||
|
||||
/// Context for message handler operations.
|
||||
|
||||
Reference in New Issue
Block a user