aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-07-05 12:17:22 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-07-05 12:17:22 +0500
commit0d35651c137aee84768c826891fdde2dd00466a5 (patch)
tree80fd1831c0f2a187111432bd82c33731bd517282 /plugins
parentb5bf437c6f0b92758772e32f9973d0a85550d616 (diff)
downloadprosody-0d35651c137aee84768c826891fdde2dd00466a5.tar.gz
prosody-0d35651c137aee84768c826891fdde2dd00466a5.zip
mod_presence: Simplified roster iteration
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_presence.lua10
1 files changed, 4 insertions, 6 deletions
diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua
index 27881215..6b706cd5 100644
--- a/plugins/mod_presence.lua
+++ b/plugins/mod_presence.lua
@@ -62,9 +62,8 @@ end
function handle_normal_presence(origin, stanza, core_route_stanza)
if origin.roster then
- for jid in pairs(origin.roster) do -- broadcast to all interested contacts
- local subscription = origin.roster[jid].subscription;
- if subscription == "both" or subscription == "from" then
+ for jid, item in pairs(origin.roster) do -- broadcast to all interested contacts
+ if item.subscription == "both" or item.subscription == "from" then
stanza.attr.to = jid;
core_route_stanza(origin, stanza);
end
@@ -78,9 +77,8 @@ function handle_normal_presence(origin, stanza, core_route_stanza)
end
if stanza.attr.type == nil and not origin.presence then -- initial presence
local probe = st.presence({from = origin.full_jid, type = "probe"});
- for jid in pairs(origin.roster) do -- probe all contacts we are subscribed to
- local subscription = origin.roster[jid].subscription;
- if subscription == "both" or subscription == "to" then
+ for jid, item in pairs(origin.roster) do -- probe all contacts we are subscribed to
+ if item.subscription == "both" or item.subscription == "to" then
probe.attr.to = jid;
core_route_stanza(origin, probe);
end