diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index 7dbe42f78..34e8dea49 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -1046,6 +1046,8 @@ bool Session::addTorrent_impl(AddTorrentData addData, const MagnetUri &magnetUri if (m_torrents.contains(hash)) { TorrentHandle *const torrent = m_torrents.value(hash); + if (torrent->isPrivate() || (!fromMagnetUri && torrentInfo.isPrivate())) + return false; torrent->addTrackers(fromMagnetUri ? magnetUri.trackers() : torrentInfo.trackers()); torrent->addUrlSeeds(fromMagnetUri ? magnetUri.urlSeeds() : torrentInfo.urlSeeds()); return true; diff --git a/src/gui/addnewtorrentdialog.cpp b/src/gui/addnewtorrentdialog.cpp index eb844f02f..66098cd50 100644 --- a/src/gui/addnewtorrentdialog.cpp +++ b/src/gui/addnewtorrentdialog.cpp @@ -189,9 +189,14 @@ bool AddNewTorrentDialog::loadTorrent(const QString &torrentPath) if (BitTorrent::Session::instance()->isKnownTorrent(m_hash)) { BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(m_hash); if (torrent) { - 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); + if (torrent->isPrivate() || m_torrentInfo.isPrivate()) { + 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); + } + 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 { 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)) { BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(m_hash); if (torrent) { - 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); + if (torrent->isPrivate()) { + 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); + } + 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 { MessageBoxRaised::critical(0, tr("Cannot add torrent"), tr("Cannot add this torrent. Perhaps it is already in adding."), QMessageBox::Ok);