aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/rostermanager.lua7
-rw-r--r--core/usermanager.lua3
2 files changed, 6 insertions, 4 deletions
diff --git a/core/rostermanager.lua b/core/rostermanager.lua
index a3315245..506cf205 100644
--- a/core/rostermanager.lua
+++ b/core/rostermanager.lua
@@ -96,7 +96,7 @@ function load_roster(username, host)
local data, err = datamanager.load(username, host, "roster");
roster = data or {};
if user then user.roster = roster; end
- if not roster[false] then roster[false] = { }; end
+ if not roster[false] then roster[false] = { broken = err or nil }; end
if roster[jid] then
roster[jid] = nil;
log("warn", "roster for "..jid.." has a self-contact");
@@ -125,6 +125,7 @@ function save_roster(username, host, roster)
if metadata.version ~= true then
metadata.version = (metadata.version or 0) + 1;
end
+ if roster[false].broken then return nil, "Not saving broken roster" end
return datamanager.store(username, host, "roster", roster);
end
log("warn", "save_roster: user had no roster to save");
@@ -190,9 +191,9 @@ function process_inbound_unsubscribe(username, host, jid)
end
function is_contact_subscribed(username, host, jid)
- local roster = load_roster(username, host);
+ local roster, err = load_roster(username, host);
local item = roster[jid];
- return item and (item.subscription == "from" or item.subscription == "both");
+ return item and (item.subscription == "from" or item.subscription == "both"), err;
end
function is_contact_pending_in(username, host, jid)
diff --git a/core/usermanager.lua b/core/usermanager.lua
index 42e49d38..698d2f10 100644
--- a/core/usermanager.lua
+++ b/core/usermanager.lua
@@ -69,7 +69,8 @@ end
function user_exists(username, host)
if not(require_provisioning) and is_cyrus(host) then return true; end
- return datamanager.load(username, host, "accounts") ~= nil; -- FIXME also check for empty credentials
+ local account, err = datamanager.load(username, host, "accounts");
+ return (account or err) ~= nil; -- FIXME also check for empty credentials
end
function create_user(username, password, host)