From e5721e4840915e42d69bbc5ab70bcc0bcd6e52a4 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Sun, 4 Oct 2009 21:25:59 +0500 Subject: rostermanager: Added support for saving rosters of offline users to the save_roster function. --- core/rostermanager.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'core') 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); -- cgit v1.2.3