This commit is contained in:
@@ -35,38 +35,55 @@ function shared.Messenger.Init()
|
||||
if not shared.messenger.queue then shared.messenger.queue = {} end
|
||||
if not shared.messenger.ticker then
|
||||
local function DoMessage()
|
||||
--if Heimdall_Data.config.messenger.debug then
|
||||
-- print(string.format("[%s] Processing message queue", ModuleName))
|
||||
--end
|
||||
if Heimdall_Data.config.messenger.debug then
|
||||
print(string.format("[%s] Processing message queue - Size: %d", ModuleName, #shared.messenger.queue))
|
||||
end
|
||||
|
||||
if not Heimdall_Data.config.messenger.enabled then
|
||||
--if Heimdall_Data.config.messenger.debug then
|
||||
-- print(string.format("[%s] Module disabled, skipping message processing", ModuleName))
|
||||
--end
|
||||
if Heimdall_Data.config.messenger.debug then
|
||||
print(string.format("[%s] Module disabled, skipping message processing", ModuleName))
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
---@type Message
|
||||
local message = shared.messenger.queue[1]
|
||||
if not message then
|
||||
--if Heimdall_Data.config.messenger.debug then
|
||||
-- print(string.format("[%s] Message queue empty", ModuleName))
|
||||
--end
|
||||
if Heimdall_Data.config.messenger.debug then
|
||||
print(string.format("[%s] Message queue empty", ModuleName))
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if Heimdall_Data.config.messenger.debug then
|
||||
print(string.format("[%s] Processing message - Channel: %s, Data: %s", ModuleName,
|
||||
message.channel or "nil", message.data or "nil"))
|
||||
print(string.format("[%s] Message content: %s", ModuleName, message.message or "nil"))
|
||||
end
|
||||
|
||||
if not message.message or message.message == "" then
|
||||
if Heimdall_Data.config.messenger.debug then
|
||||
print(string.format("[%s] Invalid message: empty content", ModuleName))
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if not message.channel or message.channel == "" then
|
||||
if Heimdall_Data.config.messenger.debug then
|
||||
print(string.format("[%s] Invalid message: no channel specified", ModuleName))
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if string.find(message.channel, "^C") then
|
||||
if Heimdall_Data.config.messenger.debug then
|
||||
print(string.format("[%s] Converting channel type from C to CHANNEL", ModuleName))
|
||||
end
|
||||
message.channel = "CHANNEL"
|
||||
elseif string.find(message.channel, "^W") then
|
||||
if Heimdall_Data.config.messenger.debug then
|
||||
print(string.format("[%s] Converting channel type from W to WHISPER", ModuleName))
|
||||
end
|
||||
message.channel = "WHISPER"
|
||||
end
|
||||
|
||||
@@ -119,10 +136,9 @@ function shared.Messenger.Init()
|
||||
SendChatMessage(message.message, message.channel, nil, message.data)
|
||||
end
|
||||
local function Tick()
|
||||
--if Heimdall_Data.config.messenger.debug then
|
||||
-- local queueSize = #shared.messenger.queue
|
||||
-- print(string.format("[%s] Queue check - Messages pending: %d", ModuleName, queueSize))
|
||||
--end
|
||||
if Heimdall_Data.config.messenger.debug then
|
||||
print(string.format("[%s] Tick - Queue size: %d", ModuleName, #shared.messenger.queue))
|
||||
end
|
||||
DoMessage()
|
||||
shared.messenger.ticker = C_Timer.NewTimer(Heimdall_Data.config.messenger.interval, Tick, 1)
|
||||
end
|
||||
|
||||
@@ -167,10 +167,10 @@ function shared.Whoer.Init()
|
||||
shared.dumpTable(filters)
|
||||
return WHOQuery.new(queryParts[1], filters)
|
||||
end,
|
||||
---@param queries string
|
||||
---@param queryStr string
|
||||
---@return WHOQuery[]
|
||||
WhoQueriesFromString = function(queries)
|
||||
local queries = shared.Split(queries, "\n")
|
||||
WhoQueriesFromString = function(queryStr)
|
||||
local queries = shared.Split(queryStr, "\n")
|
||||
local ret = {}
|
||||
for _, query in pairs(queries) do
|
||||
table.insert(ret, shared.WhoQueryService.WhoQueryFromString(query))
|
||||
@@ -187,6 +187,12 @@ function shared.Whoer.Init()
|
||||
print(string.format("[%s] ShouldNotifyForZone %s", ModuleName, inputZone))
|
||||
end
|
||||
for zone, _ in pairs(Heimdall_Data.config.who.zoneNotifyFor) do
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(string.format("[%s] Checking zone %s", ModuleName, zone))
|
||||
end
|
||||
if zone == "*" then
|
||||
return true
|
||||
end
|
||||
if string.find(inputZone, zone) then
|
||||
if not Heimdall_Data.config.who.debug then
|
||||
print(string.format("[%s] ShouldNotifyForZone %s is true thanks to %s", ModuleName, inputZone, zone))
|
||||
@@ -229,6 +235,10 @@ function shared.Whoer.Init()
|
||||
local function Notify(player)
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(string.format("[%s] Processing notification for player: %s", ModuleName, player.name))
|
||||
print(string.format("[%s] Player details - Guild: %s, Race: %s, Class: %s, Zone: %s", ModuleName,
|
||||
player.guild, player.race, player.class, player.zone))
|
||||
print(string.format("[%s] Player history - First seen: %s, Last seen: %s, Seen count: %d", ModuleName,
|
||||
player.firstSeen, player.lastSeen, player.seenCount))
|
||||
end
|
||||
|
||||
if not Heimdall_Data.config.who.enabled then
|
||||
@@ -404,6 +414,7 @@ function shared.Whoer.Init()
|
||||
frame:SetScript("OnEvent", function(self, event, ...)
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(string.format("[%s] WHO list update received", ModuleName))
|
||||
print(string.format("[%s] Query index: %d/%d", ModuleName, whoQueryIdx, #shared.WhoQueryService.queries))
|
||||
end
|
||||
|
||||
if not Heimdall_Data.config.who.enabled then
|
||||
@@ -454,13 +465,15 @@ function shared.Whoer.Init()
|
||||
print(string.format("[%s] Ignoring blacklisted player: %s", ModuleName, name))
|
||||
end
|
||||
continue = true
|
||||
else
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(string.format("[%s] Player %s is not blacklisted", ModuleName, name))
|
||||
end
|
||||
end
|
||||
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(string.format("[%s] Player %s is not blacklisted", ModuleName, name))
|
||||
end
|
||||
if not continue then
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(string.format("[%s] Player %s is not filtered out", ModuleName, name))
|
||||
end
|
||||
local timestamp = date("%Y-%m-%dT%H:%M:%S")
|
||||
local player = HeimdallStinkies[name]
|
||||
if not player then
|
||||
@@ -559,16 +572,24 @@ function shared.Whoer.Init()
|
||||
local query = shared.WhoQueryService.queries[whoQueryIdx]
|
||||
if not query then
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(string.format("[%s] Error: No WHO query found to run", ModuleName))
|
||||
print(string.format("[%s] Error: No WHO query found to run at index %d", ModuleName, whoQueryIdx))
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(string.format("[%s] Running WHO query %d/%d: %s", ModuleName, whoQueryIdx,
|
||||
#shared.WhoQueryService.queries, query.query))
|
||||
print(string.format("[%s] Query has %d filters", ModuleName, #query.filters))
|
||||
for i, filter in ipairs(query.filters) do
|
||||
print(string.format("[%s] Filter %d: %s", ModuleName, i, filter.key))
|
||||
end
|
||||
end
|
||||
whoQueryIdx = whoQueryIdx + 1
|
||||
if whoQueryIdx > #shared.WhoQueryService.queries then
|
||||
whoQueryIdx = 1
|
||||
end
|
||||
lastQuery = query
|
||||
--print(string.format("Running who query: %s", tostring(query.query)))
|
||||
---@diagnostic disable-next-line: param-type-mismatch
|
||||
SetWhoToUI(1)
|
||||
SendWho(query.query)
|
||||
|
||||
Reference in New Issue
Block a user