mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-30 02:50:39 +00:00
Implement unregister command for jsonrpc and dbus daemon
This commit is contained in:
parent
b78573021d
commit
c73c58723c
11 changed files with 98 additions and 9 deletions
|
@ -68,6 +68,7 @@ public class DbusManagerImpl implements Manager {
|
|||
|
||||
private final Set<ReceiveMessageHandler> weakHandlers = new HashSet<>();
|
||||
private final Set<ReceiveMessageHandler> messageHandlers = new HashSet<>();
|
||||
private final List<Runnable> closedListeners = new ArrayList<>();
|
||||
private DBusSigHandler<Signal.MessageReceivedV2> dbusMsgHandler;
|
||||
private DBusSigHandler<Signal.ReceiptReceivedV2> dbusRcptHandler;
|
||||
private DBusSigHandler<Signal.SyncMessageReceivedV2> dbusSyncHandler;
|
||||
|
@ -583,6 +584,13 @@ public class DbusManagerImpl implements Manager {
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addClosedListener(final Runnable listener) {
|
||||
synchronized (closedListeners) {
|
||||
closedListeners.add(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
synchronized (this) {
|
||||
|
@ -595,6 +603,10 @@ public class DbusManagerImpl implements Manager {
|
|||
weakHandlers.clear();
|
||||
messageHandlers.clear();
|
||||
}
|
||||
synchronized (closedListeners) {
|
||||
closedListeners.forEach(Runnable::run);
|
||||
closedListeners.clear();
|
||||
}
|
||||
}
|
||||
|
||||
private SendMessageResults handleMessage(
|
||||
|
|
|
@ -138,6 +138,24 @@ public class DbusSignalImpl implements Signal {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregister() throws Error.Failure {
|
||||
try {
|
||||
m.unregister();
|
||||
} catch (IOException e) {
|
||||
throw new Error.Failure("Failed to unregister: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAccount() throws Error.Failure {
|
||||
try {
|
||||
m.deleteAccount();
|
||||
} catch (IOException e) {
|
||||
throw new Error.Failure("Failed to delete account: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDevice(String uri) {
|
||||
try {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue