Don't overwrite settings if joining an already joined channel.
This commit is contained in:
parent
0d2ad26892
commit
ed5089c103
1 changed files with 13 additions and 45 deletions
|
@ -67,18 +67,20 @@ end
|
||||||
--[[ EVENT FUNCTIONS ]] --
|
--[[ EVENT FUNCTIONS ]] --
|
||||||
|
|
||||||
function core:ProcessChannelChange(_,message,_,_,_,_,_,_,index,name)
|
function core:ProcessChannelChange(_,message,_,_,_,_,_,_,index,name)
|
||||||
if message == 'YOU_JOINED' then
|
if message == 'YOU_JOINED' then
|
||||||
local number,_,category = core:GetChannelInfo(name)
|
local number,_,category = core:GetChannelInfo(name)
|
||||||
|
|
||||||
if category == 'CHANNEL_CATEGORY_CUSTOM' then
|
if category == 'CHANNEL_CATEGORY_CUSTOM' then
|
||||||
ChatSaverDB[name] = {}
|
if ChatSaverDB[name] == nil then
|
||||||
ChatSaverDB[name]['frames'] = {}
|
ChatSaverDB[name] = {}
|
||||||
ChatSaverDB[name]['index'] = number
|
ChatSaverDB[name]['frames'] = {}
|
||||||
ChatSaverDB[name]['frames'][DEFAULT_CHAT_FRAME:GetID()] = true
|
ChatSaverDB[name]['index'] = number
|
||||||
end
|
ChatSaverDB[name]['frames'][DEFAULT_CHAT_FRAME:GetID()] = true
|
||||||
elseif message == 'YOU_LEFT' then
|
end
|
||||||
ChatSaverDB[name] = nil
|
end
|
||||||
end
|
elseif message == 'YOU_LEFT' then
|
||||||
|
ChatSaverDB[name] = nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function core:RejoinChannels(...)
|
function core:RejoinChannels(...)
|
||||||
|
@ -128,42 +130,8 @@ function core:SetupChatSaver(...)
|
||||||
self:RegisterEvent('CHAT_MSG_CHANNEL_NOTICE','ProcessChannelChange')
|
self:RegisterEvent('CHAT_MSG_CHANNEL_NOTICE','ProcessChannelChange')
|
||||||
end
|
end
|
||||||
|
|
||||||
function core:StoreChannel(_,_,_,_,_,_,_,_,_,name)
|
|
||||||
local number,channelName,category = core:GetChannelInfo(name);
|
|
||||||
|
|
||||||
if(category == 'CHANNEL_CATEGORY_CUSTOM') then
|
|
||||||
ChatSaverDB[name] = {};
|
|
||||||
ChatSaverDB[name]['frames'] = {};
|
|
||||||
ChatSaverDB[name]['index'] = number;
|
|
||||||
ChatSaverDB[name]['frames'][DEFAULT_CHAT_FRAME:GetID()] = true;
|
|
||||||
end
|
|
||||||
|
|
||||||
self:UnregisterEvent('CHAT_MSG_CHANNEL_NOTICE');
|
|
||||||
end
|
|
||||||
|
|
||||||
--[[ HOOKED FUNCTIONS ]] --
|
--[[ HOOKED FUNCTIONS ]] --
|
||||||
|
|
||||||
function core:JoinChannel(msg)
|
|
||||||
self.hooks[SlashCmdList].JOIN(msg);
|
|
||||||
|
|
||||||
local name = gsub(msg,"%s*([^%s]+).*","%1");
|
|
||||||
|
|
||||||
if(strlen(name) > 0 and string.match(name,"%a+")) then
|
|
||||||
self:RegisterEvent('CHAT_MSG_CHANNEL_NOTICE','StoreChannel');
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function core:LeaveChannel(msg)
|
|
||||||
self.hooks[SlashCmdList].LEAVE(msg);
|
|
||||||
|
|
||||||
local id = gsub(msg,"%s*([^%s]+).*","%1");
|
|
||||||
|
|
||||||
if(strlen(id) > 0) then
|
|
||||||
local _,name = core:GetChannelInfo(id);
|
|
||||||
ChatSaverDB[name] = nil;
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function core:ToggleChatChannel(checked,channel)
|
function core:ToggleChatChannel(checked,channel)
|
||||||
if(ChatSaverDB[channel] == nil) then
|
if(ChatSaverDB[channel] == nil) then
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue