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

@@ -283,9 +283,23 @@ func (c *Client) handleInternalEvent(eventType string, data map[string]any) {
})
case "client_moved":
clientID := getUint16(data, "clientID")
channelID := getUint64(data, "channelID")
c.clientsMu.Lock()
if client, ok := c.clients[clientID]; ok {
client.ChannelID = channelID
}
c.clientsMu.Unlock()
// Update selfInfo if it's us
if c.selfInfo != nil && c.selfInfo.ClientID == clientID {
c.selfInfo.ChannelID = channelID
}
c.emit(EventClientMoved, &ClientMovedEvent{
ClientID: getUint16(data, "clientID"),
ChannelID: getUint64(data, "channelID"),
ClientID: clientID,
ChannelID: channelID,
})
case "channel_list":

View File

@@ -81,7 +81,9 @@ func (c *Client) JoinChannelWithPassword(channelID uint64, password string) erro
cmd := protocol.NewCommand("clientmove")
cmd.AddParam("clid", fmt.Sprintf("%d", c.selfInfo.ClientID))
cmd.AddParam("cid", fmt.Sprintf("%d", channelID))
cmd.AddParam("cpw", password)
if password != "" {
cmd.AddParam("cpw", password)
}
err := c.internal.SendCommand(cmd)
if err == nil && c.selfInfo != nil {