From 8114e1ae5dcca506e1687b17c846b75a3f0257a8 Mon Sep 17 00:00:00 2001 From: iximeow Date: Mon, 2 Oct 2017 01:27:41 -0700 Subject: store and show reply_to info if present --- src/tw/tweet.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/tw/tweet.rs') 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, + #[serde(skip_serializing_if="Option::is_none")] + #[serde(default = "Option::default")] + pub reply_to_tweet: Option, #[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 }) } -- cgit v1.1