mirror of
https://github.com/AsamK/signal-cli.git
synced 2026-03-15 02:40:23 +00:00
Mark legacy accounts without ACI as unregistered
This commit is contained in:
parent
87945ac506
commit
c237f98044
@ -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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user