mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Split receiveMessages method
This commit is contained in:
parent
430c155f7e
commit
5c389c875d
6 changed files with 32 additions and 15 deletions
|
@ -193,9 +193,15 @@ public interface Manager extends Closeable {
|
|||
|
||||
void requestAllSyncData() throws IOException;
|
||||
|
||||
void receiveMessages(
|
||||
long timeout, TimeUnit unit, boolean returnOnTimeout, ReceiveMessageHandler handler
|
||||
) throws IOException;
|
||||
/**
|
||||
* 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);
|
||||
|
||||
|
|
|
@ -873,7 +873,16 @@ public class ManagerImpl implements Manager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void receiveMessages(
|
||||
public void receiveMessages(long timeout, TimeUnit unit, ReceiveMessageHandler handler) throws IOException {
|
||||
receiveMessages(timeout, unit, true, handler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveMessages(ReceiveMessageHandler handler) throws IOException {
|
||||
receiveMessages(1L, TimeUnit.HOURS, false, handler);
|
||||
}
|
||||
|
||||
private void receiveMessages(
|
||||
long timeout, TimeUnit unit, boolean returnOnTimeout, ReceiveMessageHandler handler
|
||||
) throws IOException {
|
||||
retryFailedReceivedMessages(handler);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue