From fe80b29ca03ed5e4462800804f33ecc00e1f880f Mon Sep 17 00:00:00 2001 From: Andy Wortman 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') 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