Commit ea321be1 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Make Kick part of the Client interface.

All clients implement Kick, no need for a separate interface.
parent 69c438ab
...@@ -101,8 +101,5 @@ type Client interface { ...@@ -101,8 +101,5 @@ type Client interface {
OverridePermissions(*Group) bool OverridePermissions(*Group) bool
PushConn(g *Group, id string, conn conn.Up, tracks []conn.UpTrack, replace string) error PushConn(g *Group, id string, conn conn.Up, tracks []conn.UpTrack, replace string) error
PushClient(id, username string, add bool) error PushClient(id, username string, add bool) error
}
type Kickable interface {
Kick(id, user, message string) error Kick(id, user, message string) error
} }
...@@ -586,10 +586,7 @@ func (g *Group) Range(f func(c Client) bool) { ...@@ -586,10 +586,7 @@ func (g *Group) Range(f func(c Client) bool) {
func kickall(g *Group, message string) { func kickall(g *Group, message string) {
g.Range(func(c Client) bool { g.Range(func(c Client) bool {
cc, ok := c.(Kickable) c.Kick("", "", message)
if ok {
cc.Kick("", "", message)
}
return true return true
}) })
} }
......
...@@ -1099,12 +1099,7 @@ func kickClient(g *group.Group, id, user, dest string, message string) error { ...@@ -1099,12 +1099,7 @@ func kickClient(g *group.Group, id, user, dest string, message string) error {
return group.UserError("no such user") return group.UserError("no such user")
} }
c, ok := client.(group.Kickable) return client.Kick(id, user, message)
if !ok {
return group.UserError("this client is not kickable")
}
return c.Kick(id, user, message)
} }
func handleClientMessage(c *webClient, m clientMessage) error { func handleClientMessage(c *webClient, m clientMessage) error {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment