Use Client.key for channel clientMap and modeMap lookups and insertions

This commit is contained in:
ed 2016-03-19 02:07:18 -04:00
parent 0e43a20937
commit d9b56c3e05

View File

@ -60,7 +60,7 @@ func (c *Client) joinChannel(channelName string) {
newChannel = true newChannel = true
} }
if _, inChannel := channel.clientMap[c.nick]; inChannel { if _, inChannel := channel.clientMap[c.key]; inChannel {
//Client is already in the channel, do nothing //Client is already in the channel, do nothing
return return
} }
@ -71,8 +71,8 @@ func (c *Client) joinChannel(channelName string) {
mode.operator = true mode.operator = true
} }
channel.clientMap[c.nick] = c channel.clientMap[c.key] = c
channel.modeMap[c.nick] = mode channel.modeMap[c.key] = mode
c.channelMap[channelKey] = channel c.channelMap[channelKey] = channel
for _, client := range channel.clientMap { for _, client := range channel.clientMap {
@ -91,7 +91,7 @@ func (c *Client) joinChannel(channelName string) {
for _, client := range channel.clientMap { for _, client := range channel.clientMap {
prefix := "" prefix := ""
if mode, exists := channel.modeMap[client.nick]; exists { if mode, exists := channel.modeMap[client.key]; exists {
prefix = mode.Prefix() prefix = mode.Prefix()
} }