diff --git a/irc/channel.go b/irc/channel.go index 3b241435..ba8658bd 100644 --- a/irc/channel.go +++ b/irc/channel.go @@ -720,7 +720,7 @@ func (channel *Channel) Join(client *Client, key string, isSajoin bool, rb *Resp channel.AddHistoryItem(histItem) } - client.addChannel(channel) + client.addChannel(channel, rb == nil) if rb == nil { return diff --git a/irc/client.go b/irc/client.go index 9e1e3ff3..6841791f 100644 --- a/irc/client.go +++ b/irc/client.go @@ -1496,13 +1496,15 @@ func (session *Session) Notice(text string) { session.Send(nil, session.client.server.name, "NOTICE", session.client.Nick(), text) } -func (client *Client) addChannel(channel *Channel) { +// `simulated` is for the fake join of an always-on client +// (we just read the channel name from the database, there's no need to write it back) +func (client *Client) addChannel(channel *Channel, simulated bool) { client.stateMutex.Lock() client.channels[channel] = true alwaysOn := client.alwaysOn client.stateMutex.Unlock() - if alwaysOn { + if alwaysOn && !simulated { client.markDirty(IncludeChannels) } }