Browse Source

missing function. thanks jpfox

miguelfreitas
Miguel Freitas 11 years ago
parent
commit
1e577bfdfb
  1. 10
      src/twister_utils.cpp
  2. 2
      src/twister_utils.h

10
src/twister_utils.cpp

@ -231,7 +231,6 @@ data_error: @@ -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) @@ -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 "";
}
}

2
src/twister_utils.h

@ -44,4 +44,6 @@ void unHexcapePost(libtorrent::entry &e); @@ -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

Loading…
Cancel
Save