From 10a16169a4f05c957a4662f92547c7167d735974 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Tue, 5 Mar 2013 04:02:54 -0300 Subject: [PATCH] Fix hotkeys reload and implement filters for console --- modules/game_console/console.lua | 15 +++++++++++++++ modules/game_hotkeys/hotkeys_manager.lua | 3 +++ 2 files changed, 18 insertions(+) diff --git a/modules/game_console/console.lua b/modules/game_console/console.lua index 48699082..0bd8643c 100644 --- a/modules/game_console/console.lua +++ b/modules/game_console/console.lua @@ -72,6 +72,7 @@ violationsChannelId = nil violationWindow = nil violationReportTab = nil ignoredChannels = {} +filters = {} local ignoreSettings = { privateMessages = false, @@ -591,10 +592,24 @@ function sendCurrentMessage() sendMessage(message) end +function addFilter(filter) + table.insert(filters, filter) +end + +function removeFilter(filter) + table.removevalue(filters, filter) +end + function sendMessage(message, tab) local tab = tab or getCurrentTab() 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 local name = tab:getText() if tab == serverTab or tab == getRuleViolationsTab() then diff --git a/modules/game_hotkeys/hotkeys_manager.lua b/modules/game_hotkeys/hotkeys_manager.lua index d3f3356a..ed332a61 100644 --- a/modules/game_hotkeys/hotkeys_manager.lua +++ b/modules/game_hotkeys/hotkeys_manager.lua @@ -76,6 +76,8 @@ function init() onGameStart = online, onGameEnd = offline }) + + load() end function terminate() @@ -96,6 +98,7 @@ end function configure(savePerServer, savePerCharacter) perServer = savePerServer perCharacter = savePerCharacter + reload() end function online()