1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2025-07-04 06:06:24 +00:00
This commit is contained in:
Leijurv
2018-03-08 22:18:53 +00:00
committed by GitHub
3 changed files with 8 additions and 4 deletions

View File

@ -31,7 +31,7 @@ compileKotlin {
dependencies { dependencies {
compile('com.github.badoualy:kotlogram:666a81ef9d6707f117a3fecc2d21c91d51c7d075') { compile('com.github.badoualy:kotlogram:1.0.0-RC2') {
exclude module: 'slf4j-simple' exclude module: 'slf4j-simple'
} }
compile 'org.xerial:sqlite-jdbc:3.16.1' compile 'org.xerial:sqlite-jdbc:3.16.1'

View File

@ -111,6 +111,7 @@ class DownloadManager(internal var client: TelegramClient?, p: DownloadProgressI
System.out.println("Downloading most recent dialogs... ") System.out.println("Downloading most recent dialogs... ")
var max_message_id = 0 var max_message_id = 0
val dialogs = client!!.messagesGetDialogs( val dialogs = client!!.messagesGetDialogs(
true,
0, 0,
0, 0,
TLInputPeerEmpty(), TLInputPeerEmpty(),
@ -398,8 +399,8 @@ class DownloadManager(internal var client: TelegramClient?, p: DownloadProgressI
} }
@Throws(RpcErrorException::class, IOException::class, TimeoutException::class) @Throws(RpcErrorException::class, IOException::class, TimeoutException::class)
fun downloadFile(targetFilename: String, size: Int, dcId: Int, id: Long, accessHash: Long) { fun downloadFile(targetFilename: String, size: Int, dcId: Int, id: Long, accessHash: Long, version: Int) {
val loc = TLInputDocumentFileLocation(id, accessHash) val loc = TLInputDocumentFileLocation(id, accessHash, version)
downloadFileFromDc(targetFilename, loc, dcId, size) 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. 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) { } else if (e.getCode() == 400) {
//Somehow this file is broken. No idea why. Let's skip it for now //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 return false
} else { } else {
throw e throw e

View File

@ -99,7 +99,7 @@ open class DocumentFileManager(msg: TLMessage, user: UserManager, client: Telegr
@Throws(RpcErrorException::class, IOException::class, TimeoutException::class) @Throws(RpcErrorException::class, IOException::class, TimeoutException::class)
override fun download(): Boolean { override fun download(): Boolean {
if (doc != null) { 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 return true
} }