]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/commands/DaemonCommand.java
Remove workaround for getBoolean from JsonRpcLocalCommand
[signal-cli] / src / main / java / org / asamk / signal / commands / DaemonCommand.java
index 0591486c931f80b85450ae136fd74b24a6cbaeff..5045db9a28c89fce326bdfe780c9c479ba3c7ea8 100644 (file)
@@ -54,10 +54,10 @@ public class DaemonCommand implements MultiLocalCommand {
     public void handleCommand(
             final Namespace ns, final Manager m, final OutputWriter outputWriter
     ) throws CommandException {
-        boolean ignoreAttachments = ns.getBoolean("ignore-attachments");
+        boolean ignoreAttachments = Boolean.TRUE.equals(ns.getBoolean("ignore-attachments"));
 
         DBusConnection.DBusBusType busType;
-        if (ns.getBoolean("system")) {
+        if (Boolean.TRUE.equals(ns.getBoolean("system"))) {
             busType = DBusConnection.DBusBusType.SYSTEM;
         } else {
             busType = DBusConnection.DBusBusType.SESSION;
@@ -75,7 +75,7 @@ public class DaemonCommand implements MultiLocalCommand {
             }
         } catch (DBusException | IOException e) {
             logger.error("Dbus command failed", e);
-            throw new UnexpectedErrorException("Dbus command failed");
+            throw new UnexpectedErrorException("Dbus command failed", e);
         }
     }
 
@@ -83,10 +83,10 @@ public class DaemonCommand implements MultiLocalCommand {
     public void handleCommand(
             final Namespace ns, final List<Manager> managers, final SignalCreator c, final OutputWriter outputWriter
     ) throws CommandException {
-        boolean ignoreAttachments = ns.getBoolean("ignore-attachments");
+        boolean ignoreAttachments = Boolean.TRUE.equals(ns.getBoolean("ignore-attachments"));
 
         DBusConnection.DBusBusType busType;
-        if (ns.getBoolean("system")) {
+        if (Boolean.TRUE.equals(ns.getBoolean("system"))) {
             busType = DBusConnection.DBusBusType.SYSTEM;
         } else {
             busType = DBusConnection.DBusBusType.SESSION;
@@ -95,7 +95,7 @@ public class DaemonCommand implements MultiLocalCommand {
         try (var conn = DBusConnection.getConnection(busType)) {
             final var signalControl = new DbusSignalControlImpl(c, m -> {
                 try {
-                    final var objectPath = DbusConfig.getObjectPath(m.getUsername());
+                    final var objectPath = DbusConfig.getObjectPath(m.getSelfNumber());
                     return run(conn, objectPath, m, outputWriter, ignoreAttachments);
                 } catch (DBusException e) {
                     logger.error("Failed to export object", e);
@@ -113,7 +113,7 @@ public class DaemonCommand implements MultiLocalCommand {
             signalControl.run();
         } catch (DBusException | IOException e) {
             logger.error("Dbus command failed", e);
-            throw new UnexpectedErrorException("Dbus command failed");
+            throw new UnexpectedErrorException("Dbus command failed", e);
         }
     }