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

Supergroups have their own message IDs. Load more than the 1 last dialog and take the biggest ID.

This commit is contained in:
Fabian Schlenz 2016-07-11 06:31:06 +02:00
parent 7e91ec092e
commit 468c5517dd

View File

@ -83,11 +83,17 @@ public class DownloadManager {
public void _downloadMessages(Integer limit) throws RpcErrorException, IOException, TimeoutException {
System.out.println("Downloading most recent dialog... ");
int max_message_id = client.messagesGetDialogs(
int max_message_id = 0;
TLAbsDialogs dialogs = client.messagesGetDialogs(
0,
0,
new TLInputPeerEmpty(),
1).getDialogs().get(0).getTopMessage();
100);
for (TLAbsDialog d : dialogs.getDialogs()) {
if (d.getTopMessage() > max_message_id) {
max_message_id = d.getTopMessage();
}
}
System.out.println("Top message ID is " + max_message_id);
int max_database_id = db.getTopMessageID();
System.out.println("Top message ID in database is " + max_database_id);