0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 02:02:38 +01:00

ircd:Ⓜ️:room: Add annotate() convenience reaction.

This commit is contained in:
Jason Volk 2019-12-11 11:40:54 -08:00
parent 6fa63f8bf0
commit ba5352e560
2 changed files with 16 additions and 0 deletions

View file

@ -71,6 +71,7 @@ namespace ircd::m
// [SET] Convenience sends
event::id::buf react(const room &, const id::user &sender, const id::event &, const string_view &rel_type, json::iov &relates);
event::id::buf annotate(const room &, const id::user &sender, const id::event &, const string_view &key);
event::id::buf message(const room &, const id::user &sender, const json::members &content);
event::id::buf message(const room &, const id::user &sender, const string_view &body, const string_view &msgtype = "m.text");
event::id::buf msghtml(const room &, const id::user &sender, const string_view &html, const string_view &alt = {}, const string_view &msgtype = "m.notice");

View file

@ -157,6 +157,21 @@ ircd::m::message(const room &room,
return send(room, sender, "m.room.message", contents);
}
ircd::m::event::id::buf
ircd::m::annotate(const room &room,
const id::user &sender,
const id::event &target,
const string_view &key)
{
json::iov relates;
const json::iov::push push
{
relates, { "key", key },
};
return react(room, sender, target, "m.annotation", relates);
}
ircd::m::event::id::buf
ircd::m::react(const room &room,
const id::user &sender,