Add sendSyncRequest command

This commit is contained in:
AsamK 2021-05-03 20:37:13 +02:00
parent 36475bb632
commit 9e3c9db5c0
4 changed files with 42 additions and 10 deletions

View file

@ -27,6 +27,7 @@ public class Commands {
addCommand("send", new SendCommand());
addCommand("sendContacts", new SendContactsCommand());
addCommand("sendReaction", new SendReactionCommand());
addCommand("sendSyncRequest", new SendSyncRequestCommand());
addCommand("setPin", new SetPinCommand());
addCommand("trust", new TrustCommand());
addCommand("unblock", new UnblockCommand());

View file

@ -0,0 +1,27 @@
package org.asamk.signal.commands;
import net.sourceforge.argparse4j.inf.Namespace;
import net.sourceforge.argparse4j.inf.Subparser;
import org.asamk.signal.commands.exceptions.CommandException;
import org.asamk.signal.commands.exceptions.IOErrorException;
import org.asamk.signal.manager.Manager;
import java.io.IOException;
public class SendSyncRequestCommand implements LocalCommand {
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("Send a synchronization request message to master device (for group, contacts, ...).");
}
@Override
public void handleCommand(final Namespace ns, final Manager m) throws CommandException {
try {
m.requestAllSyncData();
} catch (IOException e) {
throw new IOErrorException("Request sync data error: " + e.getMessage());
}
}
}