modify DBus unlisten and unregister

add unlisten() and unregister() to this branch

move unlisten() and unregister() methods from Signal.java to SignalControl.java for consistency

update documentation
This commit is contained in:
John Freed 2021-10-06 03:20:29 +02:00
parent 690636b83d
commit 3e67d61681
9 changed files with 196 additions and 14 deletions

View file

@ -922,8 +922,12 @@ public class ManagerImpl implements Manager {
while (!Thread.interrupted()) {
SignalServiceEnvelope envelope;
final CachedMessage[] cachedMessage = {null};
account.setLastReceiveTimestamp(System.currentTimeMillis());
if (account == null) {
logger.debug("Account closed.");
break;
}
logger.debug("Checking for new message from server");
account.setLastReceiveTimestamp(System.currentTimeMillis());
try {
var result = signalWebSocket.readOrEmpty(unit.toMillis(timeout), envelope1 -> {
final var recipientId = envelope1.hasSourceUuid()
@ -955,7 +959,7 @@ public class ManagerImpl implements Manager {
} else {
throw e;
}
} catch (WebSocketUnavailableException e) {
} catch (IOException e) {
logger.debug("Pipe unexpectedly unavailable, connecting");
signalWebSocket.connect();
continue;

View file

@ -27,6 +27,7 @@ import org.slf4j.LoggerFactory;
import org.whispersystems.libsignal.IdentityKeyPair;
import org.whispersystems.libsignal.util.KeyHelper;
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
import org.whispersystems.signalservice.api.SignalServiceAccountManager.NewDeviceRegistrationReturn;
import org.whispersystems.signalservice.api.groupsv2.ClientZkOperations;
import org.whispersystems.signalservice.api.groupsv2.GroupsV2Operations;
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
@ -90,7 +91,13 @@ public class ProvisioningManager {
}
public Manager finishDeviceLink(String deviceName) throws IOException, TimeoutException, UserAlreadyExists {
var ret = accountManager.getNewDeviceRegistration(tempIdentityKey);
NewDeviceRegistrationReturn ret;
logger.info("Waiting for addDevice request...");
try {
ret = accountManager.getNewDeviceRegistration(tempIdentityKey);
} catch (IOException | TimeoutException e) {
throw new TimeoutException(e.getMessage());
}
var number = ret.getNumber();
logger.info("Received link information from {}, linking in progress ...", number);