comparison Core.lua @ 139:debff5ad3de4

Possible issue with the overriding of the CheckInbox function where the first call to it after a login might not work might have been fixed. (I can?t reproduce it, but can see the potential for problems)
author Zerotorescue
date Sat, 29 Jan 2011 22:24:19 +0100
parents 9998d4ff8152
children 2af0f77dbae0
comparison
equal deleted inserted replaced
138:2c6184c56192 139:debff5ad3de4
333 self:RegisterEvent("MAIL_SHOW"); 333 self:RegisterEvent("MAIL_SHOW");
334 self:RegisterEvent("PLAYER_ENTERING_WORLD"); 334 self:RegisterEvent("PLAYER_ENTERING_WORLD");
335 335
336 self.btnConfig:Show(); 336 self.btnConfig:Show();
337 337
338 -- Reset variables
339 lastAmount = 0;
340 self.debugChannel = nil;
341
338 if not originalCheckInbox then 342 if not originalCheckInbox then
339 -- Override the CheckInbox function 343 -- Override the CheckInbox function
340 -- Remember the original 344 -- Remember the original
341 originalCheckInbox = CheckInbox; 345 originalCheckInbox = CheckInbox;
342 -- Then override that 346 -- Then override that
343 CheckInbox = NewCheckInbox; 347 CheckInbox = NewCheckInbox;
344 end 348 end
345
346 -- Reset variables
347 lastAmount = 0;
348 self.debugChannel = nil;
349 349
350 -- If we were toggling this addon on while the mailbox is opened we must register all events again 350 -- If we were toggling this addon on while the mailbox is opened we must register all events again
351 if MailFrame:IsVisible() then 351 if MailFrame:IsVisible() then
352 self:MAIL_SHOW(); 352 self:MAIL_SHOW();
353 end 353 end
816 816
817 -- The idea for this is to wait with refresing while there is still mail remaining which can be opened 817 -- The idea for this is to wait with refresing while there is still mail remaining which can be opened
818 -- This should speed things up a tiny bit, but might become buggy if coded wrong 818 -- This should speed things up a tiny bit, but might become buggy if coded wrong
819 -- We actually override the function in the onenable 819 -- We actually override the function in the onenable
820 function NewCheckInbox(...) 820 function NewCheckInbox(...)
821 if not MailOpener.db.profile.general.overrideCheckInbox or not MailOpener.db.profile.general.continueOpening or lastAmount == 0 then 821 if not MailOpener.db.profile.general.overrideCheckInbox or not MailOpener.db.profile.general.continueOpening or not lastAmount or lastAmount == 0 then
822 -- If the override Check Inbox option is off 822 -- If the override Check Inbox option is off
823 -- or continuous opening is off 823 -- or continuous opening is off
824 -- or there's currently no mail visible 824 -- or there's currently no mail visible
825 825
826 MailOpener:Debug("CheckInbox:" .. tostring((not MailOpener.db.profile.general.overrideCheckInbox)) .. "/" .. tostring((not MailOpener.db.profile.general.continueOpening)) .. "/" .. tostring(lastAmount == 0)); 826 MailOpener:Debug("CheckInbox:" .. tostring((not MailOpener.db.profile.general.overrideCheckInbox)) .. "/" .. tostring((not MailOpener.db.profile.general.continueOpening)) .. "/" .. tostring(lastAmount == 0));