Skip to content

Commit

Permalink
Better (worse?) handling of Battle.net IDs. All Battle.net whispers a…
Browse files Browse the repository at this point in the history
…re now displayed with [id: <some id>] instead of their corresponding real names. This "resolves" the issue where real names are not consistent between logins, which would attribute some messages to the wrong people in Elephant before this update. Instead, they will be attributed to the internal ID decided by the WoW client when the message is received or sent. This stays consistent within a single gaming session, but changes when you logoff/log back in. So the same ID might be reused for a different person later on.

Nothing can be done about this inconsistency from an addon. Using IDs is the closest I can be. This is due to privacy reasons and unfortunately is out of my control.
  • Loading branch information
AllInOneMighty committed Jan 16, 2023
1 parent a37478f commit 544139b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions Locales/Locale-enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ L['monstersay'] = "%s says"
L['monsteryell'] = "%s yells"
L['whisperfrom'] = "%s whispers"
L['whisperto'] = "To %s"
L['id'] = "id"

--[[ Addon messages ]]
L['clearallconfirm'] = "All chats cleared."
Expand Down
15 changes: 14 additions & 1 deletion Message.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ local function GetSenderWithClassColor(sender, classColor, withLink)
end
end

local function GetBattleNetId(sender)
return string.sub(sender, 3, -3)
end

--[[
Creates a hex color string from the given decimal
red, green, blue and alpha values.
Expand Down Expand Up @@ -84,7 +88,16 @@ function Elephant:GetLiteralMessage(mStruct, useTimestamps)
elseif mStruct['type'] == "MONSTER_WHISPER" then
msg = msg .. mStruct['arg2']
else
local pLink = GetSenderWithClassColor(mStruct['arg2'], mStruct['clColor'], true)
local withLink = true
local sender = mStruct['arg2']

if mStruct['type'] == "BN_WHISPER_INFORM" or mStruct['type'] == "BN_WHISPER" then
-- We can't track Battle.net names due to privacy reasons, so we remove links and name resolution.
withLink = false
sender = "[" .. Elephant.L['id'] .. ": " .. GetBattleNetId(mStruct['arg2']) .. "]"
end

local pLink = GetSenderWithClassColor(sender, mStruct['clColor'], withLink)

if mStruct['type'] == "WHISPER_INFORM" or mStruct['type'] == "BN_WHISPER_INFORM" then
msg = msg .. format(Elephant.L['whisperto'], pLink)
Expand Down

0 comments on commit 544139b

Please sign in to comment.