Quantcast

Removed a possible taint

Alar of Runetotem [08-03-16 - 20:59]
Removed a possible taint

Refactore UIDropDown use
Filename
FollowerRecruiting.lua
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