diff --git a/src/main/kotlin/de/fabianonline/telegram_backup/CommandLineController.kt b/src/main/kotlin/de/fabianonline/telegram_backup/CommandLineController.kt index b539c0f..5f8dead 100644 --- a/src/main/kotlin/de/fabianonline/telegram_backup/CommandLineController.kt +++ b/src/main/kotlin/de/fabianonline/telegram_backup/CommandLineController.kt @@ -133,6 +133,7 @@ class CommandLineController { val d = DownloadManager(client, CommandLineDownloadProgress()) logger.debug("Calling DownloadManager.downloadMessages with limit {}", CommandLineOptions.val_limit_messages) d.downloadMessages(CommandLineOptions.val_limit_messages) + UpdatesManager.update(client) logger.debug("CommandLineOptions.cmd_no_media: {}", CommandLineOptions.cmd_no_media) if (!CommandLineOptions.cmd_no_media) { logger.debug("Calling DownloadManager.downloadMedia") diff --git a/src/main/kotlin/de/fabianonline/telegram_backup/UpdatesManager.kt b/src/main/kotlin/de/fabianonline/telegram_backup/UpdatesManager.kt new file mode 100644 index 0000000..50d58cc --- /dev/null +++ b/src/main/kotlin/de/fabianonline/telegram_backup/UpdatesManager.kt @@ -0,0 +1,25 @@ +package de.fabianonline.telegram_backup + +import com.github.badoualy.telegram.api.TelegramClient +import com.github.badoualy.telegram.tl.api.updates.TLState +import com.github.badoualy.telegram.tl.api.updates.TLAbsDifference + +object UpdatesManager { + fun update(client: TelegramClient) { + val state: TLState = client.updatesGetState() + + println("pts: ${state.pts}") + println("qts: ${state.qts}") + println("date: ${state.date}") + println("seq: ${state.seq}") + println("unreadCount: ${state.unreadCount}") + + val pts = 1 //211282 + val date = 1515060280 + val qts = -1 // We don't support encryption. Setting qts to -1 signals this to telegram, so we won't get updates for encrypted messages. + val diff = client.updatesGetDifference(pts, date, qts) + + println("diff type: ${diff.javaClass}") + println(diff.toPrettyJson()) + } +}