diff options
Diffstat (limited to 'src/tweet.cpp')
| -rw-r--r-- | src/tweet.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
| 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 { | |||
| 18 | _text = _data.at("text"); | 18 | _text = _data.at("text"); |
| 19 | _author = user(_data.at("user").dump()); | 19 | _author = user(_data.at("user").dump()); |
| 20 | _retweeted = _data.at("retweeted"); | 20 | _retweeted = _data.at("retweeted"); |
| 21 | |||
| 22 | if (_data.find("entities") != _data.end()) | ||
| 23 | { | ||
| 24 | auto _entities = _data.at("entities"); | ||
| 25 | if (_entities.find("user_mentions") != _entities.end()) | ||
| 26 | { | ||
| 27 | for (auto _mention : _entities.at("user_mentions")) | ||
| 28 | { | ||
| 29 | _mentions.push_back(std::make_pair(_mention.at("id"), _mention.at("screen_name").get<std::string>())); | ||
| 30 | } | ||
| 31 | } | ||
| 32 | } | ||
| 21 | } | 33 | } |
| 22 | 34 | ||
| 23 | tweet_id tweet::getID() const | 35 | tweet_id tweet::getID() const |
| @@ -48,6 +60,11 @@ namespace twitter { | |||
| 48 | return _retweeted; | 60 | return _retweeted; |
| 49 | } | 61 | } |
| 50 | 62 | ||
| 63 | std::vector<std::pair<user_id, std::string>> tweet::getMentions() const | ||
| 64 | { | ||
| 65 | return _mentions; | ||
| 66 | } | ||
| 67 | |||
| 51 | tweet::operator bool() const | 68 | tweet::operator bool() const |
| 52 | { | 69 | { |
| 53 | return _valid; | 70 | return _valid; |
