remove chat.

This commit is contained in:
Miroslav Šedivý 2020-10-29 18:11:30 +01:00
parent 78c397ef54
commit 3c5c01f475
4 changed files with 0 additions and 72 deletions

View File

@ -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"

View File

@ -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"`

View File

@ -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
}

View File

@ -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)