* Replaced DownloadFactory's m_variables with a torrent::Object map.

* Starting work on moving the download commands to the new command
framework.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@901 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2007-05-16 14:39:03 +00:00
parent 032bae7030
commit 9fe72cb3b5
11 changed files with 414 additions and 56 deletions
+44 -1
View File
@@ -37,9 +37,52 @@
#include "config.h"
#include <functional>
#include <torrent/data/file.h>
#include <torrent/data/file_list.h>
#include "core/download.h"
#include "utils/command_download_slot.h"
#include "globals.h"
#include "control.h"
#include "command_helpers.h"
std::string
retrieve_d_base_path(core::Download* download) {
if (download->file_list()->is_multi_file())
return download->file_list()->root_dir();
else
return download->file_list()->at(0)->frozen_path();
}
std::string
retrieve_d_base_filename(core::Download* download) {
std::string base;
if (download->file_list()->is_multi_file())
base = download->file_list()->root_dir();
else
base = download->file_list()->at(0)->frozen_path();
std::string::size_type split = base.rfind('/');
if (split == std::string::npos)
return base;
else
return base.substr(split + 1);
}
#define ADD_COMMAND_DOWNLOAD_SLOT(key, function, slot, parm, doc) \
commandDownloadSlotsItr->set_slot(slot); \
variables->insert(key, commandDownloadSlotsItr++, NULL, &utils::CommandDownloadSlot::function, utils::VariableMap::flag_dont_delete | utils::VariableMap::flag_public_xmlrpc, parm, doc);
#define ADD_COMMAND_DOWNLOAD_VOID(key, slot) \
ADD_COMMAND_DOWNLOAD_SLOT(key, call_unknown, utils::object_d_fn(slot), "i:", "")
void
initialize_command_download() {
// utils::VariableMap* variables = control->variable();
utils::VariableMap* variables = control->download_variables();
ADD_COMMAND_DOWNLOAD_VOID("base_path", &retrieve_d_base_path);
ADD_COMMAND_DOWNLOAD_VOID("base_filename", &retrieve_d_base_filename);
}