# HG changeset patch # User Matthew Wild # Date 1455884102 0 # Node ID 7ae430fecf12e613ee596adcbb0ebb370d7184fd # Parent f0e6757261bcac09ace28f2c36b8a1ce1bd19537 rostermanager: Require storagemanager at the top, fixes traceback on Lua 5.2 diff -r f0e6757261bc -r 7ae430fecf12 core/rostermanager.lua --- 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