1
Fork 0
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:
Juliusz Chroboczek 2020-04-25 02:01:04 +02:00
parent f5a518a448
commit 2cb323ec31

View file

@ -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
}
}