Browse Source

Rewrite TrackerList::reannounceSelected(), now it can force reannounce DHT

adaptive-webui-19844
Chocobo1 9 years ago
parent
commit
fb1772f019
  1. 19
      src/gui/properties/trackerlist.cpp

19
src/gui/properties/trackerlist.cpp

@ -400,16 +400,23 @@ void TrackerList::editSelectedTracker() { @@ -400,16 +400,23 @@ void TrackerList::editSelectedTracker() {
#if LIBTORRENT_VERSION_NUM >= 10000
void TrackerList::reannounceSelected() {
QList<QTreeWidgetItem *> selected_items = selectedItems();
if (selected_items.isEmpty()) return;
BitTorrent::TorrentHandle *const torrent = properties->getCurrentTorrent();
if (!torrent) return;
QList<BitTorrent::TrackerEntry> trackers = torrent->trackers();
QList<QTreeWidgetItem *> selected_items = getSelectedTrackerItems();
if (selected_items.isEmpty()) return;
foreach (QTreeWidgetItem* item, selected_items) {
// DHT case
if (item == dht_item) {
torrent->forceDHTAnnounce();
continue;
}
QList<BitTorrent::TrackerEntry> trackers = torrent->trackers();
for (int i = 0; i < trackers.size(); ++i) {
foreach (QTreeWidgetItem* w, selected_items) {
if (w->text(COL_URL) == trackers[i].url()) {
// Trackers case
for (int i = 0; i < trackers.size(); ++i) {
if (item->text(COL_URL) == trackers[i].url()) {
torrent->forceReannounce(i);
break;
}

Loading…
Cancel
Save