Changeset

830:c0554caf90e6

MUC: Use util.stanza.clone instead of pre/deserialize for cloning stanzas
author Waqas Hussain <waqas20@gmail.com>
date Fri, 20 Feb 2009 02:23:21 +0500
parents 829:b01fd698495e
children 831:e2d2095705dc
files plugins/mod_muc.lua
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_muc.lua	Fri Feb 20 02:18:07 2009 +0500
+++ b/plugins/mod_muc.lua	Fri Feb 20 02:23:21 2009 +0500
@@ -62,7 +62,7 @@
 end
 local presence_filters = {["http://jabber.org/protocol/muc"]=true;["http://jabber.org/protocol/muc#user"]=true};
 function get_filtered_presence(stanza)
-	return filter_xmlns_from_stanza(st.deserialize(st.preserialize(stanza)), presence_filters);
+	return filter_xmlns_from_stanza(st.clone(stanza), presence_filters);
 end
 function getUsingPath(stanza, path, getText)
 	local tag = stanza;
@@ -162,10 +162,10 @@
 		if not subject and body then -- add to history
 			local history = rooms_info:get(room, 'history');
 			if not history then history = {}; rooms_info:set(room, 'history', history); end
-			-- stanza = st.deserialize(st.preserialize(stanza));
+			-- stanza = st.clone(stanza);
 			stanza:tag("delay", {xmlns = "urn:xmpp:delay", from = muc_domain, stamp = datetime.datetime()}):up(); -- XEP-0203
 			stanza:tag("x", {xmlns = "jabber:x:delay", from = muc_domain, stamp = datetime.legacy()}):up(); -- XEP-0091 (deprecated)
-			t_insert(history, st.preserialize(stanza));
+			t_insert(history, st.clone(st.preserialize(stanza)));
 			while #history > history_length do t_remove(history, 1) end
 		end
 	end
@@ -182,10 +182,10 @@
 		if historic then -- add to history
 			local history = rooms_info:get(room, 'history');
 			if not history then history = {}; rooms_info:set(room, 'history', history); end
-			-- stanza = st.deserialize(st.preserialize(stanza));
+			-- stanza = st.clone(stanza);
 			stanza:tag("delay", {xmlns = "urn:xmpp:delay", from = muc_domain, stamp = datetime.datetime()}):up(); -- XEP-0203
 			stanza:tag("x", {xmlns = "jabber:x:delay", from = muc_domain, stamp = datetime.legacy()}):up(); -- XEP-0091 (deprecated)
-			t_insert(history, st.preserialize(stanza));
+			t_insert(history, st.clone(st.preserialize(stanza)));
 			while #history > history_length do t_remove(history, 1) end
 		end
 	end