mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
parent
24069c8277
commit
505de39d2a
2 changed files with 15 additions and 2 deletions
|
@ -29,6 +29,7 @@ public class ServiceConfig {
|
||||||
public final static long AVATAR_DOWNLOAD_FAILSAFE_MAX_SIZE = 10 * 1024 * 1024;
|
public final static long AVATAR_DOWNLOAD_FAILSAFE_MAX_SIZE = 10 * 1024 * 1024;
|
||||||
public final static boolean AUTOMATIC_NETWORK_RETRY = true;
|
public final static boolean AUTOMATIC_NETWORK_RETRY = true;
|
||||||
public final static int GROUP_MAX_SIZE = 1001;
|
public final static int GROUP_MAX_SIZE = 1001;
|
||||||
|
public final static int MAXIMUM_ONE_OFF_REQUEST_SIZE = 3;
|
||||||
|
|
||||||
private final static KeyStore iasKeyStore;
|
private final static KeyStore iasKeyStore;
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@ import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static org.asamk.signal.manager.config.ServiceConfig.MAXIMUM_ONE_OFF_REQUEST_SIZE;
|
||||||
|
|
||||||
public class RecipientHelper {
|
public class RecipientHelper {
|
||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger(RecipientHelper.class);
|
private final static Logger logger = LoggerFactory.getLogger(RecipientHelper.class);
|
||||||
|
@ -134,7 +136,14 @@ public class RecipientHelper {
|
||||||
public Map<String, RegisteredUser> getRegisteredUsers(
|
public Map<String, RegisteredUser> getRegisteredUsers(
|
||||||
final Set<String> numbers
|
final Set<String> numbers
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
return getRegisteredUsers(numbers, true);
|
if (numbers.size() > MAXIMUM_ONE_OFF_REQUEST_SIZE) {
|
||||||
|
final var allNumbers = new HashSet<>(account.getRecipientStore().getAllNumbers()) {{
|
||||||
|
addAll(numbers);
|
||||||
|
}};
|
||||||
|
return getRegisteredUsers(allNumbers, false);
|
||||||
|
} else {
|
||||||
|
return getRegisteredUsers(numbers, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, RegisteredUser> getRegisteredUsers(
|
private Map<String, RegisteredUser> getRegisteredUsers(
|
||||||
|
@ -174,7 +183,10 @@ public class RecipientHelper {
|
||||||
logger.debug("No new numbers to query.");
|
logger.debug("No new numbers to query.");
|
||||||
return Map.of();
|
return Map.of();
|
||||||
}
|
}
|
||||||
logger.trace("Querying CDSI for {} new numbers ({} previous)", newNumbers.size(), previousNumbers.size());
|
logger.trace("Querying CDSI for {} new numbers ({} previous), isPartialRefresh={}",
|
||||||
|
newNumbers.size(),
|
||||||
|
previousNumbers.size(),
|
||||||
|
isPartialRefresh);
|
||||||
final var token = previousNumbers.isEmpty()
|
final var token = previousNumbers.isEmpty()
|
||||||
? Optional.<byte[]>empty()
|
? Optional.<byte[]>empty()
|
||||||
: Optional.ofNullable(account.getCdsiToken());
|
: Optional.ofNullable(account.getCdsiToken());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue