@ -763,12 +763,15 @@ QTorrentHandle Bittorrent::addMagnetUri(QString magnet_uri, bool resumed) {
@@ -763,12 +763,15 @@ QTorrentHandle Bittorrent::addMagnetUri(QString magnet_uri, bool resumed) {
}
}
QString savePath = getSavePath ( hash ) ;
qDebug ( " addMagnetURI: using save_path: %s " , savePath . toLocal8Bit ( ) . data ( ) ) ;
if ( defaultTempPath . isEmpty ( ) | | ( resumed & & TorrentPersistentData : : isSeed ( hash ) ) ) {
p . save_path = savePath . toLocal8Bit ( ) . data ( ) ;
} else {
if ( ! defaultTempPath . isEmpty ( ) & & resumed & & ! TorrentPersistentData : : isSeed ( hash ) ) {
qDebug ( " addMagnetURI: Temp folder is enabled. " ) ;
p . save_path = defaultTempPath . toLocal8Bit ( ) . data ( ) ;
qDebug ( " addMagnetURI: using save_path: %s " , defaultTempPath . toLocal8Bit ( ) . data ( ) ) ;
} else {
p . save_path = savePath . toLocal8Bit ( ) . data ( ) ;
qDebug ( " addMagnetURI: using save_path: %s " , savePath . toLocal8Bit ( ) . data ( ) ) ;
}
# ifdef LIBTORRENT_0_15
// Skip checking and directly start seeding (new in libtorrent v0.15)
if ( TorrentTempData : : isSeedingMode ( hash ) ) {
@ -799,6 +802,13 @@ QTorrentHandle Bittorrent::addMagnetUri(QString magnet_uri, bool resumed) {
@@ -799,6 +802,13 @@ QTorrentHandle Bittorrent::addMagnetUri(QString magnet_uri, bool resumed) {
return h ;
}
Q_ASSERT ( h . hash ( ) = = hash ) ;
// If temp path is enabled, move torrent
if ( ! defaultTempPath . isEmpty ( ) & & ! resumed ) {
qDebug ( " Temp folder is enabled, moving new torrent to temp folder " ) ;
h . move_storage ( defaultTempPath ) ;
}
// Connections limit per torrent
h . set_max_connections ( Preferences : : getMaxConnecsPerTorrent ( ) ) ;
// Uploads limit per torrent
@ -927,11 +937,13 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
@@ -927,11 +937,13 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
} else {
savePath = getSavePath ( hash ) ;
}
qDebug ( " addTorrent: using save_path: %s " , savePath . toLocal8Bit ( ) . data ( ) ) ;
if ( defaultTempPath . isEmpty ( ) | | ( resumed & & TorrentPersistentData : : isSeed ( hash ) ) ) {
p . save_path = savePath . toLocal8Bit ( ) . data ( ) ;
} else {
if ( ! defaultTempPath . isEmpty ( ) & & resumed & & ! TorrentPersistentData : : isSeed ( hash ) ) {
qDebug ( " addTorrent::Temp folder is enabled. " ) ;
p . save_path = defaultTempPath . toLocal8Bit ( ) . data ( ) ;
qDebug ( " addTorrent: using save_path: %s " , defaultTempPath . toLocal8Bit ( ) . data ( ) ) ;
} else {
p . save_path = savePath . toLocal8Bit ( ) . data ( ) ;
qDebug ( " addTorrent: using save_path: %s " , savePath . toLocal8Bit ( ) . data ( ) ) ;
}
# ifdef LIBTORRENT_0_15
@ -972,6 +984,12 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
@@ -972,6 +984,12 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
return h ;
}
// If temp path is enabled, move torrent
if ( ! defaultTempPath . isEmpty ( ) & & ! resumed ) {
qDebug ( " Temp folder is enabled, moving new torrent to temp folder " ) ;
h . move_storage ( defaultTempPath ) ;
}
// Connections limit per torrent
h . set_max_connections ( Preferences : : getMaxConnecsPerTorrent ( ) ) ;
// Uploads limit per torrent
@ -1704,6 +1722,11 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
@@ -1704,6 +1722,11 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
}
}
}
else if ( storage_moved_alert * p = dynamic_cast < storage_moved_alert * > ( a . get ( ) ) ) {
QTorrentHandle h ( p - > handle ) ;
if ( h . is_valid ( ) )
h . force_recheck ( ) ; //XXX: Required by libtorrent for now
}
else if ( metadata_received_alert * p = dynamic_cast < metadata_received_alert * > ( a . get ( ) ) ) {
QTorrentHandle h ( p - > handle ) ;
if ( h . is_valid ( ) ) {