Working option file, doesn't yet load from a sane place.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@449 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2005-06-01 13:33:44 +00:00
parent 74930f86b3
commit 0206ee066d
8 changed files with 178 additions and 33 deletions
+15 -14
View File
@@ -22,23 +22,24 @@
#include "config.h"
#include <cstdio>
#include <stdexcept>
#include <sigc++/bind.h>
#include "option_handler_rules.h"
OptionHandlerDownloadMinPeers::~OptionHandlerDownloadMinPeers() {
bool
validate_download_peers(int arg) {
return arg > 0 && arg < (1 << 16);
}
void
OptionHandlerDownloadMinPeers::process(const std::string& key, const std::string& arg) {
int a;
if (std::sscanf(arg.c_str(), "%i", &a) != 1 ||
a <= 0 ||
a >= (1 << 16))
throw std::runtime_error("Invalid argument for min peers \"" + arg + "\"");
(*m_map)[key] = sigc::bind(sigc::ptr_fun(&OptionHandlerDownloadMinPeers::apply), a);
apply_download_min_peers(core::Download* d, int arg) {
d->get_download().set_peers_min(arg);
}
void
apply_download_max_peers(core::Download* d, int arg) {
d->get_download().set_peers_max(arg);
}
void
apply_download_max_uploads(core::Download* d, int arg) {
d->get_download().set_uploads_max(arg);
}