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
This commit is contained in:
contact 2020-04-07 13:02:44 +00:00
parent bea333aec8
commit 3857f41e57

View File

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