mirror of
https://github.com/matrix-construct/construct
synced 2024-12-27 07:54:05 +01:00
modules/m_user: Additional derived tools for linear highlight counting.
This commit is contained in:
parent
5daa57d447
commit
b1cd9edcd2
1 changed files with 34 additions and 0 deletions
|
@ -85,3 +85,37 @@ highlighted_count__between(const user &user,
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern "C" size_t
|
||||
highlighted_count__since(const user &user,
|
||||
const room &room,
|
||||
const event::idx ¤t)
|
||||
{
|
||||
event::id::buf last_read_buf;
|
||||
const event::id last_read
|
||||
{
|
||||
receipt::read(last_read_buf, room, user)
|
||||
};
|
||||
|
||||
if(!last_read)
|
||||
return 0;
|
||||
|
||||
const auto &a
|
||||
{
|
||||
index(last_read)
|
||||
};
|
||||
|
||||
return highlighted_count__between(user, room, a, current);
|
||||
}
|
||||
|
||||
extern "C" size_t
|
||||
highlighted_count(const user &user,
|
||||
const room &room)
|
||||
{
|
||||
const auto ¤t
|
||||
{
|
||||
head_idx(room)
|
||||
};
|
||||
|
||||
return highlighted_count__since(user, room, current);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue