# HG changeset patch # User Kim Alvefur # Date 1364168610 -3600 # Node ID f66a08f208ad3aad763959a9de963303654b689a # Parent 15e2c4fd26a0dd9ea016c6affa25d6d47fd3c5b9 mod_addressing: Optimization diff -r 15e2c4fd26a0 -r f66a08f208ad mod_addressing/mod_addressing.lua --- 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;