Files

15 lines
910 B
Lua

-- Whisper names: the 70334 client formats the whisper target from its name cache as name + separator + empty
-- realm, so sent whispers read "To [Name ]". Trim trailing spaces/dashes from the author argument of whisper
-- events before the chat frame builds the player link. Uses the chat filter API; Blizzard code is unchanged.
local filter = ChatFrameUtil and ChatFrameUtil.AddMessageEventFilter or ChatFrame_AddMessageEventFilter
if type(filter) ~= "function" then return end
local function trim(_, _, message, author, ...)
if type(author) ~= "string" or (issecretvalue and issecretvalue(author)) then return false end
local clean = author:gsub("[%s%-]+$", "")
if clean == author or clean == "" then return false end
return false, message, clean, ...
end
for _, event in ipairs({"CHAT_MSG_WHISPER", "CHAT_MSG_WHISPER_INFORM", "CHAT_MSG_AFK", "CHAT_MSG_DND"}) do
filter(event, trim)
end