mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Minor fixes
This commit is contained in:
parent
530ef51ba7
commit
c79860b493
5 changed files with 14 additions and 6 deletions
|
@ -124,7 +124,7 @@ public class RegistrationManager implements Closeable {
|
||||||
|
|
||||||
public Manager verifyAccount(
|
public Manager verifyAccount(
|
||||||
String verificationCode, String pin
|
String verificationCode, String pin
|
||||||
) throws IOException, KeyBackupSystemNoDataException, KeyBackupServicePinException {
|
) throws IOException, LockedException, KeyBackupSystemNoDataException, KeyBackupServicePinException {
|
||||||
verificationCode = verificationCode.replace("-", "");
|
verificationCode = verificationCode.replace("-", "");
|
||||||
VerifyAccountResponse response;
|
VerifyAccountResponse response;
|
||||||
MasterKey masterKey;
|
MasterKey masterKey;
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class PinHelper {
|
||||||
) throws IOException, KeyBackupSystemNoDataException, KeyBackupServicePinException {
|
) throws IOException, KeyBackupSystemNoDataException, KeyBackupServicePinException {
|
||||||
var tokenResponse = keyBackupService.getToken(basicStorageCredentials);
|
var tokenResponse = keyBackupService.getToken(basicStorageCredentials);
|
||||||
if (tokenResponse == null || tokenResponse.getTries() == 0) {
|
if (tokenResponse == null || tokenResponse.getTries() == 0) {
|
||||||
throw new IOException("KBS Account locked");
|
throw new IOException("KBS Account locked, maximum pin attempts reached.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var registrationLockData = restoreMasterKey(pin, basicStorageCredentials, tokenResponse);
|
var registrationLockData = restoreMasterKey(pin, basicStorageCredentials, tokenResponse);
|
||||||
|
|
|
@ -229,7 +229,13 @@ public class SignalAccount implements Closeable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static File getUserPath(final File dataPath, final String username) {
|
private static File getUserPath(final File dataPath, final String username) {
|
||||||
return new File(dataPath, username + ".d");
|
final var path = new File(dataPath, username + ".d");
|
||||||
|
try {
|
||||||
|
IOUtils.createPrivateDirectories(path);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new AssertionError("Failed to create user path", e);
|
||||||
|
}
|
||||||
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static File getMessageCachePath(File dataPath, String username) {
|
private static File getMessageCachePath(File dataPath, String username) {
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class RecipientStore implements ContactsStore, ProfileStore {
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public SignalServiceAddress resolveServiceAddress(SignalServiceAddress address) {
|
public SignalServiceAddress resolveServiceAddress(SignalServiceAddress address) {
|
||||||
return resolveServiceAddress(resolveRecipient(address, true));
|
return resolveServiceAddress(resolveRecipient(address, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public RecipientId resolveRecipient(UUID uuid) {
|
public RecipientId resolveRecipient(UUID uuid) {
|
||||||
|
@ -331,9 +331,8 @@ public class RecipientStore implements ContactsStore, ProfileStore {
|
||||||
private void updateRecipientAddressLocked(
|
private void updateRecipientAddressLocked(
|
||||||
final RecipientId recipientId, final SignalServiceAddress address
|
final RecipientId recipientId, final SignalServiceAddress address
|
||||||
) {
|
) {
|
||||||
final var nextRecipientId = nextIdLocked();
|
|
||||||
final var recipient = recipients.get(recipientId);
|
final var recipient = recipients.get(recipientId);
|
||||||
storeRecipientLocked(nextRecipientId, Recipient.newBuilder(recipient).withAddress(address).build());
|
storeRecipientLocked(recipientId, Recipient.newBuilder(recipient).withAddress(address).build());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void storeRecipientLocked(
|
private void storeRecipientLocked(
|
||||||
|
|
|
@ -71,6 +71,9 @@ public class ProfileUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Pair<String, String> splitName(String name) {
|
private static Pair<String, String> splitName(String name) {
|
||||||
|
if (name == null) {
|
||||||
|
return new Pair<>(null, null);
|
||||||
|
}
|
||||||
String[] parts = name.split("\0");
|
String[] parts = name.split("\0");
|
||||||
|
|
||||||
switch (parts.length) {
|
switch (parts.length) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue