Skip to content

Commit

Permalink
Blacklist global fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Wutname1 committed Jan 30, 2024
1 parent efa4081 commit 9267118
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
17 changes: 14 additions & 3 deletions Core/Framework.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,10 @@ end
override allows the source to be put into the target
even if its already populated
]]
---@param target table
---@param source table
---@param override boolean
---@return table
function SUI:MergeData(target, source, override)
if source == nil then return target end

Expand Down Expand Up @@ -1454,9 +1458,11 @@ function SUI:isPartialMatch(frameName, tab)
return result
end

--[[
Takes a target table and searches for the specified phrase
]]
---Takes a target table and searches for the specified phrase
---@param searchTable table
---@param searchPhrase string|number
---@param all boolean
---@return boolean
function SUI:IsInTable(searchTable, searchPhrase, all)
if searchTable == nil or searchPhrase == nil then
SUI:Error('Invalid isInTable call', 'Core')
Expand Down Expand Up @@ -1485,6 +1491,9 @@ function SUI:IsInTable(searchTable, searchPhrase, all)
return false
end

---@param currentTable table
---@param defaultTable table
---@return table
function SUI:CopyTable(currentTable, defaultTable)
if type(currentTable) ~= 'table' then currentTable = {} end

Expand Down Expand Up @@ -1622,6 +1631,8 @@ function SUI:FilterTableFromBlacklist(cleanTable, blacklistTable)
return tfbCleaned
end

---@param inTable table
---@return string
function SUI:TableToLuaString(inTable)
local function recurse(table, level, ret)
for i, v in pairs(table) do
Expand Down
7 changes: 4 additions & 3 deletions Modules/AutoTurnIn.lua
Original file line number Diff line number Diff line change
Expand Up @@ -625,23 +625,24 @@ function module.Blacklist.isBlacklisted(lookupId)
local wildcardBlacklist = blacklistDB.Wildcard

-- Function to perform a case-insensitive search
local function isNameInBlacklist(blacklist, checkName)
local function isInPairSearch(blacklist, checkName)
for _, key in pairs(blacklist) do
if string.find(string.lower(checkName), string.lower(key)) then return true end
end
return false
end

-- Check for direct match in blacklists or wildcard match
if SUI:IsInTable(gossipBlacklist, name) or SUI:IsInTable(TempBlackList, name) or SUI:IsInTable(questBlacklist, lookupId) then
if SUI:IsInTable(gossipBlacklist, name) or SUI:IsInTable(TempBlackList, name) then
debug(name .. '---IS BLACKLISTED')
return true
elseif isNameInBlacklist(wildcardBlacklist, name) then
elseif isInPairSearch(wildcardBlacklist, name) or isInPairSearch(questBlacklist, name) then
debug(name .. ' - IS BLACKLISTED')
return true
end

-- Not blacklisted
debug(name .. '---IS NOT BLACKLISTED')
return false
end

Expand Down

0 comments on commit 9267118

Please sign in to comment.