* 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:
rakshasa
2007-07-19 20:50:48 +00:00
parent 350bdfde7e
commit a8bd405040
16 changed files with 686 additions and 67 deletions
+13 -3
View File
@@ -44,6 +44,7 @@ namespace core {
}
namespace torrent {
class File;
class Object;
}
@@ -51,13 +52,18 @@ namespace rpc {
class XmlRpc {
public:
typedef rak::function1<core::Download*, const char*> slot_find_download;
typedef rak::function2<bool, const char*, uint32_t> slot_write;
typedef rak::function1<core::Download*, const char*> slot_find_download;
typedef rak::function2<torrent::File*, core::Download*, uint32_t> slot_find_file;
typedef rak::function2<bool, const char*, uint32_t> slot_write;
static const int dialect_generic = 0;
static const int dialect_i8 = 1;
static const int dialect_apache = 2;
static const int call_generic = 0;
static const int call_download = 1;
static const int call_file = 2;
XmlRpc() : m_env(NULL), m_registry(NULL), m_dialect(dialect_i8) {}
bool is_valid() const { return m_env != NULL; }
@@ -67,7 +73,7 @@ public:
bool process(const char* inBuffer, uint32_t length, slot_write slotWrite);
void insert_command(const char* name, const char* parm, const char* doc, bool onDownload);
void insert_command(const char* name, const char* parm, const char* doc, int call);
int dialect() { return m_dialect; }
void set_dialect(int dialect);
@@ -75,6 +81,9 @@ public:
slot_find_download& get_slot_find_download() { return m_slotFindDownload; }
void set_slot_find_download(slot_find_download::base_type* slot) { m_slotFindDownload.set(slot); }
slot_find_file& get_slot_find_file() { return m_slotFindFile; }
void set_slot_find_file(slot_find_file::base_type* slot) { m_slotFindFile.set(slot); }
private:
void* m_env;
void* m_registry;
@@ -82,6 +91,7 @@ private:
int m_dialect;
slot_find_download m_slotFindDownload;
slot_find_file m_slotFindFile;
};
}