mirror of
https://github.com/jech/galene.git
synced 2024-11-10 02:35:58 +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
|
return g, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func delGroup(name string) bool {
|
func delGroupUnlocked(name string) bool {
|
||||||
groups.mu.Lock()
|
|
||||||
defer groups.mu.Unlock()
|
|
||||||
|
|
||||||
g := groups.groups[name]
|
g := groups.groups[name]
|
||||||
if g == nil {
|
if g == nil {
|
||||||
return true
|
return true
|
||||||
|
@ -158,6 +155,9 @@ func delClient(c *client) {
|
||||||
g.clients =
|
g.clients =
|
||||||
append(g.clients[:i], g.clients[i+1:]...)
|
append(g.clients[:i], g.clients[i+1:]...)
|
||||||
c.group = nil
|
c.group = nil
|
||||||
|
if len(g.clients) == 0 {
|
||||||
|
delGroupUnlocked(g.name)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue