comparison Modules/BeanCounterSupport.lua @ 122:6a51405c7733

Hopefully fixed hooking errors (I can?t reproduce them, but this should still solve it).
author Zerotorescue
date Sat, 16 Oct 2010 14:44:48 +0200
parents f01e0184a275
children
comparison
equal deleted inserted replaced
121:fa413243f1b2 122:6a51405c7733
43 43
44 self:RegisterEvent("MAIL_CLOSED"); 44 self:RegisterEvent("MAIL_CLOSED");
45 45
46 refMonitoredFrame = InboxCloseButton; 46 refMonitoredFrame = InboxCloseButton;
47 47
48 -- Hook the OnHide of refMonitoredFrame indicating BeanCounter has started 48 if not self:IsHooked(refMonitoredFrame, "OnHide") then
49 self:HookScript(refMonitoredFrame, "OnHide", "BeanCounterActivated"); 49 -- Hook the OnHide of refMonitoredFrame indicating BeanCounter has started
50 self:HookScript(refMonitoredFrame, "OnHide", "BeanCounterActivated");
51 end
50 end 52 end
51 53
52 function mod:MAIL_CLOSED() 54 function mod:MAIL_CLOSED()
53 self:Debug("MAIL_CLOSED"); 55 self:Debug("MAIL_CLOSED");
54 56
73 mod:Debug("BeanCounterActivated"); 75 mod:Debug("BeanCounterActivated");
74 76
75 -- Unhook the current hook (and reapply it after the OnShow was triggered) 77 -- Unhook the current hook (and reapply it after the OnShow was triggered)
76 self:Unhook(refMonitoredFrame, "OnHide"); 78 self:Unhook(refMonitoredFrame, "OnHide");
77 79
78 -- Hook the OnShow of refMonitoredFrame indicating BeanCounter is finished 80 if not self:IsHooked(refMonitoredFrame, "OnShow") then
79 self:HookScript(refMonitoredFrame, "OnShow", "BeanCounterDeactivated"); 81 -- Hook the OnShow of refMonitoredFrame indicating BeanCounter is finished
82 self:HookScript(refMonitoredFrame, "OnShow", "BeanCounterDeactivated");
83 end
80 84
81 MailAddonBusy = MailAddonName; 85 MailAddonBusy = MailAddonName;
82 end 86 end
83 end 87 end
84 88
90 mod:Debug("BeanCounterDeactivated"); 94 mod:Debug("BeanCounterDeactivated");
91 95
92 -- Unhook the current hook (and reapply it after the OnHide was triggered) 96 -- Unhook the current hook (and reapply it after the OnHide was triggered)
93 self:Unhook(refMonitoredFrame, "OnShow"); 97 self:Unhook(refMonitoredFrame, "OnShow");
94 98
95 -- Hook the OnHide of the refMonitoredFrame again which is trigged when BeanCounter starts 99 if not self:IsHooked(refMonitoredFrame, "OnHide") then
96 self:HookScript(refMonitoredFrame, "OnHide", "BeanCounterActivated"); 100 -- Hook the OnHide of the refMonitoredFrame again which is trigged when BeanCounter starts
101 self:HookScript(refMonitoredFrame, "OnHide", "BeanCounterActivated");
102 end
97 103
98 if MailAddonBusy == MailAddonName then 104 if MailAddonBusy == MailAddonName then
99 MailAddonBusy = nil; 105 MailAddonBusy = nil;
100 end 106 end
101 end 107 end