mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 13:04:23 +00:00
Merge pull request #12877 from an0n666/private-torrents
Address some issues regarding private torrents
This commit is contained in:
commit
788d2729db
@ -285,6 +285,7 @@ namespace BitTorrent
|
|||||||
virtual void addUrlSeeds(const QVector<QUrl> &urlSeeds) = 0;
|
virtual void addUrlSeeds(const QVector<QUrl> &urlSeeds) = 0;
|
||||||
virtual void removeUrlSeeds(const QVector<QUrl> &urlSeeds) = 0;
|
virtual void removeUrlSeeds(const QVector<QUrl> &urlSeeds) = 0;
|
||||||
virtual bool connectPeer(const PeerAddress &peerAddress) = 0;
|
virtual bool connectPeer(const PeerAddress &peerAddress) = 0;
|
||||||
|
virtual void clearPeers() = 0;
|
||||||
|
|
||||||
virtual QString createMagnetURI() const = 0;
|
virtual QString createMagnetURI() const = 0;
|
||||||
|
|
||||||
|
@ -435,6 +435,11 @@ void TorrentHandleImpl::replaceTrackers(const QVector<TrackerEntry> &trackers)
|
|||||||
|
|
||||||
if (!newTrackers.isEmpty())
|
if (!newTrackers.isEmpty())
|
||||||
m_session->handleTorrentTrackersAdded(this, newTrackers);
|
m_session->handleTorrentTrackersAdded(this, newTrackers);
|
||||||
|
|
||||||
|
// Clear the peer list if it's a private torrent since
|
||||||
|
// we do not want to keep connecting with peers from old tracker.
|
||||||
|
if (isPrivate())
|
||||||
|
clearPeers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -489,6 +494,13 @@ void TorrentHandleImpl::removeUrlSeeds(const QVector<QUrl> &urlSeeds)
|
|||||||
m_session->handleTorrentUrlSeedsRemoved(this, removedUrlSeeds);
|
m_session->handleTorrentUrlSeedsRemoved(this, removedUrlSeeds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TorrentHandleImpl::clearPeers()
|
||||||
|
{
|
||||||
|
#if (LIBTORRENT_VERSION_NUM >= 10207)
|
||||||
|
m_nativeHandle.clear_peers();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
bool TorrentHandleImpl::connectPeer(const PeerAddress &peerAddress)
|
bool TorrentHandleImpl::connectPeer(const PeerAddress &peerAddress)
|
||||||
{
|
{
|
||||||
lt::error_code ec;
|
lt::error_code ec;
|
||||||
|
@ -237,6 +237,7 @@ namespace BitTorrent
|
|||||||
void addUrlSeeds(const QVector<QUrl> &urlSeeds) override;
|
void addUrlSeeds(const QVector<QUrl> &urlSeeds) override;
|
||||||
void removeUrlSeeds(const QVector<QUrl> &urlSeeds) override;
|
void removeUrlSeeds(const QVector<QUrl> &urlSeeds) override;
|
||||||
bool connectPeer(const PeerAddress &peerAddress) override;
|
bool connectPeer(const PeerAddress &peerAddress) override;
|
||||||
|
void clearPeers() override;
|
||||||
|
|
||||||
QString createMagnetURI() const override;
|
QString createMagnetURI() const override;
|
||||||
|
|
||||||
|
@ -256,7 +256,8 @@ void PeerListWidget::showPeerListMenu(const QPoint &)
|
|||||||
menu->setAttribute(Qt::WA_DeleteOnClose);
|
menu->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
// Add Peer Action
|
// Add Peer Action
|
||||||
if (!torrent->isQueued() && !torrent->isChecking()) {
|
// Do not allow user to add peers in a private torrent
|
||||||
|
if (!torrent->isQueued() && !torrent->isChecking() && !torrent->isPrivate()) {
|
||||||
const QAction *addPeerAct = menu->addAction(UIThemeManager::instance()->getIcon("user-group-new"), tr("Add a new peer..."));
|
const QAction *addPeerAct = menu->addAction(UIThemeManager::instance()->getIcon("user-group-new"), tr("Add a new peer..."));
|
||||||
connect(addPeerAct, &QAction::triggered, this, [this, torrent]()
|
connect(addPeerAct, &QAction::triggered, this, [this, torrent]()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user