comparison mod_storage_xmlarchive/mod_storage_xmlarchive.lua @ 5729:79ba1a1a75cc

mod_storage_xmlarchive: Fix "user" iteration API Fixes use in prosody-migrator. Otherwise this particular API is not used much, or this would have been noticed before. Usually it is a different store like 'accounts' that is responsible for providing the authoritative list of users. Thanks Ge0rG for testing
author Kim Alvefur <zash@zash.se>
date Thu, 23 Nov 2023 16:16:34 +0100
parents 98bf0f597df4
children 100110d539d3
comparison
equal deleted inserted replaced
5728:80702e33ba71 5729:79ba1a1a75cc
11 local st = require"util.stanza"; 11 local st = require"util.stanza";
12 local dt = require"util.datetime"; 12 local dt = require"util.datetime";
13 local new_stream = require "util.xmppstream".new; 13 local new_stream = require "util.xmppstream".new;
14 local xml = require "util.xml"; 14 local xml = require "util.xml";
15 local async = require "util.async"; 15 local async = require "util.async";
16 local it = require "util.iterators";
16 local empty = {}; 17 local empty = {};
17 18
18 if not dm.append_raw then 19 if not dm.append_raw then
19 module:require"datamanager_append_raw"; 20 module:require"datamanager_append_raw";
20 end 21 end
436 assert(type(dates[1]) == "string" and type(dates[#dates]) == "string", 437 assert(type(dates[1]) == "string" and type(dates[#dates]) == "string",
437 "Archive does not appear to be in xmlarchive format"); 438 "Archive does not appear to be in xmlarchive format");
438 return dates; 439 return dates;
439 end 440 end
440 441
442 -- filter out the 'user@yyyy-mm-dd' stores
443 local function skip_at_date(item)
444 return not item:find("@");
445 end
446
441 function archive:users() 447 function archive:users()
442 return dm.users(module.host, self.store, "list"); 448 return it.filter(skip_at_date, dm.users(module.host, self.store, "list"));
443 end 449 end
444 450
445 local provider = {}; 451 local provider = {};
446 function provider:open(store, typ) 452 function provider:open(store, typ)
447 if typ ~= "archive" then return nil, "unsupported-store"; end 453 if typ ~= "archive" then return nil, "unsupported-store"; end