]> nmode's Git Repositories - signal-cli/commitdiff
implement Dbus sync methods (#737)
authorJohn Freed <okgithub@johnfreed.com>
Sun, 26 Sep 2021 07:00:26 +0000 (09:00 +0200)
committerGitHub <noreply@github.com>
Sun, 26 Sep 2021 07:00:26 +0000 (09:00 +0200)
implement two Dbus methods:
- sendContacts
- sendSyncRequest

update documentation

man/signal-cli-dbus.5.adoc
src/main/java/org/asamk/Signal.java
src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java

index b7dfcfe1699926bef2f4d736a666cc7b6bfd0fd0..8cc234bcab7612243679138e1beaec2356c830f1 100755 (executable)
@@ -107,6 +107,18 @@ sendGroupMessage(message<s>, attachments<as>, groupId<ay>) -> timestamp<x>::
 
 Exceptions: GroupNotFound, Failure, AttachmentInvalid
 
+sendContacts() -> <>::
+
+Sends a synchronization message with the local contacts list to all linked devices. This command should only be used if this is the primary device.
+
+Exceptions: Failure
+
+sendSyncRequest() -> <>::
+
+Sends a synchronization request to the primary device (for group, contacts, ...). Only works if sent from a secondary device.
+
+Exception: Failure
+
 sendNoteToSelfMessage(message<s>, attachments<as>) -> timestamp<x>::
 * message     : Text to send (can be UTF8)
 * attachments : String array of filenames to send as attachments (passed as filename, so need to be readable by the user signal-cli is running under)
index 1eb96510f55f4463cd02be1cad043f478016b7ff..d981e024c5accf35cf566b7284a9acf03a049b7d 100644 (file)
@@ -49,6 +49,10 @@ public interface Signal extends DBusInterface {
             String emoji, boolean remove, String targetAuthor, long targetSentTimestamp, List<String> recipients
     ) throws Error.InvalidNumber, Error.Failure;
 
+    void sendContacts() throws Error.Failure;
+
+    void sendSyncRequest() throws Error.Failure;
+
     long sendNoteToSelfMessage(
             String message, List<String> attachments
     ) throws Error.AttachmentInvalid, Error.Failure;
index 0fde767d75411584c77cd99d37d09724c7a6c49f..4a478f13398f4ee4218677242ea08154e7ddc5db 100644 (file)
@@ -202,6 +202,24 @@ public class DbusSignalImpl implements Signal {
         }
     }
 
+    @Override
+    public void sendContacts() {
+        try {
+            m.sendContacts();
+        } catch (IOException e) {
+            throw new Error.Failure("SendContacts error: " + e.getMessage());
+        }
+    }
+
+    @Override
+    public void sendSyncRequest() {
+        try {
+            m.requestAllSyncData();
+        } catch (IOException e) {
+            throw new Error.Failure("Request sync data error: " + e.getMessage());
+        }
+    }
+
     @Override
     public long sendNoteToSelfMessage(
             final String message, final List<String> attachments