1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2024-12-25 22:35:35 +00:00

Testing putting multiple GetMessages requests into one RpcQuery. References #35.

This commit is contained in:
Fabian Schlenz 2016-11-25 21:23:45 +01:00
parent 2dc3484f7d
commit 0249374384

View File

@ -33,6 +33,8 @@ import com.github.badoualy.telegram.tl.api.*;
import com.github.badoualy.telegram.tl.api.upload.TLFile;
import com.github.badoualy.telegram.tl.exception.RpcErrorException;
import com.github.badoualy.telegram.tl.api.request.TLRequestUploadGetFile;
import com.github.badoualy.telegram.tl.core.TLMethod;
import com.github.badoualy.telegram.tl.api.request.*;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
@ -169,6 +171,26 @@ public class DownloadManager {
prog.onMessageDownloadStart(ids.size());
boolean has_seen_flood_wait_message = false;
/// Testing
List<TLRequestMessagesGetMessages> methods = new LinkedList<>();
int a = 0;
while(ids.size()>0 && a<5) {
a++;
TLIntVector vector = new TLIntVector();
for (int i=0; i<Config.GET_MESSAGES_BATCH_SIZE; i++) {
if (ids.size()==0) break;
vector.add(ids.remove(0));
}
TLRequestMessagesGetMessages method = new TLRequestMessagesGetMessages(vector);
methods.add(method);
}
List<? extends TLObject> responses = client.executeRpcQueries(methods);
for(TLObject obj : responses) {
System.out.println(obj.getClass().getName());
}
System.exit(0);
/// Testing ends
logger.debug("Entering download loop");
while (ids.size()>0) {
logger.trace("Loop");