diff options
author | Andy Wortman <ixineeringeverywhere@gmail.com> | 2017-10-01 23:51:13 -0700 |
---|---|---|
committer | Andy Wortman <ixineeringeverywhere@gmail.com> | 2017-10-01 23:51:13 -0700 |
commit | afd61ae0822690f30d37859c806a8d8d843b8c1a (patch) | |
tree | b556fba4831a5e16f6838a6d4e1448e2be92cec7 /display | |
parent | 943824e02fa771fa8350e4da90f2c9591ec4647e (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); } |