From 422edb64efa38059b46cfd886a8a0b9f9679075d Mon Sep 17 00:00:00 2001 From: Chris Forkner Date: Sat, 20 Dec 2025 13:56:53 -0700 Subject: [PATCH] Add Compatibility Shim --- Chat.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Chat.lua b/Chat.lua index 84a85ef..7a9029c 100644 --- a/Chat.lua +++ b/Chat.lua @@ -26,6 +26,30 @@ SOFTWARE. local semver = LibStub:GetLibrary("SemanticVersion-1.0") +-- Compatibility shim: Retail moved/removed the old ChatFrame_MessageEventHandler global. +-- Provide gw.ChatFrame_MessageEventHandler so older code keeps working. +gw.ChatFrame_MessageEventHandler = gw.ChatFrame_MessageEventHandler or function(frame, event, ...) + -- Old clients / some builds still have the global: + local g = _G.ChatFrame_MessageEventHandler + if type(g) == "function" then + return g(frame, event, ...) + end + + -- Retail: dispatch through the frame’s OnEvent handler (Blizzard chat pipeline) + if frame and frame.GetScript then + local onEvent = frame:GetScript("OnEvent") + if type(onEvent) == "function" then + return onEvent(frame, event, ...) + end + end + + -- Last ditch: don't explode. (Optional) + -- You can omit this if you prefer silent failure. + if frame and frame.AddMessage then + local msg = ... + if msg then frame:AddMessage(tostring(msg)) end + end +end --- Callback handler for guild chat messages. -- @param type Message type received.