NUM_CHAT_WINDOWS constant
This commit is contained in:
parent
ebd2270b45
commit
f439389e64
1 changed files with 12 additions and 12 deletions
|
@ -2,10 +2,6 @@ ChatSaver = LibStub('AceAddon-3.0'):NewAddon('ChatSaver','AceConsole-3.0','AceHo
|
||||||
local core = ChatSaver;
|
local core = ChatSaver;
|
||||||
|
|
||||||
function core:OnInitialize()
|
function core:OnInitialize()
|
||||||
self:RawHook(SlashCmdList,'JOIN','JoinChannel',true);
|
|
||||||
self:RawHook(SlashCmdList,'LEAVE','LeaveChannel',true);
|
|
||||||
self:Hook('ToggleChatChannel','ToggleChatChannel',true);
|
|
||||||
|
|
||||||
self:RegisterChatCommand('cs','SlashCommand');
|
self:RegisterChatCommand('cs','SlashCommand');
|
||||||
|
|
||||||
if(ChatSaverDB == nil) then
|
if(ChatSaverDB == nil) then
|
||||||
|
@ -17,8 +13,11 @@ function core:OnInitialize()
|
||||||
end
|
end
|
||||||
|
|
||||||
function core:OnEnable()
|
function core:OnEnable()
|
||||||
|
self:RawHook(SlashCmdList,'JOIN','JoinChannel',true);
|
||||||
|
self:RawHook(SlashCmdList,'LEAVE','LeaveChannel',true);
|
||||||
|
self:Hook('ToggleChatChannel','ToggleChatChannel',true);
|
||||||
|
|
||||||
self:RegisterEvent('CHANNEL_UI_UPDATE','RejoinChannels');
|
self:RegisterEvent('CHANNEL_UI_UPDATE','RejoinChannels');
|
||||||
|
|
||||||
if(core.firstrun) then
|
if(core.firstrun) then
|
||||||
self:RegisterEvent('CHAT_MSG_CHANNEL_NOTICE','SetupChatSaver');
|
self:RegisterEvent('CHAT_MSG_CHANNEL_NOTICE','SetupChatSaver');
|
||||||
end
|
end
|
||||||
|
@ -30,13 +29,13 @@ end
|
||||||
|
|
||||||
function core:RejoinChannels(...)
|
function core:RejoinChannels(...)
|
||||||
local currentChannels = {};
|
local currentChannels = {};
|
||||||
for i = 1,select("#",GetChannelList()) do
|
for i = 1,select('#',GetChannelList()) do
|
||||||
currentChannels[select(i,GetChannelList())] = true
|
currentChannels[select(i,GetChannelList())] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
for channel,_ in pairs(ChatSaverDB) do
|
for channel,_ in pairs(ChatSaverDB) do
|
||||||
if(currentChannels[channel] == nil) then
|
if(currentChannels[channel] == nil) then
|
||||||
JoinPermanentChannel(channel);
|
JoinPermanentChannel(channel); -- does not place in chat frame properly
|
||||||
for index,_ in pairs(ChatSaverDB[channel].frames) do
|
for index,_ in pairs(ChatSaverDB[channel].frames) do
|
||||||
ChatFrame_AddChannel(_G['ChatFrame'..index],channel);
|
ChatFrame_AddChannel(_G['ChatFrame'..index],channel);
|
||||||
end
|
end
|
||||||
|
@ -46,11 +45,12 @@ function core:RejoinChannels(...)
|
||||||
self:UnregisterEvent('CHANNEL_UI_UPDATE');
|
self:UnregisterEvent('CHANNEL_UI_UPDATE');
|
||||||
end
|
end
|
||||||
|
|
||||||
function core:SetupChatSaver(...)
|
function core:SetupChatSaver(...)
|
||||||
for frame = 1,10 do
|
local chatWindowChannels = { GetChatWindowChannels(frame) };
|
||||||
local frameChannels = { GetChatWindowChannels(frame) };
|
|
||||||
for i = 1,#frameChannels,2 do
|
for frame = 1,NUM_CHAT_WINDOWS do
|
||||||
local name,zone = frameChannels[i], frameChannels[i+1]
|
for i = 1,#chatWindowChannels,2 do
|
||||||
|
local name,zone = chatWindowChannels[i], chatWindowChannels[i + 1];
|
||||||
|
|
||||||
if(zone == 0) then
|
if(zone == 0) then
|
||||||
if(ChatSaverDB[name] == nil) then
|
if(ChatSaverDB[name] == nil) then
|
||||||
|
|
Loading…
Reference in a new issue