Don't clear channel key on JOIN

Closes: https://todo.sr.ht/~emersion/soju/50

git-svn-id: file:///srv/svn/repo/suika/trunk@285 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This commit is contained in:
contact 2020-05-01 15:39:53 +00:00
parent 9f84047153
commit 2773535389

View File

@ -955,6 +955,11 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
})
ch := &Channel{Name: upstreamName, Key: key, Detached: false}
if current, ok := uc.network.channels[ch.Name]; ok && key == "" {
// Don't clear the channel key if there's one set
// TODO: add a way to unset the channel key
ch.Key = current.Key
}
if err := uc.network.createUpdateChannel(ch); err != nil {
dc.logger.Printf("failed to create or update channel %q: %v", upstreamName, err)
}