case insensitive for message and option to disable blacklist

Leandro Silva [04-06-20 - 19:27]
case insensitive for message and option to disable blacklist
Filename
Inviter.lua
LeoDolmenRunner.lua
LeoDolmenRunner.txt
Settings.lua
diff --git a/Inviter.lua b/Inviter.lua
index 1d1eb7b..654188a 100644
--- a/Inviter.lua
+++ b/Inviter.lua
@@ -36,7 +36,7 @@ function Inviter:CheckOfflines()
             LeoDolmenRunner.debug("Removing " .. name .. " from kick list, back online")
             Inviter.kickList[name] = nil
         end
-        if self:IsPlayerInBlacklist(name) then
+        if LeoDolmenRunner.settings.inviter.enableBlacklist and self:IsPlayerInBlacklist(name) then
             Inviter.kickList[name] = {
                 unitTag = unitTag,
                 added  = 0
@@ -60,6 +60,7 @@ function Inviter:ChatMessage(type, from, message)
     if type ~= CHAT_CHANNEL_SAY and type ~= CHAT_CHANNEL_YELL and type ~= CHAT_CHANNEL_ZONE and type ~= CHAT_CHANNEL_ZONE_LANGUAGE_1 and
     type ~= CHAT_CHANNEL_ZONE_LANGUAGE_2 and type ~= CHAT_CHANNEL_ZONE_LANGUAGE_3 and type ~= CHAT_CHANNEL_ZONE_LANGUAGE_4 then return end

+    message = string.lower(message)
     if message ~= Inviter.message or from == nil or from == "" then return end

     from = from:gsub("%^.+", "")
@@ -89,9 +90,10 @@ end
 local orig_GroupListRow_OnMouseUp = ZO_GroupListRow_OnMouseUp
 function ZO_GroupListRow_OnMouseUp(control, button, upInside)
     orig_GroupListRow_OnMouseUp(control, button, upInside)
-    if button == MOUSE_BUTTON_INDEX_RIGHT and upInside then
+    if not LeoDolmenRunner.settings.inviter.enableBlacklist then return end
+    local data = ZO_ScrollList_GetData(control)
+    if button == MOUSE_BUTTON_INDEX_RIGHT and upInside and data.characterName ~= GetUnitName("player") then
         AddMenuItem("LDR: Add to blacklist", function()
-            local data = ZO_ScrollList_GetData(control)
             LeoDolmenRunner.log("Adding " .. data.characterName .. " to the blacklist")
             table.insert(LeoDolmenRunner.settings.inviter.blacklist, data.characterName)
         end)
@@ -148,6 +150,8 @@ function Inviter:Start(message)

     if message ~= nil then Inviter.message = message end

+    Inviter.message = string.lower(Inviter.message)
+
     LeoDolmenRunnerWindowInviterPanelMessage:SetText(Inviter.message)

     LeoDolmenRunner.log("Starting auto invite. Listening to " .. Inviter.message)
diff --git a/LeoDolmenRunner.lua b/LeoDolmenRunner.lua
index 158db70..74ab2d7 100644
--- a/LeoDolmenRunner.lua
+++ b/LeoDolmenRunner.lua
@@ -1,7 +1,7 @@
 LeoDolmenRunner = {
     name = "LeoDolmenRunner",
     displayName = "Leo's Dolmen Runner",
-    version = "1.1.5",
+    version = "1.1.6",
     chatPrefix = "|c39B027LeoDolmenRunner|r: ",
     isDebug = false,
     defaults = {
@@ -14,6 +14,7 @@ LeoDolmenRunner = {
         inviter = {
             maxSize = 24,
             autoKick = false,
+            enableBlacklist = true,
             kickDelay = 10,
             blacklist = {}
         }
@@ -122,6 +123,7 @@ local function OnAddOnLoaded(event, addonName)
     LDR.settings = LibSavedVars:NewAccountWide( LDR.name .. "_Data", "Account", LDR.defaults )

     if not LeoDolmenRunner.settings.inviter.blacklist then LeoDolmenRunner.settings.inviter.blacklist = {} end
+    if not LeoDolmenRunner.settings.inviter.enableBlacklist then LeoDolmenRunner.settings.inviter.enableBlacklist = true end

     LDR:Initialize()

diff --git a/LeoDolmenRunner.txt b/LeoDolmenRunner.txt
index 85cfe63..c9b88db 100644
--- a/LeoDolmenRunner.txt
+++ b/LeoDolmenRunner.txt
@@ -1,7 +1,7 @@
 ## Title: Leo's Dolmen Runner
 ## APIVersion: 100029 100030
-## Version: 1.1.5
-## AddOnVersion: 115
+## Version: 1.1.6
+## AddOnVersion: 116
 ## Author: |c39B027@LeandroSilva|r
 ## SavedVariables: LeoDolmenRunner_Data
 ## DependsOn: LibFeedback LibAddonMenu-2.0 LibSavedVars
diff --git a/Settings.lua b/Settings.lua
index 2c3eeca..bfa0b71 100644
--- a/Settings.lua
+++ b/Settings.lua
@@ -69,6 +69,13 @@ function LeoDolmenRunner_Settings:CreatePanel()
             getFunc = function() return LeoDolmenRunner.settings.inviter.maxSize end,
             setFunc = function(value) LeoDolmenRunner.settings.inviter.maxSize = value end,
             default = 24,
+        },{
+            type = "checkbox",
+            name = "Enable Blacklist",
+            default = true,
+            width = "full",
+            getFunc = function() return LeoDolmenRunner.settings.inviter.enableBlacklist end,
+            setFunc = function(value) LeoDolmenRunner.settings.inviter.enableBlacklist = value end,
         }
     }
     LAM:RegisterOptionControls(OptionsName, optionsData)