0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 10:12:39 +01:00

ircd:Ⓜ️:typing: Fix clamp on configured timeout max for typists.

This commit is contained in:
Jason Volk 2020-02-21 12:29:12 -08:00
parent 1765ba8921
commit fca41d5e22

View file

@ -177,7 +177,8 @@ _handle_edu_m_typing(const m::event &event,
// don't/can't set and then update the state. Use the maximum timeout
// value here because the minimum might unfairly time them out.
auto _edu(edu);
json::get<"timeout"_>(_edu) = milliseconds(timeout_max).count();
const milliseconds max(timeout_max), min(timeout_min);
json::get<"timeout"_>(_edu) = std::clamp(json::get<"timeout"_>(_edu), min.count(), max.count());
if(!update_state(_edu))
return;
}