comparison Modules/OpenAll.lua @ 174:463e29ca6b08

More merging'
author Zachary Kotlarek <zach@kotlarek.com>
date Sun, 10 Mar 2013 16:08:39 -0700
parents 2b11229bf239
children
comparison
equal deleted inserted replaced
173:7452702f6f35 174:463e29ca6b08
8 --[[ 8 --[[
9 Dev notes: 9 Dev notes:
10 When shift clicking the Open All button it should override all filters. 10 When shift clicking the Open All button it should override all filters.
11 ]] 11 ]]
12 12
13 local MAIL_ITEM_INDEX, MAIL_OPEN_EVERYTHING, mailTimer, inventoryFull, inventoryFullSoundPlayed, inventoryFullSoundPlayedThisVisit, opening, lastSync, numCurrentMail, numHiddenMail, continue; 13 local MAIL_ITEM_INDEX, MAIL_OPEN_EVERYTHING, mailTimer, inventoryFull, inventoryFullSoundPlayed, inventoryFullSoundPlayedThisVisit, opening, lastSync, numCurrentMail, numHiddenMail, continue, firstOpenThisSync, takingSingleItem;
14 14
15 function mod:OnInitialize() 15 function mod:OnInitialize()
16 local defaults = { 16 local defaults = {
17 profile = { 17 profile = {
18 speed = 0.05, 18 speed = 0.05,
44 local button = CreateFrame("Button", "btnMailOpenerOpenAll", InboxFrame, "UIPanelButtonTemplate"); 44 local button = CreateFrame("Button", "btnMailOpenerOpenAll", InboxFrame, "UIPanelButtonTemplate");
45 button:SetText(L["Open all"]); 45 button:SetText(L["Open all"]);
46 button:SetHeight(26); 46 button:SetHeight(26);
47 button:SetWidth(120); 47 button:SetWidth(120);
48 button:SetPoint("BOTTOM", InboxFrame, "CENTER", -10, -165); 48 button:SetPoint("BOTTOM", InboxFrame, "CENTER", -10, -165);
49 button:RegisterForClicks("LeftButtonUp", "RightButtonUp"); 49 button:RegisterForClicks("LeftButtonUp", "RightButtonUp", "MiddleButtonUp");
50 button:SetScript("OnClick", function(self, mouseButton) 50 button:SetScript("OnClick", function(self, mouseButton)
51 local action = "open";
51 if mouseButton == "RightButton" then 52 if mouseButton == "RightButton" then
53 action = "menu";
54 elseif mouseButton == "MiddleButton" or (mouseButton == "LeftButton" and IsAltKeyDown()) then
55 action = "stop";
56 end
57
58 if action == "menu" then
52 -- Hide the gametooltip 59 -- Hide the gametooltip
53 GameTooltip:Hide(); 60 GameTooltip:Hide();
54 61
55 if not mod.ddmFilters then 62 if not mod.ddmFilters then
56 -- Build the drop down menu 63 -- Build the drop down menu
116 info.text = L["Other mail with gold"]; 123 info.text = L["Other mail with gold"];
117 info.func = function(this) mod.db.profile.filter.normalMoney = this.checked; end; 124 info.func = function(this) mod.db.profile.filter.normalMoney = this.checked; end;
118 info.checked = mod.db.profile.filter.normalMoney; 125 info.checked = mod.db.profile.filter.normalMoney;
119 UIDropDownMenu_AddButton(info, level); 126 UIDropDownMenu_AddButton(info, level);
120 127
121 -- Make Other mail with gold 128 -- Close link
122 info.text = CLOSE; 129 info.text = CLOSE;
123 info.func = function() CloseDropDownMenus(); end; 130 info.func = function() CloseDropDownMenus(); end;
124 info.checked = nil; 131 info.checked = nil;
125 info.notCheckable = true; 132 info.notCheckable = true;
126 UIDropDownMenu_AddButton(info, level); 133 UIDropDownMenu_AddButton(info, level);
131 138
132 mod.ddmFilters = dropDownMenu; 139 mod.ddmFilters = dropDownMenu;
133 end 140 end
134 141
135 ToggleDropDownMenu(1, nil, mod.ddmFilters, self:GetName(), 0, 0); 142 ToggleDropDownMenu(1, nil, mod.ddmFilters, self:GetName(), 0, 0);
143 elseif action == "stop" then
144 MailOpener:Print(L["Interrupting mail opening as the alt key was held down while clicking the open all button or the middle mouse-button was used on it."]);
145
146 mod:StopOpening(true);
136 else 147 else
137 mod:Open(true, IsShiftKeyDown()); 148 mod:Open(true, IsShiftKeyDown());
138 end 149 end
139 end); 150 end);
140 button.tooltipTitle = L["Open all"]; 151 button.tooltipTitle = L["Open all"];
141 button.tooltip = L["Hold |cfffed000shift|r while clicking this button to temporarily override your filters and loot every single mail containing attachments and/or gold.\n\n|cfffed000Right|r click this button to quickly adjust mail opening filters for this profile."]; 152 button.tooltip = L["Hold |cfffed000shift|r while clicking this button to temporarily override your filters and loot every single mail containing attachments and/or gold.\n\n|cfffed000Right|r click this button to quickly adjust mail opening filters for this profile.\n\n|cfffed000Middle|r click or hold |cfffed000alt|r while clicking this button to interrupt mail opening."];
142 button:SetScript("OnEnter", function(self) 153 button:SetScript("OnEnter", function(self)
143 if MailOpener.db.profile.general.showHelpTooltips then 154 if MailOpener.db.profile.general.showHelpTooltips then
144 GameTooltip:SetOwner(self, "ANCHOR_NONE") 155 GameTooltip:SetOwner(self, "ANCHOR_NONE")
145 GameTooltip:SetPoint("BOTTOM", self, "TOP") 156 GameTooltip:SetPoint("BOTTOM", self, "TOP")
146 GameTooltip:SetText(self.tooltipTitle, 1, .82, 0, 1) 157 GameTooltip:SetText(self.tooltipTitle, 1, .82, 0, 1)
269 280
270 -- We need to know when to start opening 281 -- We need to know when to start opening
271 self:RegisterMessage("MO_OPEN_MAIL", "Open"); 282 self:RegisterMessage("MO_OPEN_MAIL", "Open");
272 self:RegisterMessage("MO_SERVER_SYNCED"); 283 self:RegisterMessage("MO_SERVER_SYNCED");
273 self:RegisterMessage("MO_MAIL_EMPTIED"); 284 self:RegisterMessage("MO_MAIL_EMPTIED");
285 self:RegisterMessage("MO_STOP_MAIL_OPENING");
274 286
275 self:CancelTimer(self.tmrTimeRemaining, true); 287 self:CancelTimer(self.tmrTimeRemaining, true);
276 self.tmrTimeRemaining = self:ScheduleRepeatingTimer("UpdateTimer", 1); 288 self.tmrTimeRemaining = self:ScheduleRepeatingTimer("UpdateTimer", 1);
277 self:UpdateTimer(); 289 self:UpdateTimer();
278 end 290 end
290 302
291 -- We no longer care 303 -- We no longer care
292 self:UnregisterMessage("MO_OPEN_MAIL"); 304 self:UnregisterMessage("MO_OPEN_MAIL");
293 self:UnregisterMessage("MO_SERVER_SYNCED"); 305 self:UnregisterMessage("MO_SERVER_SYNCED");
294 self:UnregisterMessage("MO_MAIL_EMPTIED"); 306 self:UnregisterMessage("MO_MAIL_EMPTIED");
307 self:UnregisterMessage("MO_STOP_MAIL_OPENING");
295 308
296 self:CancelTimer(self.tmrMailOpener, true); 309 self:CancelTimer(self.tmrMailOpener, true);
297 self:CancelTimer(self.tmrTimeRemaining, true); 310 self:CancelTimer(self.tmrTimeRemaining, true);
298 311
299 self:SetOpeningStatus(false); 312 self:SetOpeningStatus(false);
306 self:StopOpening(false); 319 self:StopOpening(false);
307 320
308 lastSync = GetTime(); 321 lastSync = GetTime();
309 322
310 self:UpdateMailCount(); 323 self:UpdateMailCount();
324
325 -- While this is true, we'll announce mail skipped - will be set to false after opening happened once
326 firstOpenThisSync = true;
311 end 327 end
312 328
313 function mod:MO_MAIL_EMPTIED() 329 function mod:MO_MAIL_EMPTIED()
314 -- A mail has been processed so we can process the next 330 -- A mail has been processed so we can process the next
315 continue = true; 331 continue = true;
316 332
317 self:UpdateTimer(); 333 self:UpdateTimer();
334 end
335
336 function mod:MO_STOP_MAIL_OPENING()
337 self:StopOpening(true);
318 end 338 end
319 339
320 function mod:UpdateMailCount() 340 function mod:UpdateMailCount()
321 local numItems, totalItems = GetInboxNumItems(); 341 local numItems, totalItems = GetInboxNumItems();
322 342
327 function mod:BAG_UPDATE() 347 function mod:BAG_UPDATE()
328 -- If the bags are updated we should check if the inventory is full again 348 -- If the bags are updated we should check if the inventory is full again
329 inventoryFull = false; 349 inventoryFull = false;
330 -- Replay sound 350 -- Replay sound
331 inventoryFullSoundPlayed = nil; 351 inventoryFullSoundPlayed = nil;
352
353 if opening and takingSingleItem then
354 self:ScheduleTimer("Continue", self.db.profile.speed);
355 end
332 end 356 end
333 357
334 -- 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 358 -- 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
335 function mod:UI_ERROR_MESSAGE(e, errorMessage) 359 function mod:UI_ERROR_MESSAGE(e, errorMessage)
336 if errorMessage == ERR_INV_FULL then 360 if errorMessage == ERR_INV_FULL then
368 if newMailItemIndex > 1 then 392 if newMailItemIndex > 1 then
369 self:Debug("Open succes"); 393 self:Debug("Open succes");
370 394
371 -- Stop the previous opening and restart 395 -- Stop the previous opening and restart
372 if forced == true then 396 if forced == true then
397 -- Show skips again
398 firstOpenThisSync = true;
399
373 self:StopOpening(false); -- this is not a "simple" stop, so also reset inventory full warning 400 self:StopOpening(false); -- this is not a "simple" stop, so also reset inventory full warning
374 else 401 else
375 self:StopOpening(true); -- forced is false - automated action - simple reset, skip inventory full reset to avoid sound spam 402 self:StopOpening(true); -- forced is false - automated action - simple reset, skip inventory full reset to avoid sound spam
376 end 403 end
377 404
404 end 431 end
405 end 432 end
406 433
407 -- Return the type of mail a message subject is 434 -- Return the type of mail a message subject is
408 local knownAHSubjectPatterns = { 435 local knownAHSubjectPatterns = {
409 canceled = AUCTION_REMOVED_MAIL_SUBJECT:replace("%s", ""), 436 canceled = AUCTION_REMOVED_MAIL_SUBJECT:format(""),
410 expired = AUCTION_EXPIRED_MAIL_SUBJECT:replace("%s", ""), 437 expired = AUCTION_EXPIRED_MAIL_SUBJECT:format(""),
411 outbid = AUCTION_OUTBID_MAIL_SUBJECT:replace("%s", ""), 438 outbid = AUCTION_OUTBID_MAIL_SUBJECT:format(""),
412 success = AUCTION_SOLD_MAIL_SUBJECT:replace("%s", ""), 439 success = AUCTION_SOLD_MAIL_SUBJECT:format(""),
413 won = AUCTION_WON_MAIL_SUBJECT:replace("%s", ""), 440 won = AUCTION_WON_MAIL_SUBJECT:format(""),
414 }; 441 };
415 function mod:GetAuctionMailType(subject) 442 function mod:GetAuctionMailType(subject)
416 if subject then 443 if subject then
417 -- Check if any of our patterns match, sorted by most likely matches first (if one is true the rest shouldn't be evaluated) 444 -- Check if any of our patterns match, sorted by most likely matches first (if one is true the rest shouldn't be evaluated)
418 if subject:find(knownAHSubjectPatterns.expired) then 445 if subject:find(knownAHSubjectPatterns.expired) then
429 end 456 end
430 457
431 return; -- not auction mail 458 return; -- not auction mail
432 end 459 end
433 460
461 local slotsAvailable;
462
434 function mod:OpenMail(index) 463 function mod:OpenMail(index)
435 if index and index > 0 then 464 if index and index > 0 then
436 -- LUA arrays start at 1, so mail with index 0 doesn't exist, so we're finished 465 -- LUA arrays start at 1, so mail with index 0 doesn't exist, so we're finished
437 466
438 local sender, subject, gold, cod, _, items, _, _, _, _, isGM = select(3, GetInboxHeaderInfo(index)); 467 local sender, subject, gold, cod, _, items, _, _, _, _, isGM = select(3, GetInboxHeaderInfo(index));
439 local auctionMailType = self:GetAuctionMailType(subject); 468 local auctionMailType = self:GetAuctionMailType(subject);
440 469
441 if not subject then subject = ""; end 470 if not subject then subject = ""; end
442 471
472 local onlyShowOnceCheck = firstOpenThisSync;
473
443 local skippingString = L["Skipping %d: %s (%s)"]; 474 local skippingString = L["Skipping %d: %s (%s)"];
444 475
445 if isGM then 476 if isGM then
446 -- Blizzard Mail 477 -- Blizzard Mail
447 if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped.GMMail then 478 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped.GMMail then
448 print(skippingString:format(index, subject, L["Blizzard mail"])); 479 print(skippingString:format(index, subject, L["Blizzard mail"]));
449 end 480 end
450 481
451 self:OpenNext(); 482 self:OpenNext();
452 483
453 return; 484 return;
454 elseif cod and cod > 0 then 485 elseif cod and cod > 0 then
455 -- Cost on delivery 486 -- Cost on delivery
456 if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped.COD then 487 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped.COD then
457 print(skippingString:format(index, subject, L["C.O.D."])); 488 print(skippingString:format(index, subject, L["C.O.D."]));
458 end 489 end
459 490
460 self:OpenNext(); 491 self:OpenNext();
461 492
462 return; 493 return;
463 elseif ((gold and gold > 0) or (items and items > 0)) then 494 elseif ((gold and gold > 0) or (items and items > 0)) then
464 -- Mail with some sort of attachments 495 -- Mail with some sort of attachments
465 496
466 local slotsAvailable;
467 if self.db.profile.keepFreeSpace > 0 then 497 if self.db.profile.keepFreeSpace > 0 then
468 slotsAvailable = 0; 498 slotsAvailable = 0;
469 499
470 -- First find out the amount of empty bag slots 500 -- First find out the amount of empty bag slots
471 for bag = 0, NUM_BAG_SLOTS do 501 for bag = 0, NUM_BAG_SLOTS do
478 end 508 end
479 509
480 -- and not MAIL_OPEN_EVERYTHING 510 -- and not MAIL_OPEN_EVERYTHING
481 -- Removed above part from below if statement, I forgot why I put it here and now it makes no sense 511 -- Removed above part from below if statement, I forgot why I put it here and now it makes no sense
482 if inventoryFull and not MailOpener.db.profile.general.continueOpeningStackableItems and items and items > 0 then 512 if inventoryFull and not MailOpener.db.profile.general.continueOpeningStackableItems and items and items > 0 then
483 if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped.inventoryFull then 513 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped.inventoryFull then
484 print(skippingString:format(index, subject, L["inventory is full"])); 514 print(skippingString:format(index, subject, L["inventory is full"]));
485 end 515 end
486 516
487 self:OpenNext(); 517 self:OpenNext();
488 518
489 return; 519 return;
490 elseif self.db.profile.keepFreeSpace > 0 and items and slotsAvailable ~= nil and slotsAvailable <= 0 then 520 elseif self.db.profile.keepFreeSpace > 0 and items and slotsAvailable ~= nil and slotsAvailable <= 0 then
491 if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped.keepFreeSpaceLimit then 521 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped.keepFreeSpaceLimit then
492 print(skippingString:format(index, subject, L["keep free space limit"])); 522 print(skippingString:format(index, subject, L["keep free space limit"]));
493 end 523 end
494 524
495 self:OpenNext(); 525 self:OpenNext();
496 526
512 542
513 mailType = "AH" .. auctionMailType; 543 mailType = "AH" .. auctionMailType;
514 end 544 end
515 545
516 if not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.normalMoney and mailType == "normalGoldMail" then 546 if not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.normalMoney and mailType == "normalGoldMail" then
517 if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then 547 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped[mailType] then
518 print(skippingString:format(index, subject, L["normal mail with gold"])); 548 print(skippingString:format(index, subject, L["normal mail with gold"]));
519 end 549 end
520 550
521 self:OpenNext(); 551 self:OpenNext();
522 552
523 return; 553 return;
524 elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.normalAttachments and mailType == "normalItemsMail" then 554 elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.normalAttachments and mailType == "normalItemsMail" then
525 if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then 555 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped[mailType] then
526 print(skippingString:format(index, subject, L["normal mail with attachments"])); 556 print(skippingString:format(index, subject, L["normal mail with attachments"]));
527 end 557 end
528 558
529 self:OpenNext(); 559 self:OpenNext();
530 560
531 return; 561 return;
532 elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.AH.expired and mailType == "AHexpired" then 562 elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.AH.expired and mailType == "AHexpired" then
533 if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then 563 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped[mailType] then
534 print(skippingString:format(index, subject, L["expired auction"])); 564 print(skippingString:format(index, subject, L["expired auction"]));
535 end 565 end
536 566
537 self:OpenNext(); 567 self:OpenNext();
538 568
539 return; 569 return;
540 elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.AH.success and mailType == "AHsuccess" then 570 elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.AH.success and mailType == "AHsuccess" then
541 if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then 571 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped[mailType] then
542 print(skippingString:format(index, subject, L["successful auction"])); 572 print(skippingString:format(index, subject, L["successful auction"]));
543 end 573 end
544 574
545 self:OpenNext(); 575 self:OpenNext();
546 576
547 return; 577 return;
548 elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.AH.won and mailType == "AHwon" then 578 elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.AH.won and mailType == "AHwon" then
549 if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then 579 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped[mailType] then
550 print(skippingString:format(index, subject, L["auction won"])); 580 print(skippingString:format(index, subject, L["auction won"]));
551 end 581 end
552 582
553 self:OpenNext(); 583 self:OpenNext();
554 584
555 return; 585 return;
556 elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.AH.canceled and mailType == "AHcanceled" then 586 elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.AH.canceled and mailType == "AHcanceled" then
557 if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then 587 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped[mailType] then
558 print(skippingString:format(index, subject, L["canceled auction"])); 588 print(skippingString:format(index, subject, L["canceled auction"]));
559 end 589 end
560 590
561 self:OpenNext(); 591 self:OpenNext();
562 592
563 return; 593 return;
564 elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.AH.outbid and mailType == "AHoutbid" then 594 elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.AH.outbid and mailType == "AHoutbid" then
565 if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then 595 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped[mailType] then
566 print(skippingString:format(index, subject, L["outbid on auction"])); 596 print(skippingString:format(index, subject, L["outbid on auction"]));
567 end 597 end
568 598
569 self:OpenNext(); 599 self:OpenNext();
570 600
588 -- If we still have slots available, then loot this one item 618 -- If we still have slots available, then loot this one item
589 619
590 self:Debug("Taking attachment " .. attachIndex); 620 self:Debug("Taking attachment " .. attachIndex);
591 621
592 TakeInboxItem(index, attachIndex); 622 TakeInboxItem(index, attachIndex);
623 takingSingleItem = true;
624
625 -- We want to open the next attachment for this same mail again, so set the index one back
626 MAIL_ITEM_INDEX = ( MAIL_ITEM_INDEX + 1 );
593 627
594 -- Gained an item, lost an available slot 628 -- Gained an item, lost an available slot
595 slotsAvailable = ( slotsAvailable - 1 ); 629 slotsAvailable = ( slotsAvailable - 1 );
630
631 break;
596 else 632 else
597 -- No more room available, announce and go to next item 633 -- No more room available, announce and go to next item
598 if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped.keepFreeSpaceLimit then 634 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped.keepFreeSpaceLimit then
599 print(skippingString:format(index, subject, L["keep free space limit"])); 635 print(skippingString:format(index, subject, L["keep free space limit"]));
600 end 636 end
601 637
602 -- We're done with this mail, it isn't empty so that event won't be triggered, but we may still continue 638 -- We're done with this mail, it isn't empty so that event won't be triggered, but we may still continue
603 continue = true; 639 continue = true;
619 else 655 else
620 print(L["Processing %d: %s"]:format(index, subject)); 656 print(L["Processing %d: %s"]:format(index, subject));
621 end 657 end
622 end 658 end
623 659
660 self:CancelTimer(self.tmrMailOpener, true);
624 -- And prepare for the next 661 -- And prepare for the next
625 self.tmrMailOpener = self:ScheduleTimer("OpenNext", self.db.profile.speed); 662 self.tmrMailOpener = self:ScheduleTimer("OpenNext", self.db.profile.speed);
626 end 663 end
627 end 664 end
628 else 665 else
629 -- Unknown, probably just text 666 -- Unknown, probably just text
630 if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped.other then 667 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped.other then
631 print(L["Skipping %d: %s"]:format(index, subject)); 668 print(L["Skipping %d: %s"]:format(index, subject));
632 end 669 end
633 670
634 self:OpenNext(); 671 self:OpenNext();
635 end 672 end
636 else 673 else
637 -- Finished! 674 -- Finished!
638 if MailOpener.db.profile.notifications.finishedCurrentBatch then 675 if MailOpener.db.profile.notifications.finishedCurrentBatch and firstOpenThisSync then
639 print(L["Finished opening the current batch."]); 676 print(L["Finished opening the current batch."]);
640 end 677 end
678
679 -- We have opened mail once this batch, so quit notifying
680 firstOpenThisSync = nil;
641 681
642 self:SetOpeningStatus(false); 682 self:SetOpeningStatus(false);
643 683
644 self:Debug("MO_OPEN_COMPLETE"); 684 self:Debug("MO_OPEN_COMPLETE");
645 685
658 -- Open it 698 -- Open it
659 self:OpenMail(MAIL_ITEM_INDEX); 699 self:OpenMail(MAIL_ITEM_INDEX);
660 else 700 else
661 -- Try again at the next interval 701 -- Try again at the next interval
662 702
703 self:CancelTimer(self.tmrMailOpener, true);
663 self.tmrMailOpener = self:ScheduleTimer("OpenNext", self.db.profile.speed); 704 self.tmrMailOpener = self:ScheduleTimer("OpenNext", self.db.profile.speed);
664 end 705 end
665 end 706 end
666 707
667 function mod:Continue() 708 function mod:Continue()
668 continue = true; 709 continue = true;
669 self:OpenNext(); 710 takingSingleItem = nil;
670 end 711 end
671 712
672 local mailRemainingPatterns = { 713 local mailRemainingPatterns = {
673 minutesSeconds = L["|cffffffff%d|r/|cffffffff%d|r mail remaining, opening everything will take about |cffffffff%d|r minutes and |cffffffff%d|r seconds (next refresh in |cffffffff%d|r seconds)."], 714 minutesSeconds = L["|cffffffff%d|r/|cffffffff%d|r mail remaining, opening everything will take about |cffffffff%d|r minutes and |cffffffff%d|r seconds (next refresh in |cffffffff%d|r seconds)."],
674 minutes = L["|cffffffff%d|r/|cffffffff%d|r mail remaining, opening everything will take about |cffffffff%d|r minutes (next refresh in |cffffffff%d|r seconds)."], 715 minutes = L["|cffffffff%d|r/|cffffffff%d|r mail remaining, opening everything will take about |cffffffff%d|r minutes (next refresh in |cffffffff%d|r seconds)."],
771 MAIL_ITEM_INDEX = 0; 812 MAIL_ITEM_INDEX = 0;
772 -- Reset open everything state 813 -- Reset open everything state
773 MAIL_OPEN_EVERYTHING = nil; 814 MAIL_OPEN_EVERYTHING = nil;
774 -- Stopped opening, so allow to continue 815 -- Stopped opening, so allow to continue
775 continue = true; 816 continue = true;
817
818 takingSingleItem = nil;
776 819
777 self:SetOpeningStatus(false); 820 self:SetOpeningStatus(false);
778 end 821 end
779 822
780 function mod:SetOpeningStatus(openingStatus) 823 function mod:SetOpeningStatus(openingStatus)