diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-05-22 19:21:00 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-05-22 19:21:00 -0400 |
commit | 62f6aae6c313b2a2a493c5147ec831a66eba01ff (patch) | |
tree | a69adb7516ed3c54f3291dae14a582ecb9d0d5b2 /src/tweet.cpp | |
parent | cdea9154ff180e95dfbdd8e0647922ca8afa3d46 (diff) | |
download | libtwittercpp-62f6aae6c313b2a2a493c5147ec831a66eba01ff.tar.gz libtwittercpp-62f6aae6c313b2a2a493c5147ec831a66eba01ff.tar.bz2 libtwittercpp-62f6aae6c313b2a2a493c5147ec831a66eba01ff.zip |
Added utility function to generate tweet reply prefill
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; |