Check for redundant join/parts
This commit is contained in:
parent
6a102e8587
commit
ebaddea859
14
client.go
14
client.go
@ -61,7 +61,14 @@ func (c *Client) joinChannel(channelName string) {
|
|||||||
c.server.channelMap[channelKey] = channel
|
c.server.channelMap[channelKey] = channel
|
||||||
}
|
}
|
||||||
|
|
||||||
channel.clientMap[strings.ToLower(c.nick)] = c
|
nickKey := strings.ToLower(c.nick)
|
||||||
|
|
||||||
|
if _, inChannel := channel.clientMap[nickKey]; inChannel {
|
||||||
|
//Client is already in the channel, do nothing
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
channel.clientMap[nickKey] = c
|
||||||
c.channelMap[channelKey] = channel
|
c.channelMap[channelKey] = channel
|
||||||
|
|
||||||
for _, client := range channel.clientMap {
|
for _, client := range channel.clientMap {
|
||||||
@ -89,6 +96,11 @@ func (c *Client) partChannel(channelName string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _, inChannel := channel.clientMap[strings.ToLower(c.nick)]; inChannel == false {
|
||||||
|
//Client isn't in this channel, do nothing
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
//Notify clients of the part
|
//Notify clients of the part
|
||||||
for _, client := range channel.clientMap {
|
for _, client := range channel.clientMap {
|
||||||
client.reply(rplPart, c.nick, channelName)
|
client.reply(rplPart, c.nick, channelName)
|
||||||
|
Loading…
Reference in New Issue
Block a user