Skip to content

Commit e58e397

Browse files
committed
s
1 parent 6786456 commit e58e397

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

ElvUI/Core/Modules/Misc/AFK.lua

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -213,39 +213,37 @@ function AFK:Chat_OnEvent(event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8,
213213
end
214214

215215
local playerLink
216+
local linkTarget = chatTarget and (':'..chatTarget) or ''
216217
if infoType ~= 'BN_WHISPER' and infoType ~= 'BN_CONVERSATION' then
217-
playerLink = format('|Hplayer:%s:%s:%s%s|h', arg2, arg11, chatGroup, chatTarget and (':'..chatTarget) or '')
218+
playerLink = format('|Hplayer:%s:%s:%s%s|h', arg2, arg11, chatGroup, linkTarget)
218219
else
219-
playerLink = format('|HBNplayer:%s:%s:%s:%s%s|h', arg2, arg13, arg11, chatGroup, chatTarget and (':'..chatTarget) or '')
220+
playerLink = format('|HBNplayer:%s:%s:%s:%s%s|h', arg2, arg13, arg11, chatGroup, linkTarget)
220221
end
221222

222223
local isProtected = CH:MessageIsProtected(arg1)
223224
if not isProtected then
224-
--Escape any % characters, as it may otherwise cause an 'invalid option in format' error
225-
arg1 = gsub(arg1, '%%', '%%%%')
226-
227-
--Remove groups of many spaces
228-
arg1 = RemoveExtraSpaces(arg1)
225+
arg1 = gsub(arg1, '%%', '%%%%') -- Escape any % characters, as it may otherwise cause an 'invalid option in format' error
226+
arg1 = RemoveExtraSpaces(arg1) -- Remove groups of many spaces
229227
end
230228

231229
local isMobile = arg14 and ChatFrame_GetMobileEmbeddedTexture(info.r, info.g, info.b)
232230
local message = format('%s%s', isMobile or '', arg1)
233231

234232
local senderLink = format('%s[%s]|h', playerLink, coloredName)
235-
local success, body = pcall(format, _G['CHAT_'..infoType..'_GET']..'%s', senderLink, message)
233+
local success, msg = pcall(format, _G['CHAT_'..infoType..'_GET']..'%s', senderLink, message)
236234
if not success then return end
237235

238236
if not isProtected and CH.db.shortChannels then
239-
body = body:gsub('|Hchannel:(.-)|h%[(.-)%]|h', CH.ShortChannel)
240-
body = body:gsub('^(.-|h) '..L["whispers"], '%1')
241-
body = body:gsub('<'..AFKstr..'>', '[|cffFF9900'..L["AFK"]..'|r] ')
242-
body = body:gsub('<'..DNDstr..'>', '[|cffFF3333'..L["DND"]..'|r] ')
243-
body = body:gsub('%[BN_CONVERSATION:', '%['..'')
237+
msg = gsub(msg, '|Hchannel:(.-)|h%[(.-)%]|h', CH.ShortChannel)
238+
msg = gsub(msg, '^(.-|h) '..L["whispers"], '%1')
239+
msg = gsub(msg, '<'..AFKstr..'>', '[|cffFF9900'..L["AFK"]..'|r] ')
240+
msg = gsub(msg, '<'..DNDstr..'>', '[|cffFF3333'..L["DND"]..'|r] ')
241+
msg = gsub(msg, '%[BN_CONVERSATION:', '%['..'')
244242
end
245243

246244
local accessID = CH:GetAccessID(chatGroup, chatTarget)
247245
local typeID = CH:GetAccessID(infoType, chatTarget, arg12 or arg13)
248-
self:AddMessage(body, info.r, info.g, info.b, info.id, false, accessID, typeID)
246+
self:AddMessage(msg, info.r, info.g, info.b, info.id, false, accessID, typeID)
249247
end
250248

251249
function AFK:Toggle()

0 commit comments

Comments
 (0)