mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Disable unidentified access for recipient if it fails once
This commit is contained in:
parent
ceb6084eda
commit
a0593f4031
1 changed files with 28 additions and 0 deletions
|
@ -526,6 +526,34 @@ public class SendHelper {
|
|||
}
|
||||
|
||||
private void handleSendMessageResult(final SendMessageResult r) {
|
||||
if (r.isSuccess() && !r.getSuccess().isUnidentified()) {
|
||||
final var recipientId = recipientResolver.resolveRecipient(r.getAddress());
|
||||
final var profile = account.getRecipientStore().getProfile(recipientId);
|
||||
if (profile != null && (
|
||||
profile.getUnidentifiedAccessMode() == Profile.UnidentifiedAccessMode.ENABLED
|
||||
|| profile.getUnidentifiedAccessMode() == Profile.UnidentifiedAccessMode.UNRESTRICTED
|
||||
)) {
|
||||
account.getRecipientStore()
|
||||
.storeProfile(recipientId,
|
||||
Profile.newBuilder(profile)
|
||||
.withUnidentifiedAccessMode(Profile.UnidentifiedAccessMode.UNKNOWN)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
if (r.isUnregisteredFailure()) {
|
||||
final var recipientId = recipientResolver.resolveRecipient(r.getAddress());
|
||||
final var profile = account.getRecipientStore().getProfile(recipientId);
|
||||
if (profile != null && (
|
||||
profile.getUnidentifiedAccessMode() == Profile.UnidentifiedAccessMode.ENABLED
|
||||
|| profile.getUnidentifiedAccessMode() == Profile.UnidentifiedAccessMode.UNRESTRICTED
|
||||
)) {
|
||||
account.getRecipientStore()
|
||||
.storeProfile(recipientId,
|
||||
Profile.newBuilder(profile)
|
||||
.withUnidentifiedAccessMode(Profile.UnidentifiedAccessMode.UNKNOWN)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
if (r.getIdentityFailure() != null) {
|
||||
final var recipientId = recipientResolver.resolveRecipient(r.getAddress());
|
||||
identityFailureHandler.handleIdentityFailure(recipientId, r.getIdentityFailure());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue