diff options
author | Waqas Hussain <waqas20@gmail.com> | 2010-05-24 00:29:45 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2010-05-24 00:29:45 +0500 |
commit | 054a2d38c1ab12bf6bda2c22b775a91b9fb4dd4a (patch) | |
tree | f94fceebac77b2eb15ef6f89329d99089e4ff04f /core | |
parent | 1ee72fdb1161361d653bead96ea4fb140e9054cc (diff) | |
download | prosody-054a2d38c1ab12bf6bda2c22b775a91b9fb4dd4a.tar.gz prosody-054a2d38c1ab12bf6bda2c22b775a91b9fb4dd4a.zip |
rostermanager: Mark rosters which fail to load as broken, and never save them.
Diffstat (limited to 'core')
-rw-r--r-- | core/rostermanager.lua | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/rostermanager.lua b/core/rostermanager.lua index a3315245..285cf4f6 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"); |