aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_presence.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-07-31 23:07:02 +0100
committerMatthew Wild <mwild1@gmail.com>2012-07-31 23:07:02 +0100
commitdb304d412cbb2c4529bc3bf911dcee0747ea9084 (patch)
tree4301677c927a8fa3e7991312c13ee59ab0003a38 /plugins/mod_presence.lua
parent56c30635ccf2c210fbb37e83e28f7d956dc6c74f (diff)
parent5e947f4b086e5818b0aac35fe2bbd2079fbf4077 (diff)
downloadprosody-db304d412cbb2c4529bc3bf911dcee0747ea9084.tar.gz
prosody-db304d412cbb2c4529bc3bf911dcee0747ea9084.zip
Merge Waqas<>Zash
Diffstat (limited to 'plugins/mod_presence.lua')
-rw-r--r--plugins/mod_presence.lua17
1 files changed, 12 insertions, 5 deletions
diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua
index dac86ae6..077bc31f 100644
--- a/plugins/mod_presence.lua
+++ b/plugins/mod_presence.lua
@@ -198,12 +198,19 @@ function handle_outbound_presence_subscriptions_and_probes(origin, stanza, from_
core_post_stanza(origin, stanza);
send_presence_of_available_resources(node, host, to_bare, origin);
elseif stanza.attr.type == "unsubscribed" then
- -- 1. route stanza
- -- 2. roster push (subscription = none or to)
- if rostermanager.unsubscribed(node, host, to_bare) then
- rostermanager.roster_push(node, host, to_bare);
+ -- 1. send unavailable
+ -- 2. route stanza
+ -- 3. roster push (subscription = from or both)
+ local success, pending_in, subscribed = rostermanager.unsubscribed(node, host, to_bare);
+ if success then
+ if subscribed then
+ rostermanager.roster_push(node, host, to_bare);
+ end
+ core_post_stanza(origin, stanza);
+ if subscribed then
+ send_presence_of_available_resources(node, host, to_bare, origin, st.presence({ type = "unavailable" }));
+ end
end
- core_post_stanza(origin, stanza);
else
origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid presence type"));
end