Browse Source

fix TAGMSG playback

1. TAGMSG were incorrectly being considered multilines, because
   Is512() was checking the wrong thing
2. Playback of TAGMSG should depend on event-playback, not on message-tags
tags/v2.1.0-rc1
Shivaram Lingamneni 4 years ago
parent
commit
2f20034bb7
4 changed files with 9 additions and 4 deletions
  1. 1
    1
      irc/channel.go
  2. 1
    1
      irc/client.go
  3. 6
    1
      irc/responsebuffer.go
  4. 1
    1
      irc/utils/text.go

+ 1
- 1
irc/channel.go View File

@@ -1017,7 +1017,7 @@ func (channel *Channel) replayHistoryItems(rb *ResponseBuffer, items []history.I
1017 1017
 		case history.Notice:
1018 1018
 			rb.AddSplitMessageFromClient(item.Nick, item.AccountName, item.Tags, "NOTICE", chname, item.Message)
1019 1019
 		case history.Tagmsg:
1020
-			if rb.session.capabilities.Has(caps.MessageTags) {
1020
+			if eventPlayback {
1021 1021
 				rb.AddSplitMessageFromClient(item.Nick, item.AccountName, item.Tags, "TAGMSG", chname, item.Message)
1022 1022
 			}
1023 1023
 		case history.Join:

+ 1
- 1
irc/client.go View File

@@ -897,7 +897,7 @@ func (client *Client) replayPrivmsgHistory(rb *ResponseBuffer, items []history.I
897 897
 	}
898 898
 	batchID = rb.StartNestedHistoryBatch(target)
899 899
 
900
-	allowTags := rb.session.capabilities.Has(caps.MessageTags)
900
+	allowTags := rb.session.capabilities.Has(caps.EventPlayback)
901 901
 	for _, item := range items {
902 902
 		var command string
903 903
 		switch item.Type {

+ 6
- 1
irc/responsebuffer.go View File

@@ -119,7 +119,12 @@ func (rb *ResponseBuffer) AddFromClient(time time.Time, msgid string, fromNickMa
119 119
 // AddSplitMessageFromClient adds a new split message from a specific client to our queue.
120 120
 func (rb *ResponseBuffer) AddSplitMessageFromClient(fromNickMask string, fromAccount string, tags map[string]string, command string, target string, message utils.SplitMessage) {
121 121
 	if message.Is512() {
122
-		rb.AddFromClient(message.Time, message.Msgid, fromNickMask, fromAccount, tags, command, target, message.Message)
122
+		if message.Message == "" {
123
+			// XXX this is a TAGMSG
124
+			rb.AddFromClient(message.Time, message.Msgid, fromNickMask, fromAccount, tags, command, target)
125
+		} else {
126
+			rb.AddFromClient(message.Time, message.Msgid, fromNickMask, fromAccount, tags, command, target, message.Message)
127
+		}
123 128
 	} else {
124 129
 		if rb.session.capabilities.Has(caps.Multiline) {
125 130
 			batch := rb.session.composeMultilineBatch(fromNickMask, fromAccount, tags, command, target, message)

+ 1
- 1
irc/utils/text.go View File

@@ -90,7 +90,7 @@ func (sm *SplitMessage) IsRestrictedCTCPMessage() bool {
90 90
 }
91 91
 
92 92
 func (sm *SplitMessage) Is512() bool {
93
-	return sm.Message != ""
93
+	return sm.Split == nil
94 94
 }
95 95
 
96 96
 // TokenLineBuilder is a helper for building IRC lines composed of delimited tokens,

Loading…
Cancel
Save