mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Rename main/master device to primary device
This commit is contained in:
parent
ad65eb7ea2
commit
9ad24614cb
22 changed files with 74 additions and 74 deletions
|
@ -114,7 +114,7 @@
|
||||||
### Changed
|
### Changed
|
||||||
- libzkgroup dependency is no longer required
|
- libzkgroup dependency is no longer required
|
||||||
- Renamed `-u` and `--username` flags to `-a` and `--account` to prevent confusion with upcoming Signal usernames. The old flags are also still supported for now.
|
- Renamed `-u` and `--username` flags to `-a` and `--account` to prevent confusion with upcoming Signal usernames. The old flags are also still supported for now.
|
||||||
- Respect phone number sharing mode and unlisted state set by main device
|
- Respect phone number sharing mode and unlisted state set by primary device
|
||||||
- Adapt register command to reactivate account if possible.
|
- Adapt register command to reactivate account if possible.
|
||||||
- dbus-java now uses Java 16 native unix sockets, which should provide better cross-platform compatibility
|
- dbus-java now uses Java 16 native unix sockets, which should provide better cross-platform compatibility
|
||||||
- If sending to a recipient fails (e.g. unregistered) signal-cli now exits with a success exit code and prints additional information about the failure.
|
- If sending to a recipient fails (e.g. unregistered) signal-cli now exits with a success exit code and prints additional information about the failure.
|
||||||
|
@ -166,7 +166,7 @@
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- New global parameter `--trust-new-identities=always` to allow trusting any new identity key without verification
|
- New global parameter `--trust-new-identities=always` to allow trusting any new identity key without verification
|
||||||
- New parameter `--device-name` for `updateAccount` command to change the device name (also works for the main device)
|
- New parameter `--device-name` for `updateAccount` command to change the device name (also works for the primary device)
|
||||||
- New SignalControl DBus interface, to register/verify/link new accounts
|
- New SignalControl DBus interface, to register/verify/link new accounts
|
||||||
- New `jsonRpc` command that provides a JSON-RPC based API on stdout/stdin
|
- New `jsonRpc` command that provides a JSON-RPC based API on stdout/stdin
|
||||||
- Support for announcement groups
|
- Support for announcement groups
|
||||||
|
@ -217,7 +217,7 @@
|
||||||
### Added
|
### Added
|
||||||
- A manual page for the DBus interface (Thanks @bublath, @exquo)
|
- A manual page for the DBus interface (Thanks @bublath, @exquo)
|
||||||
- Remote message delete command (Thanks @adaptivegarage)
|
- Remote message delete command (Thanks @adaptivegarage)
|
||||||
- sendSyncRequest command to request complete contact/group list from master device
|
- sendSyncRequest command to request complete contact/group list from primary device
|
||||||
- New `--delete-account` argument for unregister (Dangerous)
|
- New `--delete-account` argument for unregister (Dangerous)
|
||||||
- New `--family-name` argument for updateProfile
|
- New `--family-name` argument for updateProfile
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@
|
||||||
- Sending reaction to group (Thanks @adaptivegarage)
|
- Sending reaction to group (Thanks @adaptivegarage)
|
||||||
- Displaying of address for messages from untrusted identities
|
- Displaying of address for messages from untrusted identities
|
||||||
- Handling of recipient number or uuid changes (e.g. after account deletions)
|
- Handling of recipient number or uuid changes (e.g. after account deletions)
|
||||||
- Only respond to sync requests from master device
|
- Only respond to sync requests from primary device
|
||||||
- Display of quit group messages
|
- Display of quit group messages
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
@ -10,7 +10,7 @@ import org.asamk.signal.manager.api.InvalidDeviceLinkException;
|
||||||
import org.asamk.signal.manager.api.InvalidStickerException;
|
import org.asamk.signal.manager.api.InvalidStickerException;
|
||||||
import org.asamk.signal.manager.api.Message;
|
import org.asamk.signal.manager.api.Message;
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
import org.asamk.signal.manager.api.NotMasterDeviceException;
|
import org.asamk.signal.manager.api.NotPrimaryDeviceException;
|
||||||
import org.asamk.signal.manager.api.Pair;
|
import org.asamk.signal.manager.api.Pair;
|
||||||
import org.asamk.signal.manager.api.RecipientIdentifier;
|
import org.asamk.signal.manager.api.RecipientIdentifier;
|
||||||
import org.asamk.signal.manager.api.SendGroupMessageResults;
|
import org.asamk.signal.manager.api.SendGroupMessageResults;
|
||||||
|
@ -65,7 +65,7 @@ public interface Manager extends Closeable {
|
||||||
|
|
||||||
Configuration getConfiguration();
|
Configuration getConfiguration();
|
||||||
|
|
||||||
void updateConfiguration(Configuration configuration) throws IOException, NotMasterDeviceException;
|
void updateConfiguration(Configuration configuration) throws IOException, NotPrimaryDeviceException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the user's profile.
|
* Update the user's profile.
|
||||||
|
@ -85,7 +85,7 @@ public interface Manager extends Closeable {
|
||||||
|
|
||||||
void addDeviceLink(URI linkUri) throws IOException, InvalidDeviceLinkException;
|
void addDeviceLink(URI linkUri) throws IOException, InvalidDeviceLinkException;
|
||||||
|
|
||||||
void setRegistrationLockPin(Optional<String> pin) throws IOException, NotMasterDeviceException;
|
void setRegistrationLockPin(Optional<String> pin) throws IOException, NotPrimaryDeviceException;
|
||||||
|
|
||||||
Profile getRecipientProfile(RecipientIdentifier.Single recipient) throws IOException, UnregisteredRecipientException;
|
Profile getRecipientProfile(RecipientIdentifier.Single recipient) throws IOException, UnregisteredRecipientException;
|
||||||
|
|
||||||
|
@ -149,15 +149,15 @@ public interface Manager extends Closeable {
|
||||||
|
|
||||||
void setContactName(
|
void setContactName(
|
||||||
RecipientIdentifier.Single recipient, String name
|
RecipientIdentifier.Single recipient, String name
|
||||||
) throws NotMasterDeviceException, IOException, UnregisteredRecipientException;
|
) throws NotPrimaryDeviceException, IOException, UnregisteredRecipientException;
|
||||||
|
|
||||||
void setContactsBlocked(
|
void setContactsBlocked(
|
||||||
Collection<RecipientIdentifier.Single> recipient, boolean blocked
|
Collection<RecipientIdentifier.Single> recipient, boolean blocked
|
||||||
) throws NotMasterDeviceException, IOException, UnregisteredRecipientException;
|
) throws NotPrimaryDeviceException, IOException, UnregisteredRecipientException;
|
||||||
|
|
||||||
void setGroupsBlocked(
|
void setGroupsBlocked(
|
||||||
Collection<GroupId> groupId, boolean blocked
|
Collection<GroupId> groupId, boolean blocked
|
||||||
) throws GroupNotFoundException, IOException, NotMasterDeviceException;
|
) throws GroupNotFoundException, IOException, NotPrimaryDeviceException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the expiration timer for a contact
|
* Change the expiration timer for a contact
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.asamk.signal.manager.api.InactiveGroupLinkException;
|
||||||
import org.asamk.signal.manager.api.InvalidDeviceLinkException;
|
import org.asamk.signal.manager.api.InvalidDeviceLinkException;
|
||||||
import org.asamk.signal.manager.api.InvalidStickerException;
|
import org.asamk.signal.manager.api.InvalidStickerException;
|
||||||
import org.asamk.signal.manager.api.Message;
|
import org.asamk.signal.manager.api.Message;
|
||||||
import org.asamk.signal.manager.api.NotMasterDeviceException;
|
import org.asamk.signal.manager.api.NotPrimaryDeviceException;
|
||||||
import org.asamk.signal.manager.api.Pair;
|
import org.asamk.signal.manager.api.Pair;
|
||||||
import org.asamk.signal.manager.api.RecipientIdentifier;
|
import org.asamk.signal.manager.api.RecipientIdentifier;
|
||||||
import org.asamk.signal.manager.api.SendGroupMessageResults;
|
import org.asamk.signal.manager.api.SendGroupMessageResults;
|
||||||
|
@ -241,9 +241,9 @@ class ManagerImpl implements Manager {
|
||||||
@Override
|
@Override
|
||||||
public void updateConfiguration(
|
public void updateConfiguration(
|
||||||
Configuration configuration
|
Configuration configuration
|
||||||
) throws NotMasterDeviceException {
|
) throws NotPrimaryDeviceException {
|
||||||
if (!account.isMasterDevice()) {
|
if (!account.isPrimaryDevice()) {
|
||||||
throw new NotMasterDeviceException();
|
throw new NotPrimaryDeviceException();
|
||||||
}
|
}
|
||||||
|
|
||||||
final var configurationStore = account.getConfigurationStore();
|
final var configurationStore = account.getConfigurationStore();
|
||||||
|
@ -327,9 +327,9 @@ class ManagerImpl implements Manager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRegistrationLockPin(Optional<String> pin) throws IOException, NotMasterDeviceException {
|
public void setRegistrationLockPin(Optional<String> pin) throws IOException, NotPrimaryDeviceException {
|
||||||
if (!account.isMasterDevice()) {
|
if (!account.isPrimaryDevice()) {
|
||||||
throw new NotMasterDeviceException();
|
throw new NotPrimaryDeviceException();
|
||||||
}
|
}
|
||||||
if (pin.isPresent()) {
|
if (pin.isPresent()) {
|
||||||
context.getAccountHelper().setRegistrationPin(pin.get());
|
context.getAccountHelper().setRegistrationPin(pin.get());
|
||||||
|
@ -692,9 +692,9 @@ class ManagerImpl implements Manager {
|
||||||
@Override
|
@Override
|
||||||
public void setContactName(
|
public void setContactName(
|
||||||
RecipientIdentifier.Single recipient, String name
|
RecipientIdentifier.Single recipient, String name
|
||||||
) throws NotMasterDeviceException, UnregisteredRecipientException {
|
) throws NotPrimaryDeviceException, UnregisteredRecipientException {
|
||||||
if (!account.isMasterDevice()) {
|
if (!account.isPrimaryDevice()) {
|
||||||
throw new NotMasterDeviceException();
|
throw new NotPrimaryDeviceException();
|
||||||
}
|
}
|
||||||
context.getContactHelper().setContactName(context.getRecipientHelper().resolveRecipient(recipient), name);
|
context.getContactHelper().setContactName(context.getRecipientHelper().resolveRecipient(recipient), name);
|
||||||
}
|
}
|
||||||
|
@ -702,9 +702,9 @@ class ManagerImpl implements Manager {
|
||||||
@Override
|
@Override
|
||||||
public void setContactsBlocked(
|
public void setContactsBlocked(
|
||||||
Collection<RecipientIdentifier.Single> recipients, boolean blocked
|
Collection<RecipientIdentifier.Single> recipients, boolean blocked
|
||||||
) throws NotMasterDeviceException, IOException, UnregisteredRecipientException {
|
) throws NotPrimaryDeviceException, IOException, UnregisteredRecipientException {
|
||||||
if (!account.isMasterDevice()) {
|
if (!account.isPrimaryDevice()) {
|
||||||
throw new NotMasterDeviceException();
|
throw new NotPrimaryDeviceException();
|
||||||
}
|
}
|
||||||
if (recipients.size() == 0) {
|
if (recipients.size() == 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -734,9 +734,9 @@ class ManagerImpl implements Manager {
|
||||||
@Override
|
@Override
|
||||||
public void setGroupsBlocked(
|
public void setGroupsBlocked(
|
||||||
final Collection<GroupId> groupIds, final boolean blocked
|
final Collection<GroupId> groupIds, final boolean blocked
|
||||||
) throws GroupNotFoundException, NotMasterDeviceException, IOException {
|
) throws GroupNotFoundException, NotPrimaryDeviceException, IOException {
|
||||||
if (!account.isMasterDevice()) {
|
if (!account.isPrimaryDevice()) {
|
||||||
throw new NotMasterDeviceException();
|
throw new NotPrimaryDeviceException();
|
||||||
}
|
}
|
||||||
if (groupIds.size() == 0) {
|
if (groupIds.size() == 0) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -206,8 +206,8 @@ class ProvisioningManagerImpl implements ProvisioningManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
try (signalAccount) {
|
try (signalAccount) {
|
||||||
if (signalAccount.isMasterDevice()) {
|
if (signalAccount.isPrimaryDevice()) {
|
||||||
logger.debug("Account is a master device.");
|
logger.debug("Account is a primary device.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (signalAccount.isRegistered()
|
if (signalAccount.isRegistered()
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class RetrieveStorageDataAction implements HandleAction {
|
||||||
public void execute(Context context) throws Throwable {
|
public void execute(Context context) throws Throwable {
|
||||||
if (context.getAccount().getStorageKey() != null) {
|
if (context.getAccount().getStorageKey() != null) {
|
||||||
context.getStorageHelper().readDataFromStorage();
|
context.getStorageHelper().readDataFromStorage();
|
||||||
} else if (!context.getAccount().isMasterDevice()) {
|
} else if (!context.getAccount().isPrimaryDevice()) {
|
||||||
context.getSyncHelper().requestSyncKeys();
|
context.getSyncHelper().requestSyncKeys();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package org.asamk.signal.manager.api;
|
package org.asamk.signal.manager.api;
|
||||||
|
|
||||||
public class NotMasterDeviceException extends Exception {
|
public class NotPrimaryDeviceException extends Exception {
|
||||||
|
|
||||||
public NotMasterDeviceException() {
|
public NotPrimaryDeviceException() {
|
||||||
super("This function is not supported for linked devices.");
|
super("This function is not supported for linked devices.");
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -60,7 +60,7 @@ public class AccountHelper {
|
||||||
if (account.getAci() == null || account.getPni() == null) {
|
if (account.getAci() == null || account.getPni() == null) {
|
||||||
checkWhoAmiI();
|
checkWhoAmiI();
|
||||||
}
|
}
|
||||||
if (!account.isMasterDevice() && account.getPniIdentityKeyPair() == null) {
|
if (!account.isPrimaryDevice() && account.getPniIdentityKeyPair() == null) {
|
||||||
context.getSyncHelper().requestSyncPniIdentity();
|
context.getSyncHelper().requestSyncPniIdentity();
|
||||||
}
|
}
|
||||||
updateAccountAttributes();
|
updateAccountAttributes();
|
||||||
|
@ -175,7 +175,7 @@ public class AccountHelper {
|
||||||
|
|
||||||
public void unregister() throws IOException {
|
public void unregister() throws IOException {
|
||||||
// When setting an empty GCM id, the Signal-Server also sets the fetchesMessages property to false.
|
// When setting an empty GCM id, the Signal-Server also sets the fetchesMessages property to false.
|
||||||
// If this is the master device, other users can't send messages to this number anymore.
|
// If this is the primary device, other users can't send messages to this number anymore.
|
||||||
// If this is a linked device, other users can still send messages, but this device doesn't receive them anymore.
|
// If this is a linked device, other users can still send messages, but this device doesn't receive them anymore.
|
||||||
dependencies.getAccountManager().setGcmId(Optional.empty());
|
dependencies.getAccountManager().setGcmId(Optional.empty());
|
||||||
|
|
||||||
|
|
|
@ -336,7 +336,7 @@ public final class IncomingMessageHandler {
|
||||||
ignoreAttachments));
|
ignoreAttachments));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (syncMessage.getRequest().isPresent() && account.isMasterDevice()) {
|
if (syncMessage.getRequest().isPresent() && account.isPrimaryDevice()) {
|
||||||
var rm = syncMessage.getRequest().get();
|
var rm = syncMessage.getRequest().get();
|
||||||
if (rm.isContactsRequest()) {
|
if (rm.isContactsRequest()) {
|
||||||
actions.add(SendSyncContactsAction.create());
|
actions.add(SendSyncContactsAction.create());
|
||||||
|
|
|
@ -388,7 +388,7 @@ public class SignalAccount implements Closeable {
|
||||||
}
|
}
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
if (isMasterDevice() && getPniIdentityKeyPair() == null) {
|
if (isPrimaryDevice() && getPniIdentityKeyPair() == null) {
|
||||||
setPniIdentityKeyPair(KeyUtils.generateIdentityKeyPair());
|
setPniIdentityKeyPair(KeyUtils.generateIdentityKeyPair());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1203,7 +1203,7 @@ public class SignalAccount implements Closeable {
|
||||||
return deviceId;
|
return deviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMasterDevice() {
|
public boolean isPrimaryDevice() {
|
||||||
return deviceId == SignalServiceAddress.DEFAULT_DEVICE_ID;
|
return deviceId == SignalServiceAddress.DEFAULT_DEVICE_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class SessionStore implements SignalServiceSessionStore {
|
||||||
|
|
||||||
synchronized (cachedSessions) {
|
synchronized (cachedSessions) {
|
||||||
return getKeysLocked(recipientId).stream()
|
return getKeysLocked(recipientId).stream()
|
||||||
// get all sessions for recipient except main device session
|
// get all sessions for recipient except primary device session
|
||||||
.filter(key -> key.deviceId() != 1 && key.recipientId().equals(recipientId))
|
.filter(key -> key.deviceId() != 1 && key.recipientId().equals(recipientId))
|
||||||
.map(Key::deviceId)
|
.map(Key::deviceId)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
|
@ -119,7 +119,7 @@ The following methods listen to the account's object path, which is constructed
|
||||||
|
|
||||||
getContactName(number<s>) -> name<s>::
|
getContactName(number<s>) -> name<s>::
|
||||||
* number : Phone number
|
* number : Phone number
|
||||||
* name : Contact's name in local storage (from the master device for a linked account, or the one set with setContactName); if not set, contact's profile name is used
|
* name : Contact's name in local storage (from the primary device for a linked account, or the one set with setContactName); if not set, contact's profile name is used
|
||||||
|
|
||||||
Exceptions: None
|
Exceptions: None
|
||||||
|
|
||||||
|
|
|
@ -110,9 +110,9 @@ Only required if a PIN was set.
|
||||||
=== unregister
|
=== unregister
|
||||||
|
|
||||||
Disable push support for this device, i.e. this device won't receive any more messages.
|
Disable push support for this device, i.e. this device won't receive any more messages.
|
||||||
If this is the master device, other users can't send messages to this number anymore.
|
If this is the primary device, other users can't send messages to this number anymore.
|
||||||
Use "updateAccount" to undo this.
|
Use "updateAccount" to undo this.
|
||||||
To remove a linked device, use "removeDevice" from the master device.
|
To remove a linked device, use "removeDevice" from the primary device.
|
||||||
|
|
||||||
*--delete-account*::
|
*--delete-account*::
|
||||||
Delete account completely from server.
|
Delete account completely from server.
|
||||||
|
@ -137,12 +137,12 @@ Update the account attributes on the signal server.
|
||||||
Can fix problems with receiving messages.
|
Can fix problems with receiving messages.
|
||||||
|
|
||||||
*-n* NAME, *--device-name* NAME::
|
*-n* NAME, *--device-name* NAME::
|
||||||
Set a new device name for the main or linked device
|
Set a new device name for the primary or linked device
|
||||||
|
|
||||||
=== updateConfiguration
|
=== updateConfiguration
|
||||||
|
|
||||||
Update signal configs and sync them to linked devices.
|
Update signal configs and sync them to linked devices.
|
||||||
This command only works on the main devices.
|
This command only works on the primary devices.
|
||||||
|
|
||||||
*--read-receipts* {true,false}::
|
*--read-receipts* {true,false}::
|
||||||
Indicates if Signal should send read receipts.
|
Indicates if Signal should send read receipts.
|
||||||
|
@ -181,7 +181,7 @@ By default "cli" will be used.
|
||||||
=== addDevice
|
=== addDevice
|
||||||
|
|
||||||
Link another device to this device.
|
Link another device to this device.
|
||||||
Only works, if this is the master device.
|
Only works, if this is the primary device.
|
||||||
|
|
||||||
*--uri* URI::
|
*--uri* URI::
|
||||||
Specify the uri contained in the QR code shown by the new device.
|
Specify the uri contained in the QR code shown by the new device.
|
||||||
|
@ -194,7 +194,7 @@ Show a list of linked devices.
|
||||||
=== removeDevice
|
=== removeDevice
|
||||||
|
|
||||||
Remove a linked device.
|
Remove a linked device.
|
||||||
Only works, if this is the master device.
|
Only works, if this is the primary device.
|
||||||
|
|
||||||
*-d* DEVICE_ID, *--device-id* DEVICE_ID::
|
*-d* DEVICE_ID, *--device-id* DEVICE_ID::
|
||||||
Specify the device you want to remove.
|
Specify the device you want to remove.
|
||||||
|
@ -547,12 +547,12 @@ Specify the group IDs that should be unblocked in base64 encoding.
|
||||||
=== sendContacts
|
=== sendContacts
|
||||||
|
|
||||||
Send a synchronization message with the local contacts list to all linked devices.
|
Send a synchronization message with the local contacts list to all linked devices.
|
||||||
This command should only be used if this is the master device.
|
This command should only be used if this is the primary device.
|
||||||
|
|
||||||
=== sendSyncRequest
|
=== sendSyncRequest
|
||||||
|
|
||||||
Send a synchronization request message to the master device (for group, contacts, ...).
|
Send a synchronization request message to the primary device (for group, contacts, ...).
|
||||||
The master device will respond with synchronization messages with full contact and group lists.
|
The primary device will respond with synchronization messages with full contact and group lists.
|
||||||
|
|
||||||
=== uploadStickerPack
|
=== uploadStickerPack
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class AddDeviceCommand implements JsonRpcLocalCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void attachToSubparser(final Subparser subparser) {
|
public void attachToSubparser(final Subparser subparser) {
|
||||||
subparser.help("Link another device to this device. Only works, if this is the master device.");
|
subparser.help("Link another device to this device. Only works, if this is the primary device.");
|
||||||
subparser.addArgument("--uri")
|
subparser.addArgument("--uri")
|
||||||
.required(true)
|
.required(true)
|
||||||
.help("Specify the uri contained in the QR code shown by the new device.");
|
.help("Specify the uri contained in the QR code shown by the new device.");
|
||||||
|
|
|
@ -7,7 +7,7 @@ import org.asamk.signal.commands.exceptions.CommandException;
|
||||||
import org.asamk.signal.commands.exceptions.UnexpectedErrorException;
|
import org.asamk.signal.commands.exceptions.UnexpectedErrorException;
|
||||||
import org.asamk.signal.commands.exceptions.UserErrorException;
|
import org.asamk.signal.commands.exceptions.UserErrorException;
|
||||||
import org.asamk.signal.manager.Manager;
|
import org.asamk.signal.manager.Manager;
|
||||||
import org.asamk.signal.manager.api.NotMasterDeviceException;
|
import org.asamk.signal.manager.api.NotPrimaryDeviceException;
|
||||||
import org.asamk.signal.manager.api.UnregisteredRecipientException;
|
import org.asamk.signal.manager.api.UnregisteredRecipientException;
|
||||||
import org.asamk.signal.manager.groups.GroupNotFoundException;
|
import org.asamk.signal.manager.groups.GroupNotFoundException;
|
||||||
import org.asamk.signal.output.OutputWriter;
|
import org.asamk.signal.output.OutputWriter;
|
||||||
|
@ -41,7 +41,7 @@ public class BlockCommand implements JsonRpcLocalCommand {
|
||||||
final var recipients = CommandUtil.getSingleRecipientIdentifiers(contacts, m.getSelfNumber());
|
final var recipients = CommandUtil.getSingleRecipientIdentifiers(contacts, m.getSelfNumber());
|
||||||
try {
|
try {
|
||||||
m.setContactsBlocked(recipients, true);
|
m.setContactsBlocked(recipients, true);
|
||||||
} catch (NotMasterDeviceException e) {
|
} catch (NotPrimaryDeviceException e) {
|
||||||
throw new UserErrorException("This command doesn't work on linked devices.");
|
throw new UserErrorException("This command doesn't work on linked devices.");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UnexpectedErrorException("Failed to sync block to linked devices: " + e.getMessage(), e);
|
throw new UnexpectedErrorException("Failed to sync block to linked devices: " + e.getMessage(), e);
|
||||||
|
@ -53,7 +53,7 @@ public class BlockCommand implements JsonRpcLocalCommand {
|
||||||
final var groupIds = CommandUtil.getGroupIds(groupIdStrings);
|
final var groupIds = CommandUtil.getGroupIds(groupIdStrings);
|
||||||
try {
|
try {
|
||||||
m.setGroupsBlocked(groupIds, true);
|
m.setGroupsBlocked(groupIds, true);
|
||||||
} catch (NotMasterDeviceException e) {
|
} catch (NotPrimaryDeviceException e) {
|
||||||
throw new UserErrorException("This command doesn't work on linked devices.");
|
throw new UserErrorException("This command doesn't work on linked devices.");
|
||||||
} catch (GroupNotFoundException e) {
|
} catch (GroupNotFoundException e) {
|
||||||
logger.warn("Unknown group id: {}", e.getMessage());
|
logger.warn("Unknown group id: {}", e.getMessage());
|
||||||
|
|
|
@ -7,7 +7,7 @@ import org.asamk.signal.commands.exceptions.CommandException;
|
||||||
import org.asamk.signal.commands.exceptions.IOErrorException;
|
import org.asamk.signal.commands.exceptions.IOErrorException;
|
||||||
import org.asamk.signal.commands.exceptions.UserErrorException;
|
import org.asamk.signal.commands.exceptions.UserErrorException;
|
||||||
import org.asamk.signal.manager.Manager;
|
import org.asamk.signal.manager.Manager;
|
||||||
import org.asamk.signal.manager.api.NotMasterDeviceException;
|
import org.asamk.signal.manager.api.NotPrimaryDeviceException;
|
||||||
import org.asamk.signal.output.OutputWriter;
|
import org.asamk.signal.output.OutputWriter;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -33,7 +33,7 @@ public class RemovePinCommand implements JsonRpcLocalCommand {
|
||||||
m.setRegistrationLockPin(Optional.empty());
|
m.setRegistrationLockPin(Optional.empty());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new IOErrorException("Remove pin error: " + e.getMessage(), e);
|
throw new IOErrorException("Remove pin error: " + e.getMessage(), e);
|
||||||
} catch (NotMasterDeviceException e) {
|
} catch (NotPrimaryDeviceException e) {
|
||||||
throw new UserErrorException("This command doesn't work on linked devices.");
|
throw new UserErrorException("This command doesn't work on linked devices.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class SendSyncRequestCommand implements JsonRpcLocalCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void attachToSubparser(final Subparser subparser) {
|
public void attachToSubparser(final Subparser subparser) {
|
||||||
subparser.help("Send a synchronization request message to master device (for group, contacts, ...).");
|
subparser.help("Send a synchronization request message to primary device (for group, contacts, ...).");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,7 +7,7 @@ import org.asamk.signal.commands.exceptions.CommandException;
|
||||||
import org.asamk.signal.commands.exceptions.IOErrorException;
|
import org.asamk.signal.commands.exceptions.IOErrorException;
|
||||||
import org.asamk.signal.commands.exceptions.UserErrorException;
|
import org.asamk.signal.commands.exceptions.UserErrorException;
|
||||||
import org.asamk.signal.manager.Manager;
|
import org.asamk.signal.manager.Manager;
|
||||||
import org.asamk.signal.manager.api.NotMasterDeviceException;
|
import org.asamk.signal.manager.api.NotPrimaryDeviceException;
|
||||||
import org.asamk.signal.output.OutputWriter;
|
import org.asamk.signal.output.OutputWriter;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -36,7 +36,7 @@ public class SetPinCommand implements JsonRpcLocalCommand {
|
||||||
m.setRegistrationLockPin(Optional.of(registrationLockPin));
|
m.setRegistrationLockPin(Optional.of(registrationLockPin));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new IOErrorException("Set pin error: " + e.getMessage(), e);
|
throw new IOErrorException("Set pin error: " + e.getMessage(), e);
|
||||||
} catch (NotMasterDeviceException e) {
|
} catch (NotPrimaryDeviceException e) {
|
||||||
throw new UserErrorException("This command doesn't work on linked devices.");
|
throw new UserErrorException("This command doesn't work on linked devices.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import org.asamk.signal.commands.exceptions.CommandException;
|
||||||
import org.asamk.signal.commands.exceptions.UnexpectedErrorException;
|
import org.asamk.signal.commands.exceptions.UnexpectedErrorException;
|
||||||
import org.asamk.signal.commands.exceptions.UserErrorException;
|
import org.asamk.signal.commands.exceptions.UserErrorException;
|
||||||
import org.asamk.signal.manager.Manager;
|
import org.asamk.signal.manager.Manager;
|
||||||
import org.asamk.signal.manager.api.NotMasterDeviceException;
|
import org.asamk.signal.manager.api.NotPrimaryDeviceException;
|
||||||
import org.asamk.signal.manager.api.UnregisteredRecipientException;
|
import org.asamk.signal.manager.api.UnregisteredRecipientException;
|
||||||
import org.asamk.signal.manager.groups.GroupNotFoundException;
|
import org.asamk.signal.manager.groups.GroupNotFoundException;
|
||||||
import org.asamk.signal.output.OutputWriter;
|
import org.asamk.signal.output.OutputWriter;
|
||||||
|
@ -41,7 +41,7 @@ public class UnblockCommand implements JsonRpcLocalCommand {
|
||||||
final var recipients = CommandUtil.getSingleRecipientIdentifiers(contacts, m.getSelfNumber());
|
final var recipients = CommandUtil.getSingleRecipientIdentifiers(contacts, m.getSelfNumber());
|
||||||
try {
|
try {
|
||||||
m.setContactsBlocked(recipients, false);
|
m.setContactsBlocked(recipients, false);
|
||||||
} catch (NotMasterDeviceException e) {
|
} catch (NotPrimaryDeviceException e) {
|
||||||
throw new UserErrorException("This command doesn't work on linked devices.");
|
throw new UserErrorException("This command doesn't work on linked devices.");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UnexpectedErrorException("Failed to sync unblock to linked devices: " + e.getMessage(), e);
|
throw new UnexpectedErrorException("Failed to sync unblock to linked devices: " + e.getMessage(), e);
|
||||||
|
@ -53,7 +53,7 @@ public class UnblockCommand implements JsonRpcLocalCommand {
|
||||||
final var groupIds = CommandUtil.getGroupIds(groupIdStrings);
|
final var groupIds = CommandUtil.getGroupIds(groupIdStrings);
|
||||||
try {
|
try {
|
||||||
m.setGroupsBlocked(groupIds, false);
|
m.setGroupsBlocked(groupIds, false);
|
||||||
} catch (NotMasterDeviceException e) {
|
} catch (NotPrimaryDeviceException e) {
|
||||||
throw new UserErrorException("This command doesn't work on linked devices.");
|
throw new UserErrorException("This command doesn't work on linked devices.");
|
||||||
} catch (GroupNotFoundException e) {
|
} catch (GroupNotFoundException e) {
|
||||||
logger.warn("Unknown group id: {}", e.getMessage());
|
logger.warn("Unknown group id: {}", e.getMessage());
|
||||||
|
|
|
@ -8,7 +8,7 @@ import org.asamk.signal.commands.exceptions.IOErrorException;
|
||||||
import org.asamk.signal.commands.exceptions.UserErrorException;
|
import org.asamk.signal.commands.exceptions.UserErrorException;
|
||||||
import org.asamk.signal.manager.Manager;
|
import org.asamk.signal.manager.Manager;
|
||||||
import org.asamk.signal.manager.api.Configuration;
|
import org.asamk.signal.manager.api.Configuration;
|
||||||
import org.asamk.signal.manager.api.NotMasterDeviceException;
|
import org.asamk.signal.manager.api.NotPrimaryDeviceException;
|
||||||
import org.asamk.signal.output.OutputWriter;
|
import org.asamk.signal.output.OutputWriter;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -53,7 +53,7 @@ public class UpdateConfigurationCommand implements JsonRpcLocalCommand {
|
||||||
Optional.ofNullable(linkPreviews)));
|
Optional.ofNullable(linkPreviews)));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new IOErrorException("UpdateAccount error: " + e.getMessage(), e);
|
throw new IOErrorException("UpdateAccount error: " + e.getMessage(), e);
|
||||||
} catch (NotMasterDeviceException e) {
|
} catch (NotPrimaryDeviceException e) {
|
||||||
throw new UserErrorException("This command doesn't work on linked devices.");
|
throw new UserErrorException("This command doesn't work on linked devices.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import org.asamk.signal.commands.exceptions.CommandException;
|
||||||
import org.asamk.signal.commands.exceptions.IOErrorException;
|
import org.asamk.signal.commands.exceptions.IOErrorException;
|
||||||
import org.asamk.signal.commands.exceptions.UserErrorException;
|
import org.asamk.signal.commands.exceptions.UserErrorException;
|
||||||
import org.asamk.signal.manager.Manager;
|
import org.asamk.signal.manager.Manager;
|
||||||
import org.asamk.signal.manager.api.NotMasterDeviceException;
|
import org.asamk.signal.manager.api.NotPrimaryDeviceException;
|
||||||
import org.asamk.signal.manager.api.UnregisteredRecipientException;
|
import org.asamk.signal.manager.api.UnregisteredRecipientException;
|
||||||
import org.asamk.signal.output.OutputWriter;
|
import org.asamk.signal.output.OutputWriter;
|
||||||
import org.asamk.signal.util.CommandUtil;
|
import org.asamk.signal.util.CommandUtil;
|
||||||
|
@ -48,7 +48,7 @@ public class UpdateContactCommand implements JsonRpcLocalCommand {
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new IOErrorException("Update contact error: " + e.getMessage(), e);
|
throw new IOErrorException("Update contact error: " + e.getMessage(), e);
|
||||||
} catch (NotMasterDeviceException e) {
|
} catch (NotPrimaryDeviceException e) {
|
||||||
throw new UserErrorException("This command doesn't work on linked devices.");
|
throw new UserErrorException("This command doesn't work on linked devices.");
|
||||||
} catch (UnregisteredRecipientException e) {
|
} catch (UnregisteredRecipientException e) {
|
||||||
throw new UserErrorException("The user " + e.getSender().getIdentifier() + " is not registered.");
|
throw new UserErrorException("The user " + e.getSender().getIdentifier() + " is not registered.");
|
||||||
|
|
|
@ -12,7 +12,7 @@ import org.asamk.signal.manager.api.InactiveGroupLinkException;
|
||||||
import org.asamk.signal.manager.api.InvalidDeviceLinkException;
|
import org.asamk.signal.manager.api.InvalidDeviceLinkException;
|
||||||
import org.asamk.signal.manager.api.Message;
|
import org.asamk.signal.manager.api.Message;
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
import org.asamk.signal.manager.api.NotMasterDeviceException;
|
import org.asamk.signal.manager.api.NotPrimaryDeviceException;
|
||||||
import org.asamk.signal.manager.api.Pair;
|
import org.asamk.signal.manager.api.Pair;
|
||||||
import org.asamk.signal.manager.api.RecipientIdentifier;
|
import org.asamk.signal.manager.api.RecipientIdentifier;
|
||||||
import org.asamk.signal.manager.api.SendGroupMessageResults;
|
import org.asamk.signal.manager.api.SendGroupMessageResults;
|
||||||
|
@ -409,14 +409,14 @@ public class DbusManagerImpl implements Manager {
|
||||||
@Override
|
@Override
|
||||||
public void setContactName(
|
public void setContactName(
|
||||||
final RecipientIdentifier.Single recipient, final String name
|
final RecipientIdentifier.Single recipient, final String name
|
||||||
) throws NotMasterDeviceException {
|
) throws NotPrimaryDeviceException {
|
||||||
signal.setContactName(recipient.getIdentifier(), name);
|
signal.setContactName(recipient.getIdentifier(), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setContactsBlocked(
|
public void setContactsBlocked(
|
||||||
final Collection<RecipientIdentifier.Single> recipients, final boolean blocked
|
final Collection<RecipientIdentifier.Single> recipients, final boolean blocked
|
||||||
) throws NotMasterDeviceException, IOException {
|
) throws NotPrimaryDeviceException, IOException {
|
||||||
for (final var recipient : recipients) {
|
for (final var recipient : recipients) {
|
||||||
signal.setContactBlocked(recipient.getIdentifier(), blocked);
|
signal.setContactBlocked(recipient.getIdentifier(), blocked);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import org.asamk.signal.manager.api.InvalidDeviceLinkException;
|
||||||
import org.asamk.signal.manager.api.InvalidNumberException;
|
import org.asamk.signal.manager.api.InvalidNumberException;
|
||||||
import org.asamk.signal.manager.api.InvalidStickerException;
|
import org.asamk.signal.manager.api.InvalidStickerException;
|
||||||
import org.asamk.signal.manager.api.Message;
|
import org.asamk.signal.manager.api.Message;
|
||||||
import org.asamk.signal.manager.api.NotMasterDeviceException;
|
import org.asamk.signal.manager.api.NotPrimaryDeviceException;
|
||||||
import org.asamk.signal.manager.api.RecipientIdentifier;
|
import org.asamk.signal.manager.api.RecipientIdentifier;
|
||||||
import org.asamk.signal.manager.api.SendMessageResult;
|
import org.asamk.signal.manager.api.SendMessageResult;
|
||||||
import org.asamk.signal.manager.api.SendMessageResults;
|
import org.asamk.signal.manager.api.SendMessageResults;
|
||||||
|
@ -490,7 +490,7 @@ public class DbusSignalImpl implements Signal {
|
||||||
public void setContactName(final String number, final String name) {
|
public void setContactName(final String number, final String name) {
|
||||||
try {
|
try {
|
||||||
m.setContactName(getSingleRecipientIdentifier(number, m.getSelfNumber()), name);
|
m.setContactName(getSingleRecipientIdentifier(number, m.getSelfNumber()), name);
|
||||||
} catch (NotMasterDeviceException e) {
|
} catch (NotPrimaryDeviceException e) {
|
||||||
throw new Error.Failure("This command doesn't work on linked devices.");
|
throw new Error.Failure("This command doesn't work on linked devices.");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new Error.Failure("Contact is not registered.");
|
throw new Error.Failure("Contact is not registered.");
|
||||||
|
@ -514,7 +514,7 @@ public class DbusSignalImpl implements Signal {
|
||||||
public void setContactBlocked(final String number, final boolean blocked) {
|
public void setContactBlocked(final String number, final boolean blocked) {
|
||||||
try {
|
try {
|
||||||
m.setContactsBlocked(List.of(getSingleRecipientIdentifier(number, m.getSelfNumber())), blocked);
|
m.setContactsBlocked(List.of(getSingleRecipientIdentifier(number, m.getSelfNumber())), blocked);
|
||||||
} catch (NotMasterDeviceException e) {
|
} catch (NotPrimaryDeviceException e) {
|
||||||
throw new Error.Failure("This command doesn't work on linked devices.");
|
throw new Error.Failure("This command doesn't work on linked devices.");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new Error.Failure(e.getMessage());
|
throw new Error.Failure(e.getMessage());
|
||||||
|
@ -527,7 +527,7 @@ public class DbusSignalImpl implements Signal {
|
||||||
public void setGroupBlocked(final byte[] groupId, final boolean blocked) {
|
public void setGroupBlocked(final byte[] groupId, final boolean blocked) {
|
||||||
try {
|
try {
|
||||||
m.setGroupsBlocked(List.of(getGroupId(groupId)), blocked);
|
m.setGroupsBlocked(List.of(getGroupId(groupId)), blocked);
|
||||||
} catch (NotMasterDeviceException e) {
|
} catch (NotPrimaryDeviceException e) {
|
||||||
throw new Error.Failure("This command doesn't work on linked devices.");
|
throw new Error.Failure("This command doesn't work on linked devices.");
|
||||||
} catch (GroupNotFoundException e) {
|
} catch (GroupNotFoundException e) {
|
||||||
throw new Error.GroupNotFound(e.getMessage());
|
throw new Error.GroupNotFound(e.getMessage());
|
||||||
|
@ -694,7 +694,7 @@ public class DbusSignalImpl implements Signal {
|
||||||
m.setRegistrationLockPin(Optional.empty());
|
m.setRegistrationLockPin(Optional.empty());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new Error.Failure("Remove pin error: " + e.getMessage());
|
throw new Error.Failure("Remove pin error: " + e.getMessage());
|
||||||
} catch (NotMasterDeviceException e) {
|
} catch (NotPrimaryDeviceException e) {
|
||||||
throw new Error.Failure("This command doesn't work on linked devices.");
|
throw new Error.Failure("This command doesn't work on linked devices.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -705,7 +705,7 @@ public class DbusSignalImpl implements Signal {
|
||||||
m.setRegistrationLockPin(Optional.of(registrationLockPin));
|
m.setRegistrationLockPin(Optional.of(registrationLockPin));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new Error.Failure("Set pin error: " + e.getMessage());
|
throw new Error.Failure("Set pin error: " + e.getMessage());
|
||||||
} catch (NotMasterDeviceException e) {
|
} catch (NotPrimaryDeviceException e) {
|
||||||
throw new Error.Failure("This command doesn't work on linked devices.");
|
throw new Error.Failure("This command doesn't work on linked devices.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1092,7 +1092,7 @@ public class DbusSignalImpl implements Signal {
|
||||||
Optional.ofNullable(linkPreviews)));
|
Optional.ofNullable(linkPreviews)));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new Error.Failure("UpdateAccount error: " + e.getMessage());
|
throw new Error.Failure("UpdateAccount error: " + e.getMessage());
|
||||||
} catch (NotMasterDeviceException e) {
|
} catch (NotPrimaryDeviceException e) {
|
||||||
throw new Error.Failure("This command doesn't work on linked devices.");
|
throw new Error.Failure("This command doesn't work on linked devices.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1270,7 +1270,7 @@ public class DbusSignalImpl implements Signal {
|
||||||
private void setIsBlocked(final boolean isBlocked) {
|
private void setIsBlocked(final boolean isBlocked) {
|
||||||
try {
|
try {
|
||||||
m.setGroupsBlocked(List.of(groupId), isBlocked);
|
m.setGroupsBlocked(List.of(groupId), isBlocked);
|
||||||
} catch (NotMasterDeviceException e) {
|
} catch (NotPrimaryDeviceException e) {
|
||||||
throw new Error.Failure("This command doesn't work on linked devices.");
|
throw new Error.Failure("This command doesn't work on linked devices.");
|
||||||
} catch (GroupNotFoundException e) {
|
} catch (GroupNotFoundException e) {
|
||||||
throw new Error.GroupNotFound(e.getMessage());
|
throw new Error.GroupNotFound(e.getMessage());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue