aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_presence.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-07-05 12:43:25 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-07-05 12:43:25 +0500
commit4fecbc0bbf5c912f3b8383d2e396cf7282b9c1a4 (patch)
tree835dd157851825330f824c484744993f85c2b5ad /plugins/mod_presence.lua
parentd7fd01bb426a887feab7c19c1d580fd91b85ba79 (diff)
downloadprosody-4fecbc0bbf5c912f3b8383d2e396cf7282b9c1a4.tar.gz
prosody-4fecbc0bbf5c912f3b8383d2e396cf7282b9c1a4.zip
mod_presence: Broadcast presence to resources before contacts
Diffstat (limited to 'plugins/mod_presence.lua')
-rw-r--r--plugins/mod_presence.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua
index 68bcb632..9ae068c2 100644
--- a/plugins/mod_presence.lua
+++ b/plugins/mod_presence.lua
@@ -62,12 +62,6 @@ end
function handle_normal_presence(origin, stanza, core_route_stanza)
local roster = origin.roster;
- 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);
- end
- end
local node, host = origin.username, origin.host;
for _, res in pairs(hosts[host].sessions[node].sessions) do -- broadcast to all resources
if res ~= origin and res.presence then -- to resource
@@ -75,6 +69,12 @@ function handle_normal_presence(origin, stanza, core_route_stanza)
core_route_stanza(origin, stanza);
end
end
+ 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);
+ end
+ 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(roster) do -- probe all contacts we are subscribed to