]> nmode's Git Repositories - signal-cli/blobdiff - lib/src/main/java/org/asamk/signal/manager/Manager.java
Use record classes
[signal-cli] / lib / src / main / java / org / asamk / signal / manager / Manager.java
index ac0cc02fc03aa98017798236ef3cabbfbf06bcfe..2cb68d206eaba52efbcbd188dcd28b4d50fd0dc3 100644 (file)
@@ -57,11 +57,11 @@ public interface Manager extends Closeable {
     ) throws IOException, NotRegisteredException {
         var pathConfig = PathConfig.createDefault(settingsPath);
 
-        if (!SignalAccount.userExists(pathConfig.getDataPath(), number)) {
+        if (!SignalAccount.userExists(pathConfig.dataPath(), number)) {
             throw new NotRegisteredException();
         }
 
-        var account = SignalAccount.load(pathConfig.getDataPath(), number, true, trustNewIdentity);
+        var account = SignalAccount.load(pathConfig.dataPath(), number, true, trustNewIdentity);
 
         if (!account.isRegistered()) {
             throw new NotRegisteredException();
@@ -74,7 +74,7 @@ public interface Manager extends Closeable {
 
     static List<String> getAllLocalNumbers(File settingsPath) {
         var pathConfig = PathConfig.createDefault(settingsPath);
-        final var dataPath = pathConfig.getDataPath();
+        final var dataPath = pathConfig.dataPath();
         final var files = dataPath.listFiles();
 
         if (files == null) {
@@ -193,6 +193,20 @@ public interface Manager extends Closeable {
 
     void requestAllSyncData() throws IOException;
 
+    /**
+     * Add a handler to receive new messages.
+     * Will start receiving messages from server, if not already started.
+     */
+    void addReceiveHandler(ReceiveMessageHandler handler);
+
+    /**
+     * Remove a handler to receive new messages.
+     * Will stop receiving messages from server, if this was the last registered receiver.
+     */
+    void removeReceiveHandler(ReceiveMessageHandler handler);
+
+    boolean isReceiving();
+
     /**
      * Receive new messages from server, returns if no new message arrive in a timespan of timeout.
      */