mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 02:02:38 +01:00
ircd:Ⓜ️:user::notifications: Add room_id to opts; prefix keying strategy.
modules/m_push: Add room_id to type generation.
This commit is contained in:
parent
36b1fa6bde
commit
4c70d8ce08
3 changed files with 11 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue