mtx::common namespace

Common structs used among many different event content types.

Classes

struct AudioInfo
Audio clip metadata.
struct FileInfo
Metadata about a file.
struct ImageInfo
Metadata about an image.
struct LocationInfo
Location metadata.
struct Mentions
Mentions metadata.
struct Relation
Relates to for reactions.
struct Relations
Multiple relations for a event.
struct ThumbnailInfo
Metadata about an image thumbnail.
struct VideoInfo
Video clip metadata.

Enums

enum class RoomVisibility { Private, Public }
Whether or not the room will be visible by non members.
enum class RelationType { Annotation, Reference, Replace, InReplyTo, Thread, Unsupported }
Definition of rel_type for relations.

Functions

auto parse_mentions(const nlohmann::json& obj) -> std::optional<Mentions>
Parses mentions from a content object.
void add_mentions(nlohmann::json& content, const std::optional<Mentions>& m)
Serializes mentions to a content object.
auto parse_relations(const nlohmann::json& obj) -> Relations
Parses relations from a content object.
void add_relations(nlohmann::json& obj, const Relations& relations)
Serializes relations to a content object.
void apply_relations(nlohmann::json& obj, const Relations& relations)
Applies also all the edit rules to the event in addition to adding the relations.

Enum documentation

enum class mtx::common::RoomVisibility

Whether or not the room will be visible by non members.

Enumerators
Private

A private visibility will hide the room from the published room list.

Public

Indicates that the room will be shown in the published room list.

enum class mtx::common::RelationType

Definition of rel_type for relations.

Enumerators
Annotation

m.annotation rel_type

Reference

m.reference rel_type

Replace

m.replace rel_type

InReplyTo

im.nheko.relations.v1.in_reply_to rel_type

Thread

m.thread

Unsupported

not one of the supported types

Function documentation

std::optional<Mentions> mtx::common::parse_mentions(const nlohmann::json& obj)

Parses mentions from a content object.

Parameters
obj The content object of an event.

void mtx::common::add_mentions(nlohmann::json& content, const std::optional<Mentions>& m)

Serializes mentions to a content object.

Relations mtx::common::parse_relations(const nlohmann::json& obj)

Parses relations from a content object.

Parameters
obj The content object of an event.

void mtx::common::add_relations(nlohmann::json& obj, const Relations& relations)

Serializes relations to a content object.

Parameters
obj The content object of an event.
relations

void mtx::common::apply_relations(nlohmann::json& obj, const Relations& relations)

Applies also all the edit rules to the event in addition to adding the relations.

Parameters
obj The content object of an event.
relations