diff --git a/client.go b/client.go index 3936464..0fe5c42 100644 --- a/client.go +++ b/client.go @@ -106,7 +106,7 @@ func (c *Client) partChannel(channelName, reason string) { return } - if _, inChannel := channel.clientMap[strings.ToLower(c.nick)]; inChannel == false { + if _, inChannel := channel.clientMap[c.key]; inChannel == false { //Client isn't in this channel, do nothing return } @@ -117,8 +117,8 @@ func (c *Client) partChannel(channelName, reason string) { } delete(c.channelMap, channelKey) - delete(channel.modeMap, strings.ToLower(c.nick)) - delete(channel.clientMap, strings.ToLower(c.nick)) + delete(channel.modeMap, c.key) + delete(channel.clientMap, c.key) if len(channel.clientMap) == 0 { delete(c.server.channelMap, channelKey) @@ -227,7 +227,7 @@ func (c *Client) clientThread() { c.partChannel(channelName, "Disconnecting") } - delete(c.server.clientMap, strings.ToLower(c.nick)) + delete(c.server.clientMap, c.key) c.connection.Close() }() diff --git a/server.go b/server.go index 4147cef..23a1c5c 100644 --- a/server.go +++ b/server.go @@ -184,14 +184,14 @@ func (s *Server) handleCommand(client *Client, command string, args []string) { if chanExists { if channel.mode.noExternal { - if _, inChannel := channel.clientMap[strings.ToLower(client.nick)]; !inChannel { + if _, inChannel := channel.clientMap[client.key]; !inChannel { //Not in channel, not allowed to send client.reply(errCannotSend, args[0]) return } } if channel.mode.moderated { - clientMode := channel.modeMap[strings.ToLower(client.nick)] + clientMode := channel.modeMap[client.key] if !clientMode.operator && !clientMode.voice { //It's moderated and we're not +v or +o, do nothing client.reply(errCannotSend, args[0]) @@ -239,7 +239,7 @@ func (s *Server) handleCommand(client *Client, command string, args []string) { return } - clientMode := channel.modeMap[strings.ToLower(client.nick)] + clientMode := channel.modeMap[client.key] if channel.mode.topicLocked && !clientMode.operator { client.reply(errNoPriv) return @@ -271,7 +271,7 @@ func (s *Server) handleCommand(client *Client, command string, args []string) { for channelName, channel := range s.channelMap { if channel.mode.secret { - if _, inChannel := channel.clientMap[strings.ToLower(client.nick)]; !inChannel { + if _, inChannel := channel.clientMap[client.key]; !inChannel { //Not in the channel, skip continue } @@ -419,7 +419,7 @@ func (s *Server) handleCommand(client *Client, command string, args []string) { return } - if cm, ok := channel.modeMap[strings.ToLower(client.nick)]; !ok || !cm.operator { + if cm, ok := channel.modeMap[client.key]; !ok || !cm.operator { //Not a channel operator. //If they're not an irc operator either, they'll fail