diff --git a/src/command_download.cc b/src/command_download.cc index 6796b39c..dd8842cb 100644 --- a/src/command_download.cc +++ b/src/command_download.cc @@ -1,39 +1,3 @@ -// rTorrent - BitTorrent client -// Copyright (C) 2005-2011, Jari Sundell -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// In addition, as a special exception, the copyright holders give -// permission to link the code of portions of this program with the -// OpenSSL library under certain conditions as described in each -// individual source file, and distribute linked combinations -// including the two. -// -// You must obey the GNU General Public License in all respects for -// all of the code used other than OpenSSL. If you modify file(s) -// with this exception, you may extend this exception to your version -// of the file(s), but you are not obligated to do so. If you do not -// wish to do so, delete this exception statement from your version. -// If you delete this exception statement from all source files in the -// program, then also delete it here. -// -// Contact: Jari Sundell -// -// Skomakerveien 33 -// 3185 Skoppum, NORWAY - #include "config.h" #include @@ -47,9 +11,9 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -435,7 +399,7 @@ t_multicall(core::Download* download, const torrent::Object::list_type& args) { for (torrent::Object::list_const_iterator cItr = ++args.begin(); cItr != args.end(); cItr++) { const std::string& cmd = cItr->as_string(); - torrent::Tracker* t = download->tracker_list()->at(itr); + auto t = download->tracker_list()->at(itr); row.push_back(rpc::parse_command(rpc::make_target(t), cmd.c_str(), cmd.c_str() + cmd.size()).first); } diff --git a/src/command_helpers.h b/src/command_helpers.h index 447fc883..11a9bc9f 100644 --- a/src/command_helpers.h +++ b/src/command_helpers.h @@ -1,39 +1,3 @@ -// rTorrent - BitTorrent client -// Copyright (C) 2005-2011, Jari Sundell -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// In addition, as a special exception, the copyright holders give -// permission to link the code of portions of this program with the -// OpenSSL library under certain conditions as described in each -// individual source file, and distribute linked combinations -// including the two. -// -// You must obey the GNU General Public License in all respects for -// all of the code used other than OpenSSL. If you modify file(s) -// with this exception, you may extend this exception to your version -// of the file(s), but you are not obligated to do so. If you do not -// wish to do so, delete this exception statement from your version. -// If you delete this exception statement from all source files in the -// program, then also delete it here. -// -// Contact: Jari Sundell -// -// Skomakerveien 33 -// 3185 Skoppum, NORWAY - #ifndef RTORRENT_UTILS_COMMAND_HELPERS_H #define RTORRENT_UTILS_COMMAND_HELPERS_H @@ -92,9 +56,9 @@ void initialize_commands(); #define CMD2_PEER_V(key, slot) CMD2_A_FUNCTION(key, command_base_call, object_convert_void(slot), "i:", "") #define CMD2_PEER_VALUE_V(key, slot) CMD2_A_FUNCTION(key, command_base_call_value, object_convert_void(slot), "i:i", "") -#define CMD2_TRACKER(key, slot) CMD2_A_FUNCTION(key, command_base_call, slot, "i:", "") -#define CMD2_TRACKER_V(key, slot) CMD2_A_FUNCTION(key, command_base_call, object_convert_void(slot), "i:", "") -#define CMD2_TRACKER_VALUE_V(key, slot) CMD2_A_FUNCTION(key, command_base_call_value, object_convert_void(slot), "i:i", "") +#define CMD2_TRACKER(key, slot) CMD2_A_FUNCTION(key, command_base_call, slot, "i:", "") +#define CMD2_TRACKER_V(key, slot) CMD2_A_FUNCTION(key, command_base_call, object_convert_void(slot), "i:", "") +#define CMD2_TRACKER_VALUE_V(key, slot) CMD2_A_FUNCTION(key, command_base_call_value, object_convert_void(slot), "i:i", "") #define CMD2_VAR_BOOL(key, value) \ control->object_storage()->insert_c_str(key, int64_t(value), rpc::object_storage::flag_bool_type); \ diff --git a/src/command_network.cc b/src/command_network.cc index e9c9f0a1..f3c9cd33 100644 --- a/src/command_network.cc +++ b/src/command_network.cc @@ -1,39 +1,3 @@ -// rTorrent - BitTorrent client -// Copyright (C) 2005-2011, Jari Sundell -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// In addition, as a special exception, the copyright holders give -// permission to link the code of portions of this program with the -// OpenSSL library under certain conditions as described in each -// individual source file, and distribute linked combinations -// including the two. -// -// You must obey the GNU General Public License in all respects for -// all of the code used other than OpenSSL. If you modify file(s) -// with this exception, you may extend this exception to your version -// of the file(s), but you are not obligated to do so. If you do not -// wish to do so, delete this exception statement from your version. -// If you delete this exception statement from all source files in the -// program, then also delete it here. -// -// Contact: Jari Sundell -// -// Skomakerveien 33 -// 3185 Skoppum, NORWAY - #include "config.h" #include @@ -42,8 +6,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -103,7 +67,7 @@ rpc_find_file(core::Download* download, uint32_t index) { } // Ergh... time to update the Tracker API to allow proper ptrs. -torrent::Tracker* +torrent::tracker::Tracker* rpc_find_tracker(core::Download* download, uint32_t index) { if (index >= download->tracker_list()->size()) return NULL; diff --git a/src/command_tracker.cc b/src/command_tracker.cc index d592b579..f19aea78 100644 --- a/src/command_tracker.cc +++ b/src/command_tracker.cc @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include "core/download.h" @@ -16,7 +16,7 @@ #include "core/dht_manager.h" void -tracker_set_enabled(torrent::Tracker* tracker, bool state) { +tracker_set_enabled(torrent::tracker::Tracker* tracker, bool state) { if (state) tracker->enable(); else @@ -63,7 +63,7 @@ apply_dht_add_node(const std::string& arg) { torrent::Object apply_enable_trackers(int64_t arg) { for (core::Manager::DListItr itr = control->core()->download_list()->begin(), last = control->core()->download_list()->end(); itr != last; ++itr) { - std::for_each((*itr)->tracker_list()->begin(), (*itr)->tracker_list()->end(), std::mem_fn(arg ? &torrent::Tracker::enable : &torrent::Tracker::disable)); + std::for_each((*itr)->tracker_list()->begin(), (*itr)->tracker_list()->end(), std::mem_fn(arg ? &torrent::tracker::Tracker::enable : &torrent::tracker::Tracker::disable)); if (arg && !rpc::call_command_value("trackers.use_udp")) (*itr)->enable_udp_trackers(false); @@ -74,50 +74,50 @@ apply_enable_trackers(int64_t arg) { void initialize_command_tracker() { - CMD2_TRACKER ("t.is_busy", std::bind(&torrent::Tracker::is_busy, std::placeholders::_1)); - CMD2_TRACKER ("t.is_enabled", std::bind(&torrent::Tracker::is_enabled, std::placeholders::_1)); - CMD2_TRACKER ("t.is_extra_tracker", std::bind(&torrent::Tracker::is_extra_tracker, std::placeholders::_1)); - CMD2_TRACKER ("t.is_open", std::bind(&torrent::Tracker::is_busy, std::placeholders::_1)); - CMD2_TRACKER ("t.is_scrapable", std::bind(&torrent::Tracker::is_scrapable, std::placeholders::_1)); - CMD2_TRACKER ("t.is_usable", std::bind(&torrent::Tracker::is_usable, std::placeholders::_1)); + CMD2_TRACKER ("t.is_busy", std::bind(&torrent::tracker::Tracker::is_busy, std::placeholders::_1)); + CMD2_TRACKER ("t.is_enabled", std::bind(&torrent::tracker::Tracker::is_enabled, std::placeholders::_1)); + CMD2_TRACKER ("t.is_extra_tracker", std::bind(&torrent::tracker::Tracker::is_extra_tracker, std::placeholders::_1)); + CMD2_TRACKER ("t.is_open", std::bind(&torrent::tracker::Tracker::is_busy, std::placeholders::_1)); + CMD2_TRACKER ("t.is_scrapable", std::bind(&torrent::tracker::Tracker::is_scrapable, std::placeholders::_1)); + CMD2_TRACKER ("t.is_usable", std::bind(&torrent::tracker::Tracker::is_usable, std::placeholders::_1)); // TODO: Deprecate. - CMD2_TRACKER ("t.can_scrape", std::bind(&torrent::Tracker::is_scrapable, std::placeholders::_1)); + CMD2_TRACKER ("t.can_scrape", std::bind(&torrent::tracker::Tracker::is_scrapable, std::placeholders::_1)); - CMD2_TRACKER_V ("t.enable", std::bind(&torrent::Tracker::enable, std::placeholders::_1)); - CMD2_TRACKER_V ("t.disable", std::bind(&torrent::Tracker::disable, std::placeholders::_1)); + CMD2_TRACKER_V ("t.enable", std::bind(&torrent::tracker::Tracker::enable, std::placeholders::_1)); + CMD2_TRACKER_V ("t.disable", std::bind(&torrent::tracker::Tracker::disable, std::placeholders::_1)); CMD2_TRACKER_VALUE_V("t.is_enabled.set", std::bind(&tracker_set_enabled, std::placeholders::_1, std::placeholders::_2)); - CMD2_TRACKER ("t.url", std::bind(&torrent::Tracker::url, std::placeholders::_1)); - CMD2_TRACKER ("t.group", std::bind(&torrent::Tracker::group, std::placeholders::_1)); - CMD2_TRACKER ("t.type", std::bind(&torrent::Tracker::type, std::placeholders::_1)); - CMD2_TRACKER ("t.id", std::bind(&torrent::Tracker::tracker_id, std::placeholders::_1)); + CMD2_TRACKER ("t.url", std::bind(&torrent::tracker::Tracker::url, std::placeholders::_1)); + CMD2_TRACKER ("t.group", std::bind(&torrent::tracker::Tracker::group, std::placeholders::_1)); + CMD2_TRACKER ("t.type", std::bind(&torrent::tracker::Tracker::type, std::placeholders::_1)); + CMD2_TRACKER ("t.id", std::bind(&torrent::tracker::Tracker::tracker_id, std::placeholders::_1)); - CMD2_TRACKER ("t.latest_event", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().latest_event(); }); - CMD2_TRACKER ("t.latest_new_peers", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().latest_new_peers(); }); - CMD2_TRACKER ("t.latest_sum_peers", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().latest_sum_peers(); }); + CMD2_TRACKER ("t.latest_event", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().latest_event(); }); + CMD2_TRACKER ("t.latest_new_peers", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().latest_new_peers(); }); + CMD2_TRACKER ("t.latest_sum_peers", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().latest_sum_peers(); }); - CMD2_TRACKER ("t.normal_interval", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().normal_interval(); }); - CMD2_TRACKER ("t.min_interval", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().min_interval(); }); + CMD2_TRACKER ("t.normal_interval", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().normal_interval(); }); + CMD2_TRACKER ("t.min_interval", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().min_interval(); }); - CMD2_TRACKER ("t.activity_time_next", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().activity_time_next(); }); - CMD2_TRACKER ("t.activity_time_last", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().activity_time_last(); }); + CMD2_TRACKER ("t.activity_time_next", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().activity_time_next(); }); + CMD2_TRACKER ("t.activity_time_last", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().activity_time_last(); }); - CMD2_TRACKER ("t.success_time_next", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().success_time_next(); }); - CMD2_TRACKER ("t.success_time_last", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().success_time_last(); }); - CMD2_TRACKER ("t.success_counter", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().success_counter(); }); + CMD2_TRACKER ("t.success_time_next", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().success_time_next(); }); + CMD2_TRACKER ("t.success_time_last", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().success_time_last(); }); + CMD2_TRACKER ("t.success_counter", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().success_counter(); }); - CMD2_TRACKER ("t.failed_time_next", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().failed_time_next(); }); - CMD2_TRACKER ("t.failed_time_last", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().failed_time_last(); }); - CMD2_TRACKER ("t.failed_counter", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().failed_counter(); }); + CMD2_TRACKER ("t.failed_time_next", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().failed_time_next(); }); + CMD2_TRACKER ("t.failed_time_last", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().failed_time_last(); }); + CMD2_TRACKER ("t.failed_counter", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().failed_counter(); }); - CMD2_TRACKER ("t.scrape_time_last", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().scrape_time_last(); }); - CMD2_TRACKER ("t.scrape_counter", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().scrape_counter(); }); + CMD2_TRACKER ("t.scrape_time_last", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().scrape_time_last(); }); + CMD2_TRACKER ("t.scrape_counter", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().scrape_counter(); }); - CMD2_TRACKER ("t.scrape_complete", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().scrape_complete(); }); - CMD2_TRACKER ("t.scrape_incomplete", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().scrape_incomplete(); }); - CMD2_TRACKER ("t.scrape_downloaded", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().scrape_downloaded(); }); + CMD2_TRACKER ("t.scrape_complete", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().scrape_complete(); }); + CMD2_TRACKER ("t.scrape_incomplete", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().scrape_incomplete(); }); + CMD2_TRACKER ("t.scrape_downloaded", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().scrape_downloaded(); }); CMD2_ANY_VALUE ("trackers.enable", std::bind(&apply_enable_trackers, int64_t(1))); CMD2_ANY_VALUE ("trackers.disable", std::bind(&apply_enable_trackers, int64_t(0))); diff --git a/src/core/download.cc b/src/core/download.cc index 08227562..8ace1c9c 100644 --- a/src/core/download.cc +++ b/src/core/download.cc @@ -6,8 +6,8 @@ #include #include #include -#include #include +#include #include #include "rpc/parse_commands.h" diff --git a/src/core/download.h b/src/core/download.h index 5de5d693..b8494a08 100644 --- a/src/core/download.h +++ b/src/core/download.h @@ -1,6 +1,7 @@ #ifndef RTORRENT_CORE_DOWNLOAD_H #define RTORRENT_CORE_DOWNLOAD_H +#include #include #include #include @@ -10,11 +11,6 @@ #include "globals.h" -namespace torrent { - class PeerList; - class TrackerList; -} - namespace core { class Download { diff --git a/src/display/utils.cc b/src/display/utils.cc index 70de5fb3..144db8f9 100644 --- a/src/display/utils.cc +++ b/src/display/utils.cc @@ -1,39 +1,3 @@ -// rTorrent - BitTorrent client -// Copyright (C) 2005-2011, Jari Sundell -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// In addition, as a special exception, the copyright holders give -// permission to link the code of portions of this program with the -// OpenSSL library under certain conditions as described in each -// individual source file, and distribute linked combinations -// including the two. -// -// You must obey the GNU General Public License in all respects for -// all of the code used other than OpenSSL. If you modify file(s) -// with this exception, you may extend this exception to your version -// of the file(s), but you are not obligated to do so. If you do not -// wish to do so, delete this exception statement from your version. -// If you delete this exception statement from all source files in the -// program, then also delete it here. -// -// Contact: Jari Sundell -// -// Skomakerveien 33 -// 3185 Skoppum, NORWAY - #include "config.h" #include @@ -47,8 +11,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -88,7 +52,7 @@ print_hhmmss(char* first, char* last, time_t t) { char* print_hhmmss_local(char* first, char* last, time_t t) { std::tm *u = std::localtime(&t); - + if (u == NULL) //return "inv_time"; throw torrent::internal_error("print_hhmmss_local(...) failed."); @@ -107,7 +71,7 @@ print_ddhhmm(char* first, char* last, time_t t) { char* print_ddmmyyyy(char* first, char* last, time_t t) { std::tm *u = std::gmtime(&t); - + if (u == NULL) //return "inv_time"; throw torrent::internal_error("print_ddmmyyyy(...) failed."); @@ -199,12 +163,11 @@ print_download_status(char* first, char* last, core::Download* d) { } else if (d->tracker_list()->has_active_not_scrape()) { torrent::TrackerList::iterator itr = std::find_if(d->tracker_list()->begin(), d->tracker_list()->end(), - std::mem_fn(&torrent::Tracker::is_busy_not_scrape)); - char status[128]; + std::mem_fn(&torrent::tracker::Tracker::is_busy_not_scrape)); + auto status = (*itr)->status(); - (*itr)->get_status(status, sizeof(status)); first = print_buffer(first, last, "Tracker[%i:%i]: Connecting to %s %s", - (*itr)->group(), std::distance(d->tracker_list()->begin(), itr), (*itr)->url().c_str(), status); + (*itr)->group(), std::distance(d->tracker_list()->begin(), itr), (*itr)->url().c_str(), status.c_str()); } else if (!d->message().empty()) { first = print_buffer(first, last, "%s", d->message().c_str()); diff --git a/src/display/window_tracker_list.cc b/src/display/window_tracker_list.cc index 989f31df..40551c92 100644 --- a/src/display/window_tracker_list.cc +++ b/src/display/window_tracker_list.cc @@ -3,9 +3,9 @@ #include #include #include -#include #include #include +#include #include "core/download.h" @@ -45,7 +45,7 @@ WindowTrackerList::redraw() { unsigned int group = tl->at(range.first)->group(); while (range.first != range.second) { - torrent::Tracker* tracker = tl->at(range.first); + auto tracker = tl->at(range.first); if (tracker->group() == group) m_canvas->print(0, pos, "%2i:", group++); diff --git a/src/rpc/command.cc b/src/rpc/command.cc index 6d6233c8..b7ad8eb0 100644 --- a/src/rpc/command.cc +++ b/src/rpc/command.cc @@ -1,39 +1,3 @@ -// rTorrent - BitTorrent client -// Copyright (C) 2005-2011, Jari Sundell -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// In addition, as a special exception, the copyright holders give -// permission to link the code of portions of this program with the -// OpenSSL library under certain conditions as described in each -// individual source file, and distribute linked combinations -// including the two. -// -// You must obey the GNU General Public License in all respects for -// all of the code used other than OpenSSL. If you modify file(s) -// with this exception, you may extend this exception to your version -// of the file(s), but you are not obligated to do so. If you do not -// wish to do so, delete this exception statement from your version. -// If you delete this exception statement from all source files in the -// program, then also delete it here. -// -// Contact: Jari Sundell -// -// Skomakerveien 33 -// 3185 Skoppum, NORWAY - #include "config.h" #include "core/download.h" @@ -45,7 +9,7 @@ template const torrent::Object func_name(command_base* rawCommand, target_type target, const torrent::Object& args); \ template const torrent::Object func_name(command_base* rawCommand, target_type target, const torrent::Object& args); \ template const torrent::Object func_name(command_base* rawCommand, target_type target, const torrent::Object& args); \ -template const torrent::Object func_name(command_base* rawCommand, target_type target, const torrent::Object& args); \ +template const torrent::Object func_name(command_base* rawCommand, target_type target, const torrent::Object& args); \ template const torrent::Object func_name(command_base* rawCommand, target_type target, const torrent::Object& args); \ template const torrent::Object func_name(command_base* rawCommand, target_type target, const torrent::Object& args); diff --git a/src/rpc/command.h b/src/rpc/command.h index de6e2256..ba90bcea 100644 --- a/src/rpc/command.h +++ b/src/rpc/command.h @@ -3,6 +3,7 @@ #include #include +#include #include #include @@ -11,13 +12,6 @@ namespace core { class Download; } -namespace torrent { - class File; - class FileListIterator; - class Peer; - class Tracker; -} - namespace rpc { template @@ -89,7 +83,7 @@ public: typedef const torrent::Object (*file_slot) (command_base*, torrent::File*, const torrent::Object&); typedef const torrent::Object (*file_itr_slot) (command_base*, torrent::FileListIterator*, const torrent::Object&); typedef const torrent::Object (*peer_slot) (command_base*, torrent::Peer*, const torrent::Object&); - typedef const torrent::Object (*tracker_slot) (command_base*, torrent::Tracker*, const torrent::Object&); + typedef const torrent::Object (*tracker_slot) (command_base*, torrent::tracker::Tracker*, const torrent::Object&); typedef const torrent::Object (*download_pair_slot) (command_base*, core::Download*, core::Download*, const torrent::Object&); @@ -138,10 +132,10 @@ public: static void pop_stack(stack_type* stack, torrent::Object* last_stack); template - void set_function(T s, int value = command_base_is_valid::value) { _pod() = s; } + void set_function(T s, [[maybe_unused]] int value = command_base_is_valid::value) { _pod() = s; } template - void set_function_2(typename command_base_is_type::type s, int value = command_base_is_valid::type>::value) { + void set_function_2(typename command_base_is_type::type s, [[maybe_unused]] int value = command_base_is_valid::type>::value) { _pod::type>() = s; } @@ -190,7 +184,7 @@ is_target_compatible(const target_type& target) { return target.first == target_ inline bool is_target_pair(const target_type& target) { return target.first >= command_base::target_download_pair; } template inline T -get_target_cast(target_type target, int type = target_type_id::value) { return (T)target.second; } +get_target_cast(target_type target, [[maybe_unused]] int type = target_type_id::value) { return (T)target.second; } inline target_type get_target_left(const target_type& target) { return target_type(target.first - 5, target.second); } inline target_type get_target_right(const target_type& target) { return target_type(target.first - 5, target.third); } @@ -213,7 +207,7 @@ command_base::_call(command_base* cmd, target_type target, Args args) { template <> struct command_base_is_valid::type> { static const int value = 1; }; \ template <> struct command_base_is_valid::type> { static const int value = 1; }; \ template <> struct command_base_is_valid::type> { static const int value = 1; }; \ - template <> struct command_base_is_valid::type> { static const int value = 1; }; \ + template <> struct command_base_is_valid::type> { static const int value = 1; }; \ template <> struct command_base_is_valid::type> { static const int value = 1; }; \ template <> struct command_base_is_valid::type> { static const int value = 1; }; @@ -230,8 +224,8 @@ COMMAND_BASE_TEMPLATE_TYPE(command_list_function, torrent::Object (T, const to template <> struct command_base_is_type > { static const int value = 1; typedef func_type::type type; }; \ template <> struct command_base_is_type > { static const int value = 1; typedef func_type::type type; }; \ template <> struct command_base_is_type > { static const int value = 1; typedef func_type::type type; }; \ - template <> struct command_base_is_type > { static const int value = 1; typedef func_type::type type; }; \ - template <> struct command_base_is_type > { static const int value = 1; typedef func_type::type type; }; \ + template <> struct command_base_is_type > { static const int value = 1; typedef func_type::type type; }; \ + template <> struct command_base_is_type > { static const int value = 1; typedef func_type::type type; }; \ template <> struct command_base_is_type > { static const int value = 1; typedef func_type::type type; }; COMMAND_BASE_TEMPLATE_CALL(command_base_call, command_function); diff --git a/src/rpc/command_impl.h b/src/rpc/command_impl.h index 38083f78..91bb9508 100644 --- a/src/rpc/command_impl.h +++ b/src/rpc/command_impl.h @@ -20,7 +20,7 @@ template <> struct target_type_id<> { static const in template <> struct target_type_id { static const int value = command_base::target_any; static const int proper_type = 1; }; template <> struct target_type_id { static const int value = command_base::target_download; static const int proper_type = 1; }; template <> struct target_type_id { static const int value = command_base::target_peer; static const int proper_type = 1; }; -template <> struct target_type_id { static const int value = command_base::target_tracker; static const int proper_type = 1; }; +template <> struct target_type_id { static const int value = command_base::target_tracker; static const int proper_type = 1; }; template <> struct target_type_id { static const int value = command_base::target_file; static const int proper_type = 1; }; template <> struct target_type_id { static const int value = command_base::target_file_itr; static const int proper_type = 1; }; diff --git a/src/rpc/command_map.h b/src/rpc/command_map.h index 123a0e91..7c342193 100644 --- a/src/rpc/command_map.h +++ b/src/rpc/command_map.h @@ -1,39 +1,3 @@ -// rTorrent - BitTorrent client -// Copyright (C) 2005-2011, Jari Sundell -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// In addition, as a special exception, the copyright holders give -// permission to link the code of portions of this program with the -// OpenSSL library under certain conditions as described in each -// individual source file, and distribute linked combinations -// including the two. -// -// You must obey the GNU General Public License in all respects for -// all of the code used other than OpenSSL. If you modify file(s) -// with this exception, you may extend this exception to your version -// of the file(s), but you are not obligated to do so. If you do not -// wish to do so, delete this exception statement from your version. -// If you delete this exception statement from all source files in the -// program, then also delete it here. -// -// Contact: Jari Sundell -// -// Skomakerveien 33 -// 3185 Skoppum, NORWAY - #ifndef RTORRENT_RPC_COMMAND_MAP_H #define RTORRENT_RPC_COMMAND_MAP_H @@ -59,7 +23,7 @@ struct command_map_data_type { command_map_data_type(const command_map_data_type& src) : m_variable(src.m_variable), m_anySlot(src.m_anySlot), m_flags(src.m_flags), m_parm(src.m_parm), m_doc(src.m_doc) {} - + command_base m_variable; command_base::any_slot m_anySlot; @@ -124,7 +88,7 @@ public: const mapped_type call_command_d(const key_type& key, core::Download* download, const mapped_type& arg) { return call_command(key, arg, target_type((int)command_base::target_download, download)); } const mapped_type call_command_p(const key_type& key, torrent::Peer* peer, const mapped_type& arg) { return call_command(key, arg, target_type((int)command_base::target_peer, peer)); } - const mapped_type call_command_t(const key_type& key, torrent::Tracker* tracker, const mapped_type& arg) { return call_command(key, arg, target_type((int)command_base::target_tracker, tracker)); } + const mapped_type call_command_t(const key_type& key, torrent::tracker::Tracker* tracker, const mapped_type& arg) { return call_command(key, arg, target_type((int)command_base::target_tracker, tracker)); } const mapped_type call_command_f(const key_type& key, torrent::File* file, const mapped_type& arg) { return call_command(key, arg, target_type((int)command_base::target_file, file)); } private: diff --git a/src/rpc/rpc_manager.h b/src/rpc/rpc_manager.h index c306cd05..4839ace0 100644 --- a/src/rpc/rpc_manager.h +++ b/src/rpc/rpc_manager.h @@ -3,6 +3,7 @@ #include #include +#include #include "rpc/command.h" #include "rpc/jsonrpc.h" @@ -12,12 +13,6 @@ namespace core { class Download; } -namespace torrent { -class File; -class Object; -class Tracker; -} // namespace torrent - namespace rpc { class rpc_error : public torrent::base_error { @@ -38,7 +33,7 @@ class RpcManager { public: using slot_download = std::function; using slot_file = std::function; - using slot_tracker = std::function; + using slot_tracker = std::function; using slot_peer = std::function; using slot_response_callback = std::function; diff --git a/src/rpc/xmlrpc.h b/src/rpc/xmlrpc.h index 5c4e70d9..07028d0b 100644 --- a/src/rpc/xmlrpc.h +++ b/src/rpc/xmlrpc.h @@ -1,68 +1,26 @@ -// rTorrent - BitTorrent client -// Copyright (C) 2005-2011, Jari Sundell -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// In addition, as a special exception, the copyright holders give -// permission to link the code of portions of this program with the -// OpenSSL library under certain conditions as described in each -// individual source file, and distribute linked combinations -// including the two. -// -// You must obey the GNU General Public License in all respects for -// all of the code used other than OpenSSL. If you modify file(s) -// with this exception, you may extend this exception to your version -// of the file(s), but you are not obligated to do so. If you do not -// wish to do so, delete this exception statement from your version. -// If you delete this exception statement from all source files in the -// program, then also delete it here. -// -// Contact: Jari Sundell -// -// Skomakerveien 33 -// 3185 Skoppum, NORWAY - #ifndef RTORRENT_RPC_XMLRPC_H #define RTORRENT_RPC_XMLRPC_H #include +#include +#include #include "command.h" #include "scgi_task.h" -#include - namespace core { class Download; } -namespace torrent { - class File; - class Object; - class Tracker; -} - namespace rpc { class XmlRpc { public: - typedef std::function slot_download; - typedef std::function slot_file; - typedef std::function slot_tracker; + typedef std::function slot_download; + typedef std::function slot_file; + typedef std::function slot_tracker; typedef std::function slot_peer; - typedef std::function slot_write; + typedef std::function slot_write; static const int dialect_generic = 0; static const int dialect_i8 = 1; diff --git a/src/ui/element_tracker_list.cc b/src/ui/element_tracker_list.cc index c048165a..e3e02719 100644 --- a/src/ui/element_tracker_list.cc +++ b/src/ui/element_tracker_list.cc @@ -1,44 +1,8 @@ -// rTorrent - BitTorrent client -// Copyright (C) 2005-2011, Jari Sundell -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// In addition, as a special exception, the copyright holders give -// permission to link the code of portions of this program with the -// OpenSSL library under certain conditions as described in each -// individual source file, and distribute linked combinations -// including the two. -// -// You must obey the GNU General Public License in all respects for -// all of the code used other than OpenSSL. If you modify file(s) -// with this exception, you may extend this exception to your version -// of the file(s), but you are not obligated to do so. If you do not -// wish to do so, delete this exception statement from your version. -// If you delete this exception statement from all source files in the -// program, then also delete it here. -// -// Contact: Jari Sundell -// -// Skomakerveien 33 -// 3185 Skoppum, NORWAY - #include "config.h" #include -#include #include +#include #include "display/frame.h" #include "display/window_tracker_list.h" @@ -103,7 +67,7 @@ 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()->at(m_focus); + auto t = m_download->download()->tracker_list()->at(m_focus); if (t->is_enabled()) t->disable(); @@ -134,7 +98,7 @@ ElementTrackerList::receive_prev() { if (m_focus != 0) --m_focus; - else + else m_focus = m_download->download()->tracker_list()->size() - 1; m_window->mark_dirty();