import org.asamk.signal.util.IOUtils;
import org.asamk.signal.util.SecurityProvider;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.freedesktop.dbus.DBusConnection;
+import org.freedesktop.dbus.connections.impl.DBusConnection;
import org.freedesktop.dbus.exceptions.DBusException;
+import org.whispersystems.signalservice.api.push.exceptions.AuthorizationFailedException;
import org.whispersystems.signalservice.api.util.PhoneNumberFormatter;
import java.io.File;
if (ns.getBoolean("dbus") || ns.getBoolean("dbus_system")) {
try {
m = null;
- int busType;
+ DBusConnection.DBusBusType busType;
if (ns.getBoolean("dbus_system")) {
- busType = DBusConnection.SYSTEM;
+ busType = DBusConnection.DBusBusType.SYSTEM;
} else {
- busType = DBusConnection.SESSION;
+ busType = DBusConnection.DBusBusType.SESSION;
}
dBusConn = DBusConnection.getConnection(busType);
ts = dBusConn.getRemoteObject(
ts = m;
try {
m.init();
+ } catch (AuthorizationFailedException e) {
+ if (!"register".equals(ns.getString("command"))) {
+ // Register command should still be possible, if current authorization fails
+ System.err.println("Authorization failed, was the number registered elsewhere?");
+ return 2;
+ }
} catch (Exception e) {
System.err.println("Error loading state file: " + e.getMessage());
return 2;