Changeset

7167:7ae430fecf12

rostermanager: Require storagemanager at the top, fixes traceback on Lua 5.2
author Matthew Wild <mwild1@gmail.com>
date Fri, 19 Feb 2016 12:15:02 +0000
parents 7165:f0e6757261bc
children 7168:d11154910be4 7169:d00d8cfcc9a8
files core/rostermanager.lua
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/core/rostermanager.lua	Thu Feb 18 19:08:01 2016 +0100
+++ b/core/rostermanager.lua	Fri Feb 19 12:15:02 2016 +0000
@@ -20,6 +20,7 @@
 
 local um_user_exists = require "core.usermanager".user_exists;
 local st = require "util.stanza";
+local storagemanager = require "core.storagemanager";
 
 local _ENV = nil;
 
@@ -108,7 +109,7 @@
 	else -- Attempt to load roster for non-loaded user
 		log("debug", "load_roster: loading for offline user: %s@%s", username, host);
 	end
-	local roster_store = require "core.storagemanager".open(host, "roster", "keyval");
+	local roster_store = storagemanager.open(host, "roster", "keyval");
 	local data, err = roster_store:get(username);
 	roster = data or {};
 	if user then user.roster = roster; end
@@ -144,10 +145,10 @@
 		end
 		if metadata.broken then return nil, "Not saving broken roster" end
 		if jid == nil then
-			local roster_store = require "core.storagemanager".open(host, "roster", "keyval");
+			local roster_store = storagemanager.open(host, "roster", "keyval");
 			return roster_store:set(username, roster);
 		else
-			local roster_store = require "core.storagemanager".open(host, "roster", "map");
+			local roster_store = storagemanager.open(host, "roster", "map");
 			return roster_store:set_keys(username, { [false] = metadata, [jid] = roster[jid] or roster_store.remove });
 		end
 	end