mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Always call save() after modifying something
This commit is contained in:
parent
9a1b348ed2
commit
208e12bdc6
2 changed files with 9 additions and 2 deletions
|
@ -240,7 +240,6 @@ public class Main {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
m.save();
|
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ class Manager implements TextSecure {
|
||||||
accountManager = new TextSecureAccountManager(URL, TRUST_STORE, username, password, USER_AGENT);
|
accountManager = new TextSecureAccountManager(URL, TRUST_STORE, username, password, USER_AGENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save() {
|
private void save() {
|
||||||
ObjectNode rootNode = jsonProcessot.createObjectNode();
|
ObjectNode rootNode = jsonProcessot.createObjectNode();
|
||||||
rootNode.put("username", username)
|
rootNode.put("username", username)
|
||||||
.put("password", password)
|
.put("password", password)
|
||||||
|
@ -160,6 +160,7 @@ class Manager implements TextSecure {
|
||||||
axolotlStore = new JsonAxolotlStore(identityKey, registrationId);
|
axolotlStore = new JsonAxolotlStore(identityKey, registrationId);
|
||||||
groupStore = new JsonGroupStore();
|
groupStore = new JsonGroupStore();
|
||||||
registered = false;
|
registered = false;
|
||||||
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRegistered() {
|
public boolean isRegistered() {
|
||||||
|
@ -177,6 +178,7 @@ class Manager implements TextSecure {
|
||||||
accountManager.requestSmsVerificationCode();
|
accountManager.requestSmsVerificationCode();
|
||||||
|
|
||||||
registered = false;
|
registered = false;
|
||||||
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int BATCH_SIZE = 100;
|
private static final int BATCH_SIZE = 100;
|
||||||
|
@ -194,6 +196,8 @@ class Manager implements TextSecure {
|
||||||
}
|
}
|
||||||
|
|
||||||
preKeyIdOffset = (preKeyIdOffset + BATCH_SIZE + 1) % Medium.MAX_VALUE;
|
preKeyIdOffset = (preKeyIdOffset + BATCH_SIZE + 1) % Medium.MAX_VALUE;
|
||||||
|
save();
|
||||||
|
|
||||||
return records;
|
return records;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,6 +214,7 @@ class Manager implements TextSecure {
|
||||||
PreKeyRecord record = new PreKeyRecord(Medium.MAX_VALUE, keyPair);
|
PreKeyRecord record = new PreKeyRecord(Medium.MAX_VALUE, keyPair);
|
||||||
|
|
||||||
axolotlStore.storePreKey(Medium.MAX_VALUE, record);
|
axolotlStore.storePreKey(Medium.MAX_VALUE, record);
|
||||||
|
save();
|
||||||
|
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
@ -222,6 +227,7 @@ class Manager implements TextSecure {
|
||||||
|
|
||||||
axolotlStore.storeSignedPreKey(nextSignedPreKeyId, record);
|
axolotlStore.storeSignedPreKey(nextSignedPreKeyId, record);
|
||||||
nextSignedPreKeyId = (nextSignedPreKeyId + 1) % Medium.MAX_VALUE;
|
nextSignedPreKeyId = (nextSignedPreKeyId + 1) % Medium.MAX_VALUE;
|
||||||
|
save();
|
||||||
|
|
||||||
return record;
|
return record;
|
||||||
} catch (InvalidKeyException e) {
|
} catch (InvalidKeyException e) {
|
||||||
|
@ -244,6 +250,7 @@ class Manager implements TextSecure {
|
||||||
SignedPreKeyRecord signedPreKeyRecord = generateSignedPreKey(axolotlStore.getIdentityKeyPair());
|
SignedPreKeyRecord signedPreKeyRecord = generateSignedPreKey(axolotlStore.getIdentityKeyPair());
|
||||||
|
|
||||||
accountManager.setPreKeys(axolotlStore.getIdentityKeyPair().getPublicKey(), lastResortKey, signedPreKeyRecord, oneTimePreKeys);
|
accountManager.setPreKeys(axolotlStore.getIdentityKeyPair().getPublicKey(), lastResortKey, signedPreKeyRecord, oneTimePreKeys);
|
||||||
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -392,6 +399,7 @@ class Manager implements TextSecure {
|
||||||
} catch (InvalidNumberException e) {
|
} catch (InvalidNumberException e) {
|
||||||
System.err.println("Failed to add recipient \"" + recipient + "\": " + e.getMessage());
|
System.err.println("Failed to add recipient \"" + recipient + "\": " + e.getMessage());
|
||||||
System.err.println("Aborting sending.");
|
System.err.println("Aborting sending.");
|
||||||
|
save();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue