Skip to main content

MessengerCommand

Enum MessengerCommand 

Source
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

§room_id: RoomId

The room to send into.

§message: OutgoingMessage

The message content.

§txn_id: Option<TxnId>

A caller-supplied transaction id (deterministic tests); None mints a fresh one from this device’s own counter.

§

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": true and 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

§from_room: RoomId

The room the event is taken from.

§event_id: EventId

The event being forwarded.

§to_room: RoomId

The room it is sent into.

§txn_id: Option<TxnId>

A caller-supplied transaction id; None mints a fresh one.

§

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

§room_id: RoomId

The room the reaction is sent in.

§target: EventId

The event being reacted to.

§key: String

The reaction’s own key (typically an emoji).

§

Redact

Redacts an event (PUT /rooms/{roomId}/redact/{eventId}/{txnId}).

Fields

§room_id: RoomId

The room the target event lives in.

§target: EventId

The event being redacted.

§reason: Option<String>

Why, if given.

§

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

§room_id: RoomId

The room the failed send belongs to.

§txn_id: TxnId

The failed send’s own transaction id.

§

CreateRoom

Creates a room (POST /createRoom).

Fields

§kind: CreateRoomKind

Which shape to create.

§

JoinRoom

Joins a room this account has been invited to (or a public channel).

Fields

§room_id: RoomId

The room to join.

§

LeaveRoom

Leaves a room.

Fields

§room_id: RoomId

The room to leave.

§

Invite

Invites a user to a room.

Fields

§room_id: RoomId

The room to invite into.

§user_id: UserId

The user being invited.

§

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

§room_id: RoomId

The room to remove them from.

§user_id: UserId

The member being removed.

§reason: Option<String>

Why, if given.

§

SetTag

Adds (or updates) an m.tag room-account-data tag.

Fields

§room_id: RoomId

The room being tagged.

§tag: String

The tag’s own name.

§order: Option<f64>

The tag’s sort order among sibling tags, if any.

§

RemoveTag

Removes a tag from a room.

Fields

§room_id: RoomId

The room the tag is removed from.

§tag: String

The tag’s own name.

§

MarkRead

Sets this room’s read-up-to marker to event_id (POST /rooms/{roomId}/read_markers).

Fields

§room_id: RoomId

The room being marked read.

§event_id: EventId

The last event the user has seen.

§

SetTyping

Starts or stops this device’s own typing indicator in a room (PUT /rooms/{roomId}/typing/{userId}).

Fields

§room_id: RoomId

The room to set the indicator in.

§typing: bool

true to start, false to clear.

§

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).

Fields

§room_id: RoomId

The room the item lives in.

§event_id: EventId

The item’s event id.

§

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).

Fields

§room_id: RoomId

The room to page further back into.

§

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).

Fields

§event_type: String

The account-data type being set.

§content: Value

The full new value.

§

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

§room_id: RoomId

The room the account data is scoped to.

§event_type: String

The account-data type being set.

§content: Value

The full new value.

§

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).

Fields

§term: String

The search term.

§

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.

Fields

§term: String

The search term.

Trait Implementations§

Source§

impl Clone for MessengerCommand

Source§

fn clone(&self) -> MessengerCommand

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MessengerCommand

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl PartialEq for MessengerCommand

Source§

fn eq(&self, other: &MessengerCommand) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MessengerCommand

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more