mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 21:14:33 +00:00
Don't merge trackers for private torrents. Closes #2928.
This commit is contained in:
parent
f37aed868e
commit
b099a766e6
@ -1046,6 +1046,8 @@ bool Session::addTorrent_impl(AddTorrentData addData, const MagnetUri &magnetUri
|
|||||||
|
|
||||||
if (m_torrents.contains(hash)) {
|
if (m_torrents.contains(hash)) {
|
||||||
TorrentHandle *const torrent = m_torrents.value(hash);
|
TorrentHandle *const torrent = m_torrents.value(hash);
|
||||||
|
if (torrent->isPrivate() || (!fromMagnetUri && torrentInfo.isPrivate()))
|
||||||
|
return false;
|
||||||
torrent->addTrackers(fromMagnetUri ? magnetUri.trackers() : torrentInfo.trackers());
|
torrent->addTrackers(fromMagnetUri ? magnetUri.trackers() : torrentInfo.trackers());
|
||||||
torrent->addUrlSeeds(fromMagnetUri ? magnetUri.urlSeeds() : torrentInfo.urlSeeds());
|
torrent->addUrlSeeds(fromMagnetUri ? magnetUri.urlSeeds() : torrentInfo.urlSeeds());
|
||||||
return true;
|
return true;
|
||||||
|
@ -189,9 +189,14 @@ bool AddNewTorrentDialog::loadTorrent(const QString &torrentPath)
|
|||||||
if (BitTorrent::Session::instance()->isKnownTorrent(m_hash)) {
|
if (BitTorrent::Session::instance()->isKnownTorrent(m_hash)) {
|
||||||
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(m_hash);
|
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(m_hash);
|
||||||
if (torrent) {
|
if (torrent) {
|
||||||
torrent->addTrackers(m_torrentInfo.trackers());
|
if (torrent->isPrivate() || m_torrentInfo.isPrivate()) {
|
||||||
torrent->addUrlSeeds(m_torrentInfo.urlSeeds());
|
MessageBoxRaised::critical(0, tr("Already in download list"), tr("Torrent is already in download list. Trackers weren't merged because it is a private torrent."), QMessageBox::Ok);
|
||||||
MessageBoxRaised::information(0, tr("Already in download list"), tr("Torrent is already in download list. Trackers were merged."), QMessageBox::Ok);
|
}
|
||||||
|
else {
|
||||||
|
torrent->addTrackers(m_torrentInfo.trackers());
|
||||||
|
torrent->addUrlSeeds(m_torrentInfo.urlSeeds());
|
||||||
|
MessageBoxRaised::information(0, tr("Already in download list"), tr("Torrent is already in download list. Trackers were merged."), QMessageBox::Ok);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MessageBoxRaised::critical(0, tr("Cannot add torrent"), tr("Cannot add this torrent. Perhaps it is already in adding state."), QMessageBox::Ok);
|
MessageBoxRaised::critical(0, tr("Cannot add torrent"), tr("Cannot add this torrent. Perhaps it is already in adding state."), QMessageBox::Ok);
|
||||||
@ -216,9 +221,14 @@ bool AddNewTorrentDialog::loadMagnet(const BitTorrent::MagnetUri &magnetUri)
|
|||||||
if (BitTorrent::Session::instance()->isKnownTorrent(m_hash)) {
|
if (BitTorrent::Session::instance()->isKnownTorrent(m_hash)) {
|
||||||
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(m_hash);
|
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(m_hash);
|
||||||
if (torrent) {
|
if (torrent) {
|
||||||
torrent->addTrackers(magnetUri.trackers());
|
if (torrent->isPrivate()) {
|
||||||
torrent->addUrlSeeds(magnetUri.urlSeeds());
|
MessageBoxRaised::critical(0, tr("Already in download list"), tr("Torrent is already in download list. Trackers weren't merged because it is a private torrent."), QMessageBox::Ok);
|
||||||
MessageBoxRaised::information(0, tr("Already in download list"), tr("Magnet link is already in download list. Trackers were merged."), QMessageBox::Ok);
|
}
|
||||||
|
else {
|
||||||
|
torrent->addTrackers(magnetUri.trackers());
|
||||||
|
torrent->addUrlSeeds(magnetUri.urlSeeds());
|
||||||
|
MessageBoxRaised::information(0, tr("Already in download list"), tr("Magnet link is already in download list. Trackers were merged."), QMessageBox::Ok);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MessageBoxRaised::critical(0, tr("Cannot add torrent"), tr("Cannot add this torrent. Perhaps it is already in adding."), QMessageBox::Ok);
|
MessageBoxRaised::critical(0, tr("Cannot add torrent"), tr("Cannot add this torrent. Perhaps it is already in adding."), QMessageBox::Ok);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user