2011-05-25 05:05:57 -04:00
|
|
|
ChatSaver = LibStub('AceAddon-3.0'):NewAddon('ChatSaver','AceHook-3.0','AceEvent-3.0');
|
|
|
|
local core = ChatSaver;
|
|
|
|
|
2011-05-25 07:21:59 -04:00
|
|
|
local db;
|
|
|
|
|
2011-05-25 05:36:29 -04:00
|
|
|
function core:OnInitialize()
|
2011-05-25 05:05:57 -04:00
|
|
|
self:RegisterEvent('PLAYER_LOGIN','ReloadUI');
|
2011-05-25 07:21:59 -04:00
|
|
|
self:Hook(SlashCmdList,'JOIN','JoinChannel',true);
|
2011-05-25 05:05:57 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
function core:ReloadUI()
|
2011-05-25 05:36:29 -04:00
|
|
|
channelList = {};
|
|
|
|
|
|
|
|
for i = 1, select("#",GetChannelList()), 2 do
|
|
|
|
local index,channel = select(i,GetChannelList());
|
|
|
|
channelList[index] = channel;
|
|
|
|
end
|
|
|
|
|
2011-05-25 05:44:45 -04:00
|
|
|
--force channel list for now
|
2011-05-25 05:36:29 -04:00
|
|
|
myChannels = {};
|
|
|
|
myChannels[1] = 'General';
|
|
|
|
myChannels[2] = 'Trade';
|
|
|
|
myChannels[3] = 'LocalDefense';
|
|
|
|
myChannels[4] = 'ncaheal';
|
|
|
|
myChannels[5] = 'ncabads';
|
|
|
|
myChannels[6] = 'ncafail';
|
|
|
|
|
|
|
|
for index,channel in pairs(myChannels) do
|
|
|
|
if(channel ~= channelList[index]) then
|
|
|
|
print('Channel ',channel,' not joined. Rejoining now!');
|
|
|
|
JoinPermanentChannel(channel);
|
2011-05-25 07:21:59 -04:00
|
|
|
|
|
|
|
local i = 1;
|
|
|
|
while ( DEFAULT_CHAT_FRAME.channelList[i] ) do
|
|
|
|
i = i + 1;
|
|
|
|
end
|
|
|
|
DEFAULT_CHAT_FRAME.channelList[i] = channel;
|
2011-05-25 05:36:29 -04:00
|
|
|
end
|
|
|
|
end
|
2011-05-25 05:05:57 -04:00
|
|
|
end
|
|
|
|
|
2011-05-25 07:21:59 -04:00
|
|
|
function core:JoinChannel()
|
|
|
|
--need to store channel in db
|
|
|
|
end
|