Diff

plugins/muc/util.lib.lua @ 6271:006b0e0f0de2

plugins/muc: Move 'x' filtering from occupant to util
author daurnimator <quae@daurnimator.com>
date Thu, 05 Jun 2014 17:07:14 -0400
parent 6218:bf11910bad5a
child 9599:5a2135964ed3
line wrap: on
line diff
--- a/plugins/muc/util.lib.lua	Thu Jun 05 17:15:04 2014 -0400
+++ b/plugins/muc/util.lib.lua	Thu Jun 05 17:07:14 2014 -0400
@@ -41,4 +41,18 @@
 	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;