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

Merge pull request #1416 from slingamn/tagmsg_bug.3

fix TAGMSG being relayed to clients without message-tags
This commit is contained in:
Shivaram Lingamneni 2020-11-30 14:23:54 -08:00 committed by GitHub
commit a291e5ca74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

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 { } else {
// slowpath
session.sendFromClientInternal(false, m.time, m.msgid, m.source, m.accountName, nil, m.command, m.params...) 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)
} }
} }

@ -1 +1 @@
Subproject commit 14435ce0e8af86d0d0be5d9eca35bf2ab9931b4f Subproject commit 8c66157a9ea22a824dc55210903222889cc3672d