|
|
@ -1797,21 +1797,31 @@ Value newpostmsg(const Array& params, bool fHelp) |
|
|
|
boost::algorithm::token_compress_on); |
|
|
|
boost::algorithm::token_compress_on); |
|
|
|
BOOST_FOREACH(string const& token, tokens) { |
|
|
|
BOOST_FOREACH(string const& token, tokens) { |
|
|
|
if( token.length() >= 2 ) { |
|
|
|
if( token.length() >= 2 ) { |
|
|
|
|
|
|
|
char delim = token.at(0); |
|
|
|
|
|
|
|
if( delim != '#' && delim != '@') continue; |
|
|
|
|
|
|
|
string target = (delim == '#') ? "hashtag" : "mention"; |
|
|
|
string word = token.substr(1); |
|
|
|
string word = token.substr(1); |
|
|
|
#ifdef HAVE_BOOST_LOCALE |
|
|
|
#ifdef HAVE_BOOST_LOCALE |
|
|
|
word = boost::locale::to_lower(word); |
|
|
|
word = boost::locale::to_lower(word); |
|
|
|
#else |
|
|
|
#else |
|
|
|
boost::algorithm::to_lower(word); |
|
|
|
boost::algorithm::to_lower(word); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
if( token.at(0) == '#') { |
|
|
|
if( word.find(delim) == string::npos ) { |
|
|
|
dhtPutData(word, "hashtag", true, |
|
|
|
dhtPutData(word, target, true, |
|
|
|
v, strUsername, GetAdjustedTime(), 0); |
|
|
|
v, strUsername, GetAdjustedTime(), 0); |
|
|
|
} else if( token.at(0) == '@') { |
|
|
|
} else { |
|
|
|
dhtPutData(word, "mention", true, |
|
|
|
vector<string> subtokens; |
|
|
|
|
|
|
|
boost::algorithm::split(subtokens,word,std::bind1st(std::equal_to<char>(),delim), |
|
|
|
|
|
|
|
boost::algorithm::token_compress_on); |
|
|
|
|
|
|
|
BOOST_FOREACH(string const& word, subtokens) { |
|
|
|
|
|
|
|
if( word.length() ) { |
|
|
|
|
|
|
|
dhtPutData(word, target, true, |
|
|
|
v, strUsername, GetAdjustedTime(), 0); |
|
|
|
v, strUsername, GetAdjustedTime(), 0); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
hexcapePost(v); |
|
|
|
hexcapePost(v); |
|
|
|
return entryToJson(v); |
|
|
|
return entryToJson(v); |
|
|
|