Thread Tools Display Modes
12-22-06, 08:36 AM   #1
Anea
A Defias Bandit
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2
Hooking the secure UnitFrame pop-up

Hello all,

I have some trouble working out how the new secure stuff should be handled... This code worked fine untill patch 2.0...

I first add a menu command to the UnitFrame menu's:
Code:
table.insert(UnitPopupMenus["PLAYER"], 8, "MYMOD");
table.insert(UnitPopupMenus["FRIEND"], 4, "MYMOD");
Then I hook the UnitPopup function:
Code:
MyOrig_UnitPopup_OnClick = UnitPopup_OnClick;
UnitPopup_OnClick = My_UnitPopup_OnClick;
The function My_UnitPopup_OnClick consists of some text output to the default chatframe:
Code:
local dropdownFrame = getglobal(UIDROPDOWNMENU_INIT_MENU);
local val = this.value;
local unit = dropdownFrame.unit;
local name = dropdownFrame.name;
if (val == "MYMOD") then
  -- Retrieve some info, output some text.
end
The above hooking works fine as long it concerns safe functions, but gives the famous "... has been blocked from an action ..."-error as soon as one tries to select eg. duel, or dismiss pet.

Ok so, this needs to be done secure. No problem, so I changed the hooking code to:
Code:
hooksecurefunc("UnitPopup_OnClick", My_UnitPopup_OnClick);
Interesting but true: Nothing changed... I still get the same error. I am puzzled as I really do not execute any "harmfull code" when an option is selected that isn't mine.

Would love to see your expert options on this!

Greetings!
Anea
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Hooking the secure UnitFrame pop-up


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off