Parcourir la source

Merge pull request #755 from slingamn/issue754_dm_tags

fix #754
tags/v2.0.0-rc1
Shivaram Lingamneni il y a 4 ans
Parent
révision
66e2710ba2
Aucun compte lié à l'adresse e-mail de l'auteur
1 fichiers modifiés avec 16 ajouts et 8 suppressions
  1. 16
    8
      irc/handlers.go

+ 16
- 8
irc/handlers.go Voir le fichier

@@ -2011,13 +2011,16 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi
2011 2011
 		allowedTor := !user.isTor || !message.IsRestrictedCTCPMessage()
2012 2012
 		if allowedPlusR && allowedTor {
2013 2013
 			for _, session := range user.Sessions() {
2014
-				if histType == history.Tagmsg {
2015
-					// don't send TAGMSG at all if they don't have the tags cap
2016
-					if session.capabilities.Has(caps.MessageTags) {
2017
-						session.sendFromClientInternal(false, message.Time, message.Msgid, nickMaskString, accountName, tags, command, tnick)
2014
+				hasTagsCap := session.capabilities.Has(caps.MessageTags)
2015
+				// don't send TAGMSG at all if they don't have the tags cap
2016
+				if histType == history.Tagmsg && hasTagsCap {
2017
+					session.sendFromClientInternal(false, message.Time, message.Msgid, nickMaskString, accountName, tags, command, tnick)
2018
+				} else if histType != history.Tagmsg {
2019
+					tagsToSend := tags
2020
+					if !hasTagsCap {
2021
+						tagsToSend = nil
2018 2022
 					}
2019
-				} else {
2020
-					session.sendSplitMsgFromClientInternal(false, nickMaskString, accountName, tags, command, tnick, message)
2023
+					session.sendSplitMsgFromClientInternal(false, nickMaskString, accountName, tagsToSend, command, tnick, message)
2021 2024
 				}
2022 2025
 			}
2023 2026
 		}
@@ -2034,10 +2037,15 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi
2034 2037
 			if session == rb.session {
2035 2038
 				continue
2036 2039
 			}
2037
-			if histType == history.Tagmsg && rb.session.capabilities.Has(caps.MessageTags) {
2040
+			hasTagsCap := session.capabilities.Has(caps.MessageTags)
2041
+			if histType == history.Tagmsg && hasTagsCap {
2038 2042
 				session.sendFromClientInternal(false, message.Time, message.Msgid, nickMaskString, accountName, tags, command, tnick)
2039 2043
 			} else if histType != history.Tagmsg {
2040
-				session.sendSplitMsgFromClientInternal(false, nickMaskString, accountName, tags, command, tnick, message)
2044
+				tagsToSend := tags
2045
+				if !hasTagsCap {
2046
+					tagsToSend = nil
2047
+				}
2048
+				session.sendSplitMsgFromClientInternal(false, nickMaskString, accountName, tagsToSend, command, tnick, message)
2041 2049
 			}
2042 2050
 		}
2043 2051
 		if histType != history.Notice && user.Away() {

Chargement…
Annuler
Enregistrer