* Moved hash and torrent size checking to initialize so it will be

caught when loading a torrent.

* Added VariableMap to core::Download and started moving various
settings.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@624 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2006-01-19 17:13:25 +00:00
parent e8cd37ea3a
commit 52636178d1
14 changed files with 242 additions and 114 deletions
+7 -4
View File
@@ -80,10 +80,12 @@ connect_signal_storage_log(Download* d, torrent::Download::SlotString s) {
// Hmm... find some better place for all this.
static void
delete_tied(Download* d) {
const std::string tie = d->variables()->get("tied_to_file").as_string();
// This should be configurable, need to wait for the variable
// thingie to be implemented.
if (!d->tied_to_file().empty())
::unlink(d->tied_to_file().c_str());
if (!tie.empty())
::unlink(tie.c_str());
}
Manager::Manager() :
@@ -338,9 +340,10 @@ Manager::try_create_download(const std::string& uri, bool start, bool printLog,
// Adding download.
DownloadFactory* f = new DownloadFactory(uri, this);
f->variables()->set("tied_to_file", tied ? "yes" : "no");
f->set_start(start);
f->set_print_log(printLog);
f->set_tied_to_file(tied);
f->slot_finished(sigc::bind(sigc::ptr_fun(&rak::call_delete_func<core::DownloadFactory>), f));
f->load();
f->commit();
@@ -402,7 +405,7 @@ Manager::try_create_download_expand(const std::string& uri, bool start, bool pri
if (tied)
for (std::vector<std::string>::iterator itr = paths.begin(); itr != paths.end(); )
if (std::find_if(m_downloadList.begin(), m_downloadList.end(),
rak::equal(*itr, std::mem_fun(&Download::tied_to_file))) != m_downloadList.end())
rak::equal(*itr, rak::bind2nd(std::mem_fun(&Download::variable_string), "tied_to_file"))) != m_downloadList.end())
itr = paths.erase(itr);
else
itr++;