mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Add setIgnoreAttachments method
This commit is contained in:
parent
3636023cb8
commit
f5ba7894ae
6 changed files with 32 additions and 33 deletions
|
@ -194,13 +194,11 @@ public interface Manager extends Closeable {
|
|||
void requestAllSyncData() throws IOException;
|
||||
|
||||
void receiveMessages(
|
||||
long timeout,
|
||||
TimeUnit unit,
|
||||
boolean returnOnTimeout,
|
||||
boolean ignoreAttachments,
|
||||
ReceiveMessageHandler handler
|
||||
long timeout, TimeUnit unit, boolean returnOnTimeout, ReceiveMessageHandler handler
|
||||
) throws IOException;
|
||||
|
||||
void setIgnoreAttachments(boolean ignoreAttachments);
|
||||
|
||||
boolean hasCaughtUpWithOldMessages();
|
||||
|
||||
boolean isContactBlocked(RecipientIdentifier.Single recipient);
|
||||
|
|
|
@ -135,6 +135,7 @@ public class ManagerImpl implements Manager {
|
|||
|
||||
private final Context context;
|
||||
private boolean hasCaughtUpWithOldMessages = false;
|
||||
private boolean ignoreAttachments = false;
|
||||
|
||||
ManagerImpl(
|
||||
SignalAccount account,
|
||||
|
@ -824,10 +825,10 @@ public class ManagerImpl implements Manager {
|
|||
return registeredUsers;
|
||||
}
|
||||
|
||||
private void retryFailedReceivedMessages(ReceiveMessageHandler handler, boolean ignoreAttachments) {
|
||||
private void retryFailedReceivedMessages(ReceiveMessageHandler handler) {
|
||||
Set<HandleAction> queuedActions = new HashSet<>();
|
||||
for (var cachedMessage : account.getMessageCache().getCachedMessages()) {
|
||||
var actions = retryFailedReceivedMessage(handler, ignoreAttachments, cachedMessage);
|
||||
var actions = retryFailedReceivedMessage(handler, cachedMessage);
|
||||
if (actions != null) {
|
||||
queuedActions.addAll(actions);
|
||||
}
|
||||
|
@ -836,7 +837,7 @@ public class ManagerImpl implements Manager {
|
|||
}
|
||||
|
||||
private List<HandleAction> retryFailedReceivedMessage(
|
||||
final ReceiveMessageHandler handler, final boolean ignoreAttachments, final CachedMessage cachedMessage
|
||||
final ReceiveMessageHandler handler, final CachedMessage cachedMessage
|
||||
) {
|
||||
var envelope = cachedMessage.loadEnvelope();
|
||||
if (envelope == null) {
|
||||
|
@ -873,13 +874,9 @@ public class ManagerImpl implements Manager {
|
|||
|
||||
@Override
|
||||
public void receiveMessages(
|
||||
long timeout,
|
||||
TimeUnit unit,
|
||||
boolean returnOnTimeout,
|
||||
boolean ignoreAttachments,
|
||||
ReceiveMessageHandler handler
|
||||
long timeout, TimeUnit unit, boolean returnOnTimeout, ReceiveMessageHandler handler
|
||||
) throws IOException {
|
||||
retryFailedReceivedMessages(handler, ignoreAttachments);
|
||||
retryFailedReceivedMessages(handler);
|
||||
|
||||
Set<HandleAction> queuedActions = new HashSet<>();
|
||||
|
||||
|
@ -980,6 +977,11 @@ public class ManagerImpl implements Manager {
|
|||
queuedActions.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIgnoreAttachments(final boolean ignoreAttachments) {
|
||||
this.ignoreAttachments = ignoreAttachments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCaughtUpWithOldMessages() {
|
||||
return hasCaughtUpWithOldMessages;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue