From 2365091266437ac39692c320bce6a61d0895e6f8 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Sun, 22 Mar 2026 19:17:24 -0700 Subject: [PATCH] fix: tighten addon message detection to avoid suppressing regular chat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tab-based addon message detection was too aggressive — any chat message containing a tab character was treated as an addon message and silently dropped from regular chat display. This could suppress legitimate player messages containing tabs (from copy-paste). Now only matches as addon message when: - Chat type is PARTY/RAID/GUILD/WHISPER/etc. (not SAY/YELL/EMOTE) - Prefix before tab is <=16 chars (WoW addon prefix limit) - Prefix contains no spaces (addon prefixes are identifiers) This prevents false positives while still correctly detecting addon messages formatted as "DBM4\ttimer:start:10". --- src/game/game_handler.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index b9b9f99f..aaceeb30 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -13528,19 +13528,24 @@ void GameHandler::handleMessageChat(network::Packet& packet) { LOG_DEBUG("[", getChatTypeString(data.type), "] ", channelInfo, senderInfo, ": ", data.message); // Detect addon messages: format is "prefix\ttext" in the message body. - // Fire CHAT_MSG_ADDON instead of the regular chat event for these. - if (addonEventCallback_) { + // Only treat as addon message if prefix is short (<=16 chars, WoW limit), + // contains no spaces (real prefixes are identifiers like "DBM4" or "BigWigs"), + // and the message isn't a SAY/YELL/EMOTE (those are always player chat). + if (addonEventCallback_ && + data.type != ChatType::SAY && data.type != ChatType::YELL && + data.type != ChatType::EMOTE && data.type != ChatType::TEXT_EMOTE && + data.type != ChatType::MONSTER_SAY && data.type != ChatType::MONSTER_YELL) { auto tabPos = data.message.find('\t'); - if (tabPos != std::string::npos && tabPos > 0 && tabPos < data.message.size() - 1) { + if (tabPos != std::string::npos && tabPos > 0 && tabPos <= 16 && + tabPos < data.message.size() - 1) { std::string prefix = data.message.substr(0, tabPos); - std::string body = data.message.substr(tabPos + 1); - std::string channel = getChatTypeString(data.type); - char guidBuf2[32]; - snprintf(guidBuf2, sizeof(guidBuf2), "0x%016llX", (unsigned long long)data.senderGuid); - // Fire CHAT_MSG_ADDON: prefix, message, channel, sender - addonEventCallback_("CHAT_MSG_ADDON", {prefix, body, channel, data.senderName}); - // Also add to chat history but don't show the raw addon message in chat - return; + // Addon prefixes are identifier-like: no spaces + if (prefix.find(' ') == std::string::npos) { + std::string body = data.message.substr(tabPos + 1); + std::string channel = getChatTypeString(data.type); + addonEventCallback_("CHAT_MSG_ADDON", {prefix, body, channel, data.senderName}); + return; + } } }