From 37cd9e4d89f295172809734930b6e27581e36b1c Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 7 Apr 2020 15:01:11 +0200 Subject: [PATCH] Fix upstream NICK handling - uc.nicl was compared to msg.Prefix.Name after being updated to the new nick - The new nick wasn't marshaled --- upstream.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/upstream.go b/upstream.go index 8a49b75..888f6a7 100644 --- a/upstream.go +++ b/upstream.go @@ -546,8 +546,10 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error { return err } + me := false if msg.Prefix.Name == uc.nick { uc.logger.Printf("changed nick from %q to %q", uc.nick, newNick) + me = true uc.nick = newNick } @@ -559,12 +561,12 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error { } } - if msg.Prefix.Name != uc.nick { + if !me { uc.forEachDownstream(func(dc *downstreamConn) { dc.SendMessage(&irc.Message{ Prefix: dc.marshalUserPrefix(uc, msg.Prefix), Command: "NICK", - Params: []string{newNick}, + Params: []string{dc.marshalEntity(uc, newNick)}, }) }) }