Browse Source

private comments for private favs

miguelfreitas
erqan 9 years ago
parent
commit
f857194215
  1. 9
      src/twister.cpp

9
src/twister.cpp

@ -2403,6 +2403,8 @@ Value newfavmsg(const Array& params, bool fHelp)
if (isPriv) if (isPriv)
{ {
//comments for private favs should be private too...
vfav["comment"] = strComment;
std::vector<char> payloadbuf; std::vector<char> payloadbuf;
bencode(std::back_inserter(payloadbuf), vfav); bencode(std::back_inserter(payloadbuf), vfav);
std::string strMsgData = std::string(payloadbuf.data(),payloadbuf.size()); std::string strMsgData = std::string(payloadbuf.data(),payloadbuf.size());
@ -2414,7 +2416,7 @@ Value newfavmsg(const Array& params, bool fHelp)
if( !createSignedUserpost(v, strUsername, k, if( !createSignedUserpost(v, strUsername, k,
USERPOST_FLAG_P_FAV, USERPOST_FLAG_P_FAV,
strComment, &pfav, NULL, "", &pfav, NULL,
std::string(""), 0) ) std::string(""), 0) )
throw JSONRPCError(RPC_INTERNAL_ERROR,"error signing post with private key of user"); throw JSONRPCError(RPC_INTERNAL_ERROR,"error signing post with private key of user");
} }
@ -2436,7 +2438,8 @@ Value newfavmsg(const Array& params, bool fHelp)
// if member of torrent post it directly // if member of torrent post it directly
h.add_piece(k,buf.data(),buf.size()); h.add_piece(k,buf.data(),buf.size());
} }
//look for mentions and hashtags in comment //look for mentions and hashtags in comment if it isn't private...
if (!isPriv)
dispatchHM(strComment, strUsername, v); dispatchHM(strComment, strUsername, v);
hexcapePost(v); hexcapePost(v);
@ -2709,7 +2712,7 @@ Value getfavs(const Array& params, bool fHelp)
upst["sig_fav"] = dfav.dict_find_string_value("sig_userpost"); upst["sig_fav"] = dfav.dict_find_string_value("sig_userpost");
upst["n"] = post->dict_find_string_value("n"); upst["n"] = post->dict_find_string_value("n");
upst["k"] = post->dict_find_int_value("k"); upst["k"] = post->dict_find_int_value("k");
upst["msg"] = post->dict_find_string_value("msg"); upst["msg"] = dfav.dict_find_string_value("comment");
upst["time"] = post->dict_find_int_value("time"); upst["time"] = post->dict_find_int_value("time");
upst["height"] = post->dict_find_int_value("height"); upst["height"] = post->dict_find_int_value("height");

Loading…
Cancel
Save