Mercurial > wow > mailopener
changeset 115:97205db58bad
Disabling Mail Opener will now also stop the overriding of the CheckInbox function.
| author | Zerotorescue |
|---|---|
| date | Thu, 07 Oct 2010 23:34:34 +0200 |
| parents | 05084fdb7e3d |
| children | cff956d6e9d0 |
| files | Core.lua |
| diffstat | 1 files changed, 19 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- 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(...);
