aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-07-05 12:25:15 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-07-05 12:25:15 +0500
commit25a62bae4e109d8fd1b8f5bd27881ab201badd61 (patch)
tree5a1f652d6dad143754f33119872a609eb3ce46d6
parent0d35651c137aee84768c826891fdde2dd00466a5 (diff)
downloadprosody-25a62bae4e109d8fd1b8f5bd27881ab201badd61.tar.gz
prosody-25a62bae4e109d8fd1b8f5bd27881ab201badd61.zip
mod_presence: Changed handle_normal_presence to use a local roster rather than origin's roster
-rw-r--r--plugins/mod_presence.lua13
1 files changed, 7 insertions, 6 deletions
diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua
index 6b706cd5..e2fcf152 100644
--- a/plugins/mod_presence.lua
+++ b/plugins/mod_presence.lua
@@ -61,8 +61,9 @@ local function recalc_resource_map(origin)
end
function handle_normal_presence(origin, stanza, core_route_stanza)
- if origin.roster then
- for jid, item in pairs(origin.roster) do -- broadcast to all interested contacts
+ local roster = origin.roster;
+ if roster then
+ for jid, item in pairs(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);
@@ -77,7 +78,7 @@ 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, item in pairs(origin.roster) do -- probe all contacts we are subscribed to
+ for jid, item in pairs(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);
@@ -90,13 +91,13 @@ function handle_normal_presence(origin, stanza, core_route_stanza)
res.presence.attr.to = nil;
end
end
- if origin.roster.pending then -- resend incoming subscription requests
- for jid in pairs(origin.roster.pending) do
+ if roster.pending then -- resend incoming subscription requests
+ for jid in pairs(roster.pending) do
origin.send(st.presence({type="subscribe", from=jid})); -- TODO add to attribute? Use original?
end
end
local request = st.presence({type="subscribe", from=origin.username.."@"..origin.host});
- for jid, item in pairs(origin.roster) do -- resend outgoing subscription requests
+ for jid, item in pairs(roster) do -- resend outgoing subscription requests
if item.ask then
request.attr.to = jid;
core_route_stanza(origin, request);