# HG changeset patch # User Zerotorescue # Date 1287606771 -7200 # Node ID f662ee4d9c05e62160d2154d9a6a2a26cc6f7b06 # Parent 43a7124c984728ea046dc88c66956688381e7dfd Fixed the retrieval of a single attachment from mail when you are close to the keep free space limit. diff -r 43a7124c9847 -r f662ee4d9c05 Modules/OpenAll.lua --- a/Modules/OpenAll.lua Wed Oct 20 22:31:41 2010 +0200 +++ b/Modules/OpenAll.lua Wed Oct 20 22:32:51 2010 +0200 @@ -10,7 +10,7 @@ When shift clicking the Open All button it should override all filters. ]] -local MAIL_ITEM_INDEX, MAIL_OPEN_EVERYTHING, mailTimer, inventoryFull, inventoryFullSoundPlayed, inventoryFullSoundPlayedThisVisit, opening, lastSync, numCurrentMail, numHiddenMail, continue, firstOpenThisSync; +local MAIL_ITEM_INDEX, MAIL_OPEN_EVERYTHING, mailTimer, inventoryFull, inventoryFullSoundPlayed, inventoryFullSoundPlayedThisVisit, opening, lastSync, numCurrentMail, numHiddenMail, continue, firstOpenThisSync, takingSingleItem; function mod:OnInitialize() local defaults = { @@ -349,6 +349,10 @@ inventoryFull = false; -- Replay sound inventoryFullSoundPlayed = nil; + + if opening and takingSingleItem then + self:ScheduleTimer("Continue", self.db.profile.speed); + end end -- We registered this event to look for the inventory full error message because this is faster than counting the amount of items in the inventory all the time @@ -454,6 +458,8 @@ return; -- not auction mail end +local slotsAvailable; + function mod:OpenMail(index) if index and index > 0 then -- LUA arrays start at 1, so mail with index 0 doesn't exist, so we're finished @@ -488,7 +494,6 @@ elseif ((gold and gold > 0) or (items and items > 0)) then -- Mail with some sort of attachments - local slotsAvailable; if self.db.profile.keepFreeSpace > 0 then slotsAvailable = 0; @@ -615,9 +620,15 @@ self:Debug("Taking attachment " .. attachIndex); TakeInboxItem(index, attachIndex); + takingSingleItem = true; + + -- We want to open the next attachment for this same mail again, so set the index one back + MAIL_ITEM_INDEX = ( MAIL_ITEM_INDEX + 1 ); -- Gained an item, lost an available slot slotsAvailable = ( slotsAvailable - 1 ); + + break; else -- No more room available, announce and go to next item if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped.keepFreeSpaceLimit then @@ -646,6 +657,7 @@ end end + self:CancelTimer(self.tmrMailOpener, true); -- And prepare for the next self.tmrMailOpener = self:ScheduleTimer("OpenNext", self.db.profile.speed); end @@ -688,13 +700,14 @@ else -- Try again at the next interval + self:CancelTimer(self.tmrMailOpener, true); self.tmrMailOpener = self:ScheduleTimer("OpenNext", self.db.profile.speed); end end function mod:Continue() continue = true; - self:OpenNext(); + takingSingleItem = nil; end local mailRemainingPatterns = { @@ -802,6 +815,8 @@ -- Stopped opening, so allow to continue continue = true; + takingSingleItem = nil; + self:SetOpeningStatus(false); end