Skip to content

Commit 9de2fc8

Browse files
committed
Fix secrets breaking chat copy methods
1 parent 3203be6 commit 9de2fc8

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

chatcopy.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ BCM.modules[#BCM.modules+1] = function()
1212
end
1313

1414
--Copying Functions
15+
local issecretvalue = issecretvalue or function() return false end
1516
local copyFunc = function(frame)
1617
if not IsShiftKeyDown() then return end
1718
local cf = _G[format("%s%d", "ChatFrame", frame:GetID())]
1819
local text = ""
1920
for i = 1, cf:GetNumMessages() do
2021
local line = cf:GetMessageInfo(i)
21-
if line then
22+
if not issecretvalue(line) and line then
2223
BCMCopyFrame.font:SetFormattedText("%s\n", line) -- We do this to fix special pipe methods e.g. 5 |4hour:hours; Example: copying /played text
2324
local cleanLine = BCMCopyFrame.font:GetText() or ""
2425
text = text .. cleanLine
@@ -27,6 +28,7 @@ BCM.modules[#BCM.modules+1] = function()
2728
text = text:gsub("|T[^\\]+\\[^\\]+\\[Uu][Ii]%-[Rr][Aa][Ii][Dd][Tt][Aa][Rr][Gg][Ee][Tt][Ii][Nn][Gg][Ii][Cc][Oo][Nn]_(%d)[^|]+|t", "{rt%1}") -- I like being able to copy raid icons
2829
text = text:gsub("|T13700([1-8])[^|]+|t", "{rt%1}") -- I like being able to copy raid icons
2930
text = text:gsub("|T[^|]+|t", "") -- Remove any other icons to prevent copying issues
31+
text = text:gsub("|A[^|]+|a", "") -- Remove any other icons to prevent copying issues
3032
text = text:gsub("|K[^|]+|k", BCM.protectedText) -- Remove protected text
3133
BCMCopyFrame.box:SetText(text)
3234
BCMCopyFrame:Show()

timestamp.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,20 @@ BCM.modules[#BCM.modules+1] = function()
2424
local stamp = BetterDate(bcmDB.stampfmt, time())
2525
num = num + 1
2626
if bcmDB.stampcol == "" then
27-
text = format("|Hgarrmission:BCMts:%d:|h%s|h%s", num, stamp, text)
27+
text = format("|Haddon:BCMts:%d:|h%s|h%s", num, stamp, text)
2828
else
29-
text = format("|cFF%s|Hgarrmission:BCMts:%d:|h%s|h|r%s", bcmDB.stampcol, num, stamp, text)
29+
text = format("|cFF%s|Haddon:BCMts:%d:|h%s|h|r%s", bcmDB.stampcol, num, stamp, text)
3030
end
3131
return text
3232
end
3333

34-
hooksecurefunc("SetItemRef", function(link, _, _, frame)
34+
local issecretvalue = issecretvalue or function() return false end
35+
EventRegistry:RegisterCallback("SetItemRef", function(_, link, _, _, frame)
3536
local _, bcm = strsplit(":", link)
3637
if bcm == "BCMts" then
3738
for i = frame:GetNumMessages(), 1, -1 do
3839
local text = frame:GetMessageInfo(i)
39-
if text and text:find(link, nil, true) then
40+
if not issecretvalue(text) and text and text:find(link, nil, true) then
4041
text = text:gsub("|T[^\\]+\\[^\\]+\\[Uu][Ii]%-[Rr][Aa][Ii][Dd][Tt][Aa][Rr][Gg][Ee][Tt][Ii][Nn][Gg][Ii][Cc][Oo][Nn]_(%d)[^|]+|t", "{rt%1}") -- I like being able to copy raid icons
4142
text = text:gsub("|T13700([1-8])[^|]+|t", "{rt%1}") -- I like being able to copy raid icons
4243
text = text:gsub("|T[^|]+|t", "") -- Remove any other icons to prevent copying issues
@@ -48,4 +49,3 @@ BCM.modules[#BCM.modules+1] = function()
4849
end
4950
end)
5051
end
51-

0 commit comments

Comments
 (0)