diff --git a/build.gradle b/build.gradle index 9017a1b..ba64f4e 100644 --- a/build.gradle +++ b/build.gradle @@ -31,7 +31,7 @@ compileKotlin { dependencies { - compile('com.github.badoualy:kotlogram:666a81ef9d6707f117a3fecc2d21c91d51c7d075') { + compile('com.github.badoualy:kotlogram:1.0.0-RC2') { exclude module: 'slf4j-simple' } compile 'org.xerial:sqlite-jdbc:3.16.1' diff --git a/src/main/kotlin/de/fabianonline/telegram_backup/DownloadManager.kt b/src/main/kotlin/de/fabianonline/telegram_backup/DownloadManager.kt index 9766ae4..6cfaf86 100644 --- a/src/main/kotlin/de/fabianonline/telegram_backup/DownloadManager.kt +++ b/src/main/kotlin/de/fabianonline/telegram_backup/DownloadManager.kt @@ -111,6 +111,7 @@ class DownloadManager(internal var client: TelegramClient?, p: DownloadProgressI System.out.println("Downloading most recent dialogs... ") var max_message_id = 0 val dialogs = client!!.messagesGetDialogs( + true, 0, 0, TLInputPeerEmpty(), @@ -398,8 +399,8 @@ class DownloadManager(internal var client: TelegramClient?, p: DownloadProgressI } @Throws(RpcErrorException::class, IOException::class, TimeoutException::class) - fun downloadFile(targetFilename: String, size: Int, dcId: Int, id: Long, accessHash: Long) { - val loc = TLInputDocumentFileLocation(id, accessHash) + fun downloadFile(targetFilename: String, size: Int, dcId: Int, id: Long, accessHash: Long, version: Int) { + val loc = TLInputDocumentFileLocation(id, accessHash, version) downloadFileFromDc(targetFilename, loc, dcId, size) } @@ -438,6 +439,9 @@ class DownloadManager(internal var client: TelegramClient?, p: DownloadProgressI continue // response is null since we didn't actually receive any data. Skip the rest of this iteration and try again. } else if (e.getCode() == 400) { //Somehow this file is broken. No idea why. Let's skip it for now + System.out.println("400 error code") + e.printStackTrace() + System.out.println("400 error code") return false } else { throw e diff --git a/src/main/kotlin/de/fabianonline/telegram_backup/mediafilemanager/DocumentFileManager.kt b/src/main/kotlin/de/fabianonline/telegram_backup/mediafilemanager/DocumentFileManager.kt index e032d9c..9e368d4 100644 --- a/src/main/kotlin/de/fabianonline/telegram_backup/mediafilemanager/DocumentFileManager.kt +++ b/src/main/kotlin/de/fabianonline/telegram_backup/mediafilemanager/DocumentFileManager.kt @@ -99,7 +99,7 @@ open class DocumentFileManager(msg: TLMessage, user: UserManager, client: Telegr @Throws(RpcErrorException::class, IOException::class, TimeoutException::class) override fun download(): Boolean { if (doc != null) { - DownloadManager.downloadFile(targetPathAndFilename, size, doc!!.getDcId(), doc!!.getId(), doc!!.getAccessHash()) + DownloadManager.downloadFile(targetPathAndFilename, size, doc!!.getDcId(), doc!!.getId(), doc!!.getAccessHash(), doc!!.getVersion()) } return true }