aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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