Changeset

7154:b3b92204802f

rostermanager: Use storagemanager
author Kim Alvefur <zash@zash.se>
date Tue, 09 Feb 2016 17:01:04 +0100
parents 7153:89fa66d4e502
children 7155:4a0825984e42
files core/rostermanager.lua
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/core/rostermanager.lua	Tue Feb 09 16:56:27 2016 +0100
+++ b/core/rostermanager.lua	Tue Feb 09 17:01:04 2016 +0100
@@ -18,7 +18,6 @@
 local hosts = hosts;
 local bare_sessions = prosody.bare_sessions;
 
-local datamanager = require "util.datamanager"
 local um_user_exists = require "core.usermanager".user_exists;
 local st = require "util.stanza";
 
@@ -109,7 +108,8 @@
 	else -- Attempt to load roster for non-loaded user
 		log("debug", "load_roster: loading for offline user: %s@%s", username, host);
 	end
-	local data, err = datamanager.load(username, host, "roster");
+	local roster_store = require "core.storagemanager".open(host, "roster", "keyval");
+	local data, err = roster_store:get(username);
 	roster = data or {};
 	if user then user.roster = roster; end
 	roster_metadata(roster, err);
@@ -143,7 +143,8 @@
 			metadata.version = (metadata.version or 0) + 1;
 		end
 		if metadata.broken then return nil, "Not saving broken roster" end
-		return datamanager.store(username, host, "roster", roster);
+		local roster_store = require "core.storagemanager".open(host, "roster", "keyval");
+		return roster_store:set(username, roster);
 	end
 	log("warn", "save_roster: user had no roster to save");
 	return nil;