diff options
author | Matthew Wild <mwild1@gmail.com> | 2013-04-03 13:53:21 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2013-04-03 13:53:21 +0100 |
commit | 1213909d149d2ae2d697d6694ee1a30ef41c47f4 (patch) | |
tree | bf22e9f39d9ccaa98ba9f214cfa01d7c3408d46a /util | |
parent | c8e37d89fdf5c9b5990cd309d53707f990986559 (diff) | |
parent | 64579702abbbb36676a94a86d88cc54c119f4433 (diff) | |
download | prosody-1213909d149d2ae2d697d6694ee1a30ef41c47f4.tar.gz prosody-1213909d149d2ae2d697d6694ee1a30ef41c47f4.zip |
Merge 0.9->trunk
Diffstat (limited to 'util')
-rw-r--r-- | util/helpers.lua | 8 | ||||
-rw-r--r-- | util/stanza.lua | 6 |
2 files changed, 12 insertions, 2 deletions
diff --git a/util/helpers.lua b/util/helpers.lua index 6103a319..08b86a7c 100644 --- a/util/helpers.lua +++ b/util/helpers.lua @@ -14,6 +14,14 @@ module("helpers", package.seeall); local log = require "util.logger".init("util.debug"); +function log_host_events(host) + return log_events(prosody.hosts[host].events, host); +end + +function revert_log_host_events(host) + return revert_log_events(prosody.hosts[host].events); +end + function log_events(events, name, logger) local f = events.fire_event; if not f then diff --git a/util/stanza.lua b/util/stanza.lua index a0ab2a5a..213ed506 100644 --- a/util/stanza.lua +++ b/util/stanza.lua @@ -153,7 +153,7 @@ function stanza_mt:maptags(callback) local n_children, n_tags = #self, #tags; local i = 1; - while curr_tag <= n_tags do + while curr_tag <= n_tags and n_tags > 0 do if self[i] == tags[curr_tag] then local ret = callback(self[i]); if ret == nil then @@ -161,13 +161,15 @@ function stanza_mt:maptags(callback) t_remove(tags, curr_tag); n_children = n_children - 1; n_tags = n_tags - 1; + i = i - 1; + curr_tag = curr_tag - 1; else self[i] = ret; tags[i] = ret; end - i = i + 1; curr_tag = curr_tag + 1; end + i = i + 1; end return self; end |