Cleaner verifying joined channels code

This commit is contained in:
Andrew Tomaka 2011-05-27 15:08:27 -04:00
parent 2f596575d8
commit 5331debea4

View file

@ -27,21 +27,14 @@ function core:RejoinChannels(event,message,...)
return; return;
end end
local channelList = {}; local currentChannels = {};
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());
channelList[index] = channel; currentChannels[channel] = true;
end end
for channel,information in pairs(ChatSaverDB) do for channel,information in pairs(ChatSaverDB) do
local found = false; if(currentChannels[channel] == nil) then
for jIndex,jChannel in pairs(channelList) do
if(jChannel == channel) then
found = true;
end
end
if(found == false) then
JoinPermanentChannel(channel); JoinPermanentChannel(channel);
for index,shown in pairs(ChatSaverDB[channel].frames) do for index,shown in pairs(ChatSaverDB[channel].frames) do
if(shown) then if(shown) then