Browse Source

Merge pull request #332 from erqan/getlasthave-with-userlist

changes getlasthave method for any possible group implementation on clie...
miguelfreitas
miguelfreitas 10 years ago
parent
commit
b7de00d35e
  1. 1
      src/bitcoinrpc.cpp
  2. 18
      src/twister.cpp

1
src/bitcoinrpc.cpp

@ -1316,6 +1316,7 @@ Array RPCConvertValues(const std::string &strMethod, const std::vector<std::stri
if (strMethod == "newdirectmsg" && n > 4) ConvertTo<bool>(params[4]); if (strMethod == "newdirectmsg" && n > 4) ConvertTo<bool>(params[4]);
if (strMethod == "newrtmsg" && n > 1) ConvertTo<boost::int64_t>(params[1]); if (strMethod == "newrtmsg" && n > 1) ConvertTo<boost::int64_t>(params[1]);
if (strMethod == "newrtmsg" && n > 2) ConvertTo<Object>(params[2]); if (strMethod == "newrtmsg" && n > 2) ConvertTo<Object>(params[2]);
if (strMethod == "getlasthave" && n > 1) ConvertTo<Array>(params[1]);
if (strMethod == "getposts" && n > 0) ConvertTo<boost::int64_t>(params[0]); if (strMethod == "getposts" && n > 0) ConvertTo<boost::int64_t>(params[0]);
if (strMethod == "getposts" && n > 1) ConvertTo<Array>(params[1]); if (strMethod == "getposts" && n > 1) ConvertTo<Array>(params[1]);
if (strMethod == "getposts" && n > 2) ConvertTo<boost::int64_t>(params[2]); if (strMethod == "getposts" && n > 2) ConvertTo<boost::int64_t>(params[2]);

18
src/twister.cpp

@ -2643,14 +2643,22 @@ Value getfollowing(const Array& params, bool fHelp)
Value getlasthave(const Array& params, bool fHelp) Value getlasthave(const Array& params, bool fHelp)
{ {
if (fHelp || (params.size() != 1)) if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error( throw runtime_error(
"getlasthave <username>\n" "getlasthave <username> | <groupname> [user1,user2...]\n"
"get last 'have' (higher post number) of each user user we follow"); "get last 'have' (higher post number) of each user local user follows.\n"
"if a groupname with an array is given, only those users' last 'have' values will be returned.");
string localUser = params[0].get_str();
std::set<std::string> following; std::set<std::string> following;
string localUser = params[0].get_str();
if (params.size() > 1)
{
Array userlist = params[1].get_array();
for (unsigned int i = 0; i < userlist.size(); i++)
following.insert(userlist[i].get_str());
}
else
{ {
LOCK(cs_twister); LOCK(cs_twister);
if( m_users.count(localUser) ) if( m_users.count(localUser) )

Loading…
Cancel
Save