parent
a3bc754e80
commit
760934d5a5
@ -107,9 +107,13 @@ public class RecipientHelper {
|
||||
try {
|
||||
return Optional.of(resolveRecipient(recipient));
|
||||
} catch (UnregisteredRecipientException e) {
|
||||
if (recipient instanceof RecipientIdentifier.Number r) {
|
||||
return account.getRecipientStore().resolveRecipientByNumberOptional(r.number());
|
||||
} else {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public RecipientId refreshRegisteredUser(RecipientId recipientId) throws IOException, UnregisteredRecipientException {
|
||||
final var address = resolveSignalServiceAddress(recipientId);
|
||||
|
@ -215,6 +215,16 @@ public class RecipientStore implements RecipientIdCreator, RecipientResolver, Re
|
||||
return byNumber.get().id();
|
||||
}
|
||||
|
||||
public Optional<RecipientId> resolveRecipientByNumberOptional(final String number) {
|
||||
final Optional<RecipientWithAddress> byNumber;
|
||||
try (final var connection = database.getConnection()) {
|
||||
byNumber = findByNumber(connection, number);
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException("Failed read from recipient store", e);
|
||||
}
|
||||
return byNumber.map(RecipientWithAddress::id);
|
||||
}
|
||||
|
||||
public RecipientId resolveRecipientByUsername(
|
||||
final String username, Supplier<ServiceId> serviceIdSupplier
|
||||
) throws UnregisteredRecipientException {
|
||||
|
Loading…
x
Reference in New Issue
Block a user