Software /
code /
prosody
Diff
core/presencemanager.lua @ 326:99a8317d1235
Send unsubscribe and unsubscribed on roster item delete, and broadcast available resources' presence in reply to pre-approved subscription request
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Mon, 17 Nov 2008 13:51:47 +0500 |
parent | 325:5de1048b3fbf |
child | 468:ab49cb6d0e92 |
line wrap: on
line diff
--- a/core/presencemanager.lua Mon Nov 17 12:27:02 2008 +0500 +++ b/core/presencemanager.lua Mon Nov 17 13:51:47 2008 +0500 @@ -61,16 +61,16 @@ -- 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 @@ 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 @@ 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