Add --quote-attachment paramter to send command

Fixes #1318
This commit is contained in:
AsamK 2023-10-10 19:54:45 +02:00
parent 91ab0b12b0
commit 7b5b5776f0
7 changed files with 64 additions and 22 deletions

View file

@ -21,8 +21,12 @@ public record Message(
RecipientIdentifier.Single author,
String message,
List<Mention> mentions,
List<TextStyle> textStyles
) {}
List<TextStyle> textStyles,
List<Attachment> attachments
) {
public record Attachment(String contentType, String filename, String preview) {}
}
public record Sticker(byte[] packId, int stickerId) {}

View file

@ -627,12 +627,19 @@ public class ManagerImpl implements Manager {
}
if (message.quote().isPresent()) {
final var quote = message.quote().get();
final var quotedAttachments = new ArrayList<SignalServiceDataMessage.Quote.QuotedAttachment>();
for (final var a : quote.attachments()) {
final var quotedAttachment = new SignalServiceDataMessage.Quote.QuotedAttachment(a.contentType(),
a.filename(),
a.preview() == null ? null : context.getAttachmentHelper().uploadAttachment(a.preview()));
quotedAttachments.add(quotedAttachment);
}
messageBuilder.withQuote(new SignalServiceDataMessage.Quote(quote.timestamp(),
context.getRecipientHelper()
.resolveSignalServiceAddress(context.getRecipientHelper().resolveRecipient(quote.author()))
.getServiceId(),
quote.message(),
List.of(),
quotedAttachments,
resolveMentions(quote.mentions()),
SignalServiceDataMessage.Quote.Type.NORMAL,
quote.textStyles().stream().map(TextStyle::toBodyRange).toList()));