mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
parent
415b65d208
commit
d13d150fe1
6 changed files with 87 additions and 29 deletions
|
@ -708,15 +708,27 @@ public class ManagerImpl implements Manager {
|
|||
messageBuilder.withAttachments(attachmentHelper.uploadAttachments(attachments));
|
||||
}
|
||||
if (message.mentions().size() > 0) {
|
||||
final var mentions = new ArrayList<SignalServiceDataMessage.Mention>();
|
||||
for (final var m : message.mentions()) {
|
||||
final var recipientId = resolveRecipient(m.recipient());
|
||||
mentions.add(new SignalServiceDataMessage.Mention(resolveSignalServiceAddress(recipientId).getAci(),
|
||||
m.start(),
|
||||
m.length()));
|
||||
}
|
||||
messageBuilder.withMentions(mentions);
|
||||
messageBuilder.withMentions(resolveMentions(message.mentions()));
|
||||
}
|
||||
if (message.quote().isPresent()) {
|
||||
final var quote = message.quote().get();
|
||||
messageBuilder.withQuote(new SignalServiceDataMessage.Quote(quote.timestamp(),
|
||||
resolveSignalServiceAddress(resolveRecipient(quote.author())),
|
||||
quote.message(),
|
||||
List.of(),
|
||||
resolveMentions(quote.mentions())));
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<SignalServiceDataMessage.Mention> resolveMentions(final List<Message.Mention> mentionList) throws IOException {
|
||||
final var mentions = new ArrayList<SignalServiceDataMessage.Mention>();
|
||||
for (final var m : mentionList) {
|
||||
final var recipientId = resolveRecipient(m.recipient());
|
||||
mentions.add(new SignalServiceDataMessage.Mention(resolveSignalServiceAddress(recipientId).getAci(),
|
||||
m.start(),
|
||||
m.length()));
|
||||
}
|
||||
return mentions;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package org.asamk.signal.manager.api;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public record Message(String messageText, List<String> attachments, List<Mention> mentions) {
|
||||
public record Message(String messageText, List<String> attachments, List<Mention> mentions, Optional<Quote> quote) {
|
||||
|
||||
public record Mention(RecipientIdentifier.Single recipient, int start, int length) {}
|
||||
|
||||
public record Quote(long timestamp, RecipientIdentifier.Single author, String message, List<Mention> mentions) {}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue