aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-10-04 21:25:59 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-10-04 21:25:59 +0500
commite5721e4840915e42d69bbc5ab70bcc0bcd6e52a4 (patch)
tree041cc58a048e0d9d86d6dd0eff9bbabc5ca306d2
parentfbfa652fba6fe4ccf3d019e57bd8f916454f5fa8 (diff)
downloadprosody-e5721e4840915e42d69bbc5ab70bcc0bcd6e52a4.tar.gz
prosody-e5721e4840915e42d69bbc5ab70bcc0bcd6e52a4.zip
rostermanager: Added support for saving rosters of offline users to the save_roster function.
-rw-r--r--core/rostermanager.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/core/rostermanager.lua b/core/rostermanager.lua
index 0163e343..c3fd3b68 100644
--- a/core/rostermanager.lua
+++ b/core/rostermanager.lua
@@ -102,9 +102,16 @@ function load_roster(username, host)
return roster;
end
-function save_roster(username, host)
+function save_roster(username, host, roster)
log("debug", "save_roster: saving roster for "..username.."@"..host);
- if hosts[host] and hosts[host].sessions[username] and hosts[host].sessions[username].roster then
+ if not roster then
+ roster = hosts[host] and hosts[host].sessions[username] and hosts[host].sessions[username].roster;
+ --if not roster then
+ -- --roster = load_roster(username, host);
+ -- return true; -- roster unchanged, no reason to save
+ --end
+ end
+ if roster then
local roster = hosts[host].sessions[username].roster;
roster[false].version = (roster[false].version or 1) + 1;
return datamanager.store(username, host, "roster", hosts[host].sessions[username].roster);