From 5544f2a1380b234f19e564598025b82c0e2c9452 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sun, 22 Nov 2009 10:40:54 +0000 Subject: [PATCH] - Another compilation fix for libtorrent v0.14 --- src/qtorrenthandle.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/qtorrenthandle.cpp b/src/qtorrenthandle.cpp index 5f13eaaaa..58699ae96 100644 --- a/src/qtorrenthandle.cpp +++ b/src/qtorrenthandle.cpp @@ -560,7 +560,24 @@ void QTorrentHandle::set_peer_download_limit(asio::ip::tcp::endpoint ip, int lim void QTorrentHandle::add_tracker(announce_entry const& url) { Q_ASSERT(h.is_valid()); +#ifdef LIBTORRENT_0_15 h.add_tracker(url); +#else + std::vector trackers = h.trackers(); + bool exists = false; + std::vector::iterator it = trackers.begin(); + while(it != trackers.end()) { + if(it->url == url.url) { + exists = true; + break; + } + it++; + } + if(!exists) { + trackers.push_back(url); + h.replace_trackers(trackers); + } +#endif } void QTorrentHandle::prioritize_first_last_piece(bool b) {