mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-17 17:27:19 +02:00
Typing dots: none for commands and private messages, and no flood of stop notices
A line that starts with "/" is a command, a whisper or party chat, so typing one no longer shows dots to the whole server. Dots already showing are cleared when the line becomes one. A "stopped typing" notice was relayed every time it arrived, while "typing" was held to one per 200 ms, so a modified client could flood everyone through the host. A lobby's host and a dedicated server now pass a stop on only when that player's dots are up, which is at most once per accepted "typing".
This commit is contained in:
1 parent
eb038d5797
commit
28231c0df2
5 files changed
+25
-3
No files matched your search
@@ -1267,12 +1267,17 @@ void Host::receive(std::uint64_t peer, std::span<const std::uint8_t> bytes, std:
|
||||
return;
|
||||
}
|
||||
// Grey dots above the sender. Not a chat line, and not logged. A player who may not
|
||||
// chat sends none. "On" is held to a few a second; "off" always goes through.
|
||||
// chat sends none. "On" is held to a few a second, and "off" is passed on only after an
|
||||
// "on", so neither can flood the relay.
|
||||
if (p.kind == PacketKind::typing) {
|
||||
if (!routed_source(p, link->member, peer, true, id_) || !may(peer, multiplayer::role_chat)) return;
|
||||
if (p.typing) {
|
||||
if (link->typing_notice && now_ < link->typing_notice + 200000) return;
|
||||
link->typing_notice = now_;
|
||||
link->typing = true;
|
||||
} else {
|
||||
if (!link->typing) return;
|
||||
link->typing = false;
|
||||
}
|
||||
link->last_packet = now_;
|
||||
active(*link);
|
||||
|
||||
Reference in new issue
Block a user