Browse Source

shorter rpc name: getlocaldirectmessages => getdirectmsgs

miguelfreitas
Miguel Freitas 11 years ago
parent
commit
d17224516f
  1. 14
      README.md
  2. 3
      TODO
  3. 6
      src/bitcoinrpc.cpp
  4. 2
      src/bitcoinrpc.h
  5. 6
      src/twister.cpp

14
README.md

@ -115,6 +115,20 @@ sure they don't clash. @@ -115,6 +115,20 @@ sure they don't clash.
- The recipient must be your follower.
To get the last 10 direct messages to/from remote user:
./twisterd getdirectmsgs myname 10 '[{"username":"myfriend"}]'
Notes for `getdirectmsgs`:
- These direct message IDs (max_id, since_id etc) are not related to post
numbers. The numbering is local and specific to this thread.
- This function will return messages which have been successfully decrypted
upon receiving or that have been sent by this same computer. A different
computer, sharing the same account, will see the same received, but not the
same sent messages.
To setup your profile:
./twisterd dhtput myname profile s '{"fullname":"My Name","bio":"just another user","location":"nowhere","url":"twister.net.co"}' myname 1

3
TODO

@ -40,4 +40,7 @@ registration for obvious reasons (no block yet, other nodes wouldn't accept the @@ -40,4 +40,7 @@ registration for obvious reasons (no block yet, other nodes wouldn't accept the
- Implement the mention forwarding mechanism discussed in the paper so user don't need to do polling
and can also be sure to receive all mentions.
- Implement hashtag "storage-less" torrents for post distribution.

6
src/bitcoinrpc.cpp

@ -246,7 +246,7 @@ static const CRPCCommand vRPCCommands[] = @@ -246,7 +246,7 @@ static const CRPCCommand vRPCCommands[] =
{ "newdirectmsg", &newdirectmsg, false, true },
{ "newrtmsg", &newrtmsg, false, true },
{ "getposts", &getposts, false, true },
{ "getlocaldirectmessages", &getlocaldirectmessages, false, true },
{ "getdirectmsgs", &getdirectmsgs, false, true },
{ "setspammsg", &setspammsg, false, true },
{ "getspammsg", &getspammsg, false, true },
{ "follow", &follow, false, true },
@ -1240,8 +1240,8 @@ Array RPCConvertValues(const std::string &strMethod, const std::vector<std::stri @@ -1240,8 +1240,8 @@ Array RPCConvertValues(const std::string &strMethod, const std::vector<std::stri
if (strMethod == "getposts" && n > 0) ConvertTo<boost::int64_t>(params[0]);
if (strMethod == "getposts" && n > 1) ConvertTo<Array>(params[1]);
if (strMethod == "getposts" && n > 2) ConvertTo<boost::int64_t>(params[2]);
if (strMethod == "getlocaldirectmessages" && n > 1) ConvertTo<boost::int64_t>(params[1]);
if (strMethod == "getlocaldirectmessages" && n > 2) ConvertTo<Array>(params[2]);
if (strMethod == "getdirectmsgs" && n > 1) ConvertTo<boost::int64_t>(params[1]);
if (strMethod == "getdirectmsgs" && n > 2) ConvertTo<Array>(params[2]);
if (strMethod == "follow" && n > 1) ConvertTo<Array>(params[1]);
if (strMethod == "unfollow" && n > 1) ConvertTo<Array>(params[1]);
if (strMethod == "listusernamespartial" && n > 1) ConvertTo<boost::int64_t>(params[1]);

2
src/bitcoinrpc.h

@ -198,7 +198,7 @@ extern json_spirit::Value newpostmsg(const json_spirit::Array& params, bool fHel @@ -198,7 +198,7 @@ extern json_spirit::Value newpostmsg(const json_spirit::Array& params, bool fHel
extern json_spirit::Value newdirectmsg(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value newrtmsg(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value getposts(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value getlocaldirectmessages(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value getdirectmsgs(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value setspammsg(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value getspammsg(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value follow(const json_spirit::Array& params, bool fHelp);

6
src/twister.cpp

@ -1166,12 +1166,12 @@ Value getposts(const Array& params, bool fHelp) @@ -1166,12 +1166,12 @@ Value getposts(const Array& params, bool fHelp)
return ret;
}
Value getlocaldirectmessages(const Array& params, bool fHelp)
Value getdirectmsgs(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 2 || params.size() > 3)
throw runtime_error(
"getlocaldirectmessages <localuser> <count_per_user> '[{\"username\":username,\"max_id\":max_id,\"since_id\":since_id},...]'\n"
"get decrypted direct messages sent/received by user <localuser>\n"
"getdirectmsgs <localuser> <count_per_user> '[{\"username\":username,\"max_id\":max_id,\"since_id\":since_id},...]'\n"
"get (locally stored) decrypted direct messages sent/received by user <localuser>\n"
"max_id and since_id may be omited. up to <count_per_user> are returned for each remote user.");
string strUsername = params[0].get_str();

Loading…
Cancel
Save