Improve identites listing

This commit is contained in:
AsamK 2023-08-26 16:33:39 +02:00
parent 884fa2748e
commit bc3bdbbf21
2 changed files with 11 additions and 2 deletions

View file

@ -1147,7 +1147,12 @@ public class ManagerImpl implements Manager {
@Override @Override
public List<Identity> getIdentities() { public List<Identity> getIdentities() {
return account.getIdentityKeyStore().getIdentities().stream().map(this::toIdentity).toList(); return account.getIdentityKeyStore()
.getIdentities()
.stream()
.map(this::toIdentity)
.filter(Objects::nonNull)
.toList();
} }
private Identity toIdentity(final IdentityInfo identityInfo) { private Identity toIdentity(final IdentityInfo identityInfo) {
@ -1157,6 +1162,10 @@ public class ManagerImpl implements Manager {
final var address = account.getRecipientAddressResolver() final var address = account.getRecipientAddressResolver()
.resolveRecipientAddress(account.getRecipientResolver().resolveRecipient(identityInfo.getServiceId())); .resolveRecipientAddress(account.getRecipientResolver().resolveRecipient(identityInfo.getServiceId()));
if (address.serviceId().isPresent() && !Objects.equals(address.serviceId().get(),
identityInfo.getServiceId())) {
return null;
}
final var scannableFingerprint = context.getIdentityHelper() final var scannableFingerprint = context.getIdentityHelper()
.computeSafetyNumberForScanning(identityInfo.getServiceId(), identityInfo.getIdentityKey()); .computeSafetyNumberForScanning(identityInfo.getServiceId(), identityInfo.getIdentityKey());
return new Identity(address.toApiRecipientAddress(), return new Identity(address.toApiRecipientAddress(),

View file

@ -1032,7 +1032,7 @@ public class DbusSignalImpl implements Signal {
connection.exportObject(object); connection.exportObject(object);
logger.debug("Exported dbus object: " + object.getObjectPath()); logger.debug("Exported dbus object: " + object.getObjectPath());
} catch (DBusException e) { } catch (DBusException e) {
e.printStackTrace(); logger.warn("Failed to export dbus object (" + object.getObjectPath() + "): " + e.getMessage());
} }
} }