Output sender also for sealed sender messages that fail to decrypt

This commit is contained in:
AsamK 2022-01-27 20:03:43 +01:00
parent d812c249ba
commit ffaa9d2ed3
2 changed files with 11 additions and 4 deletions

View file

@ -5,6 +5,7 @@ import org.asamk.signal.manager.groups.GroupUtils;
import org.asamk.signal.manager.helper.RecipientAddressResolver; import org.asamk.signal.manager.helper.RecipientAddressResolver;
import org.asamk.signal.manager.storage.recipients.RecipientAddress; import org.asamk.signal.manager.storage.recipients.RecipientAddress;
import org.asamk.signal.manager.storage.recipients.RecipientResolver; import org.asamk.signal.manager.storage.recipients.RecipientResolver;
import org.signal.libsignal.metadata.ProtocolException;
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment; import org.whispersystems.signalservice.api.messages.SignalServiceAttachment;
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentRemoteId; import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentRemoteId;
import org.whispersystems.signalservice.api.messages.SignalServiceContent; import org.whispersystems.signalservice.api.messages.SignalServiceContent;
@ -789,16 +790,21 @@ public record MessageEnvelope(
SignalServiceContent content, SignalServiceContent content,
RecipientResolver recipientResolver, RecipientResolver recipientResolver,
RecipientAddressResolver addressResolver, RecipientAddressResolver addressResolver,
final AttachmentFileProvider fileProvider final AttachmentFileProvider fileProvider,
Exception exception
) { ) {
final var source = !envelope.isUnidentifiedSender() && envelope.hasSourceUuid() final var source = !envelope.isUnidentifiedSender() && envelope.hasSourceUuid()
? recipientResolver.resolveRecipient(envelope.getSourceAddress()) ? recipientResolver.resolveRecipient(envelope.getSourceAddress())
: envelope.isUnidentifiedSender() && content != null : envelope.isUnidentifiedSender() && content != null
? recipientResolver.resolveRecipient(content.getSender()) ? recipientResolver.resolveRecipient(content.getSender())
: null; : exception instanceof ProtocolException e
? recipientResolver.resolveRecipient(e.getSender())
: null;
final var sourceDevice = envelope.hasSourceDevice() final var sourceDevice = envelope.hasSourceDevice()
? envelope.getSourceDevice() ? envelope.getSourceDevice()
: content != null ? content.getSenderDevice() : 0; : content != null
? content.getSenderDevice()
: exception instanceof ProtocolException e ? e.getSenderDevice() : 0;
Optional<Receipt> receipt; Optional<Receipt> receipt;
Optional<Typing> typing; Optional<Typing> typing;

View file

@ -184,7 +184,8 @@ public final class IncomingMessageHandler {
content, content,
account.getRecipientStore(), account.getRecipientStore(),
account.getRecipientStore()::resolveRecipientAddress, account.getRecipientStore()::resolveRecipientAddress,
context.getAttachmentHelper()::getAttachmentFile), exception); context.getAttachmentHelper()::getAttachmentFile,
exception), exception);
return actions; return actions;
} }
} }