mirror of
https://github.com/AsamK/signal-cli
synced 2025-09-02 20:40:38 +00:00
restructure listIdentities
Now returns a complete dictionary (array of dictionary entries) rather then a list of one-entry dictionaries.
This commit is contained in:
parent
af9000972e
commit
3a94d6a00c
3 changed files with 8 additions and 7 deletions
|
@ -193,13 +193,13 @@ setContactName(number<s>,name<>) -> <>::
|
|||
|
||||
listIdentities() -> identities<a{sv}>::
|
||||
* contactNumber : Phone number of contact
|
||||
* identities : Array of dictionaries with key contactNumber and values listed below
|
||||
* identities : Array of dictionary entries with key contactNumber and values listed below
|
||||
** trustLevel : String representation of trust level
|
||||
** dateAdded : String representation of date added
|
||||
** fingerprint : String representation of hexadecimal fingerprint
|
||||
** safetyNumber : String representation of safety number (10 or 11 space-separated six-digit numbers)
|
||||
|
||||
Returns an array of dictionaries for all contacts (obtained by listNumbers() and screened to exclude those with no identity information). For each dictionary, the key is the contactNumber and the value is a list of four strings: trustLevel, dateAdded, fingerprint, safetyNumber.
|
||||
Returns an array of dictionary entries for all contacts (obtained by listNumbers() and screened to exclude those with no identity information). For each dictionary, the key is the contactNumber and the value is a list of four strings: trustLevel, dateAdded, fingerprint, safetyNumber.
|
||||
|
||||
Exceptions: None
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ public interface Signal extends DBusInterface {
|
|||
String emoji, boolean remove, String targetAuthor, long targetSentTimestamp, byte[] groupId
|
||||
) throws Error.GroupNotFound, Error.Failure, Error.InvalidNumber, Error.InvalidGroupId;
|
||||
|
||||
List<Map<String, Variant<?>>> listIdentities();
|
||||
Map<String, Variant<?>> listIdentities();
|
||||
|
||||
Map<String, Variant<?>> listIdentities(String number) throws Error.InvalidNumber;
|
||||
|
||||
|
|
|
@ -300,16 +300,17 @@ public class DbusSignalImpl implements Signal {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Variant<?>>> listIdentities() {
|
||||
public Map<String, Variant<?>> listIdentities() {
|
||||
List<String> numbers = listNumbers();
|
||||
List<Map<String, Variant<?>>> results = new ArrayList<>();
|
||||
Map<String, Variant<?>> result = new HashMap<>();
|
||||
if (numbers.isEmpty()) {return result;}
|
||||
for (String number:numbers) {
|
||||
Map<String, Variant<?>> identity = listIdentities(number);
|
||||
if (! identity.isEmpty()) {
|
||||
results.add(identity);
|
||||
result.put(number, identity.get(number));
|
||||
}
|
||||
}
|
||||
return results;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue