-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathVersionCheck.lua
More file actions
51 lines (47 loc) · 2.11 KB
/
VersionCheck.lua
File metadata and controls
51 lines (47 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
local _, NSI = ... -- Internal namespace
function NSI:RequestVersionNumber(type, name) -- type == "Addon" or "WA" or "Note"
if (UnitIsGroupLeader("player") or UnitIsGroupAssistant("player") or NSRT.Settings["Debug"]) then
local unit, ver, url, ignore = self:GetVersionNumber(type, name, "player")
self:VersionResponse({name = UnitName("player"), version = "No Response", ignoreCheck = ignore})
self:Broadcast("NSI_VERSION_REQUEST", "RAID", type, name)
for unit in self:IterateGroupMembers() do
if UnitInRaid(unit) and not UnitIsUnit("player", unit) then
local index = UnitInRaid(unit)
local response = select(8, GetRaidRosterInfo(index)) and "No Response" or "Offline"
self:VersionResponse({name = UnitName(unit), version = response, ignoreCheck = false})
end
end
return {name = UnitName("player"), version = ver, ignoreCheck = ignore}, url
end
end
function NSI:VersionResponse(data)
self.NSUI.version_scrollbox:AddData(data)
end
function NSI:GetVersionNumber(type, name, unit)
local ignoreCheck = false
for u in self:IterateGroupMembers() do
if C_FriendList.IsIgnored(u) then
ignoreCheck = true
break
end
end
if type == "Addon" then
local ver = C_AddOns.GetAddOnMetadata(name, "Version") or "Addon Missing"
if ver ~= "Addon Missing" then
ver = C_AddOns.IsAddOnLoaded(name) and ver or "Addon not enabled"
end
return unit, ver, "", ignoreCheck
elseif type == "Note" then
local note = self:GetNote()
local hashed
if C_AddOns.IsAddOnLoaded("MRT") then
hashed = self:GetHash(note) or "Note Missing"
else
hashed = C_AddOns.GetAddOnMetadata("MRT", "Version") and "MRT not enabled" or "MRT not installed"
end
return unit, hashed, "", ignoreCheck
elseif type == "Reminder" then
local reminder = self.Reminder and self.Reminder ~= "" and self:GetHash(self.Reminder) or "Reminder Missing"
return unit, reminder, "", ignoreCheck
end
end