Poor attempt to implement pre-hook via RawHook
This commit is contained in:
parent
23764d1402
commit
bbd2e324a3
1 changed files with 13 additions and 18 deletions
|
@ -4,8 +4,8 @@ local core = ChatSaver;
|
||||||
local db;
|
local db;
|
||||||
|
|
||||||
function core:OnInitialize()
|
function core:OnInitialize()
|
||||||
self:Hook(SlashCmdList,'JOIN','JoinChannel',true);
|
self:RawHook(SlashCmdList,'JOIN','JoinChannel',true);
|
||||||
self:Hook(SlashCmdList,'LEAVE','LeaveChannel',true);
|
self:RawHook(SlashCmdList,'LEAVE','JoinChannel',true);
|
||||||
|
|
||||||
self:RegisterChatCommand('cs','SlashCommand');
|
self:RegisterChatCommand('cs','SlashCommand');
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ function core:RejoinChannels(event,message,...)
|
||||||
channelList[index] = channel;
|
channelList[index] = channel;
|
||||||
end
|
end
|
||||||
|
|
||||||
for index,channel in pairs(ChatSaverDB) do
|
for channel,information in pairs(ChatSaverDB) do
|
||||||
local found = false;
|
local found = false;
|
||||||
for jIndex,jChannel in pairs(channelList) do
|
for jIndex,jChannel in pairs(channelList) do
|
||||||
if(jChannel == channel) then
|
if(jChannel == channel) then
|
||||||
|
@ -46,27 +46,22 @@ function core:RejoinChannels(event,message,...)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function core:InChannels()
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
function core:JoinChannel(msg)
|
function core:JoinChannel(msg)
|
||||||
|
self.hooks[SlashCmdList].JOIN(msg);
|
||||||
|
|
||||||
local name = gsub(msg, "%s*([^%s]+).*", "%1");
|
local name = gsub(msg, "%s*([^%s]+).*", "%1");
|
||||||
--need to store channel in db
|
|
||||||
local channelCount = table.getn(ChatSaverDB);
|
ChatSaverDB[name] = {};
|
||||||
ChatSaverDB[channelCount + 1] = name;
|
ChatSaverDB[name]['frames'] = {};
|
||||||
|
ChatSaverDB[name]['index'] = GetChannelName(name);
|
||||||
|
ChatSaverDB[name]['frames'][DEFAULT_CHAT_FRAME:GetID()] = true;
|
||||||
end
|
end
|
||||||
|
|
||||||
function core:LeaveChannel(msg)
|
function core:LeaveChannel(msg)
|
||||||
|
self.hooks[SlashCmdList].LEAVE(msg);
|
||||||
|
|
||||||
local number = gsub(msg, "%s*([^%s]+).*", "%1");
|
local number = gsub(msg, "%s*([^%s]+).*", "%1");
|
||||||
local _,name = GetChannelName(number);
|
local _,name = GetChannelName(number);
|
||||||
|
|
||||||
pos = 9;
|
ChatSaverDB[name] = nil;
|
||||||
for index,channel in pairs(ChatSaverDB) do
|
|
||||||
if(channel == name) then
|
|
||||||
pos = index;
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
table.remove(ChatSaverDB,pos);
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue