Merge pull request #3332 from ngosang/addtrackers2

Automatically add trackers to new downloads. Closes #262
This commit is contained in:
sledgehammer999 2015-11-02 10:51:59 -06:00
commit 66ce5c2557
6 changed files with 76 additions and 0 deletions

View file

@ -1,3 +1,4 @@
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2015 Vladimir Golovnev <glassez@yandex.ru>
@ -619,6 +620,16 @@ void Session::configure()
qDebug("Applying encryption settings");
m_nativeSession->set_pe_settings(encryptionSettings);
// * Add trackers
m_additionalTrackers.empty();
if (pref->isAddTrackersEnabled()) {
foreach (QString tracker, pref->getTrackersList().split("\n")) {
tracker = tracker.trimmed();
if (!tracker.isEmpty())
m_additionalTrackers << tracker;
}
}
// * Maximum ratio
m_highRatioAction = pref->getMaxRatioAction();
setGlobalMaxRatio(pref->getGlobalMaxRatio());
@ -2153,6 +2164,9 @@ void Session::handleAddTorrentAlert(libtorrent::add_torrent_alert *p)
}
}
if (pref->isAddTrackersEnabled() && !torrent->isPrivate())
torrent->addTrackers(m_additionalTrackers);
bool addPaused = data.addPaused;
if (data.addPaused == TriStateBool::Undefined)
addPaused = pref->addTorrentsInPause();