Monitor all forms of chat changes instead of just slash commands.
This commit is contained in:
parent
76a3df5b2e
commit
0d2ad26892
1 changed files with 17 additions and 2 deletions
|
@ -11,8 +11,6 @@ function core:OnInitialize()
|
|||
end
|
||||
|
||||
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');
|
||||
|
@ -68,6 +66,21 @@ end
|
|||
|
||||
--[[ EVENT FUNCTIONS ]] --
|
||||
|
||||
function core:ProcessChannelChange(_,message,_,_,_,_,_,_,index,name)
|
||||
if message == 'YOU_JOINED' then
|
||||
local number,_,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
|
||||
elseif message == 'YOU_LEFT' then
|
||||
ChatSaverDB[name] = nil
|
||||
end
|
||||
end
|
||||
|
||||
function core:RejoinChannels(...)
|
||||
local currentChannels = {};
|
||||
for i = 1,select('#',GetChannelList()) do
|
||||
|
@ -90,6 +103,7 @@ function core:RejoinChannels(...)
|
|||
end
|
||||
|
||||
self:UnregisterEvent('CHANNEL_UI_UPDATE');
|
||||
self:RegisterEvent('CHAT_MSG_CHANNEL_NOTICE','ProcessChannelChange')
|
||||
end
|
||||
|
||||
function core:SetupChatSaver(...)
|
||||
|
@ -111,6 +125,7 @@ function core:SetupChatSaver(...)
|
|||
end
|
||||
|
||||
self:UnregisterEvent('CHAT_MSG_CHANNEL_NOTICE');
|
||||
self:RegisterEvent('CHAT_MSG_CHANNEL_NOTICE','ProcessChannelChange')
|
||||
end
|
||||
|
||||
function core:StoreChannel(_,_,_,_,_,_,_,_,_,name)
|
||||
|
|
Loading…
Reference in a new issue