mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
parent
19f7b5d78d
commit
b77d820661
1 changed files with 21 additions and 9 deletions
|
@ -1594,14 +1594,7 @@ public class Manager implements Closeable {
|
||||||
() -> false);
|
() -> false);
|
||||||
|
|
||||||
for (var r : result) {
|
for (var r : result) {
|
||||||
if (r.getIdentityFailure() != null) {
|
handlePossibleIdentityFailure(r);
|
||||||
final var recipientId = resolveRecipient(r.getAddress());
|
|
||||||
final var newIdentity = account.getIdentityKeyStore()
|
|
||||||
.saveIdentity(recipientId, r.getIdentityFailure().getIdentityKey(), new Date());
|
|
||||||
if (newIdentity) {
|
|
||||||
account.getSessionStore().archiveSessions(recipientId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Pair<>(timestamp, result);
|
return new Pair<>(timestamp, result);
|
||||||
|
@ -1617,7 +1610,9 @@ public class Manager implements Closeable {
|
||||||
final var expirationTime = contact != null ? contact.getMessageExpirationTime() : 0;
|
final var expirationTime = contact != null ? contact.getMessageExpirationTime() : 0;
|
||||||
messageBuilder.withExpiration(expirationTime);
|
messageBuilder.withExpiration(expirationTime);
|
||||||
message = messageBuilder.build();
|
message = messageBuilder.build();
|
||||||
results.add(sendMessage(recipientId, message));
|
final var result = sendMessage(recipientId, message);
|
||||||
|
handlePossibleIdentityFailure(result);
|
||||||
|
results.add(result);
|
||||||
}
|
}
|
||||||
return new Pair<>(timestamp, results);
|
return new Pair<>(timestamp, results);
|
||||||
}
|
}
|
||||||
|
@ -1630,6 +1625,23 @@ public class Manager implements Closeable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handlePossibleIdentityFailure(final SendMessageResult r) {
|
||||||
|
if (r.getIdentityFailure() != null) {
|
||||||
|
final var recipientId = resolveRecipient(r.getAddress());
|
||||||
|
final var identityKey = r.getIdentityFailure().getIdentityKey();
|
||||||
|
if (identityKey != null) {
|
||||||
|
final var newIdentity = account.getIdentityKeyStore()
|
||||||
|
.saveIdentity(recipientId, identityKey, new Date());
|
||||||
|
if (newIdentity) {
|
||||||
|
account.getSessionStore().archiveSessions(recipientId);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Retrieve profile to get the current identity key from the server
|
||||||
|
retrieveEncryptedProfile(recipientId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Pair<Long, SendMessageResult> sendSelfMessage(
|
private Pair<Long, SendMessageResult> sendSelfMessage(
|
||||||
SignalServiceDataMessage.Builder messageBuilder
|
SignalServiceDataMessage.Builder messageBuilder
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue