aboutsummaryrefslogtreecommitdiff
path: root/src/commands/follow.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2017-11-18 16:49:23 -0800
committeriximeow <me@iximeow.net>2017-11-18 16:49:23 -0800
commit69afc6b85c28b3f6ae857b369d09dea7d1b4f14e (patch)
tree10ce6f47ba5ef8641aab53052dd69e958df3af3a /src/commands/follow.rs
parent780ccc569fee0eeb21069575bd88dd8f94aeb424 (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
)
)
)