mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 02:20:39 +00:00
Add --unrestricted-unidentified-sender to updateAccount command
This commit is contained in:
parent
3290a5bf4d
commit
30e8e36635
9 changed files with 38 additions and 10 deletions
|
@ -89,7 +89,7 @@ public interface Manager extends Closeable {
|
|||
*/
|
||||
Map<String, UserStatus> getUserStatus(Set<String> numbers) throws IOException, RateLimitException;
|
||||
|
||||
void updateAccountAttributes(String deviceName) throws IOException;
|
||||
void updateAccountAttributes(String deviceName, Boolean unrestrictedUnidentifiedSender) throws IOException;
|
||||
|
||||
Configuration getConfiguration();
|
||||
|
||||
|
|
|
@ -328,6 +328,13 @@ public final class ProfileHelper {
|
|||
|
||||
final var profile = account.getProfileStore().getProfile(recipientId);
|
||||
|
||||
if (recipientId.equals(account.getSelfRecipientId())) {
|
||||
final var isUnrestricted = encryptedProfile.isUnrestrictedUnidentifiedAccess();
|
||||
if (account.isUnrestrictedUnidentifiedAccess() != isUnrestricted) {
|
||||
account.setUnrestrictedUnidentifiedAccess(isUnrestricted);
|
||||
}
|
||||
}
|
||||
|
||||
Profile newProfile = null;
|
||||
if (profileKey.isPresent()) {
|
||||
logger.trace("Decrypting profile");
|
||||
|
|
|
@ -277,10 +277,13 @@ public class ManagerImpl implements Manager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateAccountAttributes(String deviceName) throws IOException {
|
||||
public void updateAccountAttributes(String deviceName, Boolean unrestrictedUnidentifiedSender) throws IOException {
|
||||
if (deviceName != null) {
|
||||
context.getAccountHelper().setDeviceName(deviceName);
|
||||
}
|
||||
if (unrestrictedUnidentifiedSender != null) {
|
||||
account.setUnrestrictedUnidentifiedAccess(unrestrictedUnidentifiedSender);
|
||||
}
|
||||
context.getAccountHelper().updateAccountAttributes();
|
||||
context.getAccountHelper().checkWhoAmiI();
|
||||
}
|
||||
|
|
|
@ -154,6 +154,10 @@ public class SignalAccount implements Closeable {
|
|||
private final KeyValueEntry<Long> storageManifestVersion = new KeyValueEntry<>("storage-manifest-version",
|
||||
long.class,
|
||||
-1L);
|
||||
private final KeyValueEntry<Boolean> unrestrictedUnidentifiedAccess = new KeyValueEntry<>(
|
||||
"unrestricted-unidentified-access",
|
||||
Boolean.class,
|
||||
false);
|
||||
private boolean isMultiDevice = false;
|
||||
private boolean registered = false;
|
||||
|
||||
|
@ -1594,8 +1598,11 @@ public class SignalAccount implements Closeable {
|
|||
}
|
||||
|
||||
public boolean isUnrestrictedUnidentifiedAccess() {
|
||||
final var profile = getProfileStore().getProfile(getSelfRecipientId());
|
||||
return profile != null && profile.getUnidentifiedAccessMode() == Profile.UnidentifiedAccessMode.UNRESTRICTED;
|
||||
return Boolean.TRUE.equals(getKeyValueStore().getEntry(unrestrictedUnidentifiedAccess));
|
||||
}
|
||||
|
||||
public void setUnrestrictedUnidentifiedAccess(boolean value) {
|
||||
getKeyValueStore().storeEntry(unrestrictedUnidentifiedAccess, value);
|
||||
}
|
||||
|
||||
public boolean isDiscoverableByPhoneNumber() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue