changeset 935:f66a08f208ad

mod_addressing: Optimization
author Kim Alvefur <zash@zash.se>
date Mon, 25 Mar 2013 00:43:30 +0100
parents 15e2c4fd26a0
children 7236cdec3ea1
files mod_addressing/mod_addressing.lua
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mod_addressing/mod_addressing.lua	Mon Mar 25 00:40:17 2013 +0100
+++ b/mod_addressing/mod_addressing.lua	Mon Mar 25 00:43:30 2013 +0100
@@ -4,7 +4,7 @@
 local xmlns_address = 'http://jabber.org/protocol/address';
 
 local function handle_extended_addressing(data)
-	local origin, stanza = data.origin, data.stanza;
+	local stanza = data.stanza;
 	if stanza.attr.type == "error" then
 		return -- so we don't process bounces
 	end
@@ -18,7 +18,7 @@
 				local type, jid, delivered = address.attr.type, address.attr.jid, address.attr.delivered;
 				if (type == "cc" or type == "bcc" or type == "to")
 					and jid and not delivered then
-					table.insert(destinations, jid)
+					destinations[#destinations+1] = jid;
 					module:log("debug", "%s to %s", type, jid)
 					if type == "to" or type == "cc" then
 						address.attr.delivered = "true";
@@ -30,9 +30,9 @@
 			end
 			return address; -- unsupported stuff goes right back
 		end);
-		for _, destination in ipairs(destinations) do
-			stanza.attr.to = destination;
-			module:log("debug", "posting stanza to %s", destination)
+		for i=1,#destinations do
+			stanza.attr.to = destinations[i];
+			module:log("debug", "posting stanza to %s", destinations[i])
 			module:send(stanza);
 		end
 		stanza.attr.to = orig_to;