From a8c241f6bdf8b7400e2279e5f8fd1b9b5319da2b Mon Sep 17 00:00:00 2001 From: Kelsi Date: Sun, 22 Mar 2026 16:43:13 -0700 Subject: [PATCH] fix: fire CHAT_MSG_* events for player's own messages and system text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit addLocalChatMessage only pushed to chatHistory and called the C++ display callback — it never fired Lua addon events. This meant the player's own sent messages (local echoes from sendChatMessage) and system messages (loot, XP gains, errors) were invisible to Lua chat frame addons. Now fires CHAT_MSG_{type} with the full 12-arg WoW signature from addLocalChatMessage, matching the incoming message path. Uses the active character name as sender for player-originated messages. --- src/game/game_handler.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index 93fc6a58..36ad69ce 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -14972,6 +14972,24 @@ void GameHandler::addLocalChatMessage(const MessageChatData& msg) { chatHistory.pop_front(); } if (addonChatCallback_) addonChatCallback_(msg); + + // Fire CHAT_MSG_* for local echoes (player's own messages, system messages) + // so Lua chat frame addons display them. + if (addonEventCallback_) { + std::string eventName = "CHAT_MSG_"; + eventName += getChatTypeString(msg.type); + const Character* ac = getActiveCharacter(); + std::string senderName = msg.senderName.empty() + ? (ac ? ac->name : std::string{}) : msg.senderName; + char guidBuf[32]; + snprintf(guidBuf, sizeof(guidBuf), "0x%016llX", + (unsigned long long)(msg.senderGuid != 0 ? msg.senderGuid : playerGuid)); + addonEventCallback_(eventName, { + msg.message, senderName, + std::to_string(static_cast(msg.language)), + msg.channelName, senderName, "", "0", "0", "", "0", "0", guidBuf + }); + } } // ============================================================