WoW:API AcceptGroup: Difference between revisions

m
Move page script moved page API AcceptGroup to WoW:API AcceptGroup without leaving a redirect
(Trying to bring more in line with Help:API_Function_articles by adding boilerplate and such)
m (Move page script moved page API AcceptGroup to WoW:API AcceptGroup without leaving a redirect)
 
(One intermediate revision by one other user not shown)
Line 17: Line 17:
   
   
  function MyAddon:confirmPartyInvite(info, sender)
  function MyAddon:confirmPartyInvite(info, sender)
  local inviteAccepted = false;
   if ( MyAddon:someTestOfSenderThatYouMakeUp(sender) ) then
   if ( MyAddon:someTestOfSenderThatYouMakeUp(sender) ) then
     AcceptGroup();
     AcceptGroup();
     inviteAccepted = true;
     self:RegisterEvent("PARTY_MEMBERS_CHANGED", "closePopup")
   end
   end
end
   
   
  if ( inviteAccepted ) then
function MyAddon:closePopup()
    StaticPopup_Hide("PARTY_INVITE");
  StaticPopup_Hide("PARTY_INVITE")
   end
   self:UnregisterEvent("PARTY_MEMBERS_CHANGED")
  end
  end
 


== Result ==
== Result ==
Line 39: Line 37:
Note that calling this function does NOT cause the "accept/decline dialog" to go away. Use [[API_StaticPopup_Hide|StaticPopup_Hide]]("PARTY_INVITE") to hide the dialog.
Note that calling this function does NOT cause the "accept/decline dialog" to go away. Use [[API_StaticPopup_Hide|StaticPopup_Hide]]("PARTY_INVITE") to hide the dialog.


As of 3.1 calling StaticPopup_Hide("PARTY_INVITE") too quickly after AcceptGroup() appears to interfere with the actual accepting.
As of 3.1 calling StaticPopup_Hide("PARTY_INVITE") too quickly after AcceptGroup() will interfere with accepting the invitation, and it will instead instantly be declined. To avoid this, you will need to register the PARTY_MEMBERS_CHANGED event and hide the popup when that occurs.
Anonymous user