From 00c24a09092e29c0fbf97c9a554954641c615147 Mon Sep 17 00:00:00 2001 From: Xruptor Date: Sat, 11 Aug 2018 11:16:59 -0400 Subject: [PATCH] -Fixed yet another taint error for the UnitPopups options --- XanChat.lua | 19 +++++++++++++------ XanChat.toc | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/XanChat.lua b/XanChat.lua index 2f61cfd..b8dea21 100644 --- a/XanChat.lua +++ b/XanChat.lua @@ -55,6 +55,11 @@ end ------------------------------ --special thanks to Tekkub for tekPlayerMenu +local function insertbefore(t, before, val) + for k,v in ipairs(t) do if v == before then return table.insert(t, k, val) end end + table.insert(t, val) +end + StaticPopupDialogs["COPYNAME"] = { text = "COPY NAME", button2 = CANCEL, @@ -68,7 +73,6 @@ StaticPopupDialogs["COPYNAME"] = { maxLetters = 255, } -local menuList = {"PLAYER","RAID_PLAYER","PARTY","FRIEND"} local clickers = {["COPYNAME"] = function(a1) xanChat_DoCopyName(a1) end, ["WHO"] = SendWho, ["GUILD_INVITE"] = GuildInvite} --removed dist as it was causing errors @@ -76,11 +80,14 @@ UnitPopupButtons["COPYNAME"] = {text = "Copy Name"} UnitPopupButtons["GUILD_INVITE"] = {text = "Guild Invite"} UnitPopupButtons["WHO"] = {text = "Who"} -for k,v in pairs(menuList) do - table.insert(UnitPopupMenus[v], #UnitPopupMenus[v], "COPYNAME") - table.insert(UnitPopupMenus[v], #UnitPopupMenus[v], "GUILD_INVITE") - table.insert(UnitPopupMenus[v], #UnitPopupMenus[v], "WHO") -end +insertbefore(UnitPopupMenus["FRIEND"], "GUILD_PROMOTE", "GUILD_INVITE") +insertbefore(UnitPopupMenus["FRIEND"], "IGNORE", "COPYNAME") +insertbefore(UnitPopupMenus["FRIEND"], "IGNORE", "WHO") + +insertbefore(UnitPopupMenus["RAID_PLAYER"], "IGNORE", "COPYNAME") +insertbefore(UnitPopupMenus["PARTY"], "IGNORE", "COPYNAME") +insertbefore(UnitPopupMenus["PLAYER"], "IGNORE", "COPYNAME") + hooksecurefunc("UnitPopup_HideButtons", function() local dropdownMenu = UIDROPDOWNMENU_INIT_MENU diff --git a/XanChat.toc b/XanChat.toc index 3bb8005..e810ec7 100644 --- a/XanChat.toc +++ b/XanChat.toc @@ -2,7 +2,7 @@ ## Title: xanChat ## Notes: A very minimalistic chat modification addon. ## Author: Xruptor -## Version: 4.6 +## Version: 4.7 ## OptionalDeps: tekDebug ## SavedVariables: XCHT_DB, XCHT_HISTORY -- 1.7.9.5