Permalink
Browse files

Fixed TouchJson bug with sendRetweet/deleteUpdate & XAuth

  • Loading branch information...
farnell committed May 8, 2010
1 parent 742ab9c commit 7b572caf3cb504008d1f27c3e4c8fceeefea3770
Showing with 32 additions and 18 deletions.
  1. +31 −17 MGTwitterEngine.m
  2. +1 −1 MGTwitterEngineGlobalHeader.h
View
@@ -60,10 +60,10 @@
#define MAX_LOCATION_LENGTH 30
#define MAX_DESCRIPTION_LENGTH 160
-#define DEFAULT_CLIENT_NAME @"MGTwitterEngine"
+#define DEFAULT_CLIENT_NAME @"MeMap"
#define DEFAULT_CLIENT_VERSION @"1.0"
-#define DEFAULT_CLIENT_URL @"http://mattgemmell.com/source"
-#define DEFAULT_CLIENT_TOKEN @"mgtwitterengine"
+#define DEFAULT_CLIENT_URL @"http://www.memap.com"
+#define DEFAULT_CLIENT_TOKEN @"memap"
#define URL_REQUEST_TIMEOUT 25.0 // Twitter usually fails quickly if it's going to fail at all.
@@ -456,24 +456,23 @@ - (NSString *)_sendRequestWithMethod:(NSString *)method
NSString *finalBody = @"";
if (body) {
finalBody = [finalBody stringByAppendingString:body];
- }
- if (_clientSourceToken) {
- finalBody = [finalBody stringByAppendingString:[NSString stringWithFormat:@"%@source=%@",
- (body) ? @"&" : @"?" ,
- _clientSourceToken]];
- }
-
- if (finalBody) {
- [theRequest setHTTPBody:[finalBody dataUsingEncoding:NSUTF8StringEncoding]];
-#if DEBUG
- if (YES) {
- NSLog(@"MGTwitterEngine: finalBody = %@", finalBody);
+ if (_clientSourceToken) {
+ finalBody = [finalBody stringByAppendingString:[NSString stringWithFormat:@"%@source=%@",
+ (body) ? @"&" : @"?" ,
+ _clientSourceToken]];
}
+ if (finalBody) {
+ [theRequest setHTTPBody:[finalBody dataUsingEncoding:NSUTF8StringEncoding]];
+#if DEBUG
+ if (YES) {
+ NSLog(@"MGTwitterEngine: finalBody = %@", finalBody);
+ }
#endif
- }
+ }
+ }
+
}
-
// Create a connection using this request, with the default timeout and caching policy,
// and appropriate Twitter request and response types for parsing and error reporting.
MGTwitterHTTPURLConnection *connection;
@@ -716,9 +715,24 @@ - (void)_parseDataForConnection:(MGTwitterHTTPURLConnection *)connection
break;
}
#elif TOUCHJSON_AVAILABLE
+ /*
[MGTwitterTouchJSONParser parserWithJSON:jsonData delegate:self
connectionIdentifier:identifier requestType:requestType
responseType:responseType URL:URL deliveryOptions:_deliveryOptions];
+ */
+ switch (responseType) {
+ case MGTwitterOAuthToken:;
+ OAToken *token = [[[OAToken alloc] initWithHTTPResponseBody:[[[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding] autorelease]] autorelease];
+ [self parsingSucceededForRequest:identifier ofResponseType:requestType
+ withParsedObjects:[NSArray arrayWithObject:token]];
+ break;
+ default:
+ [MGTwitterTouchJSONParser parserWithJSON:jsonData delegate:self
+ connectionIdentifier:identifier requestType:requestType
+ responseType:responseType URL:URL deliveryOptions:_deliveryOptions];
+ break;
+ }
+
#endif
}
@@ -49,7 +49,7 @@
*/
#define YAJL_AVAILABLE 0
-#define TOUCHJSON_AVAILABLE 0
+#define TOUCHJSON_AVAILABLE 1
#if YAJL_AVAILABLE
/*

0 comments on commit 7b572ca

Please sign in to comment.