--- a/core/rostermanager.lua Sat Oct 25 01:48:34 2008 +0500
+++ b/core/rostermanager.lua Sat Oct 25 02:16:29 2008 +0500
@@ -83,7 +83,7 @@
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 @@
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