make it possible to add torrent plugins via add_torrent_params

This commit is contained in:
Arvid Norberg 2013-08-02 09:42:51 +00:00
parent 755cdd00ff
commit 9319c1e073
2 changed files with 15 additions and 0 deletions

View File

@ -321,6 +321,10 @@ namespace libtorrent
int max_connections;
int upload_limit;
int download_limit;
#ifndef TORRENT_DISABLE_EXTENSIONS
std::vector<boost::function<boost::shared_ptr<torrent_plugin>(torrent*, void*)> > extensions;
#endif
};
}

View File

@ -5206,6 +5206,17 @@ retry:
torrent_ptr->start();
#ifndef TORRENT_DISABLE_EXTENSIONS
typedef std::vector<boost::function<
boost::shared_ptr<torrent_plugin>(torrent*, void*)> >
torrent_plugins_t;
for (torrent_plugins_t::const_iterator i = params.extensions.begin()
, end(params.extensions.end()); i != end; ++i)
{
torrent_ptr->add_extension((*i)(torrent_ptr.get(),
params.userdata));
}
for (ses_extension_list_t::iterator i = m_ses_extensions.begin()
, end(m_ses_extensions.end()); i != end; ++i)
{