aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2020-04-11 16:43:57 +0100
committerMatthew Wild <mwild1@gmail.com>2020-04-11 16:43:57 +0100
commitc439358e74c1c970efba55a317a7e6b65d0c38af (patch)
treee1a376050cf210588e2abf6b142d7dba9412c37e
parent007c8b7e64a93a79684b62d8ec888fe2fe1100e4 (diff)
downloadprosody-c439358e74c1c970efba55a317a7e6b65d0c38af.tar.gz
prosody-c439358e74c1c970efba55a317a7e6b65d0c38af.zip
MUC: Add API for adding 'filtered namespaces' to be stripped from inbound presence
-rw-r--r--plugins/muc/util.lib.lua18
1 files changed, 11 insertions, 7 deletions
diff --git a/plugins/muc/util.lib.lua b/plugins/muc/util.lib.lua
index 53a83fae..0877150f 100644
--- a/plugins/muc/util.lib.lua
+++ b/plugins/muc/util.lib.lua
@@ -41,18 +41,22 @@ 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
+local filtered_namespaces = module:shared("filtered-namespaces");
+filtered_namespaces["http://jabber.org/protocol/muc"] = true;
+filtered_namespaces["http://jabber.org/protocol/muc#user"] = true;
+
+local function muc_ns_filter(tag)
+ if filtered_namespaces[tag.attr.xmlns] then
return nil;
end
return tag;
end
function _M.filter_muc_x(stanza)
- return stanza:maptags(muc_x_filter);
+ return stanza:maptags(muc_ns_filter);
+end
+
+function _M.add_filtered_namespace(xmlns)
+ filtered_namespaces[xmlns] = true;
end
function _M.only_with_min_role(role)