Changeset

3110:7426727548ed

rostermanager: Mark rosters which fail to load as broken, and never save them.
author Waqas Hussain <waqas20@gmail.com>
date Mon, 24 May 2010 00:29:45 +0500
parents 3109:34280b1544fc
children 3111:826cb5f1859b
files core/rostermanager.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/core/rostermanager.lua	Mon May 24 00:04:22 2010 +0500
+++ b/core/rostermanager.lua	Mon May 24 00:29:45 2010 +0500
@@ -96,7 +96,7 @@
 	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 @@
 		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");