From 6c822abf42a548865e7907f1f02c8e3344580b4d Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Sat, 25 Oct 2008 02:29:58 +0500 Subject: Inbound subscription cancellation --- core/rostermanager.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'core/rostermanager.lua') diff --git a/core/rostermanager.lua b/core/rostermanager.lua index a9be62aa..3cdbbd3a 100644 --- a/core/rostermanager.lua +++ b/core/rostermanager.lua @@ -107,4 +107,18 @@ function process_inbound_subscription_approval(username, host, jid) 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 -- cgit v1.2.3