public void checkAccountState() throws IOException {
if (accountManager.getPreKeysCount() < ServiceConfig.PREKEY_MINIMUM_COUNT) {
refreshPreKeys();
- account.save();
}
if (account.getUuid() == null) {
account.setUuid(accountManager.getOwnUuid());
- account.save();
}
updateAccountAttributes();
}
accountManager.deleteAccount();
account.setRegistered(false);
- account.save();
}
public List<DeviceInfo> getLinkedDevices() throws IOException {
var devices = accountManager.getDevices();
account.setMultiDevice(devices.size() > 1);
- account.save();
return devices;
}
accountManager.removeDevice(deviceId);
var devices = accountManager.getDevices();
account.setMultiDevice(devices.size() > 1);
- account.save();
}
public void addDeviceLink(URI linkUri) throws IOException, InvalidKeyException {
Optional.of(account.getProfileKey().serialize()),
verificationCode);
account.setMultiDevice(true);
- account.save();
}
public void setRegistrationLockPin(Optional<String> pin) throws IOException, UnauthenticatedResponseException {
pinHelper.setRegistrationLockPin(pin.get(), masterKey);
- account.setRegistrationLockPin(pin.get());
- account.setPinMasterKey(masterKey);
+ account.setRegistrationLockPin(pin.get(), masterKey);
} else {
// Remove legacy registration lock
accountManager.removeRegistrationLockV1();
// Remove KBS Pin
pinHelper.removeRegistrationLockPin();
- account.setRegistrationLockPin(null);
- account.setPinMasterKey(null);
+ account.setRegistrationLockPin(null, null);
}
- account.save();
}
void refreshPreKeys() throws IOException {
for (var address : signalServiceAddresses) {
handleEndSession(address);
}
- account.save();
throw e;
}
}
var contact = account.getContactStore().getContact(recipientId);
final var builder = contact == null ? Contact.newBuilder() : Contact.newBuilder(contact);
account.getContactStore().storeContact(recipientId, builder.withName(name).build());
- account.save();
}
public void setContactBlocked(String number, boolean blocked) throws InvalidNumberException {
var contact = account.getContactStore().getContact(recipientId);
final var builder = contact == null ? Contact.newBuilder() : Contact.newBuilder(contact);
account.getContactStore().storeContact(recipientId, builder.withBlocked(blocked).build());
- account.save();
}
public void setGroupBlocked(final GroupId groupId, final boolean blocked) throws GroupNotFoundException {
group.setBlocked(blocked);
account.getGroupStore().updateGroup(group);
- account.save();
}
private void setExpirationTimer(RecipientId recipientId, int messageExpirationTimer) {
var recipientId = canonicalizeAndResolveRecipient(number);
setExpirationTimer(recipientId, messageExpirationTimer);
sendExpirationTimerUpdate(recipientId);
- account.save();
}
/**
var sticker = new Sticker(StickerPackId.deserialize(Hex.fromStringCondensed(packId)), packKey);
account.getStickerStore().updateSticker(sticker);
- account.save();
try {
return new URI("https",
handleEndSession(recipient);
}
}
- account.save();
}
}
messageBuilder.withTimestamp(timestamp);
getOrCreateMessagePipe();
getOrCreateUnidentifiedMessagePipe();
- try {
- final var recipientId = account.getSelfRecipientId();
+ final var recipientId = account.getSelfRecipientId();
- final var contact = account.getContactStore().getContact(recipientId);
- final var expirationTime = contact != null ? contact.getMessageExpirationTime() : 0;
- messageBuilder.withExpiration(expirationTime);
+ final var contact = account.getContactStore().getContact(recipientId);
+ final var expirationTime = contact != null ? contact.getMessageExpirationTime() : 0;
+ messageBuilder.withExpiration(expirationTime);
- var message = messageBuilder.build();
- final var result = sendSelfMessage(message);
- return new Pair<>(timestamp, result);
- } finally {
- account.save();
- }
+ var message = messageBuilder.build();
+ final var result = sendSelfMessage(message);
+ return new Pair<>(timestamp, result);
}
private SendMessageResult sendSelfMessage(SignalServiceDataMessage message) throws IOException {
}
actions = handleMessage(envelope, content, ignoreAttachments);
}
- account.save();
handler.handleMessage(envelope, content, null);
cachedMessage.delete();
return actions;
logger.warn("Message action failed.", e);
}
}
- account.save();
queuedActions.clear();
queuedActions = null;
}
queuedActions.addAll(actions);
}
}
- account.save();
if (isMessageBlocked(envelope, content)) {
logger.info("Ignoring a message from blocked user/group: {}", envelope.getTimestamp());
} else if (notAGroupMember) {