mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
parent
c9f5550d18
commit
6f5e72119e
11 changed files with 274 additions and 3 deletions
|
@ -39,6 +39,7 @@ public class Commands {
|
|||
addCommand(new UnblockCommand());
|
||||
addCommand(new UnregisterCommand());
|
||||
addCommand(new UpdateAccountCommand());
|
||||
addCommand(new UpdateConfigurationCommand());
|
||||
addCommand(new UpdateContactCommand());
|
||||
addCommand(new UpdateGroupCommand());
|
||||
addCommand(new UpdateProfileCommand());
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package org.asamk.signal.commands;
|
||||
|
||||
import net.sourceforge.argparse4j.inf.Namespace;
|
||||
import net.sourceforge.argparse4j.inf.Subparser;
|
||||
|
||||
import org.asamk.signal.OutputWriter;
|
||||
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.NotMasterDeviceException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class UpdateConfigurationCommand implements JsonRpcLocalCommand {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "updateConfiguration";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attachToSubparser(final Subparser subparser) {
|
||||
subparser.help("Update signal configs and sync them to linked devices.");
|
||||
subparser.addArgument("--read-receipts")
|
||||
.type(Boolean.class)
|
||||
.help("Indicates if Signal should send read receipts.");
|
||||
subparser.addArgument("--unidentified-delivery-indicators")
|
||||
.type(Boolean.class)
|
||||
.help("Indicates if Signal should show unidentified delivery indicators.");
|
||||
subparser.addArgument("--typing-indicators")
|
||||
.type(Boolean.class)
|
||||
.help("Indicates if Signal should send/show typing indicators.");
|
||||
subparser.addArgument("--link-previews")
|
||||
.type(Boolean.class)
|
||||
.help("Indicates if Signal should generate link previews.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(
|
||||
final Namespace ns, final Manager m, final OutputWriter outputWriter
|
||||
) throws CommandException {
|
||||
final var readReceipts = ns.getBoolean("read-receipts");
|
||||
final var unidentifiedDeliveryIndicators = ns.getBoolean("unidentified-delivery-indicators");
|
||||
final var typingIndicators = ns.getBoolean("typing-indicators");
|
||||
final var linkPreviews = ns.getBoolean("link-previews");
|
||||
try {
|
||||
m.updateConfiguration(readReceipts, unidentifiedDeliveryIndicators, typingIndicators, linkPreviews);
|
||||
} catch (IOException e) {
|
||||
throw new IOErrorException("UpdateAccount error: " + e.getMessage(), e);
|
||||
} catch (NotMasterDeviceException e) {
|
||||
throw new UserErrorException("This command doesn't work on linked devices.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -93,6 +93,16 @@ public class DbusManagerImpl implements Manager {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateConfiguration(
|
||||
final Boolean readReceipts,
|
||||
final Boolean unidentifiedDeliveryIndicators,
|
||||
final Boolean typingIndicators,
|
||||
final Boolean linkPreviews
|
||||
) throws IOException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProfile(
|
||||
final String givenName,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue