+ handleCommand(command, ts, dBusConn, outputWriter);
+ }
+ } catch (ServiceUnknown e) {
+ throw new UserErrorException("signal-cli DBus daemon not running on "
+ + (systemBus ? "system" : "session")
+ + " bus: "
+ + e.getMessage(), e);
+ } catch (DBusExecutionException | DBusException | IOException e) {
+ throw new UnexpectedErrorException("Dbus client failed: " + e.getMessage(), e);
+ }
+ }
+
+ private String tryGetSingleAccountObjectPath(final DBusConnection dBusConn) throws DBusException, CommandException {
+ var control = dBusConn.getRemoteObject(DbusConfig.getBusname(),
+ DbusConfig.getObjectPath(),
+ SignalControl.class);
+ try {
+ final var accounts = control.listAccounts();
+ if (accounts.size() == 0) {
+ throw new UserErrorException("No local users found, you first need to register or link an account");
+ } else if (accounts.size() > 1) {
+ throw new UserErrorException(
+ "Multiple users found, you need to specify an account (phone number) with -a");