Software /
code /
prosody
Diff
core/rostermanager.lua @ 173:f3a2af4d2ff2
Inbound unsubscribe
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Sat, 25 Oct 2008 02:38:24 +0500 |
parent | 172:71247788c7c7 |
child | 174:f9aff1fc7e99 |
line wrap: on
line diff
--- a/core/rostermanager.lua Sat Oct 25 02:29:58 2008 +0500 +++ b/core/rostermanager.lua Sat Oct 25 02:38:24 2008 +0500 @@ -121,4 +121,18 @@ 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