Canonicalize number when listing identities

This commit is contained in:
AsamK 2020-01-21 22:09:21 +01:00
parent cfd1e5544d
commit 7f9379f78b
2 changed files with 13 additions and 4 deletions

View file

@ -7,6 +7,8 @@ import org.asamk.signal.manager.Manager;
import org.asamk.signal.storage.protocol.JsonIdentityKeyStore;
import org.asamk.signal.util.Hex;
import org.asamk.signal.util.Util;
import org.whispersystems.libsignal.util.Pair;
import org.whispersystems.signalservice.api.util.InvalidNumberException;
import java.util.List;
import java.util.Map;
@ -39,8 +41,13 @@ public class ListIdentitiesCommand implements LocalCommand {
}
} else {
String number = ns.getString("number");
for (JsonIdentityKeyStore.Identity id : m.getIdentities(number)) {
printIdentityFingerprint(m, number, id);
try {
Pair<String, List<JsonIdentityKeyStore.Identity>> key = m.getIdentities(number);
for (JsonIdentityKeyStore.Identity id : key.second()) {
printIdentityFingerprint(m, key.first(), id);
}
} catch (InvalidNumberException e) {
System.out.println("Invalid number: " + e.getMessage());
}
}
return 0;