From aa6f3a9954d7a6d6204180030f4f9e99c0d8d574 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 1 May 2020 17:39:53 +0200 Subject: [PATCH] Don't clear channel key on JOIN Closes: https://todo.sr.ht/~emersion/soju/50 --- downstream.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/downstream.go b/downstream.go index be2b688..46573c0 100644 --- a/downstream.go +++ b/downstream.go @@ -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) }