aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/muc/occupant.lib.lua17
-rw-r--r--plugins/muc/util.lib.lua14
2 files changed, 17 insertions, 14 deletions
diff --git a/plugins/muc/occupant.lib.lua b/plugins/muc/occupant.lib.lua
index 6a3f7df4..d59252e2 100644
--- a/plugins/muc/occupant.lib.lua
+++ b/plugins/muc/occupant.lib.lua
@@ -2,21 +2,10 @@ local next = next;
local pairs = pairs;
local setmetatable = setmetatable;
local st = require "util.stanza";
+local util = module:require "muc/util";
-local get_filtered_presence do
- local presence_filters = {
- ["http://jabber.org/protocol/muc"] = true;
- ["http://jabber.org/protocol/muc#user"] = true;
- }
- local function presence_filter(tag)
- if presence_filters[tag.attr.xmlns] then
- return nil;
- end
- return tag;
- end
- function get_filtered_presence(stanza)
- return st.clone(stanza):maptags(presence_filter);
- end
+local function get_filtered_presence(stanza)
+ return util.filter_muc_x(st.clone(stanza));
end
local occupant_mt = {};
diff --git a/plugins/muc/util.lib.lua b/plugins/muc/util.lib.lua
index 90a3a183..16deb543 100644
--- a/plugins/muc/util.lib.lua
+++ b/plugins/muc/util.lib.lua
@@ -41,4 +41,18 @@ function _M.is_kickable_error(stanza)
return kickable_error_conditions[cond];
end
+local muc_x_filters = {
+ ["http://jabber.org/protocol/muc"] = true;
+ ["http://jabber.org/protocol/muc#user"] = true;
+}
+local function muc_x_filter(tag)
+ if muc_x_filters[tag.attr.xmlns] then
+ return nil;
+ end
+ return tag;
+end
+function _M.filter_muc_x(stanza)
+ return stanza:maptags(muc_x_filter);
+end
+
return _M;