From c237f98044ddd4ce3087f31e6116082fb2b08eca Mon Sep 17 00:00:00 2001 From: AsamK Date: Fri, 5 Dec 2025 20:08:00 +0100 Subject: [PATCH] Mark legacy accounts without ACI as unregistered --- .../signal/manager/helper/AccountHelper.java | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/lib/src/main/java/org/asamk/signal/manager/helper/AccountHelper.java b/lib/src/main/java/org/asamk/signal/manager/helper/AccountHelper.java index 7e9f90eb..573d2077 100644 --- a/lib/src/main/java/org/asamk/signal/manager/helper/AccountHelper.java +++ b/lib/src/main/java/org/asamk/signal/manager/helper/AccountHelper.java @@ -82,16 +82,9 @@ public class AccountHelper { } public void checkAccountState() throws IOException { - if (account.getLastReceiveTimestamp() == 0) { - logger.info("The Signal protocol expects that incoming messages are regularly received."); - } else { - var diffInMilliseconds = System.currentTimeMillis() - account.getLastReceiveTimestamp(); - long days = TimeUnit.DAYS.convert(diffInMilliseconds, TimeUnit.MILLISECONDS); - if (days > 7) { - logger.warn( - "Messages have been last received {} days ago. The Signal protocol expects that incoming messages are regularly received.", - days); - } + if (account.getAci() == null) { + account.setRegistered(false); + throw new IOException("Account without ACI"); } try { updateAccountAttributes(); @@ -100,7 +93,7 @@ public class AccountHelper { } else { context.getPreKeyHelper().refreshPreKeysIfNecessary(); } - if (account.getAci() == null || account.getPni() == null) { + if (account.getPni() == null) { checkWhoAmiI(); } if (!account.isPrimaryDevice() && account.getPniIdentityKeyPair() == null) { @@ -125,6 +118,17 @@ public class AccountHelper { account.setRegistered(false); throw e; } + if (account.getLastReceiveTimestamp() == 0) { + logger.info("The Signal protocol expects that incoming messages are regularly received."); + } else { + var diffInMilliseconds = System.currentTimeMillis() - account.getLastReceiveTimestamp(); + long days = TimeUnit.DAYS.convert(diffInMilliseconds, TimeUnit.MILLISECONDS); + if (days > 7) { + logger.warn( + "Messages have been last received {} days ago. The Signal protocol expects that incoming messages are regularly received.", + days); + } + } } public void checkWhoAmiI() throws IOException {