diff options
author | Andy Wortman <ixineeringeverywhere@gmail.com> | 2017-11-18 16:49:23 -0800 |
---|---|---|
committer | Andy Wortman <ixineeringeverywhere@gmail.com> | 2017-11-18 16:49:23 -0800 |
commit | a3966446bab8bf849457c24a9a6d05216f950e11 (patch) | |
tree | 10ce6f47ba5ef8641aab53052dd69e958df3af3a /src/commands/fav.rs | |
parent | 799757386fa02339c20eff9f256de0f97b5fa042 (diff) |
groundwork for multi-account use
add connection state tracked per-stream, add explicit TwitterProfile
mapped to names that can be used for accounts. default names are the
handle of the corresponding twitter account.
partition out user Credential to be per TwitterProfile, so fav, reply,
etc, all come from the selected account. Multiplex twitter connections
and message streams across chan (instead of earlier plan, which was to
have one chan per thread)
Diffstat (limited to 'src/commands/fav.rs')
-rw-r--r-- | src/commands/fav.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/commands/fav.rs b/src/commands/fav.rs index 7a4852e..5c12535 100644 --- a/src/commands/fav.rs +++ b/src/commands/fav.rs @@ -21,8 +21,8 @@ fn unfav(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer) { match maybe_id { Ok(twid) => { if let Some(twete) = tweeter.retrieve_tweet(&twid).map(|x| x.clone()) { // TODO: no clone when this stops taking &mut self - let result = match tweeter.profile.clone() { - Some(user_creds) => queryer.do_api_post(&format!("{}?id={}", UNFAV_TWEET_URL, twete.id), &tweeter.app_key, &user_creds), + let result = match tweeter.current_profile() { + Some(user_profile) => queryer.do_api_post(&format!("{}?id={}", UNFAV_TWEET_URL, twete.id), &tweeter.app_key, &user_profile.creds), None => Err("No logged in user to unfav from".to_owned()) }; match result { @@ -53,8 +53,8 @@ fn fav(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer) { Ok(twid) => { // tweeter.to_twitter_tweet_id(twid)... if let Some(twete) = tweeter.retrieve_tweet(&twid).map(|x| x.clone()) { // TODO: no clone when this stops taking &mut self - let result = match tweeter.profile.clone() { - Some(user_creds) => queryer.do_api_post(&format!("{}?id={}", FAV_TWEET_URL, twete.id), &tweeter.app_key, &user_creds), + let result = match tweeter.current_profile() { + Some(user_profile) => queryer.do_api_post(&format!("{}?id={}", FAV_TWEET_URL, twete.id), &tweeter.app_key, &user_profile.creds), None => Err("No logged in user to fav from".to_owned()) }; match result { |