}
}
- void requestSyncGroups() throws IOException {
+ public void requestAllSyncData() throws IOException {
+ requestSyncGroups();
+ requestSyncContacts();
+ requestSyncBlocked();
+ requestSyncConfiguration();
+ requestSyncKeys();
+ }
+
+ private void requestSyncGroups() throws IOException {
var r = SignalServiceProtos.SyncMessage.Request.newBuilder()
.setType(SignalServiceProtos.SyncMessage.Request.Type.GROUPS)
.build();
}
}
- void requestSyncContacts() throws IOException {
+ private void requestSyncContacts() throws IOException {
var r = SignalServiceProtos.SyncMessage.Request.newBuilder()
.setType(SignalServiceProtos.SyncMessage.Request.Type.CONTACTS)
.build();
}
}
- void requestSyncBlocked() throws IOException {
+ private void requestSyncBlocked() throws IOException {
var r = SignalServiceProtos.SyncMessage.Request.newBuilder()
.setType(SignalServiceProtos.SyncMessage.Request.Type.BLOCKED)
.build();
}
}
- void requestSyncConfiguration() throws IOException {
+ private void requestSyncConfiguration() throws IOException {
var r = SignalServiceProtos.SyncMessage.Request.newBuilder()
.setType(SignalServiceProtos.SyncMessage.Request.Type.CONFIGURATION)
.build();
}
}
- void requestSyncKeys() throws IOException {
+ private void requestSyncKeys() throws IOException {
var r = SignalServiceProtos.SyncMessage.Request.newBuilder()
.setType(SignalServiceProtos.SyncMessage.Request.Type.KEYS)
.build();
}
try {
- m.requestSyncGroups();
- m.requestSyncContacts();
- m.requestSyncBlocked();
- m.requestSyncConfiguration();
- m.requestSyncKeys();
+ m.requestAllSyncData();
} catch (Exception e) {
logger.error("Failed to request sync messages from linked device.");
throw e;
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());
--- /dev/null
+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());
+ }
+ }
+}