aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--util/filters.lua13
1 files changed, 12 insertions, 1 deletions
diff --git a/util/filters.lua b/util/filters.lua
index 08e683c1..f304e71a 100644
--- a/util/filters.lua
+++ b/util/filters.lua
@@ -10,6 +10,8 @@ local t_insert, t_remove = table.insert, table.remove;
module "filters"
+local new_filter_hooks = {};
+
function initialize(session)
if not session.filters then
local filters = {};
@@ -19,13 +21,18 @@ function initialize(session)
local filter_list = filters[type];
if filter_list then
for i = 1, #filter_list do
- data = filter_list[i](data);
+ data = filter_list[i](data, session);
if data == nil then break; end
end
end
return data;
end
end
+
+ for i=1,#new_filter_hooks do
+ new_filter_hooks[i](session);
+ end
+
return session.filter;
end
@@ -65,4 +72,8 @@ function remove_filter(session, type, callback)
end
end
+function add_filter_hook(callback)
+ t_insert(new_filter_hooks, callback);
+end
+
return _M;