- New --hidden parameter for removeContact command
- New --notify-self parameter for send command, for sending a non-sync message when self is part of the recipients or groups.
With this parameter sending to the self number (+XXXX) now behaves the same as the --note-to-self parameter.
+- New --unrestricted-unidentified-sender parameter for updateAccount command
### Improved
- Better shutdown handling after Ctrl+C and SIGTERM
*/
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();
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");
}
@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();
}
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;
}
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() {
*-n* NAME, *--device-name* NAME::
Set a new device name for the primary or linked device
+*--unrestricted-unidentified-sender* {true,false}::
+Enable if anyone should be able to send you unidentified sender messages.
+
=== startChangeNumber
Change an account to a new phone number with SMS or voice verification.
public void attachToSubparser(final Subparser subparser) {
subparser.help("Update the account attributes on the signal server.");
subparser.addArgument("-n", "--device-name").help("Specify a name to describe this device.");
+ subparser.addArgument("--unrestricted-unidentified-sender")
+ .type(Boolean.class)
+ .help("Enable if anyone should be able to send you unidentified sender messages.");
+
var mut = subparser.addMutuallyExclusiveGroup();
mut.addArgument("-u", "--username").help("Specify a username that can then be used to contact this account.");
mut.addArgument("--delete-username")
public void handleCommand(
final Namespace ns, final Manager m, final OutputWriter outputWriter
) throws CommandException {
- var deviceName = ns.getString("device-name");
+ final var deviceName = ns.getString("device-name");
+ final var unrestrictedUnidentifiedSender = ns.getBoolean("unrestricted-unidentified-sender");
try {
- m.updateAccountAttributes(deviceName);
+ m.updateAccountAttributes(deviceName, unrestrictedUnidentifiedSender);
} catch (IOException e) {
throw new IOErrorException("UpdateAccount error: " + e.getMessage(), e);
}
- var username = ns.getString("username");
+ final var username = ns.getString("username");
if (username != null) {
try {
m.setUsername(username);
}
}
- var deleteUsername = Boolean.TRUE.equals(ns.getBoolean("delete-username"));
+ final var deleteUsername = Boolean.TRUE.equals(ns.getBoolean("delete-username"));
if (deleteUsername) {
try {
m.deleteUsername();
}
@Override
- public void updateAccountAttributes(final String deviceName) throws IOException {
+ public void updateAccountAttributes(
+ final String deviceName, final Boolean unrestrictedUnidentifiedSender
+ ) throws IOException {
if (deviceName != null) {
final var devicePath = signal.getThisDevice();
getRemoteObject(devicePath, Signal.Device.class).Set("org.asamk.Signal.Device", "Name", deviceName);
throw new Error.Failure("Only the name of this device can be changed");
}
try {
- m.updateAccountAttributes(name);
+ m.updateAccountAttributes(name, null);
// update device list
updateDevices();
} catch (IOException e) {