From 3857f41e57d8478200161e62ba9d476125cdf133 Mon Sep 17 00:00:00 2001 From: contact Date: Tue, 7 Apr 2020 13:02:44 +0000 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 git-svn-id: file:///srv/svn/repo/suika/trunk@244 f0ae65fe-ee39-954e-97ec-027ff2717ef4 --- 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)}, }) }) }