mirror of
https://github.com/jech/galene.git
synced 2024-11-22 16:45:58 +01:00
Make Kick part of the Client interface.
All clients implement Kick, no need for a separate interface.
This commit is contained in:
parent
69c438ab30
commit
ea321be17a
3 changed files with 2 additions and 13 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
})
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue