-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathCompat.lua
More file actions
88 lines (76 loc) · 3.46 KB
/
Copy pathCompat.lua
File metadata and controls
88 lines (76 loc) · 3.46 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
-------------------------------------------------------------------------------
-- Premade Groups Filter
-------------------------------------------------------------------------------
-- Copyright (C) 2026 Bernhard Saumweber
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License along
-- with this program; if not, write to the Free Software Foundation, Inc.,
-- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-------------------------------------------------------------------------------
local PGF = select(2, ...)
local L = PGF.L
local C = PGF.C
-- Assumption: if there is no issecretvalue function, the value is never secret
local issecretvalue = issecretvalue or function () return false end
-- Assumption: clients without canaccesstable do not restrict table access
local canaccesstable = canaccesstable or function () return true end
local function IsAccessibleTable(value)
return not issecretvalue(value) and canaccesstable(value)
end
function PGF.GetSearchResultInfo(resultID)
local searchResultInfo = C_LFGList.GetSearchResultInfo(resultID)
-- In rare cases such as when an application is full or rejected,
-- C_LFGList.GetSearchResultInfo returns nil.
-- In restricted envs, the searchResultInfo table itself can be secret.
if not searchResultInfo or not IsAccessibleTable(searchResultInfo) then
return nil
end
return searchResultInfo
end
function PGF.GetSearchResultActivityID(searchResultInfo)
local activityIDs = searchResultInfo.activityIDs
if issecretvalue(activityIDs) then return nil end
if activityIDs then
if not IsAccessibleTable(activityIDs) then return nil end
local activityID = activityIDs[1]
if type(activityID) ~= "number" or issecretvalue(activityID) then return nil end
return activityID
end
local activityID = searchResultInfo.activityID
if type(activityID) ~= "number" or issecretvalue(activityID) then return nil end
return activityID
end
function PGF.GetSearchResultLeaderDungeonScoreInfo(searchResultInfo)
local scoreInfos = searchResultInfo.leaderDungeonScoreInfo
if not scoreInfos or issecretvalue(scoreInfos) then return nil end
if not IsAccessibleTable(scoreInfos) then return nil end
return scoreInfos[1]
end
function PGF.GetSearchResultLeaderPvpRatingInfo(searchResultInfo)
local ratingInfos = searchResultInfo.leaderPvpRatingInfo
if not ratingInfos or issecretvalue(ratingInfos) then return nil end
if not IsAccessibleTable(ratingInfos) then return nil end
return ratingInfos[1]
end
function PGF.GetActivityInfoTable(activityID)
return C_LFGList.GetActivityInfoTable(activityID)
end
function PGF.GetSearchResultPlayerInfo(...)
return C_LFGList.GetSearchResultPlayerInfo(...)
end
function PGF.GetSearchResultMemberCounts(resultID)
return C_LFGList.GetSearchResultMemberCounts(resultID)
end
function PGF.GetSearchResultEncounterInfo(resultID)
return C_LFGList.GetSearchResultEncounterInfo(resultID)
end