aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2017-11-11 16:56:13 -0800
committeriximeow <me@iximeow.net>2017-11-11 16:56:13 -0800
commit7eeb3207c55d432c54c908ecfadbc79df0231635 (patch)
tree1f0932faf73f9fa90ecbea1069b15d9cbe158c73
parent8b5670f420be57576ff44324360e797f46664e8e (diff)
checking for tweet length in-client is dumb
-rw-r--r--src/commands/twete.rs20
-rw-r--r--src/display/mod.rs2
2 files changed, 8 insertions, 14 deletions
diff --git a/src/commands/twete.rs b/src/commands/twete.rs
index dbea81b..c5c0c1a 100644
--- a/src/commands/twete.rs
+++ b/src/commands/twete.rs
@@ -61,19 +61,13 @@ fn twete(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer) {
pub fn send_twete(text: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer) {
let substituted = ::url_encode(&text);
- if text.len() <= 140 {
- let result = match tweeter.profile.clone() {
- Some(user_creds) => queryer.do_api_post(&format!("{}?status={}", CREATE_TWEET_URL, substituted), &tweeter.app_key, &user_creds),
- None => Err("No logged in user to tweet as".to_owned())
- };
- match result {
- Ok(_) => (),
- Err(e) => tweeter.display_info.status(e)
- }
- } else {
- // TODO: this 140 is maybe sometimes 280.. :)
- // and see if weighted_character_count still does things?
- tweeter.display_info.status(format!("tweet is too long: {}/140 chars", text.len()));
+ let result = match tweeter.profile.clone() {
+ Some(user_creds) => queryer.do_api_post(&format!("{}?status={}", CREATE_TWEET_URL, substituted), &tweeter.app_key, &user_creds),
+ None => Err("No logged in user to tweet as".to_owned())
+ };
+ match result {
+ Ok(_) => (),
+ Err(e) => tweeter.display_info.status(e)
}
}
diff --git a/src/display/mod.rs b/src/display/mod.rs
index 6df3b28..1c26678 100644
--- a/src/display/mod.rs
+++ b/src/display/mod.rs
@@ -71,7 +71,7 @@ impl DisplayInfo {
}
/*
- * wraps x so each line is indentation or fewer characters, after splitting by \n.
+ * wraps x so each line is width or fewer characters, after splitting by \n.
*/
fn into_display_lines(x: Vec<String>, width: u16) -> Vec<String> {
let split_on_newline: Vec<String> = x.into_iter()