- if (groupIdString != null) {
- byte[] groupId;
- try {
- groupId = Util.decodeGroupId(groupIdString).serialize();
- } catch (GroupIdFormatException e) {
- throw new UserErrorException("Invalid group id: " + e.getMessage());
- }
-
- try {
- var timestamp = signal.sendGroupMessage(messageText, attachments, groupId);
- outputResult(outputWriter, timestamp);
- return;
- } catch (DBusExecutionException e) {
- throw new UnexpectedErrorException("Failed to send group message: " + e.getMessage());
- }
- }
-
- if (isNoteToSelf) {
- try {
- var timestamp = signal.sendNoteToSelfMessage(messageText, attachments);
- outputResult(outputWriter, timestamp);
- return;
- } catch (Signal.Error.UntrustedIdentity e) {
- throw new UntrustedKeyErrorException("Failed to send message: " + e.getMessage());
- } catch (DBusExecutionException e) {
- throw new UnexpectedErrorException("Failed to send note to self message: " + e.getMessage());
- }
+ List<String> mentionStrings = ns.getList("mention");
+ final var mentions = mentionStrings == null ? List.<Message.Mention>of() : parseMentions(m, mentionStrings);
+
+ final Message.Quote quote;
+ final var quoteTimestamp = ns.getLong("quote-timestamp");
+ if (quoteTimestamp != null) {
+ final var quoteAuthor = ns.getString("quote-author");
+ final var quoteMessage = ns.getString("quote-message");
+ List<String> quoteMentionStrings = ns.getList("quote-mention");
+ final var quoteMentions = quoteMentionStrings == null
+ ? List.<Message.Mention>of()
+ : parseMentions(m, quoteMentionStrings);
+ quote = new Message.Quote(quoteTimestamp,
+ CommandUtil.getSingleRecipientIdentifier(quoteAuthor, m.getSelfNumber()),
+ quoteMessage == null ? "" : quoteMessage,
+ quoteMentions);
+ } else {
+ quote = null;