mirror of
https://github.com/AsamK/signal-cli
synced 2025-09-07 14:30:38 +00:00
Dbus add/remove/list/update devices
modifications responding to requests by AsamK
This commit is contained in:
parent
46eef01d61
commit
d3136060a1
3 changed files with 149 additions and 266 deletions
|
@ -83,13 +83,13 @@ public interface Signal extends DBusInterface {
|
|||
|
||||
boolean isRegistered();
|
||||
|
||||
void addDevice(String uri) throws Error.Failure;
|
||||
void addDevice(String uri) throws Error.InvalidUri;
|
||||
|
||||
void removeDevice(int deviceId) throws Error.Failure;
|
||||
|
||||
List<String> listDevices() throws Error.Failure;
|
||||
|
||||
void updateAccount(String deviceName) throws Error.Failure;
|
||||
void updateDeviceName(String deviceName) throws Error.Failure;
|
||||
|
||||
void updateProfile(
|
||||
String name, String about, String aboutEmoji, String avatarPath, boolean removeAvatar
|
||||
|
@ -241,6 +241,13 @@ public interface Signal extends DBusInterface {
|
|||
}
|
||||
}
|
||||
|
||||
class InvalidUri extends DBusExecutionException {
|
||||
|
||||
public InvalidUri(final String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
||||
class Failure extends DBusExecutionException {
|
||||
|
||||
public Failure(final String message) {
|
||||
|
|
|
@ -96,16 +96,13 @@ public class DbusSignalImpl implements Signal {
|
|||
throw new Error.Failure("Failed to get linked devices: " + e.getMessage());
|
||||
}
|
||||
|
||||
for (var d : devices) {
|
||||
var name = d.getName();
|
||||
if (name == null) {name = "null";}
|
||||
results.add(name);
|
||||
}
|
||||
return results;
|
||||
return devices.stream()
|
||||
.map(d -> d.getName() == null ? "" : d.getName())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAccount(String deviceName) {
|
||||
public void updateDeviceName(String deviceName) {
|
||||
try {
|
||||
m.updateAccountAttributes(deviceName);
|
||||
} catch (IOException | Signal.Error.Failure e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue