From 6d18a1a78cff74cf557898ecdc3b8ecea32c99dd Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Fri, 24 Jul 2020 02:55:46 -0400 Subject: [PATCH] tweak addEchoMessage signature --- irc/channel.go | 2 +- irc/handlers.go | 5 +++-- irc/responsebuffer.go | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/irc/channel.go b/irc/channel.go index 483a8009..2da18db1 100644 --- a/irc/channel.go +++ b/irc/channel.go @@ -1246,7 +1246,7 @@ func (channel *Channel) SendSplitMessage(command string, minPrefixMode modes.Mod } // send echo-message - rb.addEchoMessage(details, command, message, clientOnlyTags, chname) + rb.addEchoMessage(clientOnlyTags, details.nickMask, details.accountName, command, chname, message) for _, member := range channel.Members() { if minPrefixMode != modes.Mode(0) && !channel.ClientIsAtLeast(member, minPrefixMode) { diff --git a/irc/handlers.go b/irc/handlers.go index c31a7e75..5bcf027f 100644 --- a/irc/handlers.go +++ b/irc/handlers.go @@ -2042,7 +2042,8 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi _, isZNC := zncHandlers[lowercaseTarget] if isService || isZNC { - rb.addEchoMessage(client.Details(), command, message, tags, target) + details := client.Details() + rb.addEchoMessage(tags, details.nickMask, details.accountName, command, target, message) if histType != history.Privmsg { return // NOTICE and TAGMSG to services are ignored } @@ -2108,7 +2109,7 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi } // the originating session may get an echo message: - rb.addEchoMessage(details, command, message, tags, tnick) + rb.addEchoMessage(tags, nickMaskString, accountName, command, tnick, message) if histType != history.Notice { //TODO(dan): possibly implement cooldown of away notifications to users if away, awayMessage := user.Away(); away { diff --git a/irc/responsebuffer.go b/irc/responsebuffer.go index 8eb5bdde..ab1fa551 100644 --- a/irc/responsebuffer.go +++ b/irc/responsebuffer.go @@ -143,19 +143,19 @@ func (rb *ResponseBuffer) AddSplitMessageFromClient(fromNickMask string, fromAcc } } -func (rb *ResponseBuffer) addEchoMessage(details ClientDetails, command string, message utils.SplitMessage, tags map[string]string, target string) { +func (rb *ResponseBuffer) addEchoMessage(tags map[string]string, nickMask, accountName, command, target string, message utils.SplitMessage) { if rb.session.capabilities.Has(caps.EchoMessage) { hasTagsCap := rb.session.capabilities.Has(caps.MessageTags) if command == "TAGMSG" { if hasTagsCap { - rb.AddFromClient(message.Time, message.Msgid, details.nickMask, details.accountName, tags, command, target) + rb.AddFromClient(message.Time, message.Msgid, nickMask, accountName, tags, command, target) } } else { tagsToSend := tags if !hasTagsCap { tagsToSend = nil } - rb.AddSplitMessageFromClient(details.nickMask, details.accountName, tagsToSend, command, target, message) + rb.AddSplitMessageFromClient(nickMask, accountName, tagsToSend, command, target, message) } } }