Skip to content

Commit

Permalink
timestamp: Redo some of the timestamp code to fix an error introduced…
Browse files Browse the repository at this point in the history
… from the previous rewrite.
  • Loading branch information
funkydude committed Oct 6, 2016
1 parent 2f8cde7 commit b0b0568
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions timestamp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ BCM.modules[#BCM.modules+1] = function()

local time = time
local format = format
local num = 0

BCM.chatFuncs[#BCM.chatFuncs+1] = function(text, frame)
local stamp = BetterDate(bcmDB.stampfmt, time())
local num = frame:GetNumMessages() + 1
local id = frame:GetID()
num = num + 1
if bcmDB.stampcol == "" then
text = format("|HBCMt:%d:%d|h%s|h%s", num, id, stamp, text)
else
Expand All @@ -44,12 +45,18 @@ BCM.modules[#BCM.modules+1] = function()

local SetHyperlink = ItemRefTooltip.SetHyperlink
function ItemRefTooltip:SetHyperlink(link, ...)
local num, id = link:match("BCMt:(%d+):(%d+)")
if num then
local text = _G[format("ChatFrame%d", id)]:GetMessageInfo(num)
text = (text):gsub("|[Tt]Interface\\TargetingFrame\\UI%-RaidTargetingIcon_(%d):0|[Tt]", "{rt%1}") -- I like being able to copy raid icons
text = (text):gsub("|[Tt]13700([1-8]):0|[Tt]", "{rt%1}") -- I like being able to copy raid icons
BCM:Popup(text)
local prefix, id = link:match("(BCMt:%d+:)(%d+)")
if prefix then
local cf = _G[format("ChatFrame%d", id)]
for i = cf:GetNumMessages(), 1, -1 do
local text = cf:GetMessageInfo(i)
if text:find(prefix, nil, true) then
text = (text):gsub("|[Tt]Interface\\TargetingFrame\\UI%-RaidTargetingIcon_(%d):0|[Tt]", "{rt%1}") -- I like being able to copy raid icons
text = (text):gsub("|[Tt]13700([1-8]):0|[Tt]", "{rt%1}") -- I like being able to copy raid icons
BCM:Popup(text)
break
end
end
else
SetHyperlink(self, link, ...)
end
Expand Down

0 comments on commit b0b0568

Please sign in to comment.