diff --git a/internal/session/session.go b/internal/session/session.go index 70ee941c..4f569dd9 100644 --- a/internal/session/session.go +++ b/internal/session/session.go @@ -13,7 +13,6 @@ type SessionCtx struct { id string name string admin bool - muted bool connected bool manager *SessionManagerCtx socket types.WebSocket @@ -32,10 +31,6 @@ func (session *SessionCtx) Admin() bool { return session.admin } -func (session *SessionCtx) Muted() bool { - return session.muted -} - func (session *SessionCtx) IsHost() bool { return session.manager.host != nil && session.manager.host.ID() == session.ID() } @@ -52,10 +47,6 @@ func (session *SessionCtx) Address() string { return session.socket.Address() } -func (session *SessionCtx) SetMuted(muted bool) { - session.muted = muted -} - func (session *SessionCtx) SetName(name string) { session.name = name } diff --git a/internal/types/event/events.go b/internal/types/event/events.go index 5d11b3e3..a542e757 100644 --- a/internal/types/event/events.go +++ b/internal/types/event/events.go @@ -41,9 +41,7 @@ const ( ADMIN_BAN = "admin/ban" ADMIN_KICK = "admin/kick" ADMIN_LOCK = "admin/lock" - ADMIN_MUTE = "admin/mute" ADMIN_UNLOCK = "admin/unlock" - ADMIN_UNMUTE = "admin/unmute" ADMIN_CONTROL = "admin/control" ADMIN_RELEASE = "admin/release" ADMIN_GIVE = "admin/give" diff --git a/internal/types/message/messages.go b/internal/types/message/messages.go index 9e88d476..46f34647 100644 --- a/internal/types/message/messages.go +++ b/internal/types/message/messages.go @@ -36,7 +36,6 @@ type MembersListEntry struct { ID string `json:"id"` Name string `json:"displayname"` Admin bool `json:"admin"` - Muted bool `json:"muted"` } type Member struct { @@ -44,7 +43,6 @@ type Member struct { ID string `json:"id"` Name string `json:"displayname"` Admin bool `json:"admin"` - Muted bool `json:"muted"` } type MemberDisconnected struct { diff --git a/internal/types/session.go b/internal/types/session.go index 5460c6a4..1ede9ac1 100644 --- a/internal/types/session.go +++ b/internal/types/session.go @@ -6,11 +6,9 @@ type Session interface { ID() string Name() string Admin() bool - Muted() bool IsHost() bool Connected() bool Address() string - SetMuted(muted bool) SetName(name string) SetSocket(socket WebSocket) SetPeer(peer Peer) diff --git a/internal/websocket/handler/admin.go b/internal/websocket/handler/admin.go index f7c818f7..8784eb46 100644 --- a/internal/websocket/handler/admin.go +++ b/internal/websocket/handler/admin.go @@ -120,55 +120,6 @@ func (h *MessageHandlerCtx) adminGive(session types.Session, payload *message.Ad }, nil) } -func (h *MessageHandlerCtx) adminMute(session types.Session, payload *message.Admin) error { - if !session.Admin() { - h.logger.Debug().Msg("user not admin") - return nil - } - - target, ok := h.sessions.Get(payload.ID) - if !ok { - h.logger.Debug().Str("id", payload.ID).Msg("can't find session id") - return nil - } - - if target.Admin() { - h.logger.Debug().Msg("target is an admin, baling") - return nil - } - - target.SetMuted(true) - - return h.sessions.Broadcast( - message.AdminTarget{ - Event: event.ADMIN_MUTE, - Target: target.ID(), - ID: session.ID(), - }, nil) -} - -func (h *MessageHandlerCtx) adminUnmute(session types.Session, payload *message.Admin) error { - if !session.Admin() { - h.logger.Debug().Msg("user not admin") - return nil - } - - target, ok := h.sessions.Get(payload.ID) - if !ok { - h.logger.Debug().Str("id", payload.ID).Msg("can't find target session") - return nil - } - - target.SetMuted(false) - - return h.sessions.Broadcast( - message.AdminTarget{ - Event: event.ADMIN_UNMUTE, - Target: target.ID(), - ID: session.ID(), - }, nil) -} - func (h *MessageHandlerCtx) adminKick(session types.Session, payload *message.Admin) error { if !session.Admin() { h.logger.Debug().Msg("user not admin") diff --git a/internal/websocket/handler/handler.go b/internal/websocket/handler/handler.go index fea76f45..60b82470 100644 --- a/internal/websocket/handler/handler.go +++ b/internal/websocket/handler/handler.go @@ -151,16 +151,6 @@ func (h *MessageHandlerCtx) Message(session types.Session, raw []byte) error { err = utils.Unmarshal(payload, raw, func() error { return h.adminKick(session, payload) }) - case event.ADMIN_MUTE: - payload := &message.Admin{} - err = utils.Unmarshal(payload, raw, func() error { - return h.adminMute(session, payload) - }) - case event.ADMIN_UNMUTE: - payload := &message.Admin{} - err = utils.Unmarshal(payload, raw, func() error { - return h.adminUnmute(session, payload) - }) default: return errors.Errorf("unknown message event %s", header.Event) } diff --git a/internal/websocket/handler/session.go b/internal/websocket/handler/session.go index 85ff51c6..581dea96 100644 --- a/internal/websocket/handler/session.go +++ b/internal/websocket/handler/session.go @@ -35,7 +35,6 @@ func (h *MessageHandlerCtx) SessionConnected(session types.Session) error { ID: session.ID(), Name: session.Name(), Admin: session.Admin(), - Muted: session.Muted(), }) } @@ -70,7 +69,6 @@ func (h *MessageHandlerCtx) SessionConnected(session types.Session) error { ID: session.ID(), Name: session.Name(), Admin: session.Admin(), - Muted: session.Muted(), }, nil) }