mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-14 14:12:31 +00:00
* Minor BSD portability fixes.
* Added torrent::TrackerList::{set_,}key() and made rtorrent save the
key between sessions.
* Added import option to the man page.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@665 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
@@ -183,6 +184,14 @@ DownloadFactory::receive_success() {
|
||||
(*itr)->variable()->set("max_peers", control->variable()->get("max_peers"));
|
||||
(*itr)->variable()->set("max_uploads", control->variable()->get("max_uploads"));
|
||||
|
||||
if (rtorrent->has_key_value("key")) {
|
||||
(*itr)->tracker_list()->set_key(rtorrent->get_key("key").as_value());
|
||||
|
||||
} else {
|
||||
(*itr)->tracker_list()->set_key(rand() % (std::numeric_limits<uint32_t>::max() - 1) + 1);
|
||||
rtorrent->insert_key("key", (*itr)->tracker_list()->key());
|
||||
}
|
||||
|
||||
if (control->variable()->get_string("use_udp_trackers") == "no")
|
||||
(*itr)->enable_udp_trackers(false);
|
||||
|
||||
|
||||
@@ -61,25 +61,23 @@ WindowTrackerList::redraw() {
|
||||
m_canvas->erase();
|
||||
|
||||
int pos = 0;
|
||||
torrent::TrackerList* tl = m_download->tracker_list();
|
||||
|
||||
m_canvas->print( 2, pos, "Trackers:");
|
||||
|
||||
m_canvas->print(2, pos, "Trackers: [Key: %08x]", tl->key());
|
||||
++pos;
|
||||
|
||||
torrent::TrackerList tl = m_download->download()->tracker_list();
|
||||
|
||||
if (tl.size() == 0)
|
||||
if (tl->size() == 0)
|
||||
return;
|
||||
|
||||
if (*m_focus >= tl.size())
|
||||
if (*m_focus >= tl->size())
|
||||
throw std::logic_error("WindowTrackerList::redraw() called on an object with a bad focus value.");
|
||||
|
||||
typedef std::pair<unsigned int, unsigned int> Range;
|
||||
|
||||
Range range = rak::advance_bidirectional<unsigned int>(0, *m_focus, tl.size(), (m_canvas->get_height() + 1) / 2);
|
||||
Range range = rak::advance_bidirectional<unsigned int>(0, *m_focus, tl->size(), (m_canvas->get_height() + 1) / 2);
|
||||
|
||||
while (range.first != range.second) {
|
||||
torrent::Tracker t = tl.get(range.first);
|
||||
torrent::Tracker t = tl->get(range.first);
|
||||
|
||||
m_canvas->print(0, pos++, "%c %s",
|
||||
range.first == *m_focus ? '*' : ' ',
|
||||
@@ -89,7 +87,7 @@ WindowTrackerList::redraw() {
|
||||
range.first == *m_focus ? '*' : ' ',
|
||||
t.group(),
|
||||
rak::copy_escape_html(t.tracker_id()).c_str(),
|
||||
range.first == tl.focus() ? "yes" : " no",
|
||||
range.first == tl->focus() ? "yes" : " no",
|
||||
t.is_enabled() ? "yes" : " no",
|
||||
t.is_open() ? "yes" : " no",
|
||||
t.scrape_complete(),
|
||||
|
||||
Reference in New Issue
Block a user