Browse Source

FEATURE: If 2 torrents have the same hash, add new trackers to the existin

g torrent
adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
1065f5fb86
  1. 1
      Changelog
  2. 26
      src/bittorrent.cpp

1
Changelog

@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
- FEATURE: User can choose to apply transfer limits on LAN too
- FEATURE: User can choose to include the protocol overhead in transfer limits
- FEATURE: Torrents can be automatically rechecked on completion
- FEATURE: If 2 torrents have the same hash, add new trackers to the existing torrent
- COSMETIC: Improved style management
* Mon Jan 18 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.1.0

26
src/bittorrent.cpp

@ -978,6 +978,32 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr @@ -978,6 +978,32 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
addConsoleMessage(tr("'%1' is already in download list.", "e.g: 'xxx.avi' is already in download list.").arg(file));
//emit duplicateTorrent(file);
}
// Check if the torrent contains trackers we don't know about
// and add them
QTorrentHandle h_ex = getTorrentHandle(hash);
if(h_ex.is_valid()) {
std::vector<announce_entry> old_trackers = h.trackers();
std::vector<announce_entry> new_trackers = t->trackers();
bool trackers_added = false;
for(std::vector<announce_entry>::iterator it=new_trackers.begin();it!=new_trackers.end();it++) {
std::string tracker_url = it->url;
bool found = false;
for(std::vector<announce_entry>::iterator itold=old_trackers.begin();itold!=old_trackers.end();itold++) {
if(tracker_url == itold->url) {
found = true;
break;
}
}
if(!found) {
trackers_added = true;
announce_entry entry(tracker_url);
h.add_tracker(entry);
}
}
if(trackers_added) {
addConsoleMessage(tr("However, new trackers were added to the existing torrent."));
}
}
}else{
// Delete torrent from scan dir
QFile::remove(file);

Loading…
Cancel
Save