1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-22 16:45:58 +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 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
} }
} }