From bbd99b655ac74ac3253c793d7cf376e309156f65 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Wed, 20 Feb 2019 21:40:25 -0500 Subject: [PATCH 1/2] A labeled command that has 0 response lines should receive an empty batch See discussion on #391. --- irc/responsebuffer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/irc/responsebuffer.go b/irc/responsebuffer.go index 3fccca01..183a7fe7 100644 --- a/irc/responsebuffer.go +++ b/irc/responsebuffer.go @@ -142,10 +142,10 @@ func (rb *ResponseBuffer) flushInternal(final bool, blocking bool) error { } useLabel := rb.target.capabilities.Has(caps.LabeledResponse) && rb.Label != "" - // use a batch if we have a label, and we either currently have multiple messages, + // use a batch if we have a label, and we either currently have 0 or 2+ messages, // or we are doing a Flush() and we have to assume that there will be more messages // in the future. - useBatch := useLabel && (len(rb.messages) > 1 || !final) + useBatch := useLabel && (len(rb.messages) != 1 || !final) // if label but no batch, add label to first message if useLabel && !useBatch && len(rb.messages) == 1 && rb.batchID == "" { From baa2c3b581e10db3da29d179ff912cb0082c3f9c Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Wed, 20 Feb 2019 22:20:23 -0500 Subject: [PATCH 2/2] send the response line to NICK via the response buffer --- irc/nickname.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/irc/nickname.go b/irc/nickname.go index 370d3ec4..6c43eb32 100644 --- a/irc/nickname.go +++ b/irc/nickname.go @@ -62,8 +62,11 @@ func performNickChange(server *Server, client *Client, target *Client, newnick s if hadNick { target.server.snomasks.Send(sno.LocalNicks, fmt.Sprintf(ircfmt.Unescape("$%s$r changed nickname to %s"), whowas.nick, nickname)) target.server.whoWas.Append(whowas) + rb.Add(nil, origNickMask, "NICK", nickname) for friend := range target.Friends() { - friend.Send(nil, origNickMask, "NICK", nickname) + if friend != client { + friend.Send(nil, origNickMask, "NICK", nickname) + } } }