From f353227f68c14fbb277aa68f216196607f7d93eb Mon Sep 17 00:00:00 2001 From: "Andrew Tomaka@Gaffer" Date: Wed, 25 May 2011 05:36:29 -0400 Subject: [PATCH] Forced channel list for testing. --- ChatSaver.lua | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/ChatSaver.lua b/ChatSaver.lua index 0a50237..872b4c3 100644 --- a/ChatSaver.lua +++ b/ChatSaver.lua @@ -1,17 +1,33 @@ ChatSaver = LibStub('AceAddon-3.0'):NewAddon('ChatSaver','AceHook-3.0','AceEvent-3.0'); local core = ChatSaver; -function core:OnEnable() +function core:OnInitialize() self:RegisterEvent('PLAYER_LOGIN','ReloadUI'); end function core:ReloadUI() - channels = ListChannels(); - print('Channels' .. channels); -end - -function core:JoinChannelByName(chatFrameIndex,channel) - + channelList = {}; + + for i = 1, select("#",GetChannelList()), 2 do + local index,channel = select(i,GetChannelList()); + channelList[index] = channel; + end + + 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); + end + end end --AddChatWindowChannel(chatFrameIndex, "channel") - Make a chat channel visible in a specific ChatFrame.