}
public RecipientId resolveRecipientByUsername(
- final String username, Supplier<ServiceId> serviceIdSupplier
+ final String username, Supplier<ACI> aciSupplier
) throws UnregisteredRecipientException {
final Optional<RecipientWithAddress> byUsername;
try (final var connection = database.getConnection()) {
throw new RuntimeException("Failed read from recipient store", e);
}
if (byUsername.isEmpty() || byUsername.get().address().serviceId().isEmpty()) {
- final var serviceId = serviceIdSupplier.get();
- if (serviceId == null) {
+ final var aci = aciSupplier.get();
+ if (aci == null) {
throw new UnregisteredRecipientException(new org.asamk.signal.manager.api.RecipientAddress(null,
null,
username));
}
- return resolveRecipient(serviceId);
+ return resolveRecipientTrusted(aci, username);
}
return byUsername.get().id();
}
}
@Override
- public RecipientId resolveRecipientTrusted(final ServiceId serviceId, final String username) {
- return resolveRecipientTrusted(new RecipientAddress(serviceId, null, null, username), false);
- }
-
- public RecipientId resolveRecipientTrusted(
- final ACI aci, final String username
- ) {
- return resolveRecipientTrusted(new RecipientAddress(Optional.of(aci),
- Optional.empty(),
- Optional.empty(),
- Optional.of(username)), false);
+ public RecipientId resolveRecipientTrusted(final ACI aci, final String username) {
+ return resolveRecipientTrusted(new RecipientAddress(aci, null, null, username), false);
}
@Override
package org.asamk.signal.manager.storage.recipients;
-import org.whispersystems.signalservice.api.push.ServiceId;
import org.whispersystems.signalservice.api.push.ServiceId.ACI;
import org.whispersystems.signalservice.api.push.ServiceId.PNI;
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
RecipientId resolveRecipientTrusted(Optional<ACI> aci, Optional<PNI> pni, Optional<String> number);
- RecipientId resolveRecipientTrusted(ServiceId serviceId, String username);
+ RecipientId resolveRecipientTrusted(ACI aci, String username);
class RecipientTrustedResolverWrapper implements RecipientTrustedResolver {
}
@Override
- public RecipientId resolveRecipientTrusted(final ServiceId serviceId, final String username) {
- return recipientTrustedResolverSupplier.get().resolveRecipientTrusted(serviceId, username);
+ public RecipientId resolveRecipientTrusted(final ACI aci, final String username) {
+ return recipientTrustedResolverSupplier.get().resolveRecipientTrusted(aci, username);
}
}
}