Fix hotkeys reload and implement filters for console

This commit is contained in:
Eduardo Bart 2013-03-05 04:02:54 -03:00
parent 44bf4dcb6e
commit 10a16169a4
2 changed files with 18 additions and 0 deletions

View File

@ -72,6 +72,7 @@ violationsChannelId = nil
violationWindow = nil violationWindow = nil
violationReportTab = nil violationReportTab = nil
ignoredChannels = {} ignoredChannels = {}
filters = {}
local ignoreSettings = { local ignoreSettings = {
privateMessages = false, privateMessages = false,
@ -591,10 +592,24 @@ function sendCurrentMessage()
sendMessage(message) sendMessage(message)
end end
function addFilter(filter)
table.insert(filters, filter)
end
function removeFilter(filter)
table.removevalue(filters, filter)
end
function sendMessage(message, tab) function sendMessage(message, tab)
local tab = tab or getCurrentTab() local tab = tab or getCurrentTab()
if not tab then return end if not tab then return end
for k,func in pairs(filters) do
if func(message) then
return true
end
end
-- when talking on server log, the message goes to default channel -- when talking on server log, the message goes to default channel
local name = tab:getText() local name = tab:getText()
if tab == serverTab or tab == getRuleViolationsTab() then if tab == serverTab or tab == getRuleViolationsTab() then

View File

@ -76,6 +76,8 @@ function init()
onGameStart = online, onGameStart = online,
onGameEnd = offline onGameEnd = offline
}) })
load()
end end
function terminate() function terminate()
@ -96,6 +98,7 @@ end
function configure(savePerServer, savePerCharacter) function configure(savePerServer, savePerCharacter)
perServer = savePerServer perServer = savePerServer
perCharacter = savePerCharacter perCharacter = savePerCharacter
reload()
end end
function online() function online()