From d17224516fc99c75490f965c7fede4376ca35faf Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Mon, 14 Oct 2013 18:55:56 -0300 Subject: [PATCH] shorter rpc name: getlocaldirectmessages => getdirectmsgs --- README.md | 14 ++++++++++++++ TODO | 3 +++ src/bitcoinrpc.cpp | 6 +++--- src/bitcoinrpc.h | 2 +- src/twister.cpp | 6 +++--- 5 files changed, 24 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c6acb256..6549519b 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/TODO b/TODO index 27e2fd7b..958c3ddf 100644 --- a/TODO +++ b/TODO @@ -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. + + diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index 1279fbf5..14660750 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -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 0) ConvertTo(params[0]); if (strMethod == "getposts" && n > 1) ConvertTo(params[1]); if (strMethod == "getposts" && n > 2) ConvertTo(params[2]); - if (strMethod == "getlocaldirectmessages" && n > 1) ConvertTo(params[1]); - if (strMethod == "getlocaldirectmessages" && n > 2) ConvertTo(params[2]); + if (strMethod == "getdirectmsgs" && n > 1) ConvertTo(params[1]); + if (strMethod == "getdirectmsgs" && n > 2) ConvertTo(params[2]); if (strMethod == "follow" && n > 1) ConvertTo(params[1]); if (strMethod == "unfollow" && n > 1) ConvertTo(params[1]); if (strMethod == "listusernamespartial" && n > 1) ConvertTo(params[1]); diff --git a/src/bitcoinrpc.h b/src/bitcoinrpc.h index 2e40f9b3..2b080685 100644 --- a/src/bitcoinrpc.h +++ b/src/bitcoinrpc.h @@ -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); diff --git a/src/twister.cpp b/src/twister.cpp index 7c238d5b..63be0eb3 100644 --- a/src/twister.cpp +++ b/src/twister.cpp @@ -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 '[{\"username\":username,\"max_id\":max_id,\"since_id\":since_id},...]'\n" - "get decrypted direct messages sent/received by user \n" + "getdirectmsgs '[{\"username\":username,\"max_id\":max_id,\"since_id\":since_id},...]'\n" + "get (locally stored) decrypted direct messages sent/received by user \n" "max_id and since_id may be omited. up to are returned for each remote user."); string strUsername = params[0].get_str();