mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-06 18:22:32 +00:00
* Added support for xmlrpc commands on torrent::File objects. The
xmlrpc command takes the download info-hash and the file index as the first two parameters. * Added several file commands. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@937 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+15
-2
@@ -135,10 +135,21 @@ apply_enable_trackers(int64_t arg) {
|
||||
}
|
||||
}
|
||||
|
||||
torrent::File*
|
||||
xmlrpc_find_file(core::Download* download, uint32_t index) {
|
||||
torrent::FileList* fileList = download->download()->file_list();
|
||||
|
||||
if (index >= fileList->size_files())
|
||||
return NULL;
|
||||
|
||||
return (*fileList)[index];
|
||||
}
|
||||
|
||||
void
|
||||
initialize_xmlrpc() {
|
||||
rpc::xmlrpc.initialize();
|
||||
rpc::xmlrpc.set_slot_find_download(rak::mem_fn(control->core()->download_list(), &core::DownloadList::find_hex_ptr));
|
||||
rpc::xmlrpc.set_slot_find_file(rak::ptr_fn(&xmlrpc_find_file));
|
||||
|
||||
unsigned int count = 0;
|
||||
|
||||
@@ -147,9 +158,11 @@ initialize_xmlrpc() {
|
||||
continue;
|
||||
|
||||
if (itr->second.m_genericSlot != NULL)
|
||||
rpc::xmlrpc.insert_command(itr->first, itr->second.m_parm, itr->second.m_doc, false);
|
||||
rpc::xmlrpc.insert_command(itr->first, itr->second.m_parm, itr->second.m_doc, rpc::XmlRpc::call_generic);
|
||||
else if (itr->second.m_downloadSlot != NULL)
|
||||
rpc::xmlrpc.insert_command(itr->first, itr->second.m_parm, itr->second.m_doc, true);
|
||||
rpc::xmlrpc.insert_command(itr->first, itr->second.m_parm, itr->second.m_doc, rpc::XmlRpc::call_download);
|
||||
else if (itr->second.m_fileSlot != NULL)
|
||||
rpc::xmlrpc.insert_command(itr->first, itr->second.m_parm, itr->second.m_doc, rpc::XmlRpc::call_file);
|
||||
else
|
||||
throw torrent::internal_error("XMLRPC: Bad entry.");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user