import org.asamk.signal.manager.storage.recipients.Contact;
import org.asamk.signal.manager.storage.recipients.Profile;
import org.asamk.signal.manager.storage.recipients.RecipientAddress;
-import org.whispersystems.libsignal.IdentityKey;
import org.whispersystems.libsignal.InvalidKeyException;
import org.whispersystems.libsignal.util.Pair;
import org.whispersystems.libsignal.util.guava.Optional;
void requestAllSyncData() throws IOException;
- void receiveMessages(
- long timeout,
- TimeUnit unit,
- boolean returnOnTimeout,
- boolean ignoreAttachments,
- ReceiveMessageHandler handler
- ) 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.
+ */
+ void receiveMessages(long timeout, TimeUnit unit, ReceiveMessageHandler handler) throws IOException;
+
+ /**
+ * Receive new messages from server, returns only if the thread is interrupted.
+ */
+ void receiveMessages(ReceiveMessageHandler handler) throws IOException;
+
+ void setIgnoreAttachments(boolean ignoreAttachments);
boolean hasCaughtUpWithOldMessages();
boolean trustIdentityAllKeys(RecipientIdentifier.Single recipient);
- String computeSafetyNumber(SignalServiceAddress theirAddress, IdentityKey theirIdentityKey);
-
SignalServiceAddress resolveSignalServiceAddress(SignalServiceAddress address);
@Override