aboutsummaryrefslogtreecommitdiff
path: root/src/commands/follow.rs
diff options
context:
space:
mode:
authorAndy Wortman <ixineeringeverywhere@gmail.com>2017-11-18 16:49:23 -0800
committerAndy Wortman <ixineeringeverywhere@gmail.com>2017-11-18 16:49:23 -0800
commita3966446bab8bf849457c24a9a6d05216f950e11 (patch)
tree10ce6f47ba5ef8641aab53052dd69e958df3af3a /src/commands/follow.rs
parent799757386fa02339c20eff9f256de0f97b5fa042 (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/follow.rs')
-rw-r--r--src/commands/follow.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/commands/follow.rs b/src/commands/follow.rs
index 3a29252..6e29788 100644
--- a/src/commands/follow.rs
+++ b/src/commands/follow.rs
@@ -16,9 +16,9 @@ pub static UNFOLLOW: Command = Command {
fn unfl(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer) {
let screen_name = line.trim();
- let result = match tweeter.profile.clone() {
- Some(user_creds) => {
- queryer.do_api_post(&format!("{}?screen_name={}", FOLLOW_URL, screen_name), &tweeter.app_key, &user_creds)
+ let result = match tweeter.current_profile() {
+ Some(user_profile) => {
+ queryer.do_api_post(&format!("{}?screen_name={}", FOLLOW_URL, screen_name), &tweeter.app_key, &user_profile.creds)
},
None => Err("No logged in user to unfollow from".to_owned())
};
@@ -38,15 +38,15 @@ pub static FOLLOW: Command = Command {
fn fl(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer) {
let screen_name = line.trim();
- match tweeter.profile.clone() {
- Some(user_creds) => {
+ match tweeter.current_profile().map(|profile| profile.to_owned()) {
+ Some(user_profile) => {
tweeter.display_info.status(
format!(
"fl resp: {:?}",
queryer.do_api_post(
&format!("{}?screen_name={}", UNFOLLOW_URL, screen_name),
&tweeter.app_key,
- &user_creds
+ &user_profile.creds
)
)
)