ClassicAPI cleanup and safe hooks

This commit is contained in:
Dusk-92
2026-08-30 09:10:12 +02:00
parent 4af510e3dc
commit 279417bd54
11 changed files with 164 additions and 325 deletions
+8 -7
View File
@@ -30,14 +30,15 @@ module.enable = function(self)
-- add hooks to each frame
for i=1,NUM_CHAT_WINDOWS do
local original = _G["ChatFrame"..i].AddMessage
_G["ChatFrame"..i].AddMessage = function(frame, msg, a1, a2, a3, a4, a5)
-- ignore empty messages
if not msg then return end
local frame = _G["ChatFrame"..i]
if frame and not frame.ShaguTweaksExtrasTimestampAddMessage then
frame.ShaguTweaksExtrasTimestampAddMessage = frame.AddMessage
frame.AddMessage = function(self, msg, a1, a2, a3, a4, a5)
if not msg then return end
-- add timestamp to chat
msg = color .. left .. date(format) .. right .. "|r " .. msg
original(frame, msg, a1, a2, a3, a4, a5)
msg = color .. left .. date(format) .. right .. "|r " .. msg
self:ShaguTweaksExtrasTimestampAddMessage(msg, a1, a2, a3, a4, a5)
end
end
end
end