]> nmode's Git Repositories - signal-cli/blobdiff - lib/src/main/java/org/asamk/signal/manager/Manager.java
Implement sending message quotes
[signal-cli] / lib / src / main / java / org / asamk / signal / manager / Manager.java
index b4579274b738c4372a8d0f9ace7213bbf08eb718..61f6e1d6ca316c67d1547ef28dc69dd82f9fa0c0 100644 (file)
@@ -1,5 +1,6 @@
 package org.asamk.signal.manager;
 
+import org.asamk.signal.manager.api.Configuration;
 import org.asamk.signal.manager.api.Device;
 import org.asamk.signal.manager.api.Group;
 import org.asamk.signal.manager.api.Identity;
@@ -75,7 +76,7 @@ public interface Manager extends Closeable {
         return PhoneNumberFormatter.isValidNumber(e164Number, countryCode);
     }
 
-    static List<String> getAllLocalNumbers(File settingsPath) {
+    static List<String> getAllLocalAccountNumbers(File settingsPath) {
         var pathConfig = PathConfig.createDefault(settingsPath);
         final var dataPath = pathConfig.dataPath();
         final var files = dataPath.listFiles();
@@ -99,12 +100,9 @@ public interface Manager extends Closeable {
 
     void updateAccountAttributes(String deviceName) throws IOException;
 
-    void updateConfiguration(
-            final Boolean readReceipts,
-            final Boolean unidentifiedDeliveryIndicators,
-            final Boolean typingIndicators,
-            final Boolean linkPreviews
-    ) throws IOException, NotMasterDeviceException;
+    Configuration getConfiguration();
+
+    void updateConfiguration(Configuration configuration) throws IOException, NotMasterDeviceException;
 
     void setProfile(
             String givenName, String familyName, String about, String aboutEmoji, Optional<File> avatar
@@ -146,17 +144,17 @@ public interface Manager extends Closeable {
             GroupInviteLinkUrl inviteLinkUrl
     ) throws IOException, InactiveGroupLinkException;
 
-    void sendTypingMessage(
+    SendMessageResults sendTypingMessage(
             TypingAction action, Set<RecipientIdentifier> recipients
-    ) throws IOException, UntrustedIdentityException, NotAGroupMemberException, GroupNotFoundException, GroupSendingNotAllowedException;
+    ) throws IOException, NotAGroupMemberException, GroupNotFoundException, GroupSendingNotAllowedException;
 
-    void sendReadReceipt(
+    SendMessageResults sendReadReceipt(
             RecipientIdentifier.Single sender, List<Long> messageIds
-    ) throws IOException, UntrustedIdentityException;
+    ) throws IOException;
 
-    void sendViewedReceipt(
+    SendMessageResults sendViewedReceipt(
             RecipientIdentifier.Single sender, List<Long> messageIds
-    ) throws IOException, UntrustedIdentityException;
+    ) throws IOException;
 
     SendMessageResults sendMessage(
             Message message, Set<RecipientIdentifier> recipients
@@ -200,7 +198,11 @@ public interface Manager extends Closeable {
      * Add a handler to receive new messages.
      * Will start receiving messages from server, if not already started.
      */
-    void addReceiveHandler(ReceiveMessageHandler handler);
+    default void addReceiveHandler(ReceiveMessageHandler handler) {
+        addReceiveHandler(handler, false);
+    }
+
+    void addReceiveHandler(ReceiveMessageHandler handler, final boolean isWeakListener);
 
     /**
      * Remove a handler to receive new messages.
@@ -226,8 +228,6 @@ public interface Manager extends Closeable {
 
     boolean isContactBlocked(RecipientIdentifier.Single recipient);
 
-    File getAttachmentFile(String attachmentId);
-
     void sendContacts() throws IOException;
 
     List<Pair<RecipientAddress, Contact>> getContacts();
@@ -248,11 +248,16 @@ public interface Manager extends Closeable {
 
     boolean trustIdentityAllKeys(RecipientIdentifier.Single recipient);
 
+    void addClosedListener(Runnable listener);
+
     @Override
     void close() throws IOException;
 
     interface ReceiveMessageHandler {
 
+        ReceiveMessageHandler EMPTY = (envelope, e) -> {
+        };
+
         void handleMessage(MessageEnvelope envelope, Throwable e);
     }
 }