From 272ea046c41308abb7b96b3d4683354f4cbb1496 Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 7 Mar 2016 06:28:56 -0500 Subject: [PATCH] Remove empty channels from the server channelMap when the last client leaves --- client.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client.go b/client.go index eccf824..3327a8d 100644 --- a/client.go +++ b/client.go @@ -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) } }