deprecate set_tracker_login

This commit is contained in:
arvidn 2015-12-13 15:14:19 -05:00
parent 9e51700739
commit 4b6e11cc07
6 changed files with 24 additions and 1 deletions

View File

@ -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<time_critical_piece> 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;

View File

@ -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

View File

@ -128,7 +128,9 @@ namespace libtorrent
std::string url;
std::string trackerid;
#ifndef TORRENT_NO_DEPRECATE
std::string auth;
#endif
boost::shared_ptr<const ip_filter> filter;

View File

@ -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

View File

@ -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<torrent_paused_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
{

View File

@ -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<boost::int64_t>& progress, int flags) const
{