From a5a0ca715944e328db7969bcaaeefa52781737c7 Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Sun, 26 Jan 2014 16:29:53 +0200 Subject: [PATCH] Don't re-announce to trackers when torrent is paused. Closes #1310. --- src/properties/trackerlist.cpp | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/properties/trackerlist.cpp b/src/properties/trackerlist.cpp index 4fad8e11e..25add521d 100644 --- a/src/properties/trackerlist.cpp +++ b/src/properties/trackerlist.cpp @@ -140,7 +140,8 @@ void TrackerList::moveSelectionUp() { } h.replace_trackers(trackers); // Reannounce - h.force_reannounce(); + if (!h.is_paused()) + h.force_reannounce(); loadTrackers(); } @@ -177,7 +178,8 @@ void TrackerList::moveSelectionDown() { } h.replace_trackers(trackers); // Reannounce - h.force_reannounce(); + if (!h.is_paused()) + h.force_reannounce(); loadTrackers(); } @@ -302,7 +304,8 @@ void TrackerList::askForTrackers() { h.add_tracker(url); } // Reannounce to new trackers - h.force_reannounce(); + if (!h.is_paused()) + h.force_reannounce(); // Reload tracker list loadTrackers(); } @@ -348,7 +351,8 @@ void TrackerList::deleteSelectedTrackers() { } } h.replace_trackers(remaining_trackers); - h.force_reannounce(); + if (!h.is_paused()) + h.force_reannounce(); // Reload Trackers loadTrackers(); } @@ -396,8 +400,10 @@ void TrackerList::editSelectedTracker() { } h.replace_trackers(trackers); - h.force_reannounce(); - h.force_dht_announce(); + if (!h.is_paused()) { + h.force_reannounce(); + h.force_dht_announce(); + } } catch(invalid_handle&) { return; } @@ -447,11 +453,17 @@ void TrackerList::showTrackerListMenu(QPoint) { copyAct = menu.addAction(IconProvider::instance()->getIcon("edit-copy"), tr("Copy tracker url")); editAct = menu.addAction(IconProvider::instance()->getIcon("edit-rename"),tr("Edit selected tracker URL")); } -#if LIBTORRENT_VERSION_MAJOR >= 1 - QAction *reannounceSelAct = menu.addAction(IconProvider::instance()->getIcon("view-refresh"), tr("Force reannounce to selected trackers")); +#if LIBTORRENT_VERSION_NUM >= 10000 + QAction *reannounceSelAct = NULL; +#endif + QAction *reannounceAct = NULL; + if (!h.is_paused()) { +#if LIBTORRENT_VERSION_NUM >= 10000 + reannounceSelAct = menu.addAction(IconProvider::instance()->getIcon("view-refresh"), tr("Force reannounce to selected trackers")); #endif - menu.addSeparator(); - QAction *reannounceAct = menu.addAction(IconProvider::instance()->getIcon("view-refresh"), tr("Force reannounce to all trackers")); + menu.addSeparator(); + reannounceAct = menu.addAction(IconProvider::instance()->getIcon("view-refresh"), tr("Force reannounce to all trackers")); + } QAction *act = menu.exec(QCursor::pos()); if (act == 0) return; if (act == addAct) { @@ -466,7 +478,7 @@ void TrackerList::showTrackerListMenu(QPoint) { deleteSelectedTrackers(); return; } -#if LIBTORRENT_VERSION_MAJOR >= 1 +#if LIBTORRENT_VERSION_NUM >= 10000 if (act == reannounceSelAct) { reannounceSelected(); return;