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 boolean AUTOMATIC_NETWORK_RETRY = true;
|
||||
public final static int GROUP_MAX_SIZE = 1001;
|
||||
public final static int MAXIMUM_ONE_OFF_REQUEST_SIZE = 3;
|
||||
|
||||
private final static KeyStore iasKeyStore;
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@ import java.util.Map;
|
|||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.asamk.signal.manager.config.ServiceConfig.MAXIMUM_ONE_OFF_REQUEST_SIZE;
|
||||
|
||||
public class RecipientHelper {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(RecipientHelper.class);
|
||||
|
@ -134,8 +136,15 @@ public class RecipientHelper {
|
|||
public Map<String, RegisteredUser> getRegisteredUsers(
|
||||
final Set<String> numbers
|
||||
) throws IOException {
|
||||
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(
|
||||
final Set<String> numbers, final boolean isPartialRefresh
|
||||
|
@ -174,7 +183,10 @@ public class RecipientHelper {
|
|||
logger.debug("No new numbers to query.");
|
||||
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()
|
||||
? Optional.<byte[]>empty()
|
||||
: Optional.ofNullable(account.getCdsiToken());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue