mirror of
https://github.com/matrix-construct/construct
synced 2025-02-18 09:40:12 +01:00
ircd:Ⓜ️:room: Add react() convenience sender.
This commit is contained in:
parent
bf2df9c223
commit
6fa63f8bf0
2 changed files with 21 additions and 1 deletions
|
@ -70,12 +70,13 @@ namespace ircd::m
|
|||
event::id::buf send(const room &, const id::user &sender, const string_view &type, const json::object &content);
|
||||
|
||||
// [SET] Convenience sends
|
||||
event::id::buf redact(const room &, const id::user &sender, const id::event &, const string_view &reason);
|
||||
event::id::buf react(const room &, const id::user &sender, const id::event &, const string_view &rel_type, json::iov &relates);
|
||||
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");
|
||||
event::id::buf notice(const room &, const id::user &sender, const string_view &body);
|
||||
event::id::buf notice(const room &, const string_view &body); // sender is @ircd
|
||||
event::id::buf redact(const room &, const id::user &sender, const id::event &, const string_view &reason);
|
||||
event::id::buf invite(const room &, const id::user &target, const id::user &sender, json::iov &add_content);
|
||||
event::id::buf invite(const room &, const id::user &target, const id::user &sender);
|
||||
event::id::buf leave(const room &, const id::user &);
|
||||
|
|
|
@ -157,6 +157,25 @@ ircd::m::message(const room &room,
|
|||
return send(room, sender, "m.room.message", contents);
|
||||
}
|
||||
|
||||
ircd::m::event::id::buf
|
||||
ircd::m::react(const room &room,
|
||||
const id::user &sender,
|
||||
const id::event &target,
|
||||
const string_view &rel_type,
|
||||
json::iov &relates)
|
||||
{
|
||||
json::iov content;
|
||||
thread_local char buf[event::MAX_SIZE];
|
||||
const json::iov::push push[]
|
||||
{
|
||||
{ relates, { "event_id", target }},
|
||||
{ relates, { "rel_type", rel_type }},
|
||||
{ content, { "m.relates_to", stringify(mutable_buffer{buf}, relates) }},
|
||||
};
|
||||
|
||||
return send(room, sender, "m.reaction", content);
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstack-usage="
|
||||
ircd::m::event::id::buf
|
||||
|
|
Loading…
Add table
Reference in a new issue