From f5df4879890d1b4bee4e1a704690501dbd462eec Mon Sep 17 00:00:00 2001 From: Alar of Runetotem Date: Wed, 3 Aug 2016 22:59:43 +0200 Subject: [PATCH] Removed a possible taint Refactore UIDropDown use --- FollowerRecruiting.lua | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/FollowerRecruiting.lua b/FollowerRecruiting.lua index a62f333..a3873be 100644 --- a/FollowerRecruiting.lua +++ b/FollowerRecruiting.lua @@ -3,13 +3,17 @@ ns.Configure() local addon=addon local GRF=GarrisonRecruiterFrame.Pick local module=addon:NewSubClass("RecruitingPage") --#module -function module:OnInitialize() +local function changetext(this) + --securecall(print,"secure?",issecure(),this:GetText()) end -local origGarrisonRecruiterFrame_AddEntryToDropdown=GarrisonRecruiterFrame_AddEntryToDropdown -function _G.GarrisonRecruiterFrame_AddEntryToDropdown(entry,info,level) - info.text = entry.name; - info.value = entry.id; - info.checked = (GRF.dropDownValue == info.value); +local function HookedGarrisonRecruiterFrame_AddEntryToDropdown(entry,info,level) + if ( not level ) then + return + end + local listFrame = _G["DropDownList"..level] + local index = listFrame.numButtons + local listFrameName = listFrame:GetName(); + local button = _G[listFrameName.."Button"..index]; if (entry.id) then local list=GRF.Title2:GetText()==GARRISON_CHOOSE_THREAT and addon:GetFollowersWithCounterFor(entry.id) or addon:GetFollowersWithTrait(entry.id) if list then @@ -18,8 +22,17 @@ function _G.GarrisonRecruiterFrame_AddEntryToDropdown(entry,info,level) for i=1,#list do info.tooltipText=info.tooltipText.."\n"..addon:GetFollowerData(list[i],'fullname',L["Some follower"]) .. " " .. addon:GetFollowerStatus(list[i],false,true) end - + if ( info.colorCode ) then + --button:SetText(info.colorCode..info.text.."|r"); + else + button:SetText(info.text); + end + button.tooltipText=info.tooltipText + --button.tooltipTitle=GARRISON_FOLLOWERS end end - UIDropDownMenu_AddButton(info, level); +end +function module:OnInitialize() + --self:SafeSecureHook("GarrisonRecruiterFrame_AddEntryToDropdown") + hooksecurefunc("GarrisonRecruiterFrame_AddEntryToDropdown",HookedGarrisonRecruiterFrame_AddEntryToDropdown) end -- 1.7.9.5