device_name: Option<String>,
#[arg(long = "unrestricted-unidentified-sender")]
unrestricted_unidentified_sender: Option<bool>,
+ #[arg(long = "discoverable-by-number")]
+ discoverable_by_number: Option<bool>,
+ #[arg(long = "number-sharing")]
+ number_sharing: Option<bool>,
},
UpdateConfiguration {
#[arg(long = "read-receipts")]
account: Option<String>,
deviceName: Option<String>,
unrestrictedUnidentifiedSender: Option<bool>,
+ discoverableByNumber: Option<bool>,
+ numberSharing: Option<bool>,
) -> Result<Value, ErrorObjectOwned>;
#[method(name = "updateConfiguration", param_kind = map)]
CliCommands::UpdateAccount {
device_name,
unrestricted_unidentified_sender,
+ discoverable_by_number,
+ number_sharing,
} => {
client
- .update_account(cli.account, device_name, unrestricted_unidentified_sender)
+ .update_account(
+ cli.account,
+ device_name,
+ unrestricted_unidentified_sender,
+ discoverable_by_number,
+ number_sharing,
+ )
.await
}
CliCommands::UpdateConfiguration {
*/
Map<String, UserStatus> getUserStatus(Set<String> numbers) throws IOException, RateLimitException;
- void updateAccountAttributes(String deviceName, Boolean unrestrictedUnidentifiedSender) throws IOException;
+ void updateAccountAttributes(
+ String deviceName,
+ Boolean unrestrictedUnidentifiedSender,
+ final Boolean discoverableByNumber,
+ final Boolean numberSharing
+ ) throws IOException;
Configuration getConfiguration();
import org.asamk.signal.manager.api.NotPrimaryDeviceException;
import org.asamk.signal.manager.api.Pair;
import org.asamk.signal.manager.api.PendingAdminApprovalException;
+import org.asamk.signal.manager.api.PhoneNumberSharingMode;
import org.asamk.signal.manager.api.PinLockedException;
import org.asamk.signal.manager.api.Profile;
import org.asamk.signal.manager.api.RateLimitException;
}
@Override
- public void updateAccountAttributes(String deviceName, Boolean unrestrictedUnidentifiedSender) throws IOException {
+ public void updateAccountAttributes(
+ String deviceName,
+ Boolean unrestrictedUnidentifiedSender,
+ final Boolean discoverableByNumber,
+ final Boolean numberSharing
+ ) throws IOException {
if (deviceName != null) {
context.getAccountHelper().setDeviceName(deviceName);
}
if (unrestrictedUnidentifiedSender != null) {
account.setUnrestrictedUnidentifiedAccess(unrestrictedUnidentifiedSender);
}
+ if (discoverableByNumber != null) {
+ account.getConfigurationStore().setPhoneNumberUnlisted(!discoverableByNumber);
+ }
+ if (numberSharing != null) {
+ account.getConfigurationStore()
+ .setPhoneNumberSharingMode(numberSharing
+ ? PhoneNumberSharingMode.EVERYBODY
+ : PhoneNumberSharingMode.NOBODY);
+ }
context.getAccountHelper().updateAccountAttributes();
context.getAccountHelper().checkWhoAmiI();
}
.setLinkPreviewsEnabled(linkPreviews)
.setUnlistedPhoneNumber(unlisted)
.setPhoneNumberSharingMode(phoneNumberSharingMode)
- .setUnlistedPhoneNumber(unlisted)
.setPinnedConversations(pinnedConversations)
.setPreferContactAvatars(preferContactAvatars)
.setPayments(payments.isEnabled(), payments.getEntropy().orElse(null))
.setSealedSenderIndicatorsEnabled(Optional.ofNullable(configStore.getUnidentifiedDeliveryIndicators())
.orElse(true))
.setLinkPreviewsEnabled(Optional.ofNullable(configStore.getLinkPreviews()).orElse(true))
- .setUnlistedPhoneNumber(Optional.ofNullable(configStore.getPhoneNumberUnlisted()).orElse(true))
+ .setUnlistedPhoneNumber(Optional.ofNullable(configStore.getPhoneNumberUnlisted()).orElse(false))
.setPhoneNumberSharingMode(localToRemote(Optional.ofNullable(configStore.getPhoneNumberSharingMode())
.orElse(PhoneNumberSharingMode.EVERYBODY)))
.setE164(self.getAddress().number().orElse(""))
*--unrestricted-unidentified-sender* {true,false}::
Enable if anyone should be able to send you unidentified sender messages.
+*--discoverable-by-number* {true,false}::
+Enable/disable if the account should be discoverable by phone number
+
+*--number-sharing* {true,false}::
+Indicates if Signal should share its phone number when sending a message.
+
=== startChangeNumber
Change an account to a new phone number with SMS or voice verification.
subparser.addArgument("--unrestricted-unidentified-sender")
.type(Boolean.class)
.help("Enable if anyone should be able to send you unidentified sender messages.");
+ subparser.addArgument("--discoverable-by-number")
+ .type(Boolean.class)
+ .help("Enable/disable if the account should be discoverable by phone number");
+ subparser.addArgument("--number-sharing")
+ .type(Boolean.class)
+ .help("Indicates if Signal should share its phone number when sending a message.");
var mut = subparser.addMutuallyExclusiveGroup();
mut.addArgument("-u", "--username").help("Specify a username that can then be used to contact this account.");
) throws CommandException {
final var deviceName = ns.getString("device-name");
final var unrestrictedUnidentifiedSender = ns.getBoolean("unrestricted-unidentified-sender");
+ final var discoverableByNumber = ns.getBoolean("discoverable-by-number");
+ final var numberSharing = ns.getBoolean("number-sharing");
try {
- m.updateAccountAttributes(deviceName, unrestrictedUnidentifiedSender);
+ m.updateAccountAttributes(deviceName, unrestrictedUnidentifiedSender, discoverableByNumber, numberSharing);
} catch (IOException e) {
throw new IOErrorException("UpdateAccount error: " + e.getMessage(), e);
}
@Override
public void updateAccountAttributes(
- final String deviceName, final Boolean unrestrictedUnidentifiedSender
+ final String deviceName,
+ final Boolean unrestrictedUnidentifiedSender,
+ final Boolean discoverableByNumber,
+ final Boolean numberSharing
) throws IOException {
if (deviceName != null) {
final var devicePath = signal.getThisDevice();
getRemoteObject(devicePath, Signal.Device.class).Set("org.asamk.Signal.Device", "Name", deviceName);
+ } else {
+ throw new UnsupportedOperationException();
}
}
throw new Error.Failure("Only the name of this device can be changed");
}
try {
- m.updateAccountAttributes(name, null);
+ m.updateAccountAttributes(name, null, null, null);
// update device list
updateDevices();
} catch (IOException e) {