]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/commands/ReceiveCommand.java
Allow calling signal-cli without -u flag
[signal-cli] / src / main / java / org / asamk / signal / commands / ReceiveCommand.java
index 4d4fdc10f33fd3644053b03ddda16dcd7dc97a95..30518cb44f9dc5711dc7e2d4654cf002cb7c6416 100644 (file)
@@ -20,9 +20,9 @@ import org.freedesktop.dbus.connections.impl.DBusConnection;
 import org.freedesktop.dbus.exceptions.DBusException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.whispersystems.util.Base64;
 
 import java.io.IOException;
+import java.util.Base64;
 import java.util.concurrent.TimeUnit;
 
 import static org.asamk.signal.util.ErrorUtils.handleAssertionError;
@@ -30,7 +30,7 @@ import static org.asamk.signal.util.ErrorUtils.handleAssertionError;
 public class ReceiveCommand implements ExtendedDbusCommand, LocalCommand {
 
     // TODO delete later when "json" variable is removed
-    final static Logger logger = LoggerFactory.getLogger(ReceiveCommand.class);
+    private final static Logger logger = LoggerFactory.getLogger(ReceiveCommand.class);
 
     @Override
     public void attachToSubparser(final Subparser subparser) {
@@ -81,7 +81,7 @@ public class ReceiveCommand implements ExtendedDbusCommand, LocalCommand {
                             messageReceived.getMessage()));
                     if (messageReceived.getGroupId().length > 0) {
                         System.out.println("Group info:");
-                        System.out.println("  Id: " + Base64.encodeBytes(messageReceived.getGroupId()));
+                        System.out.println("  Id: " + Base64.getEncoder().encodeToString(messageReceived.getGroupId()));
                     }
                     if (messageReceived.getAttachments().size() > 0) {
                         System.out.println("Attachments: ");
@@ -130,7 +130,7 @@ public class ReceiveCommand implements ExtendedDbusCommand, LocalCommand {
                             syncReceived.getMessage()));
                     if (syncReceived.getGroupId().length > 0) {
                         System.out.println("Group info:");
-                        System.out.println("  Id: " + Base64.encodeBytes(syncReceived.getGroupId()));
+                        System.out.println("  Id: " + Base64.getEncoder().encodeToString(syncReceived.getGroupId()));
                     }
                     if (syncReceived.getAttachments().size() > 0) {
                         System.out.println("Attachments: ");
@@ -141,12 +141,9 @@ public class ReceiveCommand implements ExtendedDbusCommand, LocalCommand {
                     System.out.println();
                 }
             });
-        } catch (UnsatisfiedLinkError e) {
-            System.err.println("Missing native library dependency for dbus service: " + e.getMessage());
-            return 1;
         } catch (DBusException e) {
             e.printStackTrace();
-            return 1;
+            return 2;
         }
         while (true) {
             try {