Module ruma::events::message

source ·
Available on crate features events and unstable-msc1767 only.
Expand description

Types for extensible text message events (MSC1767).

Extensible events

MSCs 1767 (Text, Emote and Notice), 3551 (Files), 3552 (Images and Stickers), 3553 (Videos), 3246 (Audio), and 3488 (Location) introduce new primary types called extensible events. These types are meant to replace the m.room.message primary type and its msgtypes. Other MSCs introduce new types with an m.room.message fallback, like MSC3245 (Voice Messages), and types that only have an extensible events format, like MSC3381 (Polls).

Transition Period

MSC1767 defines a transition period that will start after the extensible events are released in a Matrix version. It should last approximately one year, but the end of that period will be formalized in a new Matrix version.

The new primary types should not be sent over the Matrix network before the end of the transition period. Instead, transitional m.room.message events should be sent. These transitional events include the content of the now legacy m.room.message event and the content of the new extensible event types in a single event.

How to use them

First, you can enable the unstable-extensible-events feature from the ruma crate, that will enable all the MSCs for the extensible events that correspond to the legacy msgtypes (1767, 3246, 3488, 3551, 3552, 3553). It is also possible to enable only the MSCs you want with the unstable-mscXXXX features (where XXXX is the number of the MSC).

The recommended way to send transitional extensible events while they are unstable and during the transition period is to use the constructors and helper methods of RoomMessageEventContent. The data will be duplicated in both the legacy and extensible events fields as needed.

Structs

The error type returned when trying to construct an empty MessageContent.
Text message content.
The payload for an extensible text message.
Text message content.

Enums

The error type returned when a conversion to an extensible event type fails.

Type Definitions

An m.message event.
An m.message event.
An m.message event from a sync_events response.
An m.message event that has been redacted.
An m.message event from a sync_events response that has been redacted.
An m.message event from a sync_events response.