3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-14 07:59:31 +01:00
Clean up channels during unregistration if necessary.
This commit is contained in:
Shivaram Lingamneni 2021-04-18 20:03:17 -04:00
parent fed5134a63
commit 3cca1e2c39

View File

@ -176,6 +176,10 @@ func (cm *ChannelManager) maybeCleanup(channel *Channel, afterJoin bool) {
return return
} }
cm.maybeCleanupInternal(cfname, entry, afterJoin)
}
func (cm *ChannelManager) maybeCleanupInternal(cfname string, entry *channelManagerEntry, afterJoin bool) {
if afterJoin { if afterJoin {
entry.pendingJoins -= 1 entry.pendingJoins -= 1
} }
@ -288,6 +292,9 @@ func (cm *ChannelManager) SetUnregistered(channelName string, account string) (e
entry.skeleton = skel entry.skeleton = skel
cm.chans[cfname] = entry cm.chans[cfname] = entry
} }
// #1619: if the channel has 0 members and was only being retained
// because it was registered, clean it up:
cm.maybeCleanupInternal(cfname, entry, false)
} }
return nil return nil
} }