Comparison

plugins/mod_bookmarks.lua @ 12172:2515033c2a74

mod_bookmarks: Skip migration of legacy data when empty Should save some cycles and not log the debug message on every login.
author Kim Alvefur <zash@zash.se>
date Mon, 10 Jan 2022 00:13:17 +0100
parent 12171:b2923a3b4e02
child 12177:024cc878f472
comparison
equal deleted inserted replaced
12171:b2923a3b4e02 12172:2515033c2a74
333 local username = session.username; 333 local username = session.username;
334 local service = mod_pep.get_pep_service(username); 334 local service = mod_pep.get_pep_service(username);
335 local jid = username.."@"..session.host; 335 local jid = username.."@"..session.host;
336 336
337 local ok, ret = service:get_items(namespace_legacy, session.full_jid); 337 local ok, ret = service:get_items(namespace_legacy, session.full_jid);
338 if ok then 338 if ok and ret[1] then
339 module:log("debug", "Legacy PEP bookmarks found for %s, migrating.", jid); 339 module:log("debug", "Legacy PEP bookmarks found for %s, migrating.", jid);
340 local failed = false; 340 local failed = false;
341 for _, item_id in ipairs(ret) do 341 for _, item_id in ipairs(ret) do
342 local item = ret[item_id]; 342 local item = ret[item_id];
343 if item.attr.id ~= "current" then 343 if item.attr.id ~= "current" then