Skip to content

Commit

Permalink
Add color to listContacts output
Browse files Browse the repository at this point in the history
Fixes #1072
  • Loading branch information
AsamK committed Oct 28, 2022
1 parent 0b5a063 commit e63f2fa
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/main/java/org/asamk/signal/commands/ListContactsCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ public void handleCommand(
for (var r : recipients) {
final var contact = r.getContact() == null ? Contact.newBuilder().build() : r.getContact();
final var profile = r.getProfile() == null ? Profile.newBuilder().build() : r.getProfile();
writer.println("Number: {} Name: {} Profile name: {} Blocked: {} Message expiration: {}",
writer.println("Number: {} Name: {} Profile name: {} Color: {} Blocked: {} Message expiration: {}",
r.getAddress().getLegacyIdentifier(),
contact.getName(),
profile.getDisplayName(),
contact.getColor(),
contact.isBlocked(),
contact.getMessageExpirationTime() == 0
? "disabled"
Expand All @@ -72,6 +73,7 @@ public void handleCommand(
return new JsonContact(address.number().orElse(null),
address.uuid().map(UUID::toString).orElse(null),
contact.getName(),
contact.getColor(),
contact.isBlocked(),
contact.getMessageExpirationTime(),
r.getProfile() == null
Expand All @@ -92,7 +94,13 @@ public void handleCommand(
}

private record JsonContact(
String number, String uuid, String name, boolean isBlocked, int messageExpirationTime, JsonProfile profile
String number,
String uuid,
String name,
String color,
boolean isBlocked,
int messageExpirationTime,
JsonProfile profile
) {

private record JsonProfile(
Expand Down

0 comments on commit e63f2fa

Please sign in to comment.