added a userdata parameter to add_torrent that is passed in to plugins
This commit is contained in:
parent
8cbc53074d
commit
7bbfb3bd4b
|
@ -185,7 +185,7 @@ namespace libtorrent
|
|||
~session_impl();
|
||||
|
||||
#ifndef TORRENT_DISABLE_EXTENSIONS
|
||||
void add_extension(boost::function<boost::shared_ptr<torrent_plugin>(torrent*)> ext);
|
||||
void add_extension(boost::function<boost::shared_ptr<torrent_plugin>(torrent*, void*)> ext);
|
||||
#endif
|
||||
void operator()();
|
||||
|
||||
|
@ -246,7 +246,8 @@ namespace libtorrent
|
|||
, entry const& resume_data
|
||||
, bool compact_mode
|
||||
, storage_constructor_type sc
|
||||
, bool paused);
|
||||
, bool paused
|
||||
, void* userdata);
|
||||
|
||||
torrent_handle add_torrent(
|
||||
char const* tracker_url
|
||||
|
@ -256,7 +257,8 @@ namespace libtorrent
|
|||
, entry const& resume_data
|
||||
, bool compact_mode
|
||||
, storage_constructor_type sc
|
||||
, bool paused);
|
||||
, bool paused
|
||||
, void* userdata);
|
||||
|
||||
void remove_torrent(torrent_handle const& h);
|
||||
|
||||
|
@ -519,7 +521,7 @@ namespace libtorrent
|
|||
|
||||
#ifndef TORRENT_DISABLE_EXTENSIONS
|
||||
typedef std::list<boost::function<boost::shared_ptr<
|
||||
torrent_plugin>(torrent*)> > extension_list_t;
|
||||
torrent_plugin>(torrent*, void*)> > extension_list_t;
|
||||
|
||||
extension_list_t m_extensions;
|
||||
#endif
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace libtorrent
|
|||
{
|
||||
struct torrent_plugin;
|
||||
class torrent;
|
||||
TORRENT_EXPORT boost::shared_ptr<torrent_plugin> create_metadata_plugin(torrent*);
|
||||
TORRENT_EXPORT boost::shared_ptr<torrent_plugin> create_metadata_plugin(torrent*, void*);
|
||||
}
|
||||
|
||||
#endif // TORRENT_METADATA_TRANSFER_HPP_INCLUDED
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace libtorrent
|
|||
{
|
||||
struct torrent_plugin;
|
||||
class torrent;
|
||||
TORRENT_EXPORT boost::shared_ptr<torrent_plugin> create_ut_pex_plugin(torrent*);
|
||||
TORRENT_EXPORT boost::shared_ptr<torrent_plugin> create_ut_pex_plugin(torrent*, void*);
|
||||
}
|
||||
|
||||
#endif // TORRENT_UT_PEX_EXTENSION_HPP_INCLUDED
|
||||
|
|
|
@ -150,7 +150,8 @@ namespace libtorrent
|
|||
, entry const& resume_data = entry()
|
||||
, bool compact_mode = true
|
||||
, bool paused = false
|
||||
, storage_constructor_type sc = default_storage_constructor);
|
||||
, storage_constructor_type sc = default_storage_constructor
|
||||
, void* userdata = 0);
|
||||
|
||||
torrent_handle add_torrent(
|
||||
char const* tracker_url
|
||||
|
@ -160,7 +161,8 @@ namespace libtorrent
|
|||
, entry const& resume_data = entry()
|
||||
, bool compact_mode = true
|
||||
, bool paused = false
|
||||
, storage_constructor_type sc = default_storage_constructor);
|
||||
, storage_constructor_type sc = default_storage_constructor
|
||||
, void* userdata = 0);
|
||||
|
||||
session_proxy abort() { return session_proxy(m_impl); }
|
||||
|
||||
|
@ -181,7 +183,7 @@ namespace libtorrent
|
|||
#endif
|
||||
|
||||
#ifndef TORRENT_DISABLE_EXTENSIONS
|
||||
void add_extension(boost::function<boost::shared_ptr<torrent_plugin>(torrent*)> ext);
|
||||
void add_extension(boost::function<boost::shared_ptr<torrent_plugin>(torrent*, void*)> ext);
|
||||
#endif
|
||||
|
||||
void set_ip_filter(ip_filter const& f);
|
||||
|
|
|
@ -556,7 +556,7 @@ namespace libtorrent { namespace
|
|||
namespace libtorrent
|
||||
{
|
||||
|
||||
boost::shared_ptr<torrent_plugin> create_metadata_plugin(torrent* t)
|
||||
boost::shared_ptr<torrent_plugin> create_metadata_plugin(torrent* t, void*)
|
||||
{
|
||||
return boost::shared_ptr<torrent_plugin>(new metadata_plugin(*t));
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ namespace libtorrent
|
|||
m_impl->abort();
|
||||
}
|
||||
|
||||
void session::add_extension(boost::function<boost::shared_ptr<torrent_plugin>(torrent*)> ext)
|
||||
void session::add_extension(boost::function<boost::shared_ptr<torrent_plugin>(torrent*, void*)> ext)
|
||||
{
|
||||
m_impl->add_extension(ext);
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ namespace libtorrent
|
|||
assert(!ti.m_half_metadata);
|
||||
boost::intrusive_ptr<torrent_info> tip(new torrent_info(ti));
|
||||
return m_impl->add_torrent(tip, save_path, resume_data
|
||||
, compact_mode, sc, paused);
|
||||
, compact_mode, sc, paused, 0);
|
||||
}
|
||||
|
||||
torrent_handle session::add_torrent(
|
||||
|
@ -194,11 +194,12 @@ namespace libtorrent
|
|||
, entry const& resume_data
|
||||
, bool compact_mode
|
||||
, bool paused
|
||||
, storage_constructor_type sc)
|
||||
, storage_constructor_type sc
|
||||
, void* userdata)
|
||||
{
|
||||
assert(!ti->m_half_metadata);
|
||||
return m_impl->add_torrent(ti, save_path, resume_data
|
||||
, compact_mode, sc, paused);
|
||||
, compact_mode, sc, paused, userdata);
|
||||
}
|
||||
|
||||
torrent_handle session::add_torrent(
|
||||
|
@ -209,10 +210,11 @@ namespace libtorrent
|
|||
, entry const& e
|
||||
, bool compact_mode
|
||||
, bool paused
|
||||
, storage_constructor_type sc)
|
||||
, storage_constructor_type sc
|
||||
, void* userdata)
|
||||
{
|
||||
return m_impl->add_torrent(tracker_url, info_hash, name, save_path, e
|
||||
, compact_mode, sc, paused);
|
||||
, compact_mode, sc, paused, userdata);
|
||||
}
|
||||
|
||||
void session::remove_torrent(const torrent_handle& h)
|
||||
|
|
|
@ -593,7 +593,7 @@ namespace detail
|
|||
|
||||
#ifndef TORRENT_DISABLE_EXTENSIONS
|
||||
void session_impl::add_extension(
|
||||
boost::function<boost::shared_ptr<torrent_plugin>(torrent*)> ext)
|
||||
boost::function<boost::shared_ptr<torrent_plugin>(torrent*, void*)> ext)
|
||||
{
|
||||
m_extensions.push_back(ext);
|
||||
}
|
||||
|
@ -1474,7 +1474,8 @@ namespace detail
|
|||
, entry const& resume_data
|
||||
, bool compact_mode
|
||||
, storage_constructor_type sc
|
||||
, bool paused)
|
||||
, bool paused
|
||||
, void* userdata)
|
||||
{
|
||||
// if you get this assert, you haven't managed to
|
||||
// open a listen port. call listen_on() first.
|
||||
|
@ -1514,7 +1515,7 @@ namespace detail
|
|||
for (extension_list_t::iterator i = m_extensions.begin()
|
||||
, end(m_extensions.end()); i != end; ++i)
|
||||
{
|
||||
boost::shared_ptr<torrent_plugin> tp((*i)(torrent_ptr.get()));
|
||||
boost::shared_ptr<torrent_plugin> tp((*i)(torrent_ptr.get(), userdata));
|
||||
if (tp) torrent_ptr->add_extension(tp);
|
||||
}
|
||||
#endif
|
||||
|
@ -1554,7 +1555,8 @@ namespace detail
|
|||
, entry const&
|
||||
, bool compact_mode
|
||||
, storage_constructor_type sc
|
||||
, bool paused)
|
||||
, bool paused
|
||||
, void* userdata)
|
||||
{
|
||||
|
||||
// TODO: support resume data in this case
|
||||
|
@ -1593,7 +1595,7 @@ namespace detail
|
|||
for (extension_list_t::iterator i = m_extensions.begin()
|
||||
, end(m_extensions.end()); i != end; ++i)
|
||||
{
|
||||
boost::shared_ptr<torrent_plugin> tp((*i)(torrent_ptr.get()));
|
||||
boost::shared_ptr<torrent_plugin> tp((*i)(torrent_ptr.get(), userdata));
|
||||
if (tp) torrent_ptr->add_extension(tp);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -347,7 +347,7 @@ namespace libtorrent { namespace
|
|||
namespace libtorrent
|
||||
{
|
||||
|
||||
boost::shared_ptr<torrent_plugin> create_ut_pex_plugin(torrent* t)
|
||||
boost::shared_ptr<torrent_plugin> create_ut_pex_plugin(torrent* t, void*)
|
||||
{
|
||||
if (t->torrent_file().priv())
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue