From f7034d0bf563b0880d31755d16299d40d0ed8936 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 2 Mar 2018 03:42:16 -0800 Subject: [PATCH] ircd::m: Add convenience notice(room) suite. --- include/ircd/m/room.h | 2 ++ ircd/m/m.cc | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/include/ircd/m/room.h b/include/ircd/m/room.h index a30e25237..ab33937dd 100644 --- a/include/ircd/m/room.h +++ b/include/ircd/m/room.h @@ -55,6 +55,8 @@ 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 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 &); event::id::buf join(const room &, const m::id::user &); diff --git a/ircd/m/m.cc b/ircd/m/m.cc index 89a007203..0eac0990a 100644 --- a/ircd/m/m.cc +++ b/ircd/m/m.cc @@ -232,8 +232,8 @@ ircd::m::init::bootstrap() _keys.bootstrap(); - message(control, me.user_id, "Welcome to the control room."); - message(control, me.user_id, "I am the daemon. You can talk to me in this room by highlighting me."); + notice(control, me.user_id, "Welcome to the control room."); + notice(control, me.user_id, "I am the daemon. You can talk to me in this room by highlighting me."); } bool @@ -345,6 +345,21 @@ ircd::m::redact(const room &room, return function(room, sender, event_id, reason); } +ircd::m::event::id::buf +ircd::m::notice(const room &room, + const string_view &body) +{ + return message(room, me.user_id, body, "m.notice"); +} + +ircd::m::event::id::buf +ircd::m::notice(const room &room, + const m::id::user &sender, + const string_view &body) +{ + return message(room, sender, body, "m.notice"); +} + ircd::m::event::id::buf ircd::m::message(const room &room, const m::id::user &sender,