0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-10-02 13:48:53 +02:00

modules/console: Add basic room messages count as default for room count cmd.

This commit is contained in:
Jason Volk 2019-08-20 18:24:24 -07:00
parent 0e956dbaca
commit d320ce0b47

View file

@ -9395,14 +9395,25 @@ console_cmd__room__count(opt &out, const string_view &line)
json::get<"limit"_>(filter)?: -1
};
size_t count{0};
m::room::messages it{room};
for(; it && limit; --it, --limit)
if(param[1])
{
const m::event &event{*it};
count += match(filter, event);
size_t count{0};
m::room::messages it{room};
for(; it && limit; --it, --limit)
{
const m::event &event{*it};
count += match(filter, event);
}
out << count << std::endl;
return true;
}
const size_t count
{
room.count()
};
out << count << std::endl;
return true;
}