Expand description
Types for extensible text message events (MSC1767).
§Extensible events
MSC1767 defines a new structure for events that is made of two parts: a type and zero or more reusable content blocks.
This allows to construct new event types from a list of known content blocks that allows in turn clients to be able to render unknown event types by using the known content blocks as a fallback. When a new type is defined, all the content blocks it can or must contain are defined too.
There are also some content blocks called “mixins” that can apply to any event when they are defined.
§MSCs
This is a list of MSCs defining the extensible events and deprecating the corresponding legacy
types. Note that “primary type” means the type field at the root of the event and “message
type” means the msgtype field in the content of the m.room.message primary type.
- MSC1767: Text messages, where the
m.messageprimary type replaces them.textmessage type. - MSC3954: Emotes, where the
m.emoteprimary type replaces them.emotemessage type. - MSC3955: Automated events, where the
m.automatedmixin replaces them.noticemessage type. - MSC3956: Encrypted events, where the
m.encryptedprimary type replaces them.room.encryptedprimary type. - MSC3551: Files, where the
m.fileprimary type replaces them.filemessage type. - MSC3552: Images and Stickers, where the
m.imageprimary type replaces them.imagemessage type and them.stickerprimary type. - MSC3553: Videos, where the
m.videoprimary type replaces them.videomessage type. - MSC3927: Audio, where the
m.audioprimary type replaces them.audiomessage type. - MSC3488: Location, where the
m.locationprimary type replaces them.locationmessage type.
There are also the following MSCs that introduce new features with extensible events:
§How to use them in Matrix
The extensible events types are meant to be used separately than the legacy types. As such, their use is reserved for room versions that support it.
Currently no stable room version supports extensible events so they can only be sent with unstable room versions that support them.
An exception is made for some new extensible events types that don’t have a legacy type. They can be used with stable room versions without support for extensible types, but they might be ignored by clients that have no support for extensible events. The types that support this must advertise it in their MSC.
Note that if a room version supports extensible events, it doesn’t support the legacy types anymore and those should be ignored. There is not yet a definition of the deprecated legacy types in extensible events rooms.
§How to use them in Ruma
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 types. It
is also possible to enable only the MSCs you want with the unstable-mscXXXX features (where
XXXX is the number of the MSC). When enabling an MSC, all MSC dependencies are enabled at the
same time to avoid issues.
Currently the extensible events use the unstable prefixes as defined in the corresponding MSCs.
Structs§
- Message
Event Content - The payload for an extensible text message.
- Message
Event Content Without Relation - Form of
MessageEventContentwithout relation. - Redacted
Message Event Content - Redacted form of
MessageEventContent - Text
Content Block - A block for text content with optional markup.
- Text
Representation - Text content with optional markup.
Type Aliases§
- Message
Event - An
org.matrix.msc1767.messageevent. - Original
Message Event - An
org.matrix.msc1767.messageevent. - Original
Sync Message Event - An
org.matrix.msc1767.messageevent from async_eventsresponse. - Redacted
Message Event - An
org.matrix.msc1767.messageevent that has been redacted. - Redacted
Sync Message Event - An
org.matrix.msc1767.messageevent from async_eventsresponse that has been redacted. - Sync
Message Event - An
org.matrix.msc1767.messageevent from async_eventsresponse.