From 62f6aae6c313b2a2a493c5147ec831a66eba01ff Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 22 May 2016 19:21:00 -0400 Subject: Added utility function to generate tweet reply prefill --- src/tweet.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/tweet.cpp') diff --git a/src/tweet.cpp b/src/tweet.cpp index 5885b51..bf95bc0 100644 --- a/src/tweet.cpp +++ b/src/tweet.cpp @@ -18,6 +18,18 @@ namespace twitter { _text = _data.at("text"); _author = user(_data.at("user").dump()); _retweeted = _data.at("retweeted"); + + if (_data.find("entities") != _data.end()) + { + auto _entities = _data.at("entities"); + if (_entities.find("user_mentions") != _entities.end()) + { + for (auto _mention : _entities.at("user_mentions")) + { + _mentions.push_back(std::make_pair(_mention.at("id"), _mention.at("screen_name").get())); + } + } + } } tweet_id tweet::getID() const @@ -48,6 +60,11 @@ namespace twitter { return _retweeted; } + std::vector> tweet::getMentions() const + { + return _mentions; + } + tweet::operator bool() const { return _valid; -- cgit 1.4.1