@@ -527,78 +527,78 @@ end
527527-- This filter function courtesy of WeakAuras -- https://github.com/WeakAuras/WeakAuras2/blob/main/WeakAuras/Transmission.lua#L147
528528
529529-- #1830 Not compatible with Midnight
530- -- local function filterFunc(_, event, msg, player, l, cs, t, flag, channelId, ...)
531- -- if flag == "GM" or flag == "DEV" or (event == "CHAT_MSG_CHANNEL" and type(channelId) == "number" and channelId > 0) then
532- -- return
533- -- end
534-
535- -- local newMsg = ""
536- -- local remaining = msg
537- -- local done
538- -- repeat
539- -- local start, finish, characterName, sequenceName, classID =
540- -- remaining:find("%[GSE: ([^%s]+) %- ([^%s]+) %- ([^]]+)")
541- -- if (characterName and sequenceName and classID) then
542- -- characterName = characterName:gsub("|c[Ff][Ff]......", ""):gsub("|r", "")
543- -- sequenceName = sequenceName:gsub("|c[Ff][Ff]......", ""):gsub("|r", "")
544- -- classID = classID:gsub("|c[Ff][Ff]......", ""):gsub("|r", "")
545- -- newMsg = newMsg .. remaining:sub(1, start - 1)
546- -- newMsg = newMsg .. GSE.CreateSequenceLink(sequenceName, classID, characterName)
547- -- remaining = remaining:sub(finish + 1)
548- -- else
549- -- done = true
550- -- end
551- -- until (done)
552- -- if newMsg ~= "" then
553- -- local trimmedPlayer = Ambiguate(player, "none")
554- -- if event == "CHAT_MSG_WHISPER" and not UnitInRaid(trimmedPlayer) and not UnitInParty(trimmedPlayer) then -- XXX: Need a guild check
555- -- local _, num = BNGetNumFriends()
556- -- for i = 1, num do
557- -- if C_BattleNet then -- introduced in 8.2.5 PTR
558- -- local toon = C_BattleNet.GetFriendNumGameAccounts(i)
559- -- for j = 1, toon do
560- -- local gameAccountInfo = C_BattleNet.GetFriendGameAccountInfo(i, j)
561- -- if
562- -- gameAccountInfo and gameAccountInfo.characterName == trimmedPlayer and
563- -- gameAccountInfo.clientProgram == "WoW"
564- -- then
565- -- return false, newMsg, player, l, cs, t, flag, channelId, ... -- Player is a real id friend, allow it
566- -- end
567- -- end
568- -- else -- keep old method for 8.2 and Classic
569- -- local toon = BNGetNumFriendGameAccounts(i)
570- -- for j = 1, toon do
571- -- local _, rName, rGame = BNGetFriendGameAccountInfo(i, j)
572- -- if rName == trimmedPlayer and rGame == "WoW" then
573- -- return false, newMsg, player, l, cs, t, flag, channelId, ... -- Player is a real id friend, allow it
574- -- end
575- -- end
576- -- end
577- -- end
578- -- return true -- Filter strangers
579- -- else
580- -- return false, newMsg, player, l, cs, t, flag, channelId, ...
581- -- end
582- -- end
583- -- end
530+ local function filterFunc (_ , event , msg , player , l , cs , t , flag , channelId , ...)
531+ if flag == " GM" or flag == " DEV" or (event == " CHAT_MSG_CHANNEL" and type (channelId ) == " number" and channelId > 0 ) then
532+ return
533+ end
584534
535+ local newMsg = " "
536+ local remaining = msg
537+ local done
538+ repeat
539+ local start , finish , characterName , sequenceName , classID =
540+ remaining :find (" %[GSE: ([^%s]+) %- ([^%s]+) %- ([^]]+)" )
541+ if (characterName and sequenceName and classID ) then
542+ characterName = characterName :gsub (" |c[Ff][Ff]......" , " " ):gsub (" |r" , " " )
543+ sequenceName = sequenceName :gsub (" |c[Ff][Ff]......" , " " ):gsub (" |r" , " " )
544+ classID = classID :gsub (" |c[Ff][Ff]......" , " " ):gsub (" |r" , " " )
545+ newMsg = newMsg .. remaining :sub (1 , start - 1 )
546+ newMsg = newMsg .. GSE .CreateSequenceLink (sequenceName , classID , characterName )
547+ remaining = remaining :sub (finish + 1 )
548+ else
549+ done = true
550+ end
551+ until (done )
552+ if newMsg ~= " " then
553+ local trimmedPlayer = Ambiguate (player , " none" )
554+ if event == " CHAT_MSG_WHISPER" and not UnitInRaid (trimmedPlayer ) and not UnitInParty (trimmedPlayer ) then -- XXX: Need a guild check
555+ local _ , num = BNGetNumFriends ()
556+ for i = 1 , num do
557+ if C_BattleNet then -- introduced in 8.2.5 PTR
558+ local toon = C_BattleNet .GetFriendNumGameAccounts (i )
559+ for j = 1 , toon do
560+ local gameAccountInfo = C_BattleNet .GetFriendGameAccountInfo (i , j )
561+ if
562+ gameAccountInfo and gameAccountInfo .characterName == trimmedPlayer and
563+ gameAccountInfo .clientProgram == " WoW"
564+ then
565+ return false , newMsg , player , l , cs , t , flag , channelId , ... -- Player is a real id friend, allow it
566+ end
567+ end
568+ else -- keep old method for 8.2 and Classic
569+ local toon = BNGetNumFriendGameAccounts (i )
570+ for j = 1 , toon do
571+ local _ , rName , rGame = BNGetFriendGameAccountInfo (i , j )
572+ if rName == trimmedPlayer and rGame == " WoW" then
573+ return false , newMsg , player , l , cs , t , flag , channelId , ... -- Player is a real id friend, allow it
574+ end
575+ end
576+ end
577+ end
578+ return true -- Filter strangers
579+ else
580+ return false , newMsg , player , l , cs , t , flag , channelId , ...
581+ end
582+ end
583+ end
585584-- #1830 Not compatible with Midnight
586- -- ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", filterFunc)
587- -- ChatFrame_AddMessageEventFilter("CHAT_MSG_YELL", filterFunc)
588- -- ChatFrame_AddMessageEventFilter("CHAT_MSG_GUILD", filterFunc)
589- -- ChatFrame_AddMessageEventFilter("CHAT_MSG_OFFICER", filterFunc)
590- -- ChatFrame_AddMessageEventFilter("CHAT_MSG_PARTY", filterFunc)
591- -- ChatFrame_AddMessageEventFilter("CHAT_MSG_PARTY_LEADER", filterFunc)
592- -- ChatFrame_AddMessageEventFilter("CHAT_MSG_RAID", filterFunc)
593- -- ChatFrame_AddMessageEventFilter("CHAT_MSG_RAID_LEADER", filterFunc)
594- -- ChatFrame_AddMessageEventFilter("CHAT_MSG_SAY", filterFunc)
595- -- ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER", filterFunc)
596- -- ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER_INFORM", filterFunc)
597- -- ChatFrame_AddMessageEventFilter("CHAT_MSG_BN_WHISPER", filterFunc)
598- -- ChatFrame_AddMessageEventFilter("CHAT_MSG_BN_WHISPER_INFORM", filterFunc)
599- -- ChatFrame_AddMessageEventFilter("CHAT_MSG_INSTANCE_CHAT", filterFunc)
600- -- ChatFrame_AddMessageEventFilter("CHAT_MSG_INSTANCE_CHAT_LEADER", filterFunc)
601-
585+ if GSE .GameMode < 12 then
586+ ChatFrame_AddMessageEventFilter (" CHAT_MSG_CHANNEL" , filterFunc )
587+ ChatFrame_AddMessageEventFilter (" CHAT_MSG_YELL" , filterFunc )
588+ ChatFrame_AddMessageEventFilter (" CHAT_MSG_GUILD" , filterFunc )
589+ ChatFrame_AddMessageEventFilter (" CHAT_MSG_OFFICER" , filterFunc )
590+ ChatFrame_AddMessageEventFilter (" CHAT_MSG_PARTY" , filterFunc )
591+ ChatFrame_AddMessageEventFilter (" CHAT_MSG_PARTY_LEADER" , filterFunc )
592+ ChatFrame_AddMessageEventFilter (" CHAT_MSG_RAID" , filterFunc )
593+ ChatFrame_AddMessageEventFilter (" CHAT_MSG_RAID_LEADER" , filterFunc )
594+ ChatFrame_AddMessageEventFilter (" CHAT_MSG_SAY" , filterFunc )
595+ ChatFrame_AddMessageEventFilter (" CHAT_MSG_WHISPER" , filterFunc )
596+ ChatFrame_AddMessageEventFilter (" CHAT_MSG_WHISPER_INFORM" , filterFunc )
597+ ChatFrame_AddMessageEventFilter (" CHAT_MSG_BN_WHISPER" , filterFunc )
598+ ChatFrame_AddMessageEventFilter (" CHAT_MSG_BN_WHISPER_INFORM" , filterFunc )
599+ ChatFrame_AddMessageEventFilter (" CHAT_MSG_INSTANCE_CHAT" , filterFunc )
600+ ChatFrame_AddMessageEventFilter (" CHAT_MSG_INSTANCE_CHAT_LEADER" , filterFunc )
601+ end
602602-- process chatlinks
603603hooksecurefunc (
604604 " SetItemRef" ,
0 commit comments