adium 2912:31c121fed3f9: Let twitter.com handle truncating text ...

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


details:	http://hg.adium.im/adium/rev/31c121fed3f9
revision:	2912:31c121fed3f9
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.
(transplanted from 6bcb9802d1cf0e8e9942b666be390c14dcf13242)

diffs (48 lines):

diff -r 6fdc9dd9a809 -r 31c121fed3f9 Plugins/Twitter Plugin/MGTwitterEngine/MGTwitterEngine.m
--- a/Plugins/Twitter Plugin/MGTwitterEngine/MGTwitterEngine.m	Fri Nov 20 14:50:28 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