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

Implemented testing of getUpdates and stuff.

This commit is contained in:
Fabian Schlenz 2018-01-29 06:15:16 +01:00
parent ab16c44de5
commit f49a9541a3
2 changed files with 26 additions and 0 deletions

View File

@ -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")

View File

@ -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())
}
}