Minor cleanup and notifications

This commit is contained in:
Andrew Tomaka 2011-05-25 23:18:21 -04:00
parent 521cd01d7c
commit 8bac341153

View file

@ -1,8 +1,6 @@
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;
local db;
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);
@ -41,6 +39,7 @@ function core:RejoinChannels(event,message,...)
end end
if(found == false) then if(found == false) then
print('Chat Saver: Restoring lost channel, ',channel);
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
@ -72,7 +71,10 @@ function core:LeaveChannel(msg)
end end
function core:ToggleChatChannel(checked,channel) function core:ToggleChatChannel(checked,channel)
if(ChatSaverDB[channel] == nil) then return end; if(ChatSaverDB[channel] == nil) then
return;
end
if(checked) then if(checked) then
ChatSaverDB[channel]['frames'][FCF_GetCurrentChatFrameID()] = true; ChatSaverDB[channel]['frames'][FCF_GetCurrentChatFrameID()] = true;
else else