Don't clear channel key on JOIN

Closes: https://todo.sr.ht/~emersion/soju/50
This commit is contained in:
Simon Ser 2020-05-01 17:39:53 +02:00
parent d9186e994d
commit aa6f3a9954
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

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)
}