Tidy up and move sources

This commit is contained in:
Vinnie Falco
2015-07-11 12:33:17 -07:00
parent 70fc091e74
commit 5bd9cd2ee8
17 changed files with 297 additions and 299 deletions

View File

@@ -20,6 +20,8 @@
#include <ripple/rpc/impl/Utilities.h>
#include <ripple/json/json_value.h>
#include <ripple/protocol/JsonFields.h>
#include <boost/algorithm/string.hpp>
#include <boost/format.hpp>
namespace ripple {
namespace RPC {
@@ -65,5 +67,32 @@ addPaymentDeliveredAmount (
meta[jss::delivered_amount] = Json::Value ("unavailable");
}
void
injectSLE (Json::Value& jv,
SLE const& sle)
{
jv = sle.getJson(0);
if (sle.getType() == ltACCOUNT_ROOT)
{
if (sle.isFieldPresent(sfEmailHash))
{
auto const& hash =
sle.getFieldH128(sfEmailHash);
Blob const b (hash.begin(), hash.end());
std::string md5 = strHex(makeSlice(b));
boost::to_lower(md5);
// VFALCO TODO Give a name and move this constant
// to a more visible location. Also
// shouldn't this be https?
jv[jss::urlgravatar] = str(boost::format(
"http://www.gravatar.com/avatar/%s") % md5);
}
}
else
{
jv[jss::Invalid] = true;
}
}
} // ripple
} // RPC