aboutsummaryrefslogtreecommitdiffstats
path: root/core/rostermanager.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2008-10-25 02:16:29 +0500
committerWaqas Hussain <waqas20@gmail.com>2008-10-25 02:16:29 +0500
commit17d7c83a7141e6d2142c9dece0845051c85ef592 (patch)
tree0cc596aa48b6a4f4505cee7271b268e631579ee7 /core/rostermanager.lua
parentb1d1a87772aa583572642c2fc76fa5bba1ca8e9a (diff)
downloadprosody-17d7c83a7141e6d2142c9dece0845051c85ef592.tar.gz
prosody-17d7c83a7141e6d2142c9dece0845051c85ef592.zip
Inbound subscription approval
Diffstat (limited to 'core/rostermanager.lua')
-rw-r--r--core/rostermanager.lua16
1 files changed, 15 insertions, 1 deletions
diff --git a/core/rostermanager.lua b/core/rostermanager.lua
index c39d28ed..a9be62aa 100644
--- a/core/rostermanager.lua
+++ b/core/rostermanager.lua
@@ -83,7 +83,7 @@ function load_roster(username, host)
return roster;
end
-- Attempt to load roster for non-loaded user
- -- TODO also support loading for offline user
+ return datamanager.load(username, host, "roster") or {};
end
function save_roster(username, host)
@@ -93,4 +93,18 @@ function save_roster(username, host)
return nil;
end
+function process_inbound_subscription_approval(username, host, jid)
+ local roster = load_roster(username, host);
+ local item = roster[jid];
+ if item and item.ask and (item.subscription == "none" or item.subscription == "from") then
+ if item.subscription == "none" then
+ item.subscription = "to";
+ else
+ item.subscription = "both";
+ end
+ item.ask = nil;
+ return datamanager.store(username, host, "roster", roster);
+ end
+end
+
return _M; \ No newline at end of file