X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/0476895c3d9e843e505ef768340d7969b084cada..2c44b65e9fcbc91652a0c8de614698545f5c2722:/lib/src/main/java/org/asamk/signal/manager/SignalAccountFiles.java diff --git a/lib/src/main/java/org/asamk/signal/manager/SignalAccountFiles.java b/lib/src/main/java/org/asamk/signal/manager/SignalAccountFiles.java index 379aa1cb..b3ed439d 100644 --- a/lib/src/main/java/org/asamk/signal/manager/SignalAccountFiles.java +++ b/lib/src/main/java/org/asamk/signal/manager/SignalAccountFiles.java @@ -47,11 +47,11 @@ public class SignalAccountFiles { } public MultiAccountManager initMultiAccountManager() { - final var managers = getAllLocalAccountNumbers().stream().map(a -> { + final var managers = accountsStore.getAllAccounts().parallelStream().map(a -> { try { - return initManager(a); + return initManager(a.path()); } catch (NotRegisteredException | IOException | AccountCheckException e) { - logger.warn("Ignoring {}: {} ({})", a, e.getMessage(), e.getClass().getSimpleName()); + logger.warn("Ignoring {}: {} ({})", a.number(), e.getMessage(), e.getClass().getSimpleName()); return null; } }).filter(Objects::nonNull).toList(); @@ -61,7 +61,16 @@ public class SignalAccountFiles { public Manager initManager(String number) throws IOException, NotRegisteredException, AccountCheckException { final var accountPath = accountsStore.getPathByNumber(number); - if (accountPath == null || !SignalAccount.accountFileExists(pathConfig.dataPath(), accountPath)) { + return this.initManager(number, accountPath); + } + + private Manager initManager( + String number, String accountPath + ) throws IOException, NotRegisteredException, AccountCheckException { + if (accountPath == null) { + throw new NotRegisteredException(); + } + if (!SignalAccount.accountFileExists(pathConfig.dataPath(), accountPath)) { throw new NotRegisteredException(); }