*
* @param numbers The set of phone number in question
* @return A map of numbers to canonicalized number and uuid. If a number is not registered the uuid is null.
- * @throws IOException if its unable to get the contacts to check if they're registered
+ * @throws IOException if it's unable to get the contacts to check if they're registered
*/
@Override
public Map<String, Pair<String, UUID>> areUsersRegistered(Set<String> numbers) throws IOException {
Map<String, String> canonicalizedNumbers = numbers.stream().collect(Collectors.toMap(n -> n, n -> {
try {
- return PhoneNumberFormatter.formatNumber(n, account.getAccount());
+ final var canonicalizedNumber = PhoneNumberFormatter.formatNumber(n, account.getAccount());
+ if (!canonicalizedNumber.equals(n)) {
+ logger.debug("Normalized number {} to {}.", n, canonicalizedNumber);
+ }
+ return canonicalizedNumber;
} catch (InvalidNumberException e) {
return "";
}
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
}
}
+ @Override
+ public void deleteRecipient(final RecipientIdentifier.Single recipient) throws IOException {
+ account.removeRecipient(resolveRecipient(recipient));
+ }
+
+ @Override
+ public void deleteContact(final RecipientIdentifier.Single recipient) throws IOException {
+ account.getContactStore().deleteContact(resolveRecipient(recipient));
+ }
+
@Override
public void setContactName(
RecipientIdentifier.Single recipient, String name