adium-1.4 2774:6bcb9802d1cf: Let twitter.com handle truncating t...

commits at adium.im commits at adium.im
Sat Nov 21 05:03:21 UTC 2009


details:	http://hg.adium.im/adium-1.4/rev/6bcb9802d1cf
revision:	2774:6bcb9802d1cf
author:		Zachary West <zacw at adium.im>
date:		Sat Nov 21 00:03:17 2009 -0500

Let twitter.com handle truncating text where appropriate; other clients send past the limit, and Twitter likes to shorten URLs in weird ways.

diffs (48 lines):

diff -r d0d890cbbe2d -r 6bcb9802d1cf Plugins/Twitter Plugin/MGTwitterEngine/MGTwitterEngine.m
--- a/Plugins/Twitter Plugin/MGTwitterEngine/MGTwitterEngine.m	Fri Nov 20 14:49:37 2009 -0500
+++ b/Plugins/Twitter Plugin/MGTwitterEngine/MGTwitterEngine.m	Sat Nov 21 00:03:17 2009 -0500
@@ -838,13 +838,8 @@
     
     NSString *path = @"account/update_location.xml";
     
-    NSString *trimmedText = location;
-    if ([trimmedText length] > MAX_LOCATION_LENGTH) {
-        trimmedText = [trimmedText substringToIndex:MAX_LOCATION_LENGTH];
-    }
-    
     NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0];
-    [params setObject:trimmedText forKey:@"location"];
+    [params setObject:location forKey:@"location"];
     NSString *body = [self _queryStringWithBase:nil parameters:params prefixed:NO];
     
     return [self _sendRequestWithMethod:HTTP_POST_METHOD path:path 
@@ -1278,13 +1273,8 @@
     
     NSString *path = @"statuses/update.xml";
     
-    NSString *trimmedText = status;
-    if ([trimmedText length] > MAX_MESSAGE_LENGTH) {
-        trimmedText = [trimmedText substringToIndex:MAX_MESSAGE_LENGTH];
-    }
-    
     NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0];
-    [params setObject:trimmedText forKey:@"status"];
+    [params setObject:status forKey:@"status"];
     if (updateID > 0) {
         [params setObject:updateID forKey:@"in_reply_to_status_id"];
     }
@@ -1338,13 +1328,8 @@
     
     NSString *path = @"direct_messages/new.xml";
     
-    NSString *trimmedText = message;
-    if ([trimmedText length] > MAX_MESSAGE_LENGTH) {
-        trimmedText = [trimmedText substringToIndex:MAX_MESSAGE_LENGTH];
-    }
-    
     NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0];
-    [params setObject:trimmedText forKey:@"text"];
+    [params setObject:message forKey:@"text"];
     [params setObject:username forKey:@"user"];
     NSString *body = [self _queryStringWithBase:nil parameters:params prefixed:NO];
     




More information about the commits mailing list