diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/display/mod.rs | 7 | ||||
-rw-r--r-- | src/main.rs | 4 | ||||
-rw-r--r-- | src/tw/mod.rs | 12 |
3 files changed, 18 insertions, 5 deletions
diff --git a/src/display/mod.rs b/src/display/mod.rs index aaca4b2..15e23d7 100644 --- a/src/display/mod.rs +++ b/src/display/mod.rs @@ -62,8 +62,11 @@ impl Render for tw::events::Event { }, tw::events::Event::Fav_RT { user_id, twete_id } => { println!("---------------------------------"); - let user = tweeter.retrieve_user(&user_id).unwrap(); - println!(" +rt_fav : {} (@{})", user.name, user.handle); + if let Some(user) = tweeter.retrieve_user(&user_id) { + println!(" +rt_fav : {} (@{})", user.name, user.handle); + } else { + println!(" +rt_fav but don't know who {} is", user_id); + } render_twete(&twete_id, tweeter); }, tw::events::Event::Fav { user_id, twete_id } => { diff --git a/src/main.rs b/src/main.rs index 0526c06..e53e6b6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -286,6 +286,7 @@ fn url_encode(s: &str) -> String { .replace("\\esc", "%1b") .replace("!", "%21") .replace("#", "%23") + .replace("$", "%24") .replace("&", "%26") .replace("'", "%27") .replace("(", "%28") @@ -297,8 +298,9 @@ fn url_encode(s: &str) -> String { .replace("/", "%2f") .replace(":", "%3a") .replace(";", "%3b") - .replace(">", "%3e") .replace("<", "%3c") + .replace("=", "%3d") + .replace(">", "%3e") .replace("?", "%3f") .replace("@", "%40") .replace("[", "%5b") diff --git a/src/tw/mod.rs b/src/tw/mod.rs index b703960..90610f1 100644 --- a/src/tw/mod.rs +++ b/src/tw/mod.rs @@ -257,8 +257,16 @@ impl TwitterCache { self.cache_api_user(json["source"].clone()); self.cache_api_user(json["target"].clone()); }, - Some("retweeted_retweet") => ()/* cache rt */, - Some("favorited_retweet") => ()/* cache rt */, + Some("retweeted_retweet") => { + self.cache_api_tweet(json["target_object"].clone()); + self.cache_api_user(json["source"].clone()); + self.cache_api_user(json["target"].clone()); + }, + Some("favorited_retweet") => { + self.cache_api_tweet(json["target_object"].clone()); + self.cache_api_user(json["source"].clone()); + self.cache_api_user(json["target"].clone()); + }, Some("delete") => { let user_id = json["delete"]["status"]["user_id_str"].as_str().unwrap().to_string(); self.fetch_user(&user_id, &mut queryer); |