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 msgtype
s.
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 msgtype
s
(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 build one of the new primary types and then to convert it to a
RoomMessageEventContent
by using .into()
or RoomMessageEventContent::from()
. The
provided constructors will copy the relevant data in the legacy fields.
For incoming events, a RoomMessageEventContent
can be converted to an extensible event with
the relevant from_*_room_message
method on the primary type. This conversion will work even
with legacy m.room.message
events that don’t have extensible events content.
It is also possible to enable extensible events support and continue using
RoomMessageEventContent
’s constructors. The data will be duplicated in both the legacy and
extensible events fields.
Structs
MessageContent
.MessageEventContent
Enums
Type Definitions
m.message
event.m.message
event.m.message
event from a sync_events
response.m.message
event that has been redacted.m.message
event from a sync_events
response that has been redacted.m.message
event from a sync_events
response.