Skip to content

Commit

Permalink
Fix registering
Browse files Browse the repository at this point in the history
Only query prekeys count if registration is complete
  • Loading branch information
AsamK committed Apr 3, 2016
1 parent edf5c9e commit 9d18b01
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/main/java/org/asamk/signal/Manager.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.whispersystems.signalservice.api.messages.*;
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import org.whispersystems.signalservice.api.push.TrustStore;
import org.whispersystems.signalservice.api.push.exceptions.AuthorizationFailedException;
import org.whispersystems.signalservice.api.push.exceptions.EncapsulatedExceptions;
import org.whispersystems.signalservice.api.util.InvalidNumberException;
import org.whispersystems.signalservice.api.util.PhoneNumberFormatter;
Expand Down Expand Up @@ -143,9 +144,13 @@ public void load() throws IOException, InvalidKeyException {
groupStore = new JsonGroupStore();
}
accountManager = new SignalServiceAccountManager(URL, TRUST_STORE, username, password, USER_AGENT);
if (accountManager.getPreKeysCount() < PREKEY_MINIMUM_COUNT) {
refreshPreKeys();
save();
try {
if (registered && accountManager.getPreKeysCount() < PREKEY_MINIMUM_COUNT) {
refreshPreKeys();
save();
}
} catch (AuthorizationFailedException e) {
System.err.println("Authorization failed, was the number registered elsewhere?");
}
}

Expand Down

0 comments on commit 9d18b01

Please sign in to comment.