X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/5c389c875d91bacba127d0e9cbdc1746b022e5aa..ce7aa580b6f0580cdcf7fd68fcc8efba737d21ed:/lib/src/main/java/org/asamk/signal/manager/Manager.java diff --git a/lib/src/main/java/org/asamk/signal/manager/Manager.java b/lib/src/main/java/org/asamk/signal/manager/Manager.java index ac0cc02f..2cb68d20 100644 --- a/lib/src/main/java/org/asamk/signal/manager/Manager.java +++ b/lib/src/main/java/org/asamk/signal/manager/Manager.java @@ -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 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. */