mirror of
https://github.com/matrix-construct/construct
synced 2024-11-15 22:41:12 +01:00
modules/m_presence: Add additional presence spam filtering logic.
This commit is contained in:
parent
5f067c2ce6
commit
960c94d4eb
1 changed files with 12 additions and 1 deletions
|
@ -124,7 +124,18 @@ try
|
||||||
json::get<"origin_server_ts"_>(event) - now_active_ago
|
json::get<"origin_server_ts"_>(event) - now_active_ago
|
||||||
};
|
};
|
||||||
|
|
||||||
useful = now_active_absolute > prev_active_absolute;
|
// First way to filter out the synapse presence spam bug is seeing
|
||||||
|
// if the update is older than the last update.
|
||||||
|
if(now_active_absolute < prev_active_absolute)
|
||||||
|
useful = false;
|
||||||
|
else if(json::get<"presence"_>(object) != unquote(existing_object.get("presence")))
|
||||||
|
useful = true;
|
||||||
|
else if(json::get<"currently_active"_>(object) != existing_object.get<bool>("currently_active"))
|
||||||
|
useful = true;
|
||||||
|
else if(json::get<"currently_active"_>(object))
|
||||||
|
useful = true;
|
||||||
|
else
|
||||||
|
useful = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!useful)
|
if(!useful)
|
||||||
|
|
Loading…
Reference in a new issue