Diff

core/rostermanager.lua @ 172:71247788c7c7

Inbound subscription cancellation
author Waqas Hussain <waqas20@gmail.com>
date Sat, 25 Oct 2008 02:29:58 +0500
parent 171:28f420d057a0
child 173:f3a2af4d2ff2
line wrap: on
line diff
--- a/core/rostermanager.lua	Sat Oct 25 02:16:29 2008 +0500
+++ b/core/rostermanager.lua	Sat Oct 25 02:29:58 2008 +0500
@@ -107,4 +107,18 @@
 	end
 end
 
+function process_inbound_subscription_cancellation(username, host, jid)
+	local roster = load_roster(username, host);
+	local item = roster[jid];
+	if item and (item.subscription == "to" or item.subscription == "both") then
+		if item.subscription == "to" then
+			item.subscription = "none";
+		else
+			item.subscription = "from";
+		end
+		-- FIXME do we need to item.ask = nil;?
+		return datamanager.store(username, host, "roster", roster);
+	end
+end
+
 return _M;
\ No newline at end of file