3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-29 07:29:31 +01:00

tweak addEchoMessage signature

This commit is contained in:
Shivaram Lingamneni 2020-07-24 02:55:46 -04:00
parent 28d4971f36
commit 6d18a1a78c
3 changed files with 7 additions and 6 deletions

View File

@ -1246,7 +1246,7 @@ func (channel *Channel) SendSplitMessage(command string, minPrefixMode modes.Mod
} }
// send echo-message // 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() { for _, member := range channel.Members() {
if minPrefixMode != modes.Mode(0) && !channel.ClientIsAtLeast(member, minPrefixMode) { if minPrefixMode != modes.Mode(0) && !channel.ClientIsAtLeast(member, minPrefixMode) {

View File

@ -2042,7 +2042,8 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi
_, isZNC := zncHandlers[lowercaseTarget] _, isZNC := zncHandlers[lowercaseTarget]
if isService || isZNC { 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 { if histType != history.Privmsg {
return // NOTICE and TAGMSG to services are ignored 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: // 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 { if histType != history.Notice {
//TODO(dan): possibly implement cooldown of away notifications to users //TODO(dan): possibly implement cooldown of away notifications to users
if away, awayMessage := user.Away(); away { if away, awayMessage := user.Away(); away {

View File

@ -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) { if rb.session.capabilities.Has(caps.EchoMessage) {
hasTagsCap := rb.session.capabilities.Has(caps.MessageTags) hasTagsCap := rb.session.capabilities.Has(caps.MessageTags)
if command == "TAGMSG" { if command == "TAGMSG" {
if hasTagsCap { 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 { } else {
tagsToSend := tags tagsToSend := tags
if !hasTagsCap { if !hasTagsCap {
tagsToSend = nil tagsToSend = nil
} }
rb.AddSplitMessageFromClient(details.nickMask, details.accountName, tagsToSend, command, target, message) rb.AddSplitMessageFromClient(nickMask, accountName, tagsToSend, command, target, message)
} }
} }
} }