Implement Poke functionality, refine talking status and add local log events

This commit is contained in:
Jose Luis Montañes Ojados
2026-01-17 00:53:50 +01:00
parent be5e26486c
commit 3a57f41fc2
5 changed files with 125 additions and 20 deletions

View File

@@ -124,6 +124,10 @@ func (c *Client) emit(event EventType, data any) {
if fn, ok := h.(func(*TalkingStatusEvent)); ok {
fn(data.(*TalkingStatusEvent))
}
case EventPoke:
if fn, ok := h.(func(*PokeEvent)); ok {
fn(data.(*PokeEvent))
}
}
}
}
@@ -405,6 +409,13 @@ func (c *Client) handleInternalEvent(eventType string, data map[string]any) {
Channels: getInt(data, "channels"),
})
case "client_poke":
c.emit(EventPoke, &PokeEvent{
SenderID: getUint16(data, "senderID"),
SenderName: getString(data, "senderName"),
Message: getString(data, "message"),
})
case "error":
c.emit(EventError, &ErrorEvent{
ID: getString(data, "id"),