WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Are quit() and logout() now protected? (https://www.wowinterface.com/forums/showthread.php?t=55823)

ceylina 10-25-17 01:11 PM

Are quit() and logout() now protected?
 
As of 7.3.2, the functions logout() and quit() are somehow considered protected now. I am trying to look to see if anything has changed that no longer allows you to programmatically call logout or quit() or if there is a new function call that replaces it with the latest patch.

http://wowprogramming.com/docs/api/Quit

This is what happens when trying to call it.
[ADDON_ACTION_FORBIDDEN] AddOn 'quickQuit' tried to call the protected function 'Quit()'.

I mean I can hit escape and use the built in exit buttons so that isn't being tainted or anything.

Fizzlemizz 10-25-17 01:21 PM

It appears so. You can still /logout and /quit

ceylina 10-25-17 01:25 PM

Sadness. I hate using macros in code. Hopefully someone will figure out the change

MunkDev 10-25-17 01:59 PM

It might not be fully protected, might just require a hardware event. E.g. you can call ReloadUI in a click script on an unprotected button, but you can't call ReloadUI from an event handler or an update script.

Fizzlemizz 10-25-17 02:08 PM

The error say they are only available to the Blizzard UI. You can /run ReloadUI() but not /run Logout() or /run Quit()

thomasjohnshannon 10-25-17 05:07 PM

Has anyone else noticed an error when you /camp if you have an addon with a SlashCmdList loaded?

MunkDev 10-25-17 05:36 PM

Quote:

Originally Posted by thomasjohnshannon (Post 325657)
Has anyone else noticed an error when you /camp if you have an addon with a SlashCmdList loaded?

Yes. They forgot to add the slash handlers for logout and quit to the secure command hash table. The table is populated with all the existing SecureCmdList functions, but logout and quit are declared afterwards with the rest of the unprotected functions.
Lua Code:
  1. -- starting at line 1584
  2. -- Pre-populate the secure command hash table
  3. for index, value in pairs(SecureCmdList) do
  4.     local i = 1;
  5.     local cmdString = _G["SLASH_"..index..i];
  6.     while ( cmdString ) do
  7.         cmdString = strupper(cmdString);
  8.         hash_SecureCmdList[cmdString] = value;  -- add to hash
  9.         i = i + 1;
  10.         cmdString = _G["SLASH_"..index..i];
  11.     end
  12. end

Lua Code:
  1. -- starting at line 1700
  2. SlashCmdList["LOGOUT"] = function(msg)
  3.     Logout();
  4. end
  5.  
  6. SlashCmdList["QUIT"] = function(msg)
  7.     if (IsKioskModeEnabled()) then
  8.         return;
  9.     end
  10.     Quit();
  11. end

This should be reported as a bug.

thomasjohnshannon 10-26-17 10:42 AM

Quote:

Originally Posted by MunkDev (Post 325654)
It might not be fully protected, might just require a hardware event. E.g. you can call ReloadUI in a click script on an unprotected button, but you can't call ReloadUI from an event handler or an update script.

I did a quick test with a static popup and it seems to be totally protected.

AnrDaemon 11-12-17 12:08 PM

In other words, LDB Exit_Buton is completely useless and can't be repaired ATM?

myrroddin 11-13-17 08:27 PM

Quote:

Originally Posted by AnrDaemon (Post 325778)
In other words, LDB Exit_Buton is completely useless and can't be repaired ATM?

Correct. +10 characters.

MunkDev 11-13-17 09:59 PM

Lua Code:
  1. local button = CreateFrame('Button', 'ExitButton', nil, 'InsecureActionButtonTemplate')
  2. button:SetAttribute('type', 'macro')
  3. button:SetAttribute('macrotext', '/exit')

...should work.

Fizzlemizz 11-17-17 05:45 PM

Quote:

Originally Posted by MunkDev (Post 325795)
Lua Code:
  1. local button = CreateFrame('Button', 'ExitButton', nil, 'InsecureActionButtonTemplate')
  2. button:SetAttribute('type', 'macro')
  3. button:SetAttribute('macrotext', '/exit')

...should work.

It does work.


All times are GMT -6. The time now is 08:01 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI