Mark legacy accounts without ACI as unregistered

This commit is contained in:
AsamK 2025-12-05 20:08:00 +01:00
parent 87945ac506
commit c237f98044

View File

@ -82,16 +82,9 @@ public class AccountHelper {
} }
public void checkAccountState() throws IOException { public void checkAccountState() throws IOException {
if (account.getLastReceiveTimestamp() == 0) { if (account.getAci() == null) {
logger.info("The Signal protocol expects that incoming messages are regularly received."); account.setRegistered(false);
} else { throw new IOException("Account without ACI");
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);
}
} }
try { try {
updateAccountAttributes(); updateAccountAttributes();
@ -100,7 +93,7 @@ public class AccountHelper {
} else { } else {
context.getPreKeyHelper().refreshPreKeysIfNecessary(); context.getPreKeyHelper().refreshPreKeysIfNecessary();
} }
if (account.getAci() == null || account.getPni() == null) { if (account.getPni() == null) {
checkWhoAmiI(); checkWhoAmiI();
} }
if (!account.isPrimaryDevice() && account.getPniIdentityKeyPair() == null) { if (!account.isPrimaryDevice() && account.getPniIdentityKeyPair() == null) {
@ -125,6 +118,17 @@ public class AccountHelper {
account.setRegistered(false); account.setRegistered(false);
throw e; 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 { public void checkWhoAmiI() throws IOException {