Color chat senders by GUID and drop the who-search option

The engine name-queries a chat sender before the CHAT_MSG event fires,
so GetPlayerInfoByGUID(GetCurrentChatGUID()) resolves every player
sender, including strangers in world channels. Other names in the text
still fall back to C_PlayerCache.GetPlayerInfoByName and libunitscan.

This makes the silent /who lookup for unknown classes obsolete; remove
it along with its FriendsFrame_OnEvent wrapper, config default, GUI
entry and translations.
This commit is contained in:
Brues
2026-10-23 02:40:08 -05:00
parent cae7c2d68a
commit 95e832835e
11 changed files with 18 additions and 32 deletions
-1
View File
@@ -827,7 +827,6 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("chat", "text", "detecturl", "1") pfUI:UpdateConfig("chat", "text", "detecturl", "1")
pfUI:UpdateConfig("chat", "text", "classcolor", "1") pfUI:UpdateConfig("chat", "text", "classcolor", "1")
pfUI:UpdateConfig("chat", "text", "playericons", "0") pfUI:UpdateConfig("chat", "text", "playericons", "0")
pfUI:UpdateConfig("chat", "text", "whosearchunknown", "0")
pfUI:UpdateConfig("chat", "text", "playerlevel", "0") pfUI:UpdateConfig("chat", "text", "playerlevel", "0")
pfUI:UpdateConfig("chat", "left", "width", "380") pfUI:UpdateConfig("chat", "left", "width", "380")
pfUI:UpdateConfig("chat", "left", "height", "180") pfUI:UpdateConfig("chat", "left", "height", "180")
-1
View File
@@ -872,7 +872,6 @@ pfUI_translation["deDE"] = {
["Website"] = nil, ["Website"] = nil,
["Welcome to |cff33ffccpf|cffffffffUI|r!\n\nI'm the first run wizard that will guide you through some basic configuration. If you're lazy, feel free to hit the \"Defaults\" button. If you wish to run this dialog again, go to the settings and hit the \"Reset Firstrun\" button.\n\nVisit |cff33ffcc%s|r to check for the latest version."] = nil, ["Welcome to |cff33ffccpf|cffffffffUI|r!\n\nI'm the first run wizard that will guide you through some basic configuration. If you're lazy, feel free to hit the \"Defaults\" button. If you wish to run this dialog again, go to the settings and hit the \"Reset Firstrun\" button.\n\nVisit |cff33ffcc%s|r to check for the latest version."] = nil,
["Whitelist"] = nil, ["Whitelist"] = nil,
["Who Search Unknown Classes (|cffffaaaaExperimental|r)"] = nil,
["Width"] = nil, ["Width"] = nil,
["Wobble Zoom"] = nil, ["Wobble Zoom"] = nil,
["Won"] = nil, ["Won"] = nil,
-1
View File
@@ -900,7 +900,6 @@ pfUI_translation["enUS"] = {
["Website"] = nil, ["Website"] = nil,
["Welcome to |cff33ffccpf|cffffffffUI|r!\n\nI'm the first run wizard that will guide you through some basic configuration. If you're lazy, feel free to hit the \"Defaults\" button. If you wish to run this dialog again, go to the settings and hit the \"Reset Firstrun\" button.\n\nVisit |cff33ffcc%s|r to check for the latest version."] = nil, ["Welcome to |cff33ffccpf|cffffffffUI|r!\n\nI'm the first run wizard that will guide you through some basic configuration. If you're lazy, feel free to hit the \"Defaults\" button. If you wish to run this dialog again, go to the settings and hit the \"Reset Firstrun\" button.\n\nVisit |cff33ffcc%s|r to check for the latest version."] = nil,
["Whitelist"] = nil, ["Whitelist"] = nil,
["Who Search Unknown Classes (|cffffaaaaExperimental|r)"] = nil,
["Width"] = nil, ["Width"] = nil,
["Wobble Zoom"] = nil, ["Wobble Zoom"] = nil,
["Won"] = nil, ["Won"] = nil,
-1
View File
@@ -872,7 +872,6 @@ pfUI_translation["esES"] = {
["Website"] = "Sitio de web", ["Website"] = "Sitio de web",
["Welcome to |cff33ffccpf|cffffffffUI|r!\n\nI'm the first run wizard that will guide you through some basic configuration. If you're lazy, feel free to hit the \"Defaults\" button. If you wish to run this dialog again, go to the settings and hit the \"Reset Firstrun\" button.\n\nVisit |cff33ffcc%s|r to check for the latest version."] = "¡Bienvenido a |cff33ffccpf|cffffffffUI|r!\n\nSoy el asistente de instalación que te guiará con la configuración básica. Si prefieres, puedes hacer clic el botón \"Predeterminado\" para cargar la configuración por defecto. Si quieres abrir este diálogo de nuevo, ve a la configuración y haz clic en el botón \"Reiniciar Primera vez\".\n\nVisita |cff33ffcc%s|r para descargar la última versión.", ["Welcome to |cff33ffccpf|cffffffffUI|r!\n\nI'm the first run wizard that will guide you through some basic configuration. If you're lazy, feel free to hit the \"Defaults\" button. If you wish to run this dialog again, go to the settings and hit the \"Reset Firstrun\" button.\n\nVisit |cff33ffcc%s|r to check for the latest version."] = "¡Bienvenido a |cff33ffccpf|cffffffffUI|r!\n\nSoy el asistente de instalación que te guiará con la configuración básica. Si prefieres, puedes hacer clic el botón \"Predeterminado\" para cargar la configuración por defecto. Si quieres abrir este diálogo de nuevo, ve a la configuración y haz clic en el botón \"Reiniciar Primera vez\".\n\nVisita |cff33ffcc%s|r para descargar la última versión.",
["Whitelist"] = "Lista blanca", ["Whitelist"] = "Lista blanca",
["Who Search Unknown Classes (|cffffaaaaExperimental|r)"] = nil,
["Width"] = "Ancho", ["Width"] = "Ancho",
["Wobble Zoom"] = "Acerca tambalea", ["Wobble Zoom"] = "Acerca tambalea",
["Won"] = "Ganado", ["Won"] = "Ganado",
-1
View File
@@ -872,7 +872,6 @@ pfUI_translation["frFR"] = {
["Website"] = "Site web", ["Website"] = "Site web",
["Welcome to |cff33ffccpf|cffffffffUI|r!\n\nI'm the first run wizard that will guide you through some basic configuration. If you're lazy, feel free to hit the \"Defaults\" button. If you wish to run this dialog again, go to the settings and hit the \"Reset Firstrun\" button.\n\nVisit |cff33ffcc%s|r to check for the latest version."] = "Bienvenue sur l'assistant d'installation de l'interface |cff33ffccpf|cffffffffUI|r!\n\nNous allons effectuer quelques configurations de base. Si vous n'avez pas la patience, cliquer sur le bouton \"Paramètres par défaut\". Si vous souhaitez relancer cette fenêtre de dialogue, allez dans les options et cliquez sur le bouton\"Réinitialiser l'assistant d'installation\" .\n\nAllez sur |cff33ffcc%s|r pour télécharger la dernière version.", ["Welcome to |cff33ffccpf|cffffffffUI|r!\n\nI'm the first run wizard that will guide you through some basic configuration. If you're lazy, feel free to hit the \"Defaults\" button. If you wish to run this dialog again, go to the settings and hit the \"Reset Firstrun\" button.\n\nVisit |cff33ffcc%s|r to check for the latest version."] = "Bienvenue sur l'assistant d'installation de l'interface |cff33ffccpf|cffffffffUI|r!\n\nNous allons effectuer quelques configurations de base. Si vous n'avez pas la patience, cliquer sur le bouton \"Paramètres par défaut\". Si vous souhaitez relancer cette fenêtre de dialogue, allez dans les options et cliquez sur le bouton\"Réinitialiser l'assistant d'installation\" .\n\nAllez sur |cff33ffcc%s|r pour télécharger la dernière version.",
["Whitelist"] = "List blanche", ["Whitelist"] = "List blanche",
["Who Search Unknown Classes (|cffffaaaaExperimental|r)"] = nil,
["Width"] = "Largeur", ["Width"] = "Largeur",
["Wobble Zoom"] = "Zoom oscillant", ["Wobble Zoom"] = "Zoom oscillant",
["Won"] = "A gagné", ["Won"] = "A gagné",
-1
View File
@@ -872,7 +872,6 @@ pfUI_translation["koKR"] = {
["Website"] = nil, ["Website"] = nil,
["Welcome to |cff33ffccpf|cffffffffUI|r!\n\nI'm the first run wizard that will guide you through some basic configuration. If you're lazy, feel free to hit the \"Defaults\" button. If you wish to run this dialog again, go to the settings and hit the \"Reset Firstrun\" button.\n\nVisit |cff33ffcc%s|r to check for the latest version."] = "|cff33ffccpf|cffffffffUI|r에 |cff33ffcc오신걸 환영합니다.|r \n\n저는 몇 가지 기본 구성을 안내 할 첫 번째 실행 위자드입니다. 모든 단계를 건너 뛰고 싶으시면 \"기본값 사용\" 버튼을 누르십시오. 이 대화 상자를 다시 실행하려면 추후 설정으로 이동하여 \"첫단계로 재설정\" 버튼을 누르십시오.\n\n최신버전 다운로드 사이트: |cff33ffcc%s|r", ["Welcome to |cff33ffccpf|cffffffffUI|r!\n\nI'm the first run wizard that will guide you through some basic configuration. If you're lazy, feel free to hit the \"Defaults\" button. If you wish to run this dialog again, go to the settings and hit the \"Reset Firstrun\" button.\n\nVisit |cff33ffcc%s|r to check for the latest version."] = "|cff33ffccpf|cffffffffUI|r에 |cff33ffcc오신걸 환영합니다.|r \n\n저는 몇 가지 기본 구성을 안내 할 첫 번째 실행 위자드입니다. 모든 단계를 건너 뛰고 싶으시면 \"기본값 사용\" 버튼을 누르십시오. 이 대화 상자를 다시 실행하려면 추후 설정으로 이동하여 \"첫단계로 재설정\" 버튼을 누르십시오.\n\n최신버전 다운로드 사이트: |cff33ffcc%s|r",
["Whitelist"] = nil, ["Whitelist"] = nil,
["Who Search Unknown Classes (|cffffaaaaExperimental|r)"] = nil,
["Width"] = nil, ["Width"] = nil,
["Wobble Zoom"] = nil, ["Wobble Zoom"] = nil,
["Won"] = nil, ["Won"] = nil,
-1
View File
@@ -872,7 +872,6 @@ pfUI_translation["ruRU"] = {
["Website"] = "Веб-сайт", ["Website"] = "Веб-сайт",
["Welcome to |cff33ffccpf|cffffffffUI|r!\n\nI'm the first run wizard that will guide you through some basic configuration. If you're lazy, feel free to hit the \"Defaults\" button. If you wish to run this dialog again, go to the settings and hit the \"Reset Firstrun\" button.\n\nVisit |cff33ffcc%s|r to check for the latest version."] = "Добро пожаловать в |cff33ffccpf|cffffffffUI|r!\n\nЯ мастер первого запуска, который проведет вас через некоторую базовую конфигурацию. Если вы ленитесь, не стесняйтесь нажать кнопку \"По умолчанию\". Если вы хотите снова запустить этот диалог, перейдите к настройкам и нажмите кнопку \"Первый запуск\".\n\nПосетите |cff33ffcc%s|r, чтобы проверить последнюю версию.", ["Welcome to |cff33ffccpf|cffffffffUI|r!\n\nI'm the first run wizard that will guide you through some basic configuration. If you're lazy, feel free to hit the \"Defaults\" button. If you wish to run this dialog again, go to the settings and hit the \"Reset Firstrun\" button.\n\nVisit |cff33ffcc%s|r to check for the latest version."] = "Добро пожаловать в |cff33ffccpf|cffffffffUI|r!\n\nЯ мастер первого запуска, который проведет вас через некоторую базовую конфигурацию. Если вы ленитесь, не стесняйтесь нажать кнопку \"По умолчанию\". Если вы хотите снова запустить этот диалог, перейдите к настройкам и нажмите кнопку \"Первый запуск\".\n\nПосетите |cff33ffcc%s|r, чтобы проверить последнюю версию.",
["Whitelist"] = "\"Белый\" список", ["Whitelist"] = "\"Белый\" список",
["Who Search Unknown Classes (|cffffaaaaExperimental|r)"] = nil,
["Width"] = "Ширина", ["Width"] = "Ширина",
["Wobble Zoom"] = "Подпрыгивание", ["Wobble Zoom"] = "Подпрыгивание",
["Won"] = "Победа", ["Won"] = "Победа",
-1
View File
@@ -873,7 +873,6 @@ pfUI_translation["zhCN"] = {
["Website"] = "网站", ["Website"] = "网站",
["Welcome to |cff33ffccpf|cffffffffUI|r!\n\nI'm the first run wizard that will guide you through some basic configuration. If you're lazy, feel free to hit the \"Defaults\" button. If you wish to run this dialog again, go to the settings and hit the \"Reset Firstrun\" button.\n\nVisit |cff33ffcc%s|r to check for the latest version."] = "欢迎使用 |cff33ffccpf|cffffffffUI|r! \n\n这是第一次运行向导,将引导您完成一些基本配置。 如果你想跳过所有步骤\"使用默认\"按钮。 如果您再次运行此对话框,请转到设置并点击 \"Reset Firstrun\" 按钮。\n\n访问 |cff33ffcc%s|r 检查最新版本。", ["Welcome to |cff33ffccpf|cffffffffUI|r!\n\nI'm the first run wizard that will guide you through some basic configuration. If you're lazy, feel free to hit the \"Defaults\" button. If you wish to run this dialog again, go to the settings and hit the \"Reset Firstrun\" button.\n\nVisit |cff33ffcc%s|r to check for the latest version."] = "欢迎使用 |cff33ffccpf|cffffffffUI|r! \n\n这是第一次运行向导,将引导您完成一些基本配置。 如果你想跳过所有步骤\"使用默认\"按钮。 如果您再次运行此对话框,请转到设置并点击 \"Reset Firstrun\" 按钮。\n\n访问 |cff33ffcc%s|r 检查最新版本。",
["Whitelist"] = "白名单", ["Whitelist"] = "白名单",
["Who Search Unknown Classes (|cffffaaaaExperimental|r)"] = nil,
["Width"] = "宽度", ["Width"] = "宽度",
["Wobble Zoom"] = "摆动变焦", ["Wobble Zoom"] = "摆动变焦",
["Won"] = "获胜", ["Won"] = "获胜",
-1
View File
@@ -872,7 +872,6 @@ pfUI_translation["zhTW"] = {
["Website"] = nil, ["Website"] = nil,
["Welcome to |cff33ffccpf|cffffffffUI|r!\n\nI'm the first run wizard that will guide you through some basic configuration. If you're lazy, feel free to hit the \"Defaults\" button. If you wish to run this dialog again, go to the settings and hit the \"Reset Firstrun\" button.\n\nVisit |cff33ffcc%s|r to check for the latest version."] = "歡迎使用 |cff33ffccpf|cffffffffUI|r! \n\n這是第一次運行嚮導,將引導您完成一些基本配置。 如果你想跳過所有步驟\"使用預設\"按鈕。 如果您再次運行此對話方塊,請轉到設置並點擊 \"Reset Firstrun\" 按鈕。\n\n訪問 |cff33ffcc%s|r 檢查最新版本。", ["Welcome to |cff33ffccpf|cffffffffUI|r!\n\nI'm the first run wizard that will guide you through some basic configuration. If you're lazy, feel free to hit the \"Defaults\" button. If you wish to run this dialog again, go to the settings and hit the \"Reset Firstrun\" button.\n\nVisit |cff33ffcc%s|r to check for the latest version."] = "歡迎使用 |cff33ffccpf|cffffffffUI|r! \n\n這是第一次運行嚮導,將引導您完成一些基本配置。 如果你想跳過所有步驟\"使用預設\"按鈕。 如果您再次運行此對話方塊,請轉到設置並點擊 \"Reset Firstrun\" 按鈕。\n\n訪問 |cff33ffcc%s|r 檢查最新版本。",
["Whitelist"] = "白名單", ["Whitelist"] = "白名單",
["Who Search Unknown Classes (|cffffaaaaExperimental|r)"] = nil,
["Width"] = nil, ["Width"] = nil,
["Wobble Zoom"] = nil, ["Wobble Zoom"] = nil,
["Won"] = nil, ["Won"] = nil,
+18 -22
View File
@@ -782,16 +782,6 @@ pfUI:RegisterModule("chat", function ()
local r,g,b = GetStringColor(C.chat.text.unknowncolor) local r,g,b = GetStringColor(C.chat.text.unknowncolor)
local unknowncolorhex = rgbhex(r,g,b) local unknowncolorhex = rgbhex(r,g,b)
-- Suppress FriendsFrame's WHO_LIST_UPDATE handling for our DLL-issued
-- name lookups so they don't pop the friends panel. User-issued /who
-- still works because IsWhoQueryPending only reports true for queries
-- issued via C_FriendList.SendWhoQueryByName.
local original_FriendsFrame_OnEvent = FriendsFrame_OnEvent
_G.FriendsFrame_OnEvent = function()
if _G.event == "WHO_LIST_UPDATE" and C_FriendList.IsWhoQueryPending() then return end
return original_FriendsFrame_OnEvent()
end
local function GetPlayerLevel(name) local function GetPlayerLevel(name)
if not pfUI_playerDB then return nil end if not pfUI_playerDB then return nil end
if not pfUI_playerDB[name] then return nil end if not pfUI_playerDB[name] then return nil end
@@ -823,25 +813,31 @@ pfUI:RegisterModule("chat", function ()
-- display class colors if already indexed -- display class colors if already indexed
if C.chat.text.classcolor == "1" then if C.chat.text.classcolor == "1" then
-- the engine name-queries a chat sender before the event fires,
-- so the sender's GUID always resolves; other names in the text
-- fall back to the name-keyed lookups
local guid = GetCurrentChatGUID()
local _, senderClass, _, senderRace, senderSex, senderName
if guid then
_, senderClass, _, senderRace, senderSex, senderName = GetPlayerInfoByGUID(guid)
end
for name in gfind(text, "|Hplayer:(.-)|h") do for name in gfind(text, "|Hplayer:(.-)|h") do
local real, _ = strsplit(":", name) local real, _ = strsplit(":", name)
local color = unknowncolorhex local color = unknowncolorhex
local match = false local match = false
local _, class, _, raceKey, sex = C_PlayerCache.GetPlayerInfoByName(real) local class, raceKey, sex
-- local guid = GetCurrentChatGUID() if real == senderName then
-- if guid then class, raceKey, sex = senderClass, senderRace, senderSex
-- _, class = GetPlayerInfoByGUID(guid) else
-- end _, class, _, raceKey, sex = C_PlayerCache.GetPlayerInfoByName(real)
end
if not class then if not class then
class = GetUnitInfo(real) class = GetUnitInfo(real)
end end
if class then if class and class ~= UNKNOWN then
if class ~= UNKNOWN then color = "|c" .. PFUI_CLASS_COLORS[class].colorStr
color = "|c" .. PFUI_CLASS_COLORS[class].colorStr match = true
match = true
end
elseif C.chat.text.whosearchunknown == "1" then
C_FriendList.SendWhoQueryByName(name) -- cooldown + state managed by DLL
end end
if C.chat.text.tintunknown == "1" or match then if C.chat.text.tintunknown == "1" or match then
-1
View File
@@ -2881,7 +2881,6 @@ pfUI:RegisterModule("gui", function ()
CreateConfig(nil, T["Enable Class Colors"], C.chat.text, "classcolor", "checkbox") CreateConfig(nil, T["Enable Class Colors"], C.chat.text, "classcolor", "checkbox")
CreateConfig(nil, T["Show Faction & Race Icons"] .. " " .. GetPlayerRaceIcons(), C.chat.text, "playericons", "checkbox") CreateConfig(nil, T["Show Faction & Race Icons"] .. " " .. GetPlayerRaceIcons(), C.chat.text, "playericons", "checkbox")
CreateConfig(nil, T["Enable Player Levels"], C.chat.text, "playerlevel", "checkbox") CreateConfig(nil, T["Enable Player Levels"], C.chat.text, "playerlevel", "checkbox")
CreateConfig(nil, T["Who Search Unknown Classes (|cffffaaaaExperimental|r)"], C.chat.text, "whosearchunknown", "checkbox")
CreateConfig(nil, T["Colorize Unknown Classes"], C.chat.text, "tintunknown", "checkbox") CreateConfig(nil, T["Colorize Unknown Classes"], C.chat.text, "tintunknown", "checkbox")
CreateConfig(nil, T["Unknown Class Color"], C.chat.text, "unknowncolor", "color") CreateConfig(nil, T["Unknown Class Color"], C.chat.text, "unknowncolor", "color")
CreateConfig(nil, T["Left Chat Width"], C.chat.left, "width") CreateConfig(nil, T["Left Chat Width"], C.chat.left, "width")