delayed hooking

This commit is contained in:
Manuel Simon Hirsig
2017-04-05 17:54:37 +02:00
parent 3b363c04c9
commit 493e237ea2
+16 -10
View File
@@ -18,9 +18,6 @@ local ATTACHMENTS_MAX_ROWS_SEND = 3
function pack(...) return arg end function pack(...) return arg end
orig = {}
hook = setmetatable({}, {__newindex=function(_, k, v) orig[k] = _G[k]; _G[k] = v end})
do do
local f = CreateFrame'Frame' local f = CreateFrame'Frame'
local cursorItem local cursorItem
@@ -78,15 +75,24 @@ function UI_ERROR_MESSAGE()
end end
end end
function PLAYER_LOGIN() orig = {}
local key = GetCVar'realmName' .. '|' .. UnitFactionGroup'player' do
postal_Characters[key] = postal_Characters[key] or {} local hooks = {}
for char, lastSeen in postal_Characters[key] do hook = setmetatable({}, {__newindex=function(_, k, v) hooks[k] = v end})
if GetTime() - lastSeen > 60 * 60 * 24 * 30 then function PLAYER_LOGIN()
postal_Characters[key][char] = nil for k, v in hooks do
orig[k] = _G[k]
_G[k] = v
end end
local key = GetCVar'realmName' .. '|' .. UnitFactionGroup'player'
postal_Characters[key] = postal_Characters[key] or {}
for char, lastSeen in postal_Characters[key] do
if GetTime() - lastSeen > 60 * 60 * 24 * 30 then
postal_Characters[key][char] = nil
end
end
postal_Characters[key][UnitName'player'] = GetTime()
end end
postal_Characters[key][UnitName'player'] = GetTime()
end end
function ADDON_LOADED() function ADDON_LOADED()