diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index 86052f3a7..4c7d61427 100644 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -732,9 +732,11 @@ namespace libtorrent void dht_announce(); #endif +#ifndef TORRENT_NO_DEPRECATE // sets the username and password that will be sent to // the tracker void set_tracker_login(std::string const& name, std::string const& pw); +#endif announce_entry* find_tracker(tracker_request const& r); @@ -1252,8 +1254,11 @@ namespace libtorrent std::vector m_time_critical_pieces; std::string m_trackerid; +#ifndef TORRENT_NO_DEPRECATE + // deprecated in 1.1 std::string m_username; std::string m_password; +#endif std::string m_save_path; diff --git a/include/libtorrent/torrent_handle.hpp b/include/libtorrent/torrent_handle.hpp index 291cc33f5..226f5ff5c 100644 --- a/include/libtorrent/torrent_handle.hpp +++ b/include/libtorrent/torrent_handle.hpp @@ -1154,10 +1154,13 @@ namespace libtorrent void set_max_connections(int max_connections) const; int max_connections() const; +#ifndef TORRENT_NO_DEPRECATE // sets a username and password that will be sent along in the HTTP-request // of the tracker announce. Set this if the tracker requires authorization. + TORRENT_DEPRECATED void set_tracker_login(std::string const& name , std::string const& password) const; +#endif // Moves the file(s) that this torrent are currently seeding from or // downloading to. If the given ``save_path`` is not located on the same diff --git a/include/libtorrent/tracker_manager.hpp b/include/libtorrent/tracker_manager.hpp index d3aaaf9f5..3928335bc 100644 --- a/include/libtorrent/tracker_manager.hpp +++ b/include/libtorrent/tracker_manager.hpp @@ -128,7 +128,9 @@ namespace libtorrent std::string url; std::string trackerid; +#ifndef TORRENT_NO_DEPRECATE std::string auth; +#endif boost::shared_ptr filter; diff --git a/src/http_tracker_connection.cpp b/src/http_tracker_connection.cpp index b7f80783f..1d8486a5c 100644 --- a/src/http_tracker_connection.cpp +++ b/src/http_tracker_connection.cpp @@ -225,7 +225,11 @@ namespace libtorrent , tracker_req().event == tracker_request::stopped ? resolver_interface::prefer_cache : resolver_interface::abort_on_shutdown +#ifndef TORRENT_NO_DEPRECATE , tracker_req().auth +#else + , "" +#endif #if TORRENT_USE_I2P , tracker_req().i2pconn #endif diff --git a/src/torrent.cpp b/src/torrent.cpp index 6401f6b0a..9d5ec0a39 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -3215,7 +3215,9 @@ namespace libtorrent } } +#ifndef TORRENT_NO_DEPRECATE req.auth = tracker_login(); +#endif req.key = tracker_key(); #ifdef TORRENT_USE_OPENSSL @@ -3282,7 +3284,9 @@ namespace libtorrent req.info_hash = m_torrent_file->info_hash(); req.kind |= tracker_request::scrape_request; req.url = m_trackers[i].url; +#ifndef TORRENT_NO_DEPRECATE req.auth = tracker_login(); +#endif req.key = tracker_key(); m_ses.queue_tracker_request(req, shared_from_this()); } @@ -3695,6 +3699,7 @@ namespace libtorrent update_tracker_timer(clock_type::now()); } +#ifndef TORRENT_NO_DEPRECATE void torrent::set_tracker_login( std::string const& name , std::string const& pw) @@ -3702,6 +3707,7 @@ namespace libtorrent m_username = name; m_password = pw; } +#endif #if TORRENT_USE_I2P void torrent::on_i2p_resolve(error_code const& ec, char const* dest) @@ -5060,12 +5066,13 @@ namespace libtorrent alerts().emplace_alert(get_handle()); } - // TODO: 2 the tracker login feature should probably be deprecated +#ifndef TORRENT_NO_DEPRECATE std::string torrent::tracker_login() const { if (m_username.empty() && m_password.empty()) return ""; return m_username + ":" + m_password; } +#endif boost::uint32_t torrent::tracker_key() const { diff --git a/src/torrent_handle.cpp b/src/torrent_handle.cpp index fa4d310b0..cbea1c798 100644 --- a/src/torrent_handle.cpp +++ b/src/torrent_handle.cpp @@ -447,11 +447,13 @@ namespace libtorrent TORRENT_ASYNC_CALL(clear_error); } +#ifndef TORRENT_NO_DEPRECATE void torrent_handle::set_tracker_login(std::string const& name , std::string const& password) const { TORRENT_ASYNC_CALL2(set_tracker_login, name, password); } +#endif void torrent_handle::file_progress(std::vector& progress, int flags) const {