Implement sending mentions

Closes #584
This commit is contained in:
AsamK 2021-11-13 22:54:59 +01:00
parent 89f568dd1f
commit 53b84bad02
5 changed files with 47 additions and 5 deletions

View file

@ -683,6 +683,16 @@ public class ManagerImpl implements Manager {
if (attachments != null) {
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);
}
}
@Override

View file

@ -2,4 +2,7 @@ package org.asamk.signal.manager.api;
import java.util.List;
public record Message(String messageText, List<String> attachments) {}
public record Message(String messageText, List<String> attachments, List<Mention> mentions) {
public record Mention(RecipientIdentifier.Single recipient, int start, int length) {}
}