missing function. thanks jpfox

This commit is contained in:
Miguel Freitas 2014-01-13 19:11:12 -02:00
parent f3b9fc3148
commit 1e577bfdfb
2 changed files with 11 additions and 1 deletions

View File

@ -231,7 +231,6 @@ data_error:
return -2;
}
void findAndHexcape(libtorrent::entry &e, string const& key)
{
if( e.type() == libtorrent::entry::dictionary_t &&
@ -329,4 +328,13 @@ void unHexcapeDht(libtorrent::entry &e)
}
}
std::string safeGetEntryString(libtorrent::entry &e, std::string const& key)
{
if( e.type() == libtorrent::entry::dictionary_t &&
e.find_key(key) && e[key].type() == libtorrent::entry::string_t ) {
return e[key].string();
} else {
return "";
}
}

View File

@ -44,4 +44,6 @@ void unHexcapePost(libtorrent::entry &e);
void hexcapeDht(libtorrent::entry &e);
void unHexcapeDht(libtorrent::entry &e);
std::string safeGetEntryString(libtorrent::entry &e, std::string const& key);
#endif // TWISTER_UTILS_H