From 2f4f06ca8bac6c19a6c902fb2f5b1cb362b9e12d Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Wed, 23 Jun 2010 11:59:28 +0000 Subject: [PATCH] Do not redownload files if they were moved --- src/bittorrent.cpp | 18 ++++++++++++++---- src/searchengine.cpp | 1 - src/ui/options.ui | 26 +++++++++++++------------- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index b74d30a13..199a9f035 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -2179,12 +2179,22 @@ void Bittorrent::addConsoleMessage(QString msg, QString) { //emit peerBlocked(QString::fromUtf8(p->ip.to_string().c_str())); } else if (fastresume_rejected_alert* p = dynamic_cast(a.get())) { - const QTorrentHandle h(p->handle); + QTorrentHandle h(p->handle); if(h.is_valid()){ qDebug("/!\\ Fast resume failed for %s, reason: %s", qPrintable(h.name()), p->message().c_str()); - addConsoleMessage(tr("Fast resume data was rejected for torrent %1, checking again...").arg(h.name()), QString::fromUtf8("red")); - addConsoleMessage(tr("Reason: %1").arg(misc::toQString(p->message()))); - //emit fastResumeDataRejected(h.name()); +#if LIBTORRENT_VERSION_MINOR < 15 + QString msg = QString::fromLocal8Bit(p->message().c_str()); + if(msg.contains("filesize", Qt::CaseInsensitive) && msg.contains("mismatch", Qt::CaseInsensitive)) { +#else + if(p->error.value() == 134) { +#endif + // Mismatching file size (files were probably moved + addConsoleMessage(tr("File sizes mismatch for torrent %1, pausing it.").arg(h.name())); + pauseTorrent(h.hash()); + } else { + addConsoleMessage(tr("Fast resume data was rejected for torrent %1, checking again...").arg(h.name()), QString::fromUtf8("red")); + addConsoleMessage(tr("Reason: %1").arg(misc::toQString(p->message()))); + } } } else if (url_seed_alert* p = dynamic_cast(a.get())) { diff --git a/src/searchengine.cpp b/src/searchengine.cpp index 089c1ce0d..ee726f5fd 100644 --- a/src/searchengine.cpp +++ b/src/searchengine.cpp @@ -337,7 +337,6 @@ void SearchEngine::on_search_button_clicked(){ // Getting checked search engines QStringList params; - QStringList engineNames; search_stopped = false; params << misc::searchEngineLocation()+QDir::separator()+"nova2.py"; params << supported_engines->enginesEnabled().join(","); diff --git a/src/ui/options.ui b/src/ui/options.ui index f17392c5b..6b9ddb730 100644 --- a/src/ui/options.ui +++ b/src/ui/options.ui @@ -191,7 +191,7 @@ - 1 + 0 @@ -514,7 +514,7 @@ 0 - -98 + 0 506 504 @@ -891,8 +891,8 @@ QGroupBox { 0 0 - 524 - 398 + 447 + 348 @@ -1178,8 +1178,8 @@ QGroupBox { 0 0 - 524 - 406 + 404 + 334 @@ -1559,7 +1559,7 @@ QGroupBox { 0 - -80 + 0 539 484 @@ -2059,8 +2059,8 @@ QGroupBox { 0 0 - 524 - 406 + 475 + 304 @@ -2477,8 +2477,8 @@ QGroupBox { 0 0 - 524 - 406 + 378 + 229 @@ -2640,8 +2640,8 @@ QGroupBox { 0 0 - 524 - 406 + 98 + 28