Implement basic listAccounts for dbus client mode

Fixes #891
This commit is contained in:
AsamK 2022-02-12 11:20:05 +01:00
parent 0e0ef402fc
commit bb3b9692e3

View file

@ -50,6 +50,7 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
@ -540,7 +541,14 @@ public class DbusManagerImpl implements Manager {
@Override @Override
public List<Pair<RecipientAddress, Contact>> getContacts() { public List<Pair<RecipientAddress, Contact>> getContacts() {
throw new UnsupportedOperationException(); return signal.listNumbers().stream().map(n -> {
final var contactName = signal.getContactName(n);
if (contactName.length() == 0) {
return null;
}
return new Pair<>(new RecipientAddress(null, n),
new Contact(contactName, null, 0, signal.isContactBlocked(n), false));
}).filter(Objects::nonNull).toList();
} }
@Override @Override