Bläddra i källkod

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 år sedan
förälder
incheckning
2f20034bb7
4 ändrade filer med 9 tillägg och 4 borttagningar
  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 Visa fil

1017
 		case history.Notice:
1017
 		case history.Notice:
1018
 			rb.AddSplitMessageFromClient(item.Nick, item.AccountName, item.Tags, "NOTICE", chname, item.Message)
1018
 			rb.AddSplitMessageFromClient(item.Nick, item.AccountName, item.Tags, "NOTICE", chname, item.Message)
1019
 		case history.Tagmsg:
1019
 		case history.Tagmsg:
1020
-			if rb.session.capabilities.Has(caps.MessageTags) {
1020
+			if eventPlayback {
1021
 				rb.AddSplitMessageFromClient(item.Nick, item.AccountName, item.Tags, "TAGMSG", chname, item.Message)
1021
 				rb.AddSplitMessageFromClient(item.Nick, item.AccountName, item.Tags, "TAGMSG", chname, item.Message)
1022
 			}
1022
 			}
1023
 		case history.Join:
1023
 		case history.Join:

+ 1
- 1
irc/client.go Visa fil

897
 	}
897
 	}
898
 	batchID = rb.StartNestedHistoryBatch(target)
898
 	batchID = rb.StartNestedHistoryBatch(target)
899
 
899
 
900
-	allowTags := rb.session.capabilities.Has(caps.MessageTags)
900
+	allowTags := rb.session.capabilities.Has(caps.EventPlayback)
901
 	for _, item := range items {
901
 	for _, item := range items {
902
 		var command string
902
 		var command string
903
 		switch item.Type {
903
 		switch item.Type {

+ 6
- 1
irc/responsebuffer.go Visa fil

119
 // AddSplitMessageFromClient adds a new split message from a specific client to our queue.
119
 // AddSplitMessageFromClient adds a new split message from a specific client to our queue.
120
 func (rb *ResponseBuffer) AddSplitMessageFromClient(fromNickMask string, fromAccount string, tags map[string]string, command string, target string, message utils.SplitMessage) {
120
 func (rb *ResponseBuffer) AddSplitMessageFromClient(fromNickMask string, fromAccount string, tags map[string]string, command string, target string, message utils.SplitMessage) {
121
 	if message.Is512() {
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
 	} else {
128
 	} else {
124
 		if rb.session.capabilities.Has(caps.Multiline) {
129
 		if rb.session.capabilities.Has(caps.Multiline) {
125
 			batch := rb.session.composeMultilineBatch(fromNickMask, fromAccount, tags, command, target, message)
130
 			batch := rb.session.composeMultilineBatch(fromNickMask, fromAccount, tags, command, target, message)

+ 1
- 1
irc/utils/text.go Visa fil

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

Laddar…
Avbryt
Spara