aboutsummaryrefslogtreecommitdiffstats
path: root/core/rostermanager.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-12-29 20:49:19 +0100
committerKim Alvefur <zash@zash.se>2017-12-29 20:49:19 +0100
commit77f0619267fc45db1ed446e018625aa7c01a5829 (patch)
tree0d7b74089aa23a80e48a7db72579dd733a93b703 /core/rostermanager.lua
parentb54d51c5bf7e1d1f79e356a95529d3ece089a79e (diff)
downloadprosody-77f0619267fc45db1ed446e018625aa7c01a5829.tar.gz
prosody-77f0619267fc45db1ed446e018625aa7c01a5829.zip
rostermanager: Explicitly remove old-style 'pending' table from rosters (or it stays forever due to map stores)
Diffstat (limited to 'core/rostermanager.lua')
-rw-r--r--core/rostermanager.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/rostermanager.lua b/core/rostermanager.lua
index f6a44028..65be0de0 100644
--- a/core/rostermanager.lua
+++ b/core/rostermanager.lua
@@ -112,7 +112,15 @@ local function load_roster(username, host)
local data, err = roster_store:get(username);
roster = data or {};
if user then user.roster = roster; end
+ local legacy_pending = roster.pending and type(roster.pending.subscription) ~= "string";
roster_metadata(roster, err);
+ if legacy_pending then
+ -- Due to map store use, we need to manually delete this entry
+ log("debug", "Removing legacy 'pending' entry");
+ if not save_roster(username, host, roster, "pending") then
+ log("warn", "Could not remove legacy 'pendig' entry");
+ end
+ end
if roster[jid] then
roster[jid] = nil;
log("debug", "Roster for %s had a self-contact, removing", jid);