remove user kick.

This commit is contained in:
Miroslav Šedivý 2020-11-28 14:32:38 +01:00
parent 592b2cfd3a
commit 3f312c84ad
3 changed files with 0 additions and 37 deletions

View File

@ -38,7 +38,6 @@ const (
) )
const ( const (
ADMIN_KICK = "admin/kick"
ADMIN_CONTROL = "admin/control" ADMIN_CONTROL = "admin/control"
ADMIN_RELEASE = "admin/release" ADMIN_RELEASE = "admin/release"
ADMIN_GIVE = "admin/give" ADMIN_GIVE = "admin/give"

View File

@ -83,34 +83,3 @@ func (h *MessageHandlerCtx) adminGive(session types.Session, payload *message.Ad
return nil return nil
} }
func (h *MessageHandlerCtx) adminKick(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
}
if target.Admin() {
h.logger.Debug().Msg("target is an admin, baling")
return nil
}
if err := target.Disconnect("kicked"); err != nil {
return err
}
h.sessions.Broadcast(
message.AdminTarget{
Event: event.ADMIN_KICK,
Target: target.ID(),
ID: session.ID(),
}, []string{payload.ID})
return nil
}

View File

@ -104,11 +104,6 @@ func (h *MessageHandlerCtx) Message(session types.Session, raw []byte) error {
err = utils.Unmarshal(payload, raw, func() error { err = utils.Unmarshal(payload, raw, func() error {
return h.adminGive(session, payload) return h.adminGive(session, payload)
}) })
case event.ADMIN_KICK:
payload := &message.Admin{}
err = utils.Unmarshal(payload, raw, func() error {
return h.adminKick(session, payload)
})
default: default:
return errors.Errorf("unknown message event %s", header.Event) return errors.Errorf("unknown message event %s", header.Event)
} }