Enhance friend check and guild roster sync

Refactor IsFriendOf function to use strlower for case-insensitive comparison and ensure guild roster sync on module enable.
This commit is contained in:
2026-08-12 11:06:40 +02:00
committed by GitHub
parent d7f3fbfc3d
commit a951da4bb2
+9 -1
View File
@@ -35,7 +35,8 @@ end
local function IsFriendOf(name)
if not name then return false end
for i = 1, GetNumFriends() do
if GetFriendInfo(i) == name then
local fname = GetFriendInfo(i)
if fname and strlower(fname) == strlower(name) then
return true
end
end
@@ -68,6 +69,13 @@ end
local GetPlayerName = GetUnitName or UnitName
module.enable = function(self)
-- force an early guild roster sync: GetNumGuildMembers() returns 0 until
-- the roster has been fetched at least once, which would otherwise let
-- guildmate emotes get filtered right after login/reload
if IsInGuild() then
GuildRoster()
end
-- periodically swap/prune the cache so it never grows forever
local cleaner = CreateFrame("Frame")
local elapsed_total = 0