]> nmode's Git Repositories - signal-cli/commitdiff
Add color to listContacts output
authorAsamK <asamk@gmx.de>
Fri, 28 Oct 2022 17:57:21 +0000 (19:57 +0200)
committerAsamK <asamk@gmx.de>
Fri, 28 Oct 2022 18:12:11 +0000 (20:12 +0200)
Fixes #1072

src/main/java/org/asamk/signal/commands/ListContactsCommand.java

index 8fc6f2d1fd944f060b50dc314023155e6fe3b2b1..abcfdca34b47b528e2246aa982fe705ae33e4d04 100644 (file)
@@ -55,10 +55,11 @@ public class ListContactsCommand implements JsonRpcLocalCommand {
             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"
@@ -72,6 +73,7 @@ public class ListContactsCommand implements JsonRpcLocalCommand {
                 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
@@ -92,7 +94,13 @@ public class ListContactsCommand implements JsonRpcLocalCommand {
     }
 
     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(