Make Kick part of the Client interface.

All clients implement Kick, no need for a separate interface.
This commit is contained in:
Juliusz Chroboczek
2021-02-26 16:20:13 +01:00
parent 69c438ab30
commit ea321be17a
3 changed files with 2 additions and 13 deletions
-3
View File
@@ -101,8 +101,5 @@ type Client interface {
OverridePermissions(*Group) bool
PushConn(g *Group, id string, conn conn.Up, tracks []conn.UpTrack, replace string) error
PushClient(id, username string, add bool) error
}
type Kickable interface {
Kick(id, user, message string) error
}
+1 -4
View File
@@ -586,10 +586,7 @@ func (g *Group) Range(f func(c Client) bool) {
func kickall(g *Group, message string) {
g.Range(func(c Client) bool {
cc, ok := c.(Kickable)
if ok {
cc.Kick("", "", message)
}
c.Kick("", "", message)
return true
})
}
+1 -6
View File
@@ -1099,12 +1099,7 @@ func kickClient(g *group.Group, id, user, dest string, message string) error {
return group.UserError("no such user")
}
c, ok := client.(group.Kickable)
if !ok {
return group.UserError("this client is not kickable")
}
return c.Kick(id, user, message)
return client.Kick(id, user, message)
}
func handleClientMessage(c *webClient, m clientMessage) error {