mirror of
https://github.com/AsamK/signal-cli
synced 2025-09-07 14:30:38 +00:00
implement Dbus addDevice and removeDevice methods
update documentation
This commit is contained in:
parent
bc3f8803dc
commit
da1bb918bf
4 changed files with 37 additions and 4 deletions
|
@ -39,6 +39,7 @@ import org.whispersystems.signalservice.api.util.InvalidNumberException;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.HashSet;
|
||||
|
@ -699,6 +700,26 @@ public class DbusSignalImpl implements Signal {
|
|||
return DbusSignalControlImpl.link(newDeviceName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDevice(String uri) {
|
||||
try {
|
||||
m.addDeviceLink(new URI(uri));
|
||||
} catch (IOException | InvalidKeyException e) {
|
||||
throw new Error.Failure(e.getClass().getSimpleName() + "Add device link failed. " + e.getMessage());
|
||||
} catch (URISyntaxException e) {
|
||||
throw new Error.Failure(e.getClass().getSimpleName() + "Device link uri has invalid format: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeDevice(int deviceId) {
|
||||
try {
|
||||
m.removeLinkedDevices(deviceId);
|
||||
} catch (IOException e) {
|
||||
throw new Error.Failure(e.getClass().getSimpleName() + "Error while removing device: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(
|
||||
String number, boolean voiceVerification
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue