* Make DownloadStore::save(...) validate the new file by loading the

bencoded data.

* Make it safe to remove torrents that are selected.

* Delete the rtorrent and libtorrent sections when loading non-session
torrents.

* Added ^O to change a torrent's root dir, ^P to set a variable.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@628 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2006-01-27 20:16:52 +00:00
parent c89ae513ef
commit 6f44f8f920
15 changed files with 203 additions and 150 deletions
+12 -3
View File
@@ -129,21 +129,30 @@ VariableBencode::~VariableBencode() {
const torrent::Bencode&
VariableBencode::get() {
return m_bencode->get_key(m_key);
if (m_root.empty())
return m_bencode->get_key(m_key);
else
return m_bencode->get_key(m_root).get_key(m_key);
}
void
VariableBencode::set(const torrent::Bencode& arg) {
// Consider removing if TYPE_NONE.
torrent::Bencode* root;
if (m_root.empty())
root = m_bencode;
else
root = &m_bencode->get_key(m_root);
switch (m_type) {
case torrent::Bencode::TYPE_NONE:
m_bencode->insert_key(m_key, arg);
root->insert_key(m_key, arg);
break;
case torrent::Bencode::TYPE_STRING:
if (arg.get_type() == torrent::Bencode::TYPE_STRING)
m_bencode->insert_key(m_key, arg);
root->insert_key(m_key, arg);
else
throw torrent::input_error("VariableBencode could not convert to string.");