diff --git a/include/ircd/m/user/notifications.h b/include/ircd/m/user/notifications.h index f59df4a96..cb86fe183 100644 --- a/include/ircd/m/user/notifications.h +++ b/include/ircd/m/user/notifications.h @@ -35,6 +35,7 @@ struct ircd::m::user::notifications::opts event::idx from {0}; // highest idx counting down event::idx to {0}; // lowest idx ending iteration string_view only; // spec "only" filter + room::id room_id; // room_id filter (optional) }; inline diff --git a/matrix/user_notifications.cc b/matrix/user_notifications.cc index 7fefcfd7b..a0acb45ec 100644 --- a/matrix/user_notifications.cc +++ b/matrix/user_notifications.cc @@ -14,16 +14,23 @@ ircd::m::user::notifications::type_prefix "ircd.push.note" }; +/// valid result examples: +/// +/// ircd.push.note.highlight!AAAANTUiY1fBZ230:zemos.net +/// ircd.push.note.highlight +/// ircd.push.note!AAAANTUiY1fBZ230:zemos.net +/// ircd.push.note ircd::string_view ircd::m::user::notifications::make_type(const mutable_buffer &buf, const opts &opts) { return fmt::sprintf { - buf, "%s%s%s", + buf, "%s%s%s%s", type_prefix, opts.only? "."_sv : string_view{}, opts.only, + string_view{opts.room_id}, }; } @@ -71,7 +78,7 @@ const const room::type events { - user_room, type + user_room, type, {-1UL, -1L}, true }; return events.for_each([&opts, &closure] diff --git a/modules/m_push.cc b/modules/m_push.cc index 217430465..ed60bb91d 100644 --- a/modules/m_push.cc +++ b/modules/m_push.cc @@ -228,6 +228,7 @@ try char type_buf[event::TYPE_MAX_SIZE]; user::notifications::opts opts; opts.only = "highlight"; + opts.room_id = eval.room_id; const auto &type { user::notifications::make_type(type_buf, opts)