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
|
@ -27,7 +27,7 @@ public class AddDeviceCommand implements JsonRpcLocalCommand {
|
|||
|
||||
@Override
|
||||
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")
|
||||
.required(true)
|
||||
.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.UserErrorException;
|
||||
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.groups.GroupNotFoundException;
|
||||
import org.asamk.signal.output.OutputWriter;
|
||||
|
@ -41,7 +41,7 @@ public class BlockCommand implements JsonRpcLocalCommand {
|
|||
final var recipients = CommandUtil.getSingleRecipientIdentifiers(contacts, m.getSelfNumber());
|
||||
try {
|
||||
m.setContactsBlocked(recipients, true);
|
||||
} catch (NotMasterDeviceException e) {
|
||||
} catch (NotPrimaryDeviceException e) {
|
||||
throw new UserErrorException("This command doesn't work on linked devices.");
|
||||
} catch (IOException 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);
|
||||
try {
|
||||
m.setGroupsBlocked(groupIds, true);
|
||||
} catch (NotMasterDeviceException e) {
|
||||
} catch (NotPrimaryDeviceException e) {
|
||||
throw new UserErrorException("This command doesn't work on linked devices.");
|
||||
} catch (GroupNotFoundException e) {
|
||||
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.UserErrorException;
|
||||
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 java.io.IOException;
|
||||
|
@ -33,7 +33,7 @@ public class RemovePinCommand implements JsonRpcLocalCommand {
|
|||
m.setRegistrationLockPin(Optional.empty());
|
||||
} catch (IOException 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.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ public class SendSyncRequestCommand implements JsonRpcLocalCommand {
|
|||
|
||||
@Override
|
||||
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
|
||||
|
|
|
@ -7,7 +7,7 @@ import org.asamk.signal.commands.exceptions.CommandException;
|
|||
import org.asamk.signal.commands.exceptions.IOErrorException;
|
||||
import org.asamk.signal.commands.exceptions.UserErrorException;
|
||||
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 java.io.IOException;
|
||||
|
@ -36,7 +36,7 @@ public class SetPinCommand implements JsonRpcLocalCommand {
|
|||
m.setRegistrationLockPin(Optional.of(registrationLockPin));
|
||||
} catch (IOException 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.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import org.asamk.signal.commands.exceptions.CommandException;
|
|||
import org.asamk.signal.commands.exceptions.UnexpectedErrorException;
|
||||
import org.asamk.signal.commands.exceptions.UserErrorException;
|
||||
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.groups.GroupNotFoundException;
|
||||
import org.asamk.signal.output.OutputWriter;
|
||||
|
@ -41,7 +41,7 @@ public class UnblockCommand implements JsonRpcLocalCommand {
|
|||
final var recipients = CommandUtil.getSingleRecipientIdentifiers(contacts, m.getSelfNumber());
|
||||
try {
|
||||
m.setContactsBlocked(recipients, false);
|
||||
} catch (NotMasterDeviceException e) {
|
||||
} catch (NotPrimaryDeviceException e) {
|
||||
throw new UserErrorException("This command doesn't work on linked devices.");
|
||||
} catch (IOException 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);
|
||||
try {
|
||||
m.setGroupsBlocked(groupIds, false);
|
||||
} catch (NotMasterDeviceException e) {
|
||||
} catch (NotPrimaryDeviceException e) {
|
||||
throw new UserErrorException("This command doesn't work on linked devices.");
|
||||
} catch (GroupNotFoundException e) {
|
||||
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.manager.Manager;
|
||||
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 java.io.IOException;
|
||||
|
@ -53,7 +53,7 @@ public class UpdateConfigurationCommand implements JsonRpcLocalCommand {
|
|||
Optional.ofNullable(linkPreviews)));
|
||||
} catch (IOException 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.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import org.asamk.signal.commands.exceptions.CommandException;
|
|||
import org.asamk.signal.commands.exceptions.IOErrorException;
|
||||
import org.asamk.signal.commands.exceptions.UserErrorException;
|
||||
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.output.OutputWriter;
|
||||
import org.asamk.signal.util.CommandUtil;
|
||||
|
@ -48,7 +48,7 @@ public class UpdateContactCommand implements JsonRpcLocalCommand {
|
|||
}
|
||||
} catch (IOException 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.");
|
||||
} catch (UnregisteredRecipientException e) {
|
||||
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.Message;
|
||||
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.RecipientIdentifier;
|
||||
import org.asamk.signal.manager.api.SendGroupMessageResults;
|
||||
|
@ -409,14 +409,14 @@ public class DbusManagerImpl implements Manager {
|
|||
@Override
|
||||
public void setContactName(
|
||||
final RecipientIdentifier.Single recipient, final String name
|
||||
) throws NotMasterDeviceException {
|
||||
) throws NotPrimaryDeviceException {
|
||||
signal.setContactName(recipient.getIdentifier(), name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContactsBlocked(
|
||||
final Collection<RecipientIdentifier.Single> recipients, final boolean blocked
|
||||
) throws NotMasterDeviceException, IOException {
|
||||
) throws NotPrimaryDeviceException, IOException {
|
||||
for (final var recipient : recipients) {
|
||||
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.InvalidStickerException;
|
||||
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.SendMessageResult;
|
||||
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) {
|
||||
try {
|
||||
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.");
|
||||
} catch (IOException e) {
|
||||
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) {
|
||||
try {
|
||||
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.");
|
||||
} catch (IOException e) {
|
||||
throw new Error.Failure(e.getMessage());
|
||||
|
@ -527,7 +527,7 @@ public class DbusSignalImpl implements Signal {
|
|||
public void setGroupBlocked(final byte[] groupId, final boolean blocked) {
|
||||
try {
|
||||
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.");
|
||||
} catch (GroupNotFoundException e) {
|
||||
throw new Error.GroupNotFound(e.getMessage());
|
||||
|
@ -694,7 +694,7 @@ public class DbusSignalImpl implements Signal {
|
|||
m.setRegistrationLockPin(Optional.empty());
|
||||
} catch (IOException e) {
|
||||
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.");
|
||||
}
|
||||
}
|
||||
|
@ -705,7 +705,7 @@ public class DbusSignalImpl implements Signal {
|
|||
m.setRegistrationLockPin(Optional.of(registrationLockPin));
|
||||
} catch (IOException e) {
|
||||
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.");
|
||||
}
|
||||
}
|
||||
|
@ -1092,7 +1092,7 @@ public class DbusSignalImpl implements Signal {
|
|||
Optional.ofNullable(linkPreviews)));
|
||||
} catch (IOException e) {
|
||||
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.");
|
||||
}
|
||||
}
|
||||
|
@ -1270,7 +1270,7 @@ public class DbusSignalImpl implements Signal {
|
|||
private void setIsBlocked(final boolean isBlocked) {
|
||||
try {
|
||||
m.setGroupsBlocked(List.of(groupId), isBlocked);
|
||||
} catch (NotMasterDeviceException e) {
|
||||
} catch (NotPrimaryDeviceException e) {
|
||||
throw new Error.Failure("This command doesn't work on linked devices.");
|
||||
} catch (GroupNotFoundException e) {
|
||||
throw new Error.GroupNotFound(e.getMessage());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue