safety update for opening

This commit is contained in:
Manuel Simon Hirsig
2017-12-17 12:57:27 +01:00
parent 6d8abfc556
commit c6919faabc
+38
View File
@@ -201,6 +201,44 @@ function Inbox_Load()
btn:SetScript('OnClick', Inbox_OpenAll)
end
do
local i, update
local f = CreateFrame'Frame'
f:Hide()
f:SetScript('OnUpdate', function()
if update then
update = false
local _, _, _, _, _, COD = GetInboxHeaderInfo(i)
if i > GetInboxNumItems() then
Inbox_Abort()
elseif Inbox_Skip or COD > 0 then
Inbox_Skip = false
i = i + 1
else
Inbox_Open(i)
end
end
end)
function MAIL_INBOX_UPDATE()
if Inbox_opening then
update = true
end
end
function Inbox_OpenAll()
Inbox_opening = true
Inbox_UpdateLock()
i = 1
Inbox_skip = false
update = true
f:Show()
end
function Inbox_Abort()
Inbox_opening = false
Inbox_UpdateLock()
f:Hide()
end
end
do
local i
local function update()