Only verify once per session unless forced.

This commit is contained in:
Andrew Tomaka 2011-05-26 02:09:37 -04:00
parent cb91b7ffaa
commit 8e22be74f8

View file

@ -1,6 +1,8 @@
ChatSaver = LibStub('AceAddon-3.0'):NewAddon('ChatSaver','AceConsole-3.0','AceHook-3.0','AceEvent-3.0'); ChatSaver = LibStub('AceAddon-3.0'):NewAddon('ChatSaver','AceConsole-3.0','AceHook-3.0','AceEvent-3.0');
local core = ChatSaver; local core = ChatSaver;
core.verified = false;
function core:OnInitialize() function core:OnInitialize()
self:RawHook(SlashCmdList,'JOIN','JoinChannel',true); self:RawHook(SlashCmdList,'JOIN','JoinChannel',true);
self:RawHook(SlashCmdList,'LEAVE','LeaveChannel',true); self:RawHook(SlashCmdList,'LEAVE','LeaveChannel',true);
@ -16,14 +18,15 @@ function core:OnEnable()
end end
function core:SlashCommand() function core:SlashCommand()
core.verified = false
core:RejoinChannels(); core:RejoinChannels();
end end
function core:RejoinChannels(event,message,...) function core:RejoinChannels(event,message,...)
if(message == 'YOU_LEFT') then if(message == 'YOU_LEFT' or core.verified == true) then
return; return;
end end
local channelList = {}; local channelList = {};
for i = 1, select("#",GetChannelList()), 2 do for i = 1, select("#",GetChannelList()), 2 do
local index,channel = select(i,GetChannelList()); local index,channel = select(i,GetChannelList());
@ -47,6 +50,8 @@ function core:RejoinChannels(event,message,...)
end end
end end
end end
core.verified = true;
end end
function core:JoinChannel(msg) function core:JoinChannel(msg)