mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-11 06:29:29 +01:00
fix #1204
This commit is contained in:
parent
b3fd7e39f0
commit
28d4971f36
@ -1246,44 +1246,19 @@ func (channel *Channel) SendSplitMessage(command string, minPrefixMode modes.Mod
|
|||||||
}
|
}
|
||||||
|
|
||||||
// send echo-message
|
// send echo-message
|
||||||
if rb.session.capabilities.Has(caps.EchoMessage) {
|
rb.addEchoMessage(details, command, message, clientOnlyTags, chname)
|
||||||
var tagsToUse map[string]string
|
|
||||||
if rb.session.capabilities.Has(caps.MessageTags) {
|
|
||||||
tagsToUse = clientOnlyTags
|
|
||||||
}
|
|
||||||
if histType == history.Tagmsg && rb.session.capabilities.Has(caps.MessageTags) {
|
|
||||||
rb.AddFromClient(message.Time, message.Msgid, details.nickMask, details.accountName, tagsToUse, command, chname)
|
|
||||||
} else {
|
|
||||||
rb.AddSplitMessageFromClient(details.nickMask, details.accountName, tagsToUse, command, chname, message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// send echo-message to other connected sessions
|
|
||||||
for _, session := range client.Sessions() {
|
|
||||||
if session == rb.session {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
var tagsToUse map[string]string
|
|
||||||
if session.capabilities.Has(caps.MessageTags) {
|
|
||||||
tagsToUse = clientOnlyTags
|
|
||||||
}
|
|
||||||
if histType == history.Tagmsg && session.capabilities.Has(caps.MessageTags) {
|
|
||||||
session.sendFromClientInternal(false, message.Time, message.Msgid, details.nickMask, details.accountName, tagsToUse, command, chname)
|
|
||||||
} else if histType != history.Tagmsg {
|
|
||||||
session.sendSplitMsgFromClientInternal(false, details.nickMask, details.accountName, tagsToUse, command, chname, message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, member := range channel.Members() {
|
for _, member := range channel.Members() {
|
||||||
// echo-message is handled above, so skip sending the msg to the user themselves as well
|
|
||||||
if member == client {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if minPrefixMode != modes.Mode(0) && !channel.ClientIsAtLeast(member, minPrefixMode) {
|
if minPrefixMode != modes.Mode(0) && !channel.ClientIsAtLeast(member, minPrefixMode) {
|
||||||
// STATUSMSG
|
// STATUSMSG
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, session := range member.Sessions() {
|
for _, session := range member.Sessions() {
|
||||||
|
if session == rb.session {
|
||||||
|
continue // we already sent echo-message, if applicable
|
||||||
|
}
|
||||||
|
|
||||||
if isCTCP && session.isTor {
|
if isCTCP && session.isTor {
|
||||||
continue // #753
|
continue // #753
|
||||||
}
|
}
|
||||||
|
@ -2041,18 +2041,16 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi
|
|||||||
service, isService := OragonoServices[lowercaseTarget]
|
service, isService := OragonoServices[lowercaseTarget]
|
||||||
_, isZNC := zncHandlers[lowercaseTarget]
|
_, isZNC := zncHandlers[lowercaseTarget]
|
||||||
|
|
||||||
if histType == history.Privmsg {
|
if isService || isZNC {
|
||||||
|
rb.addEchoMessage(client.Details(), command, message, tags, target)
|
||||||
|
if histType != history.Privmsg {
|
||||||
|
return // NOTICE and TAGMSG to services are ignored
|
||||||
|
}
|
||||||
if isService {
|
if isService {
|
||||||
servicePrivmsgHandler(service, server, client, message.Message, rb)
|
servicePrivmsgHandler(service, server, client, message.Message, rb)
|
||||||
return
|
|
||||||
} else if isZNC {
|
} else if isZNC {
|
||||||
zncPrivmsgHandler(client, lowercaseTarget, message.Message, rb)
|
zncPrivmsgHandler(client, lowercaseTarget, message.Message, rb)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// NOTICE and TAGMSG to services are ignored
|
|
||||||
if isService || isZNC {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2110,18 +2108,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:
|
||||||
if rb.session.capabilities.Has(caps.EchoMessage) {
|
rb.addEchoMessage(details, command, message, tags, tnick)
|
||||||
hasTagsCap := rb.session.capabilities.Has(caps.MessageTags)
|
|
||||||
if histType == history.Tagmsg && hasTagsCap {
|
|
||||||
rb.AddFromClient(message.Time, message.Msgid, nickMaskString, accountName, tags, command, tnick)
|
|
||||||
} else {
|
|
||||||
tagsToSend := tags
|
|
||||||
if !hasTagsCap {
|
|
||||||
tagsToSend = nil
|
|
||||||
}
|
|
||||||
rb.AddSplitMessageFromClient(nickMaskString, accountName, tagsToSend, 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 {
|
||||||
|
@ -143,6 +143,23 @@ func (rb *ResponseBuffer) AddSplitMessageFromClient(fromNickMask string, fromAcc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (rb *ResponseBuffer) addEchoMessage(details ClientDetails, command string, message utils.SplitMessage, tags map[string]string, target string) {
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tagsToSend := tags
|
||||||
|
if !hasTagsCap {
|
||||||
|
tagsToSend = nil
|
||||||
|
}
|
||||||
|
rb.AddSplitMessageFromClient(details.nickMask, details.accountName, tagsToSend, command, target, message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (rb *ResponseBuffer) sendBatchStart(blocking bool) {
|
func (rb *ResponseBuffer) sendBatchStart(blocking bool) {
|
||||||
if rb.batchID != "" {
|
if rb.batchID != "" {
|
||||||
// batch already initialized
|
// batch already initialized
|
||||||
|
Loading…
Reference in New Issue
Block a user