mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Implement removing linked devices
Only allowed from the master device
This commit is contained in:
parent
17ff7531d4
commit
08a217108a
2 changed files with 27 additions and 0 deletions
|
@ -224,6 +224,23 @@ public class Main {
|
||||||
System.exit(3);
|
System.exit(3);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "removeDevice":
|
||||||
|
if (dBusConn != null) {
|
||||||
|
System.err.println("removeDevice is not yet implemented via dbus");
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
if (!m.isRegistered()) {
|
||||||
|
System.err.println("User is not registered.");
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
int deviceId = ns.getInt("deviceId");
|
||||||
|
m.removeLinkedDevices(deviceId);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(3);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case "send":
|
case "send":
|
||||||
if (dBusConn == null && !m.isRegistered()) {
|
if (dBusConn == null && !m.isRegistered()) {
|
||||||
System.err.println("User is not registered.");
|
System.err.println("User is not registered.");
|
||||||
|
@ -516,6 +533,12 @@ public class Main {
|
||||||
|
|
||||||
Subparser parserDevices = subparsers.addParser("listDevices");
|
Subparser parserDevices = subparsers.addParser("listDevices");
|
||||||
|
|
||||||
|
Subparser parserRemoveDevice = subparsers.addParser("removeDevice");
|
||||||
|
parserRemoveDevice.addArgument("-d", "--deviceId")
|
||||||
|
.type(int.class)
|
||||||
|
.required(true)
|
||||||
|
.help("Specify the device you want to remove. Use listDevices to see the deviceIds.");
|
||||||
|
|
||||||
Subparser parserRegister = subparsers.addParser("register");
|
Subparser parserRegister = subparsers.addParser("register");
|
||||||
parserRegister.addArgument("-v", "--voice")
|
parserRegister.addArgument("-v", "--voice")
|
||||||
.help("The verification should be done over voice, not sms.")
|
.help("The verification should be done over voice, not sms.")
|
||||||
|
|
|
@ -264,6 +264,10 @@ class Manager implements Signal {
|
||||||
return accountManager.getDevices();
|
return accountManager.getDevices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeLinkedDevices(int deviceId) throws IOException {
|
||||||
|
accountManager.removeDevice(deviceId);
|
||||||
|
}
|
||||||
|
|
||||||
public static Map<String, String> getQueryMap(String query) {
|
public static Map<String, String> getQueryMap(String query) {
|
||||||
String[] params = query.split("&");
|
String[] params = query.split("&");
|
||||||
Map<String, String> map = new HashMap<>();
|
Map<String, String> map = new HashMap<>();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue