From 7a224ea81f774a23f9830fa3234d6acfcc971407 Mon Sep 17 00:00:00 2001 From: atomaka Date: Wed, 25 May 2011 07:21:59 -0400 Subject: [PATCH] Basic testing of join hook --- ChatSaver.lua | 15 ++++++++++++--- ChatSaver.toc | 3 +++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ChatSaver.lua b/ChatSaver.lua index fbb375a..26f218a 100644 --- a/ChatSaver.lua +++ b/ChatSaver.lua @@ -1,8 +1,11 @@ ChatSaver = LibStub('AceAddon-3.0'):NewAddon('ChatSaver','AceHook-3.0','AceEvent-3.0'); local core = ChatSaver; +local db; + function core:OnInitialize() self:RegisterEvent('PLAYER_LOGIN','ReloadUI'); + self:Hook(SlashCmdList,'JOIN','JoinChannel',true); end function core:ReloadUI() @@ -22,14 +25,20 @@ function core:ReloadUI() myChannels[5] = 'ncabads'; myChannels[6] = 'ncafail'; - --debugging for index,channel in pairs(myChannels) do if(channel ~= channelList[index]) then print('Channel ',channel,' not joined. Rejoining now!'); JoinPermanentChannel(channel); + + local i = 1; + while ( DEFAULT_CHAT_FRAME.channelList[i] ) do + i = i + 1; + end + DEFAULT_CHAT_FRAME.channelList[i] = channel; end end end ---AddChatWindowChannel(chatFrameIndex, "channel") - Make a chat channel visible in a specific ChatFrame. ---Chat output architecture has changed since release; calling this function alone is no longer sufficient to add a channel to a particular frame in the default UI. Use ChatFrame_AddChannel(chatFrame, "channelName") instead, like so: +function core:JoinChannel() + --need to store channel in db +end \ No newline at end of file diff --git a/ChatSaver.toc b/ChatSaver.toc index 1115b61..0d68b93 100644 --- a/ChatSaver.toc +++ b/ChatSaver.toc @@ -6,7 +6,10 @@ ## Dependencies: ## OptionalDeps: ## DefaultState: enabled +## SavedVariables: ChatSaverDB + Libs\LibStub\LibStub.lua +Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml Libs\AceAddon-3.0\AceAddon-3.0.xml Libs\AceEvent-3.0\AceEvent-3.0.xml Libs\AceHook-3.0\AceHook-3.0.xml