# HG changeset patch # User Zerotorescue # Date 1286487274 -7200 # Node ID 97205db58bad88aa45fc3ccd3f15d2b4bdb17d72 # Parent 05084fdb7e3de838ea15329b17af67c6258dd493 Disabling Mail Opener will now also stop the overriding of the CheckInbox function. diff -r 05084fdb7e3d -r 97205db58bad Core.lua --- a/Core.lua Fri Oct 01 23:42:15 2010 +0200 +++ b/Core.lua Thu Oct 07 23:34:34 2010 +0200 @@ -6,7 +6,7 @@ -- MailAddonBusy will be nil when nothing is happening or filled with the addon name when MO is working -- Another addon can use this variable to indicate they're working too, MailOpener will then wait for that to finish -local AutoOpenMail, MailOpenerConfig, lastAmount, lastQuickAuctionsStatus, freshList, mailboxEmptySoundPlayed, mailboxEmptySoundPlayedThisVisit, hasOpenedMailAlready; +local AutoOpenMail, MailOpenerConfig, lastAmount, lastQuickAuctionsStatus, freshList, mailboxEmptySoundPlayed, mailboxEmptySoundPlayedThisVisit, hasOpenedMailAlready, originalCheckInbox; function MailOpener:OnInitialize() self:Debug("OnInitialize"); @@ -321,15 +321,18 @@ self.btnConfig:Show(); + if not originalCheckInbox then + -- Override the CheckInbox function + -- Remember the original + originalCheckInbox = CheckInbox; + -- Then override that + CheckInbox = NewCheckInbox; + end + -- Reset variables lastAmount = 0; self.debugChannel = nil; - --BETA:if (self.db.profile.uses % 15) == 0 then - --BETA: -- Automatically show once every 15 uses - --BETA: self:ShowBetaPopup(); - --BETA:end - -- If we were toggling this addon on while the mailbox is opened we must register all events again if MailFrame:IsVisible() then self:MAIL_SHOW(); @@ -341,6 +344,13 @@ self.btnConfig:Hide(); + if originalCheckInbox then + -- Change checkinbox back to the original value + CheckInbox = originalCheckInbox; + -- Forget the other reference + originalCheckInbox = nil; + end + MailOpener:Stop(); end @@ -790,14 +800,14 @@ -- The idea for this is to wait with refresing while there is still mail remaining which can be opened -- This should speed things up a tiny bit, but might become buggy if coded wrong -local originalCheckInbox = CheckInbox; -function CheckInbox(...) +-- We actually override the function in the onenable +function NewCheckInbox(...) if not MailOpener.db.profile.general.overrideCheckInbox or not MailOpener.db.profile.general.continueOpening or lastAmount == 0 then -- If the override Check Inbox option is off -- or continuous opening is off -- or there's currently no mail visible - MailOpener:Debug("CheckInbox:" .. tostring(MailOpener.db.profile.general.overrideCheckInbox) .. "/" .. tostring(MailOpener.db.profile.general.continueOpening) .. "/" .. tostring(lastAmount == 0)); + MailOpener:Debug("CheckInbox:" .. tostring((not MailOpener.db.profile.general.overrideCheckInbox)) .. "/" .. tostring((not MailOpener.db.profile.general.continueOpening)) .. "/" .. tostring(lastAmount == 0)); -- Just call the original function return originalCheckInbox(...);