mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
remove chat.
This commit is contained in:
parent
78c397ef54
commit
3c5c01f475
@ -25,11 +25,6 @@ const (
|
|||||||
CONTROL_KEYBOARD = "control/keyboard"
|
CONTROL_KEYBOARD = "control/keyboard"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
CHAT_MESSAGE = "chat/message"
|
|
||||||
CHAT_EMOTE = "chat/emote"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SCREEN_CONFIGURATIONS = "screen/configurations"
|
SCREEN_CONFIGURATIONS = "screen/configurations"
|
||||||
SCREEN_RESOLUTION = "screen/resolution"
|
SCREEN_RESOLUTION = "screen/resolution"
|
||||||
|
@ -65,17 +65,6 @@ type ControlTarget struct {
|
|||||||
Target string `json:"target"`
|
Target string `json:"target"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ChatReceive struct {
|
|
||||||
Event string `json:"event"`
|
|
||||||
Content string `json:"content"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ChatSend struct {
|
|
||||||
Event string `json:"event"`
|
|
||||||
ID string `json:"id"`
|
|
||||||
Content string `json:"content"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type EmoteReceive struct {
|
type EmoteReceive struct {
|
||||||
Event string `json:"event"`
|
Event string `json:"event"`
|
||||||
Emote string `json:"emote"`
|
Emote string `json:"emote"`
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
package websocket
|
|
||||||
|
|
||||||
import (
|
|
||||||
"demodesk/neko/internal/types"
|
|
||||||
"demodesk/neko/internal/types/event"
|
|
||||||
"demodesk/neko/internal/types/message"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (h *MessageHandler) chat(id string, session types.Session, payload *message.ChatReceive) error {
|
|
||||||
if session.Muted() {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := h.sessions.Broadcast(
|
|
||||||
message.ChatSend{
|
|
||||||
Event: event.CHAT_MESSAGE,
|
|
||||||
Content: payload.Content,
|
|
||||||
ID: id,
|
|
||||||
}, nil); err != nil {
|
|
||||||
h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.CONTROL_RELEASE)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *MessageHandler) chatEmote(id string, session types.Session, payload *message.EmoteReceive) error {
|
|
||||||
if session.Muted() {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := h.sessions.Broadcast(
|
|
||||||
message.EmoteSend{
|
|
||||||
Event: event.CHAT_EMOTE,
|
|
||||||
Emote: payload.Emote,
|
|
||||||
ID: id,
|
|
||||||
}, nil); err != nil {
|
|
||||||
h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.CONTROL_RELEASE)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
@ -97,21 +97,6 @@ func (h *MessageHandler) Message(id string, raw []byte) error {
|
|||||||
return h.controlKeyboard(id, session, payload)
|
return h.controlKeyboard(id, session, payload)
|
||||||
}), "%s failed", header.Event)
|
}), "%s failed", header.Event)
|
||||||
|
|
||||||
|
|
||||||
// Chat Events
|
|
||||||
case event.CHAT_MESSAGE:
|
|
||||||
payload := &message.ChatReceive{}
|
|
||||||
return errors.Wrapf(
|
|
||||||
utils.Unmarshal(payload, raw, func() error {
|
|
||||||
return h.chat(id, session, payload)
|
|
||||||
}), "%s failed", header.Event)
|
|
||||||
case event.CHAT_EMOTE:
|
|
||||||
payload := &message.EmoteReceive{}
|
|
||||||
return errors.Wrapf(
|
|
||||||
utils.Unmarshal(payload, raw, func() error {
|
|
||||||
return h.chatEmote(id, session, payload)
|
|
||||||
}), "%s failed", header.Event)
|
|
||||||
|
|
||||||
// Screen Events
|
// Screen Events
|
||||||
case event.SCREEN_RESOLUTION:
|
case event.SCREEN_RESOLUTION:
|
||||||
return errors.Wrapf(h.screenResolution(id, session), "%s failed", header.Event)
|
return errors.Wrapf(h.screenResolution(id, session), "%s failed", header.Event)
|
||||||
|
Loading…
Reference in New Issue
Block a user