Diff

plugins/muc/occupant.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 6251:41a5e5205fd9
child 7086:6cc7c9da29ed
line wrap: on
line diff
--- a/plugins/muc/occupant.lib.lua	Thu Jun 05 17:15:04 2014 -0400
+++ b/plugins/muc/occupant.lib.lua	Thu Jun 05 17:07:14 2014 -0400
@@ -2,21 +2,10 @@
 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 = {};