aboutsummaryrefslogtreecommitdiffstats
path: root/core/presencemanager.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2008-11-17 13:51:47 +0500
committerWaqas Hussain <waqas20@gmail.com>2008-11-17 13:51:47 +0500
commit4293aefe659dc621166d492f8c91f7031c6774bd (patch)
tree72fd39b4cbe52608610be17a96458a0522240a3f /core/presencemanager.lua
parent96195352950268f0101143547a4d2400ba190e49 (diff)
downloadprosody-4293aefe659dc621166d492f8c91f7031c6774bd.tar.gz
prosody-4293aefe659dc621166d492f8c91f7031c6774bd.zip
Send unsubscribe and unsubscribed on roster item delete, and broadcast available resources' presence in reply to pre-approved subscription request
Diffstat (limited to 'core/presencemanager.lua')
-rw-r--r--core/presencemanager.lua12
1 files changed, 8 insertions, 4 deletions
diff --git a/core/presencemanager.lua b/core/presencemanager.lua
index f2bab4a3..c6619fea 100644
--- a/core/presencemanager.lua
+++ b/core/presencemanager.lua
@@ -61,16 +61,16 @@ function handle_outbound_presence_subscriptions_and_probes(origin, stanza, from_
-- 3. send_presence_of_available_resources
if rostermanager.subscribed(node, host, to_bare) then
rostermanager.roster_push(node, host, to_bare);
- core_route_stanza(origin, stanza);
- send_presence_of_available_resources(node, host, to_bare, origin, core_route_stanza);
end
+ core_route_stanza(origin, stanza);
+ send_presence_of_available_resources(node, host, to_bare, origin, core_route_stanza);
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);
- core_route_stanza(origin, stanza);
end
+ core_route_stanza(origin, stanza);
end
stanza.attr.from, stanza.attr.to = st_from, st_to;
end
@@ -91,6 +91,10 @@ function handle_inbound_presence_subscriptions_and_probes(origin, stanza, from_b
elseif stanza.attr.type == "subscribe" then
if rostermanager.is_contact_subscribed(node, host, from_bare) then
core_route_stanza(origin, st.presence({from=to_bare, to=from_bare, type="subscribed"})); -- already subscribed
+ -- Sending presence is not clearly stated in the RFC, but it seems appropriate
+ if 0 == send_presence_of_available_resources(node, host, from_bare, origin, core_route_stanza) then
+ -- TODO send last recieved unavailable presence (or we MAY do nothing, which is fine too)
+ end
else
if not rostermanager.is_contact_pending_in(node, host, from_bare) then
if rostermanager.set_contact_pending_in(node, host, from_bare) then
@@ -107,7 +111,7 @@ function handle_inbound_presence_subscriptions_and_probes(origin, stanza, from_b
rostermanager.roster_push(node, host, from_bare);
end
elseif stanza.attr.type == "unsubscribed" then
- if rostermanager.process_inbound_subscription_approval(node, host, from_bare) then
+ if rostermanager.process_inbound_subscription_cancellation(node, host, from_bare) then
rostermanager.roster_push(node, host, from_bare);
end
end -- discard any other type