0
0
Fork 0
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:
Jason Volk 2020-03-24 17:45:48 -07:00
parent 3472f551eb
commit 5776549efe

View file

@ -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 &notification)
{