pub enum MessengerCommand {
Show 20 variants
SendMessage {
room_id: RoomId,
message: OutgoingMessage,
txn_id: Option<TxnId>,
},
Forward {
from_room: RoomId,
event_id: EventId,
to_room: RoomId,
txn_id: Option<TxnId>,
},
React {
room_id: RoomId,
target: EventId,
key: String,
},
Redact {
room_id: RoomId,
target: EventId,
reason: Option<String>,
},
RetrySend {
room_id: RoomId,
txn_id: TxnId,
},
CreateRoom {
kind: CreateRoomKind,
},
JoinRoom {
room_id: RoomId,
},
LeaveRoom {
room_id: RoomId,
},
Invite {
room_id: RoomId,
user_id: UserId,
},
Kick {
room_id: RoomId,
user_id: UserId,
reason: Option<String>,
},
SetTag {
room_id: RoomId,
tag: String,
order: Option<f64>,
},
RemoveTag {
room_id: RoomId,
tag: String,
},
MarkRead {
room_id: RoomId,
event_id: EventId,
},
SetTyping {
room_id: RoomId,
typing: bool,
},
RetryDecryption {
room_id: RoomId,
event_id: EventId,
},
LoadOlder {
room_id: RoomId,
},
SetAccountData {
event_type: String,
content: Value,
},
SetRoomAccountData {
room_id: RoomId,
event_type: String,
content: Value,
},
SearchPublicRooms {
term: String,
},
SearchUsers {
term: String,
},
}Expand description
One command a shell/adapter dispatches into the core — both the M13a
receive-side variants (MarkRead, SetTyping, RetryDecryption,
LoadOlder) and the M13b send/room-membership ones. Only PartialEq
(not Eq): MessengerCommand::SetTag’s order: Option<f64> cannot
implement Eq.
Variants§
SendMessage
Sends one message into a room’s per-room ordered send pipeline
(this module’s own doc) — encrypts first if the room is encrypted,
sharing the room key to any not-yet-shared device before the
message itself is sent. A crate::room::timeline::TimelineItem
local echo appears immediately, in crate::room::timeline::SendState::Sending.
Fields
message: OutgoingMessageThe message content.
Forward
Forwards one event of from_room into to_room, through the same
per-room send pipeline as MessengerCommand::SendMessage (so it is
Megolm-encrypted when to_room is encrypted).
The forward rules live HERE, in the engine. The content is read from
the source timeline item’s DECRYPTED content – for an edited item the
latest edit’s m.new_content – with m.relates_to, m.mentions
and m.new_content removed and any earlier forward marker replaced
by this hop’s own:
- source is a private/encrypted room (DM/group):
"forwarded": trueand nothing else – no original sender, no room id, no room name; - source is a public channel (
RoomKind::Channel):"forwarded_from": {"room_id", "room_name"}– no sender (public join does not make content plaintext).
The event type m.room.message is kept. An unrecognized msgtype
passes through as the raw content object plus the marker.
Refused with MessengerError::IntentRefused, naming the event,
when the source item is missing, redacted, still sealed
(undecryptable or not decrypted yet), or not an m.room.message;
and when to_room is unknown to this core (its encryption state
cannot be known, and a plaintext send into it could leak an
encrypted room’s content).
Fields
React
Sends a plaintext m.reaction — never Megolm-encrypted, even in an
encrypted room (allowed there as metadata, per the server’s own
rule this crate mirrors).
Fields
Redact
Redacts an event (PUT /rooms/{roomId}/redact/{eventId}/{txnId}).
Fields
RetrySend
Re-queues a crate::room::timeline::SendState::Failed send at the
back of its room’s own send queue, WITHOUT re-encrypting it if it
had already been encrypted (the exact same ciphertext, the exact
same txn_id — this module’s own doc). A no-op if txn_id names
no currently-failed send in room_id.
Fields
CreateRoom
Creates a room (POST /createRoom).
Fields
kind: CreateRoomKindWhich shape to create.
JoinRoom
Joins a room this account has been invited to (or a public channel).
LeaveRoom
Leaves a room.
Invite
Invites a user to a room.
Kick
Removes a member from a room (POST /rooms/{roomId}/kick) — the
next encrypted send in this room rotates its Megolm session
automatically, excluding them (crypto::group_sessions’s own
rotation-trigger doc).
Fields
SetTag
Adds (or updates) an m.tag room-account-data tag.
Fields
RemoveTag
Removes a tag from a room.
MarkRead
Sets this room’s read-up-to marker to event_id (POST /rooms/{roomId}/read_markers).
Fields
SetTyping
Starts or stops this device’s own typing indicator in a room (PUT /rooms/{roomId}/typing/{userId}).
RetryDecryption
Re-attempts decrypting one currently-undecryptable timeline item (e.g. after the user manually re-verifies a device) — the same retry this core already runs automatically the moment a matching room key arrives (this module’s own doc).
LoadOlder
Fetches one older page of a room’s timeline (GET /rooms/{roomId}/messages?dir=b), prepending it once the response
arrives. A no-op if this room has no further history to page into
(no gap, no back-pagination token).
SetAccountData
Sets one piece of this account’s own global account data (PUT /user/{userId}/account_data/{type}) – optimistically applied to
MessengerCore::global_account_data in the same call (this
module’s own doc: the account-data endpoint replaces the whole
value, so there is nothing to merge).
SetRoomAccountData
Sets one piece of room_id’s own room-scoped account data (PUT /user/{userId}/rooms/{roomId}/account_data/{type}) – optimistically
applied to MessengerCore::room_account_data in the same call.
MessengerCommand::SetTag/RemoveTag are the "m.tag"-specific
counterpart to this general command and behave the same way. Every
account-data write travels on [crate::outgoing_queue::Lane:: AccountData]: strictly FIFO, one in flight, so two writes to the
same key can neither race nor land out of order.
Fields
SearchPublicRooms
Searches the public-room directory (POST /publicRooms). The
latest result set is read back through
MessengerCore::public_rooms_result; a response to a search
superseded by a later one is dropped (this module’s own doc).
SearchUsers
Searches the user directory (POST /user_directory/search). The
latest result set is read back through
MessengerCore::user_search_result; same supersession rule as
MessengerCommand::SearchPublicRooms.
Trait Implementations§
Source§impl Clone for MessengerCommand
impl Clone for MessengerCommand
Source§fn clone(&self) -> MessengerCommand
fn clone(&self) -> MessengerCommand
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more