Software /
code /
prosody
Comparison
core/rostermanager.lua @ 8496:9b81c22d5b54
rostermanager: Explicitly remove old-style 'pending' table from rosters (or it stays forever due to map stores)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 29 Dec 2017 20:49:19 +0100 |
parent | 8361:6af950b834a6 |
child | 8555:4f0f5b49bb03 |
comparison
equal
deleted
inserted
replaced
8494:4f75f4da6d4e | 8496:9b81c22d5b54 |
---|---|
110 end | 110 end |
111 local roster_store = storagemanager.open(host, "roster", "keyval"); | 111 local roster_store = storagemanager.open(host, "roster", "keyval"); |
112 local data, err = roster_store:get(username); | 112 local data, err = roster_store:get(username); |
113 roster = data or {}; | 113 roster = data or {}; |
114 if user then user.roster = roster; end | 114 if user then user.roster = roster; end |
115 local legacy_pending = roster.pending and type(roster.pending.subscription) ~= "string"; | |
115 roster_metadata(roster, err); | 116 roster_metadata(roster, err); |
117 if legacy_pending then | |
118 -- Due to map store use, we need to manually delete this entry | |
119 log("debug", "Removing legacy 'pending' entry"); | |
120 if not save_roster(username, host, roster, "pending") then | |
121 log("warn", "Could not remove legacy 'pendig' entry"); | |
122 end | |
123 end | |
116 if roster[jid] then | 124 if roster[jid] then |
117 roster[jid] = nil; | 125 roster[jid] = nil; |
118 log("debug", "Roster for %s had a self-contact, removing", jid); | 126 log("debug", "Roster for %s had a self-contact, removing", jid); |
119 if not save_roster(username, host, roster, jid) then | 127 if not save_roster(username, host, roster, jid) then |
120 log("warn", "Could not remove self-contact from roster for %s", jid); | 128 log("warn", "Could not remove self-contact from roster for %s", jid); |