Remove empty channels from the server channelMap when the last client leaves

This commit is contained in:
ed 2016-03-07 06:28:56 -05:00 committed by Harry Jeffery
parent 0bc9a528ff
commit 272ea046c4

View File

@ -124,10 +124,11 @@ func (c *Client) partChannel(channelName, reason string) {
client.reply(rplPart, c.nick, channel.name, reason)
}
delete(c.channelMap, channelKey)
delete(channel.clientMap, strings.ToLower(c.nick))
if len(channel.clientMap) == 0 {
delete(c.channelMap, channelKey)
delete(c.server.channelMap, channelKey)
}
}