mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
ircd:Ⓜ️ Add convenience sender for org.matrix.custom.html messages.
This commit is contained in:
parent
b840156b37
commit
c4d8b17ecb
2 changed files with 17 additions and 0 deletions
|
@ -55,6 +55,7 @@ namespace ircd::m
|
|||
event::id::buf redact(const room &, const m::id::user &sender, const m::id::event &, const string_view &reason);
|
||||
event::id::buf message(const room &, const m::id::user &sender, const json::members &content);
|
||||
event::id::buf message(const room &, const m::id::user &sender, const string_view &body, const string_view &msgtype = "m.text");
|
||||
event::id::buf msghtml(const room &, const m::id::user &sender, const string_view &html, const string_view &alt = {}, const string_view &msgtype = "m.notice");
|
||||
event::id::buf notice(const room &, const m::id::user &sender, const string_view &body);
|
||||
event::id::buf notice(const room &, const string_view &body); // sender is @ircd
|
||||
event::id::buf leave(const room &, const m::id::user &);
|
||||
|
|
16
ircd/m/m.cc
16
ircd/m/m.cc
|
@ -394,6 +394,22 @@ ircd::m::notice(const room &room,
|
|||
return message(room, sender, body, "m.notice");
|
||||
}
|
||||
|
||||
ircd::m::event::id::buf
|
||||
ircd::m::msghtml(const room &room,
|
||||
const m::id::user &sender,
|
||||
const string_view &html,
|
||||
const string_view &alt,
|
||||
const string_view &msgtype)
|
||||
{
|
||||
return message(room, sender,
|
||||
{
|
||||
{ "msgtype", msgtype },
|
||||
{ "format", "org.matrix.custom.html" },
|
||||
{ "body", { alt?: html, json::STRING } },
|
||||
{ "formatted_body", { html, json::STRING } },
|
||||
});
|
||||
}
|
||||
|
||||
ircd::m::event::id::buf
|
||||
ircd::m::message(const room &room,
|
||||
const m::id::user &sender,
|
||||
|
|
Loading…
Reference in a new issue