diff options
author | iximeow <me@iximeow.net> | 2017-10-02 01:27:41 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2017-10-02 02:32:46 -0700 |
commit | 8114e1ae5dcca506e1687b17c846b75a3f0257a8 (patch) | |
tree | b6dda082bbdbcfabebf426ba3cec41af0cb550f1 /src/tw | |
parent | 781981f333345482e93ed35453e98e519bb7cc5e (diff) |
store and show reply_to info if present
Diffstat (limited to 'src/tw')
-rw-r--r-- | src/tw/tweet.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/tw/tweet.rs b/src/tw/tweet.rs index 778461a..aa272d6 100644 --- a/src/tw/tweet.rs +++ b/src/tw/tweet.rs @@ -14,6 +14,9 @@ pub struct Tweet { #[serde(skip_serializing_if="Option::is_none")] #[serde(default = "Option::default")] pub rt_tweet: Option<String>, + #[serde(skip_serializing_if="Option::is_none")] + #[serde(default = "Option::default")] + pub reply_to_tweet: Option<String>, #[serde(skip)] pub internal_id: u64 } @@ -47,6 +50,9 @@ impl Tweet { .and_then(|x| x.get("id_str")) .and_then(|x| x.as_str()) .map(|x| x.to_owned()); + let reply_to_tweet = json_map.get("in_reply_to_status_id_str") + .and_then(|x| x.as_str()) + .map(|x| x.to_owned()); if json_map.contains_key("id_str") && json_map.contains_key("user") && json_map.contains_key("created_at") { @@ -68,6 +74,7 @@ impl Tweet { .and_then(|x| x.as_str()) .map(|x| x.to_owned()), rt_tweet: rt_twete, + reply_to_tweet: reply_to_tweet, internal_id: 0 }) } |