diff options
author | iximeow <me@iximeow.net> | 2017-10-01 23:51:13 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2017-10-01 23:51:13 -0700 |
commit | 081c0732b87383e3876fd6c60417f15830554174 (patch) | |
tree | b556fba4831a5e16f6838a6d4e1448e2be92cec7 /display | |
parent | 0733877c7140b37affcd08f5d8e3755efe74e1ef (diff) |
extract twitter message handling logic
Diffstat (limited to 'display')
-rw-r--r-- | display/mod.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/display/mod.rs b/display/mod.rs index 715c4d3..24f7e33 100644 --- a/display/mod.rs +++ b/display/mod.rs @@ -33,7 +33,6 @@ pub trait Render { impl Render for tw::events::Event { fn render(self, tweeter: &::tw::TwitterCache) { - println!("---------------------------------"); match self { tw::events::Event::Deleted { user_id, twete_id } => { if let Some(handle) = tweeter.retrieve_user(&user_id).map(|x| &x.handle) { @@ -50,30 +49,36 @@ impl Render for tw::events::Event { } }, tw::events::Event::RT_RT { user_id, twete_id } => { + println!("---------------------------------"); let user = tweeter.retrieve_user(&user_id).unwrap(); println!(" +rt_rt : {} (@{})", user.name, user.handle); render_twete(&twete_id, tweeter); }, 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); render_twete(&twete_id, tweeter); }, tw::events::Event::Fav { user_id, twete_id } => { + println!("---------------------------------"); let user = tweeter.retrieve_user(&user_id).unwrap(); println!("{} +fav : {} (@{}){}", color::Fg(color::Yellow), user.name, user.handle, color::Fg(color::Reset)); render_twete(&twete_id, tweeter); }, tw::events::Event::Unfav { user_id, twete_id } => { + println!("---------------------------------"); let user = tweeter.retrieve_user(&user_id).unwrap(); println!("{} -fav : {} (@{}){}", color::Fg(color::Yellow), user.name, user.handle, color::Fg(color::Reset)); render_twete(&twete_id, tweeter); }, tw::events::Event::Followed { user_id } => { + println!("---------------------------------"); let user = tweeter.retrieve_user(&user_id).unwrap(); println!(" +fl : {} (@{})", user.name, user.handle); }, tw::events::Event::Unfollowed { user_id } => { + println!("---------------------------------"); let user = tweeter.retrieve_user(&user_id).unwrap(); println!(" -fl : {} (@{})", user.name, user.handle); } |