diff options
author | Matthew Wild <mwild1@gmail.com> | 2012-07-31 23:07:02 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2012-07-31 23:07:02 +0100 |
commit | d4d93a75bbf30b598c71f490f77262e9a4c79b2d (patch) | |
tree | 4301677c927a8fa3e7991312c13ee59ab0003a38 /core/rostermanager.lua | |
parent | 4b640bb161bdcaf092c1445700b0a3b5a7c89b6f (diff) | |
parent | 2161f2e88c3b8b882fc30ec49609d4262d18e380 (diff) | |
download | prosody-d4d93a75bbf30b598c71f490f77262e9a4c79b2d.tar.gz prosody-d4d93a75bbf30b598c71f490f77262e9a4c79b2d.zip |
Merge Waqas<>Zash
Diffstat (limited to 'core/rostermanager.lua')
-rw-r--r-- | core/rostermanager.lua | 14 |
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) |