Use complete address instead of only identifier for retry envelope

Fixes #1074
This commit is contained in:
AsamK 2022-10-28 18:13:25 +02:00
parent e0c2f58e8d
commit 0b5a063b62
3 changed files with 7 additions and 5 deletions

View file

@ -64,8 +64,4 @@ public record RecipientAddress(Optional<UUID> uuid, Optional<String> number) {
number.isPresent() && other.number.isPresent() && number.get().equals(other.number.get()) number.isPresent() && other.number.isPresent() && number.get().equals(other.number.get())
); );
} }
public SignalServiceAddress toSignalServiceAddress() {
return new SignalServiceAddress(getServiceId(), number);
}
} }

View file

@ -7,6 +7,7 @@ import org.asamk.signal.manager.api.ReceiveConfig;
import org.asamk.signal.manager.api.UntrustedIdentityException; import org.asamk.signal.manager.api.UntrustedIdentityException;
import org.asamk.signal.manager.storage.SignalAccount; import org.asamk.signal.manager.storage.SignalAccount;
import org.asamk.signal.manager.storage.messageCache.CachedMessage; import org.asamk.signal.manager.storage.messageCache.CachedMessage;
import org.asamk.signal.manager.storage.recipients.RecipientAddress;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.whispersystems.signalservice.api.SignalWebSocket; import org.whispersystems.signalservice.api.SignalWebSocket;
@ -261,7 +262,8 @@ public class ReceiveHelper {
} }
if (!envelope.hasSourceUuid()) { if (!envelope.hasSourceUuid()) {
final var identifier = ((UntrustedIdentityException) exception).getSender(); final var identifier = ((UntrustedIdentityException) exception).getSender();
final var recipientId = account.getRecipientResolver().resolveRecipient(identifier.getServiceId()); final var recipientId = account.getRecipientResolver()
.resolveRecipient(new RecipientAddress(identifier));
try { try {
account.getMessageCache().replaceSender(cachedMessage, recipientId); account.getMessageCache().replaceSender(cachedMessage, recipientId);
} catch (IOException ioException) { } catch (IOException ioException) {

View file

@ -53,6 +53,10 @@ public record RecipientAddress(Optional<ServiceId> serviceId, Optional<PNI> pni,
this(Optional.of(address.getServiceId()), Optional.empty(), address.getNumber()); this(Optional.of(address.getServiceId()), Optional.empty(), address.getNumber());
} }
public RecipientAddress(org.asamk.signal.manager.api.RecipientAddress address) {
this(address.uuid().map(ServiceId::from), Optional.empty(), address.number());
}
public RecipientAddress(ServiceId serviceId) { public RecipientAddress(ServiceId serviceId) {
this(Optional.of(serviceId), Optional.empty()); this(Optional.of(serviceId), Optional.empty());
} }