parse address in AddressBook

This commit is contained in:
orignal 2014-10-03 14:22:32 -04:00
parent ec3462fabe
commit 07654212f8
6 changed files with 37 additions and 50 deletions

View file

@ -18,6 +18,29 @@ namespace data
{
}
bool AddressBook::GetIdentHash (const std::string& address, IdentHash& ident)
{
auto pos = address.find(".b32.i2p");
if (pos != std::string::npos)
{
Base32ToByteStream (address.c_str(), pos, ident, 32);
return true;
}
else
{
pos = address.find (".i2p");
if (pos != std::string::npos)
{
auto identHash = FindAddress (address);
if (identHash)
{
ident = *identHash;
return true;
}
}
}
return false;
}
const IdentHash * AddressBook::FindAddress (const std::string& address)
{