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

fix incorrect TAGMSG relaying

This commit is contained in:
Shivaram Lingamneni 2020-11-30 16:43:36 -05:00
parent db100f1f91
commit 1b91360885

View File

@ -172,16 +172,20 @@ func (m *MessageCache) InitializeSplitMessage(server *Server, nickmask, accountN
func (m *MessageCache) Send(session *Session) { func (m *MessageCache) Send(session *Session) {
if m.fullTags != nil { if m.fullTags != nil {
// Initialize() path:
if session.capabilities.Has(caps.MessageTags) { if session.capabilities.Has(caps.MessageTags) {
session.sendBytes(m.fullTags, false) session.sendBytes(m.fullTags, false)
} else if !(session.capabilities.Has(caps.ServerTime) || session.capabilities.Has(caps.AccountTag)) { } else if m.plain != nil {
if m.plain != nil { // plain == nil indicates a TAGMSG
if !(session.capabilities.Has(caps.ServerTime) || session.capabilities.Has(caps.AccountTag)) {
session.sendBytes(m.plain, false) session.sendBytes(m.plain, false)
} else {
// slowpath
session.sendFromClientInternal(false, m.time, m.msgid, m.source, m.accountName, nil, m.command, m.params...)
} }
} else {
session.sendFromClientInternal(false, m.time, m.msgid, m.source, m.accountName, nil, m.command, m.params...)
} }
} else if m.fullTagsMultiline != nil { } else if m.fullTagsMultiline != nil {
// InitializeSplitMessage() path:
if session.capabilities.Has(caps.Multiline) { if session.capabilities.Has(caps.Multiline) {
for _, line := range m.fullTagsMultiline { for _, line := range m.fullTagsMultiline {
session.sendBytes(line, false) session.sendBytes(line, false)
@ -191,6 +195,7 @@ func (m *MessageCache) Send(session *Session) {
session.sendBytes(line, false) session.sendBytes(line, false)
} }
} else { } else {
// slowpath
session.sendSplitMsgFromClientInternal(false, m.source, m.accountName, m.tags, m.command, m.target, m.splitMessage) session.sendSplitMsgFromClientInternal(false, m.source, m.accountName, m.tags, m.command, m.target, m.splitMessage)
} }
} }