From 66e61a62bc0dfab17a26dde4689992055303a64a Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Mon, 25 Jun 2007 02:20:23 +0000 Subject: [PATCH] edit trackers fixing --- src/deluge_core.cpp | 37 +++++++++---------------------------- 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/src/deluge_core.cpp b/src/deluge_core.cpp index 12b9de331..3913992bc 100644 --- a/src/deluge_core.cpp +++ b/src/deluge_core.cpp @@ -1372,34 +1372,15 @@ static PyObject *torrent_replace_trackers(PyObject *self, PyObject *args) torrent_handle& h = M_torrents->at(index).handle; - std::vector trackerlist; - - std::string line; - - int cur_tier; - - for (int i = 0; i < trackerlist.size(); i++) - { - if (trackerlist[i].url == tracker) - { - cur_tier = trackerlist[i].tier; - announce_entry a(tracker); - a.tier = 0; - trackerlist.erase(trackerlist.begin() + i); - trackerlist.insert(trackerlist.begin(), a); - break; - } - } - for (int i = 1; i < trackerlist.size(); i++) - { - if (trackerlist[i].tier < cur_tier) - trackerlist[i].tier++; - } - cur_tier = 0; - h.replace_trackers(trackerlist); - h.force_reannounce(); - - return Py_None; + std::vector trackerlist; + std::istringstream file(tracker); + std::string line; + while(std::getline(file, line)){ + trackerlist.push_back(line); + } + h.replace_trackers(trackerlist); + h.force_reannounce(); + return Py_None; } //==================== // Python Module data