View Single Post
04-16-12, 04:33 PM   #6
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
There is, actually.

In my own testing with my own addon Hydra, as well as reports from users, some people receive the event before the dialog is shown, while others show the dialog before receiving the event. It only ever works one way on my client, but apparently it is not consistent between clients. In Hydra, I use both detection methods (securehook on StaticPopup_Show and register for PARTY_INVITE_REQUEST event), and whenever either one occurs, check if the dialog is visible and run StaticPopup_OnClick if it is.

I experienced a similar issue years ago with guild information loading at login. After working with several users who reported that my addon was not working, I discovered that some clients receive guild information from the server (and fire PLAYER_GUILD_UPDATE) before any addons are loaded, so addons never see this event at login, while other clients (eg. mine) do not have any guild information available at login and must wait for the event.

In this case, though, hooking the dialog show is the optimal solution for the OP, as his goal is to automatically click "Decline" on the dialog (thus hiding the dialog and declining the invite). Since the dialog may not yet be visible when his addon receives the event, registering for the event is not optimal.
  Reply With Quote