Fix channel join flooding and enhance TUI features

- Implemented separate PacketID counters for Ping, Pong, and Ack (protocol compliance).
- Encrypted outgoing Pong packets after handshake.
- Fixed 'clientmove' command by omitting empty 'cpw' parameter.
- Added fullscreen log view toggle ('f' key).
- Improved logging with multi-writer and timestamps.
- Updated .gitignore to exclude binaries and logs.
This commit is contained in:
Jose Luis Montañes Ojados
2026-01-16 16:02:17 +01:00
parent c0b1217536
commit 184fff202f
15 changed files with 239 additions and 39 deletions

View File

@@ -331,6 +331,32 @@ func (c *Client) processCommand(data []byte, pkt *protocol.Packet) error {
return c.SendCommand(moveCmd)
}
case "clientlist":
// Parse client info (usually received after connection for all clients)
nick := ""
clientID := uint16(0)
channelID := uint64(0)
if n, ok := args["client_nickname"]; ok {
nick = protocol.Unescape(n)
}
if cid, ok := args["clid"]; ok {
var id uint64
fmt.Sscanf(cid, "%d", &id)
clientID = uint16(id)
}
if ctid, ok := args["cid"]; ok {
fmt.Sscanf(ctid, "%d", &channelID)
}
// Don't emit for ourselves if we already handle it in initserver
if clientID != c.ClientID && clientID != 0 {
log.Printf("Existing client: %s (ID=%d) in Channel %d", nick, clientID, channelID)
c.emitEvent("client_enter", map[string]any{
"clientID": clientID,
"nickname": nick,
"channelID": channelID,
})
}
case "notifycliententerview":
// A client entered the server
nick := ""