Refactor agentTracker to its own module

This commit is contained in:
2025-01-01 15:54:28 +01:00
parent 3f1fae8906
commit c9627779ba
6 changed files with 46 additions and 18 deletions

View File

@@ -5,24 +5,7 @@ local addonname, shared = ...
---@diagnostic disable-next-line: missing-fields
shared.Inviter = {}
function shared.Inviter.Init()
---@type table<string, boolean>
local channelRosterFrame = CreateFrame("Frame")
channelRosterFrame:RegisterEvent("CHANNEL_ROSTER_UPDATE")
channelRosterFrame:SetScript("OnEvent", function(self, event, index)
--if not Heimdall_Data.config.inviter.enabled then return end
--Since multiple modules depend on this we won't disable it, for now...
--I should really create a new module for just this though, eventually
local count = select(5, GetChannelDisplayInfo(index))
for i = 1, count do
local name = GetChannelRosterInfo(index, i)
if name then
Heimdall_Data.config.agents[name] = date("%Y-%m-%dT%H:%M:%S")
end
end
end)
local inviterGroupFrame = CreateFrame("Frame")
local nextUpdate = 0
inviterGroupFrame:RegisterEvent("GROUP_ROSTER_UPDATE")
inviterGroupFrame:SetScript("OnEvent", function(self, event, ...)
if not Heimdall_Data.config.inviter.enabled then return end