diff --git a/src/core/download_factory.cc b/src/core/download_factory.cc index b338e713..ffebefa4 100644 --- a/src/core/download_factory.cc +++ b/src/core/download_factory.cc @@ -186,9 +186,17 @@ DownloadFactory::receive_success() { (*itr)->variables()->set("max_peers", control->variables()->get("max_peers")); (*itr)->variables()->set("max_uploads", control->variables()->get("max_uploads")); - if (control->variables()->get("use_udp_trackers").as_string() == "no") + if (control->variables()->get_string("use_udp_trackers") == "no") (*itr)->enable_udp_trackers(false); + // Move some of this to "rtorrent". + if (root.has_key("libtorrent resume")) { + torrent::Bencode& libtorrent = root.get_key("libtorrent resume"); + + if (control->variables()->get_string("upload_total_clear") == "yes") + libtorrent.erase_key("total_uploaded"); + } + if (m_session) { if (!rtorrent.has_key("directory") || !rtorrent.get_key("directory").is_string()) diff --git a/src/option_handler_rules.cc b/src/option_handler_rules.cc index 7c639725..97c90bc8 100644 --- a/src/option_handler_rules.cc +++ b/src/option_handler_rules.cc @@ -160,6 +160,7 @@ initialize_option_handler(Control* c) { variables->insert("check_hash", new utils::VariableAny("yes")); variables->insert("use_udp_trackers", new utils::VariableAny("yes")); variables->insert("port_random", new utils::VariableAny("yes")); + variables->insert("session", new utils::VariableSlotString<>(NULL, rak::mem_fn(&control->core()->download_store(), &core::DownloadStore::set_path))); variables->insert("session_lock", new utils::VariableAny("yes")); variables->insert("session_on_completion", new utils::VariableAny("yes")); @@ -178,6 +179,7 @@ initialize_option_handler(Control* c) { variables->insert("download_rate", new utils::VariableSlotValue(NULL, rak::mem_fn(control->ui(), &ui::Root::set_down_throttle), "%i")); variables->insert("upload_rate", new utils::VariableSlotValue(NULL, rak::mem_fn(control->ui(), &ui::Root::set_up_throttle), "%i")); + variables->insert("upload_total_clear", new utils::VariableAny("no")); variables->insert("hash_max_tries", new utils::VariableSlotValue(NULL, rak::ptr_fn(&torrent::set_hash_max_tries), "%i")); variables->insert("max_open_files", new utils::VariableSlotValue(NULL, rak::ptr_fn(&torrent::set_max_open_files), "%i"));