Skip to content

Instantly share code, notes, and snippets.

@eehret
Created April 20, 2014 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eehret/11122781 to your computer and use it in GitHub Desktop.
Save eehret/11122781 to your computer and use it in GitHub Desktop.
Patch for BeanCounter 5.19.5445 to fix a bug where new mail items are sometimes not read when they should be.
diff --git BeanCounterMail.lua BeanCounterMail.lua
index b517cb9..01f1ce3 100644
--- BeanCounterMail.lua
+++ BeanCounterMail.lua
@@ -64,6 +64,7 @@ function private.mailMonitor(event,arg1)
elseif (event == "MAIL_SHOW") then
private.inboxStart = {} --clear the inbox list, if we errored out this should give us a fresh start.
+ private.mailReadOveride = {}
if not registeredInboxFrameHook then --make sure we only ever register this hook once
registeredInboxFrameHook = true
hooksecurefunc("InboxFrame_OnClick", private.mailFrameClick)
@@ -82,11 +83,8 @@ private.mailReadOveride = {}
function private.PreGetInboxTextHook(n, ...)
if n and n > 0 then
local _, _, sender, subject, money, _, daysLeft, _, wasRead, _, _, _ = GetInboxHeaderInfo(n)
- if sender and subject and not wasRead then
- --print("they read", n, sender, subject)
- private.mailReadOveride[n] = sender..n
- elseif wasRead then
- --print("Already read", n, sender, subject)
+ if not wasRead then
+ private.mailReadOveride[n] = true
end
end
return private.GetInboxText(n, ...)
@@ -133,6 +131,7 @@ function private.updateInboxStart()
if auctionHouse then
private.HideMailGUI(true)
wasRead = wasRead or 0 --its nil unless its has been read
+ private.mailReadOveride[n] = false -- set back to false so we don't read the same message more than once
local itemLink = GetInboxItemLink(n, 1)
local _, _, stack, _, _ = GetInboxItem(n)
local invoiceType, itemName, playerName, bid, buyout, deposit, consignment, retrieved, startTime = private.getInvoice(n,sender, subject)
@@ -148,7 +147,6 @@ function private.updateInboxStart()
end
private.lastCheckedMail = GetTime() --this keeps us from hiding the mail UI to early and causing flicker
end
- private.mailReadOveride = {}
private.wipeSearchCache() --clear the search cache, we are updating data so it is now outdated
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment