mirror of
https://github.com/jech/galene.git
synced 2024-12-22 07:15:47 +01:00
Delete empty groups.
This commit is contained in:
parent
f5a518a448
commit
2cb323ec31
1 changed files with 4 additions and 4 deletions
8
group.go
8
group.go
|
@ -111,10 +111,7 @@ func addGroup(name string) (*group, error) {
|
|||
return g, nil
|
||||
}
|
||||
|
||||
func delGroup(name string) bool {
|
||||
groups.mu.Lock()
|
||||
defer groups.mu.Unlock()
|
||||
|
||||
func delGroupUnlocked(name string) bool {
|
||||
g := groups.groups[name]
|
||||
if g == nil {
|
||||
return true
|
||||
|
@ -158,6 +155,9 @@ func delClient(c *client) {
|
|||
g.clients =
|
||||
append(g.clients[:i], g.clients[i+1:]...)
|
||||
c.group = nil
|
||||
if len(g.clients) == 0 {
|
||||
delGroupUnlocked(g.name)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue