mirror of
https://github.com/matrix-construct/construct
synced 2024-11-15 14:31:11 +01:00
modules/console: Add more options to the user notifications cmd.
This commit is contained in:
parent
3472f551eb
commit
5776549efe
1 changed files with 19 additions and 3 deletions
|
@ -12161,7 +12161,7 @@ console_cmd__user__notifications(opt &out, const string_view &line)
|
|||
{
|
||||
const params param{line, " ",
|
||||
{
|
||||
"user_id", "only"
|
||||
"user_id", "only", "room_id", "from", "to"
|
||||
}};
|
||||
|
||||
const m::user::id &user_id
|
||||
|
@ -12169,14 +12169,30 @@ console_cmd__user__notifications(opt &out, const string_view &line)
|
|||
param.at("user_id")
|
||||
};
|
||||
|
||||
const string_view &only
|
||||
{
|
||||
param["only"] == "*"?
|
||||
string_view{}:
|
||||
param["only"]
|
||||
};
|
||||
|
||||
const m::room::id &room_id
|
||||
{
|
||||
param["room_id"] == "*"?
|
||||
m::room::id{}:
|
||||
m::room::id{param["room_id"]}
|
||||
};
|
||||
|
||||
const m::user::notifications notifications
|
||||
{
|
||||
user_id
|
||||
};
|
||||
|
||||
m::user::notifications::opts opts;
|
||||
opts.only = param["only"];
|
||||
|
||||
opts.only = only;
|
||||
opts.room_id = room_id;
|
||||
opts.from = param.at<m::event::idx>("from", 0UL);
|
||||
opts.to = param.at<m::event::idx>("to", 0UL);
|
||||
notifications.for_each(opts, [&out]
|
||||
(const auto &idx, const json::object ¬ification)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue