final var actions = new ArrayList<HandleAction>();
SignalServiceContent content = null;
Exception exception = null;
- try {
- if (envelope.hasSourceServiceId()) {
+ envelope.getSourceServiceId().map(ServiceId::parseOrNull)
// Store uuid if we don't have it already
// uuid in envelope is sent by server
- account.getRecipientTrustedResolver().resolveRecipientTrusted(envelope.getSourceAddress());
- }
- } catch (Exception e) {
- exception = e;
- }
+ .ifPresent(serviceId -> account.getRecipientResolver().resolveRecipient(serviceId));
if (!envelope.isReceipt()) {
try {
final var cipherResult = dependencies.getCipher()
sender,
destination == null
? null
- : new DeviceAddress(context.getRecipientHelper().resolveRecipient(destination),
+ : new DeviceAddress(account.getRecipientResolver().resolveRecipient(destination),
destination.getServiceId(),
0),
ignoreAttachments));
final var blockedListMessage = syncMessage.getBlockedList().get();
for (var address : blockedListMessage.getAddresses()) {
context.getContactHelper()
- .setContactBlocked(context.getRecipientHelper().resolveRecipient(address), true);
+ .setContactBlocked(account.getRecipientResolver().resolveRecipient(address), true);
}
for (var groupId : blockedListMessage.getGroupIds()
.stream()
if (source == null) {
return false;
}
- final var recipientId = context.getRecipientHelper().resolveRecipient(source);
+ final var recipientId = account.getRecipientResolver().resolveRecipient(source);
if (context.getContactHelper().isContactBlocked(recipientId)) {
return true;
}
final var message = content.getDataMessage().orElse(null);
- final var recipientId = context.getRecipientHelper().resolveRecipient(source);
+ final var recipientId = account.getRecipientResolver().resolveRecipient(source);
if (!group.isMember(recipientId) && !(
group.isPendingMember(recipientId) && message != null && message.isGroupV2Update()
)) {
}
if (groupInfo.getMembers().isPresent()) {
+ final var recipientResolver = account.getRecipientResolver();
groupV1.addMembers(groupInfo.getMembers()
.get()
.stream()
- .map(context.getRecipientHelper()::resolveRecipient)
+ .map(recipientResolver::resolveRecipient)
.collect(Collectors.toSet()));
}
}
private SignalServiceAddress getSenderAddress(SignalServiceEnvelope envelope, SignalServiceContent content) {
- if (!envelope.isUnidentifiedSender() && envelope.hasSourceServiceId()) {
- return envelope.getSourceAddress();
+ final var serviceId = envelope.getSourceServiceId().map(ServiceId::parseOrNull).orElse(null);
+ if (!envelope.isUnidentifiedSender() && serviceId != null) {
+ return new SignalServiceAddress(serviceId);
} else if (content != null) {
return content.getSender();
} else {
}
private DeviceAddress getSender(SignalServiceEnvelope envelope, SignalServiceContent content) {
- if (!envelope.isUnidentifiedSender() && envelope.hasSourceServiceId()) {
- return new DeviceAddress(context.getRecipientHelper().resolveRecipient(envelope.getSourceAddress()),
- envelope.getSourceAddress().getServiceId(),
+ final var serviceId = envelope.getSourceServiceId().map(ServiceId::parseOrNull).orElse(null);
+ if (!envelope.isUnidentifiedSender() && serviceId != null) {
+ return new DeviceAddress(account.getRecipientResolver().resolveRecipient(serviceId),
+ serviceId,
envelope.getSourceDevice());
} else {
- return new DeviceAddress(context.getRecipientHelper().resolveRecipient(content.getSender()),
+ return new DeviceAddress(account.getRecipientResolver().resolveRecipient(content.getSender()),
content.getSender().getServiceId(),
content.getSenderDevice());
}
return new DeviceAddress(account.getSelfRecipientId(), account.getAci(), account.getDeviceId());
}
final var address = addressOptional.get();
- return new DeviceAddress(context.getRecipientHelper().resolveRecipient(address),
+ return new DeviceAddress(account.getRecipientResolver().resolveRecipient(address),
address.getServiceId(),
account.getDeviceId());
}