From 79de44349631554b71b4712f536359efd644e65d Mon Sep 17 00:00:00 2001 From: Daniel Oaks Date: Tue, 26 Sep 2017 08:01:10 +1000 Subject: [PATCH] channel: Don't send TOPIC on entirely new channel --- irc/channel.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/irc/channel.go b/irc/channel.go index 6b29ee2e..410eade0 100644 --- a/irc/channel.go +++ b/irc/channel.go @@ -272,6 +272,7 @@ func (channel *Channel) Join(client *Client, key string) { channel.members.Add(client) // give channel mode if necessary + var newChannel bool var givenMode *Mode client.server.registeredChannelsMutex.Lock() defer client.server.registeredChannelsMutex.Unlock() @@ -283,6 +284,7 @@ func (channel *Channel) Join(client *Client, key string) { channel.createdTime = time.Now() channel.members[client][ChannelOperator] = true givenMode = &ChannelOperator + newChannel = true } } else { // we should only do this on registered channels @@ -316,7 +318,10 @@ func (channel *Channel) Join(client *Client, key string) { } else { client.Send(nil, client.nickMaskString, "JOIN", channel.name) } - channel.getTopicNoMutex(client) // we already have Lock + // don't sent topic when it's an entirely new channel + if !newChannel { + channel.getTopicNoMutex(client) // we already have Lock + } channel.namesNoMutex(client) if givenMode != nil { for member := range channel.members {