mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-11 20:52:30 +00:00
* New Tracker API.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1002 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -280,9 +280,9 @@ t_multicall(core::Download* download, const torrent::Object& rawArgs) {
|
||||
|
||||
for (torrent::Object::list_const_iterator cItr = ++args.begin(), cLast = args.end(); cItr != args.end(); cItr++) {
|
||||
const std::string& cmd = cItr->as_string();
|
||||
torrent::Tracker t = download->tracker_list()->get(itr);
|
||||
torrent::Tracker* t = download->tracker_list()->get(itr);
|
||||
|
||||
row.push_back(rpc::parse_command(rpc::make_target(&t), cmd.c_str(), cmd.c_str() + cmd.size()).first);
|
||||
row.push_back(rpc::parse_command(rpc::make_target(t), cmd.c_str(), cmd.c_str() + cmd.size()).first);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -126,9 +126,9 @@ apply_enable_trackers(int64_t arg) {
|
||||
|
||||
for (int i = 0, last = tl.size(); i < last; ++i)
|
||||
if (arg)
|
||||
tl.get(i).enable();
|
||||
tl.get(i)->enable();
|
||||
else
|
||||
tl.get(i).disable();
|
||||
tl.get(i)->disable();
|
||||
|
||||
if (arg && !rpc::call_command_value("get_use_udp_trackers"))
|
||||
(*itr)->enable_udp_trackers(false);
|
||||
@@ -149,11 +149,7 @@ xmlrpc_find_tracker(core::Download* download, uint32_t index) {
|
||||
if (index >= download->tracker_list()->size())
|
||||
return NULL;
|
||||
|
||||
// HACK ALERT!!!!
|
||||
static torrent::Tracker hack;
|
||||
hack = download->tracker_list()->get(index);
|
||||
|
||||
return &hack;
|
||||
return download->tracker_list()->get(index);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -85,10 +85,10 @@ void
|
||||
initialize_command_tracker() {
|
||||
ADD_CT_STRING_UNI("url", std::mem_fun(&torrent::Tracker::url));
|
||||
ADD_CT_VOID_UNI("group", std::mem_fun(&torrent::Tracker::group));
|
||||
ADD_CT_VOID_UNI("type", std::mem_fun(&torrent::Tracker::tracker_type));
|
||||
ADD_CT_VOID_UNI("type", std::mem_fun(&torrent::Tracker::type));
|
||||
ADD_CT_STRING_UNI("id", std::mem_fun(&torrent::Tracker::tracker_id));
|
||||
|
||||
ADD_CT_VOID("is_open", std::mem_fun(&torrent::Tracker::is_open));
|
||||
ADD_CT_VOID("is_open", std::mem_fun(&torrent::Tracker::is_busy));
|
||||
ADD_CT_BOOL("enabled", std::ptr_fun(&apply_t_set_enabled), std::mem_fun(&torrent::Tracker::is_enabled));
|
||||
|
||||
ADD_CT_VOID_UNI("normal_interval", std::mem_fun(&torrent::Tracker::normal_interval));
|
||||
|
||||
@@ -88,11 +88,11 @@ Download::enable_udp_trackers(bool state) {
|
||||
torrent::TrackerList tl = m_download.tracker_list();
|
||||
|
||||
for (int i = 0, last = tl.size(); i < last; ++i)
|
||||
if (tl.get(i).tracker_type() == torrent::Tracker::TRACKER_UDP)
|
||||
if (tl.get(i)->type() == torrent::Tracker::TRACKER_UDP)
|
||||
if (state)
|
||||
tl.get(i).enable();
|
||||
tl.get(i)->enable();
|
||||
else
|
||||
tl.get(i).disable();
|
||||
tl.get(i)->disable();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
|
||||
@@ -192,7 +192,7 @@ print_download_status(char* first, char* last, core::Download* d) {
|
||||
torrent::TrackerList* tl = d->tracker_list();
|
||||
|
||||
first = print_buffer(first, last, "Tracker[%i:%i]: Connecting to %s",
|
||||
tl->get(tl->focus()).group(), tl->focus(), tl->get(tl->focus()).url().c_str());
|
||||
tl->get(tl->focus())->group(), tl->focus(), tl->get(tl->focus())->url().c_str());
|
||||
|
||||
} else if (!d->message().empty()) {
|
||||
first = print_buffer(first, last, "%s", d->message().c_str());
|
||||
|
||||
@@ -75,34 +75,34 @@ WindowTrackerList::redraw() {
|
||||
Range range = rak::advance_bidirectional<unsigned int>(0, *m_focus, tl->size(), (m_canvas->height() + 1) / 2);
|
||||
|
||||
while (range.first != range.second) {
|
||||
torrent::Tracker tracker = tl->get(range.first);
|
||||
torrent::Tracker* tracker = tl->get(range.first);
|
||||
|
||||
// m_canvas->print(0, pos, "[%c] [S/L %5i/%5i] %s",
|
||||
// tracker.is_enabled() ? (tracker.is_open() ? '*' : ' ') : '-',
|
||||
// tracker.scrape_complete(), tracker.scrape_incomplete(),
|
||||
// tracker.url().c_str());
|
||||
// tracker->is_enabled() ? (tracker->is_open() ? '*' : ' ') : '-',
|
||||
// tracker->scrape_complete(), tracker->scrape_incomplete(),
|
||||
// tracker->url().c_str());
|
||||
|
||||
if (tracker.group() == group)
|
||||
if (tracker->group() == group)
|
||||
m_canvas->print(0, pos, "%2i:", group++);
|
||||
|
||||
m_canvas->print(4, pos++, "%s",
|
||||
tracker.url().c_str());
|
||||
tracker->url().c_str());
|
||||
|
||||
m_canvas->print(4, pos++, "Id: %s Focus: %s Enabled: %s Open: %s S/L: %u/%u",
|
||||
rak::copy_escape_html(tracker.tracker_id()).c_str(),
|
||||
rak::copy_escape_html(tracker->tracker_id()).c_str(),
|
||||
range.first == tl->focus() ? "yes" : " no",
|
||||
tracker.is_enabled() ? "yes" : " no",
|
||||
tracker.is_open() ? "yes" : " no",
|
||||
tracker.scrape_complete(),
|
||||
tracker.scrape_incomplete());
|
||||
tracker->is_enabled() ? "yes" : " no",
|
||||
tracker->is_busy() ? "yes" : " no",
|
||||
tracker->scrape_complete(),
|
||||
tracker->scrape_incomplete());
|
||||
|
||||
// m_canvas->print(4, pos++, "Id: %s Focus: %s Enabled: %s Open: %s Timer: %u/%u",
|
||||
// rak::copy_escape_html(tracker.tracker_id()).c_str(),
|
||||
// rak::copy_escape_html(tracker->tracker_id()).c_str(),
|
||||
// range.first == tl->focus() ? "yes" : " no",
|
||||
// tracker.is_enabled() ? "yes" : " no",
|
||||
// tracker.is_open() ? "yes" : " no",
|
||||
// tracker.normal_interval(),
|
||||
// tracker.min_interval());
|
||||
// tracker->is_enabled() ? "yes" : " no",
|
||||
// tracker->is_open() ? "yes" : " no",
|
||||
// tracker->normal_interval(),
|
||||
// tracker->min_interval());
|
||||
|
||||
if (range.first == *m_focus) {
|
||||
m_canvas->set_attr(0, pos - 2, m_canvas->width(), is_focused() ? A_REVERSE : A_BOLD, COLOR_PAIR(0));
|
||||
|
||||
@@ -103,12 +103,12 @@ ElementTrackerList::receive_disable() {
|
||||
if (m_window == NULL)
|
||||
throw torrent::internal_error("ui::ElementTrackerList::receive_disable(...) called on a disabled object");
|
||||
|
||||
torrent::Tracker t = m_download->download()->tracker_list().get(m_focus);
|
||||
torrent::Tracker* t = m_download->download()->tracker_list().get(m_focus);
|
||||
|
||||
if (t.is_enabled())
|
||||
t.disable();
|
||||
if (t->is_enabled())
|
||||
t->disable();
|
||||
else
|
||||
t.enable();
|
||||
t->enable();
|
||||
|
||||
m_window->mark_dirty();
|
||||
}
|
||||
@@ -150,7 +150,7 @@ ElementTrackerList::receive_cycle_group() {
|
||||
if (m_focus >= tl.size())
|
||||
throw torrent::internal_error("ui::ElementTrackerList::receive_group_cycle(...) called with an invalid focus");
|
||||
|
||||
tl.cycle_group(tl.get(m_focus).group());
|
||||
tl.cycle_group(tl.get(m_focus)->group());
|
||||
|
||||
m_window->mark_dirty();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user