aboutsummaryrefslogtreecommitdiffstats
path: root/core/rostermanager.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2008-10-25 02:38:24 +0500
committerWaqas Hussain <waqas20@gmail.com>2008-10-25 02:38:24 +0500
commit2ab824859d622653d405e8ea0515e3acca9180f4 (patch)
tree73fe3823eff8a15ce74fabbb36dd18c7f573084e /core/rostermanager.lua
parent6c822abf42a548865e7907f1f02c8e3344580b4d (diff)
downloadprosody-2ab824859d622653d405e8ea0515e3acca9180f4.tar.gz
prosody-2ab824859d622653d405e8ea0515e3acca9180f4.zip
Inbound unsubscribe
Diffstat (limited to 'core/rostermanager.lua')
-rw-r--r--core/rostermanager.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/rostermanager.lua b/core/rostermanager.lua
index 3cdbbd3a..83bb379e 100644
--- a/core/rostermanager.lua
+++ b/core/rostermanager.lua
@@ -121,4 +121,18 @@ function process_inbound_subscription_cancellation(username, host, jid)
end
end
+function process_inbound_unsubscribe(username, host, jid)
+ local roster = load_roster(username, host);
+ local item = roster[jid];
+ if item and (item.subscription == "from" or item.subscription == "both") then
+ if item.subscription == "from" then
+ item.subscription = "none";
+ else
+ item.subscription = "to";
+ end
+ item.ask = nil;
+ return datamanager.store(username, host, "roster", roster);
+ end
+end
+
return _M; \ No newline at end of file