aboutsummaryrefslogtreecommitdiffstats
path: root/core/rostermanager.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2012-08-01 01:36:16 +0500
committerWaqas Hussain <waqas20@gmail.com>2012-08-01 01:36:16 +0500
commit333dd0e428ab1c7ff75cf6ceba1cc8117d490f17 (patch)
tree540c7d9ca85d20a292f43edd46511b373fc7da81 /core/rostermanager.lua
parentc204694247ccaeffb4842d260f5e1a5fe0b9fe1e (diff)
downloadprosody-333dd0e428ab1c7ff75cf6ceba1cc8117d490f17.tar.gz
prosody-333dd0e428ab1c7ff75cf6ceba1cc8117d490f17.zip
mod_presence, rostermanager: Bring outbound subscription cancellation in line with RFC6121.
Diffstat (limited to 'core/rostermanager.lua')
-rw-r--r--core/rostermanager.lua14
1 files changed, 6 insertions, 8 deletions
diff --git a/core/rostermanager.lua b/core/rostermanager.lua
index ac4f4e3d..fdb890f9 100644
--- a/core/rostermanager.lua
+++ b/core/rostermanager.lua
@@ -278,23 +278,21 @@ function unsubscribed(username, host, jid)
local roster = load_roster(username, host);
local item = roster[jid];
local pending = is_contact_pending_in(username, host, jid);
- local changed = nil;
- if is_contact_pending_in(username, host, jid) then
+ if pending then
roster.pending[jid] = nil; -- TODO maybe delete roster.pending if empty?
- changed = true;
end
+ local subscribed;
if item then
if item.subscription == "from" then
item.subscription = "none";
- changed = true;
+ subscribed = true;
elseif item.subscription == "both" then
item.subscription = "to";
- changed = true;
+ subscribed = true;
end
end
- if changed then
- return save_roster(username, host, roster);
- end
+ local success = (pending or subscribed) and save_roster(username, host, roster);
+ return success, pending, subscribed;
end
function process_outbound_subscription_request(username, host, jid)