Permalink
Browse files

Applied Xcode's format code.

  • Loading branch information...
1 parent 3f6888b commit 9ad9e2de3566247537f1408fd729add364027d1c Igor Sutton committed Sep 7, 2010
Showing with 23 additions and 29 deletions.
  1. +3 −3 TKPost.m
  2. +2 −5 TKTumblr.h
  3. +18 −20 TKTumblr.m
  4. +0 −1 TKTumblrReadRequest.m
View
@@ -143,9 +143,9 @@ - (NSString *)typeAsString
- (NSDictionary *)attributesAsDictionary
{
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
- [self typeAsString], @"type",
- [self group], @"group",
- nil];
+ [self typeAsString], @"type",
+ [self group], @"group",
+ nil];
return dict;
}
View
@@ -21,21 +21,19 @@
#import "TKPost.h"
#import "TKTumblrReadRequest.h"
-
#define Log(format, ...) NSLog(@"%s:%@", __PRETTY_FUNCTION__, [NSString stringWithFormat:format, ## __VA_ARGS__]);
-typedef enum {
+typedef enum
+{
TKTumblrCreated = 201,
TKTumblrBadRequest = 400,
TKTumblrForbidden = 403
} TKTumblrResponseReturnCode;
-
@protocol TKTumblrDelegate
@optional
- (void)tumblrDidReceivePost:(TKPost *)thePost withDomain:(NSString *)theDomain;
-
- (void)tumblrWillUploadPost:(TKPost *)thePost withDomain:(NSString *)theDomain;
- (void)tumblrDidUploadPost:(TKPost *)thePost withDomain:(NSString *)theDomain postID:(NSNumber *)thePostID;
- (void)tumblrDidFailToUploadPost:(TKPost *)thePost withDomain:(NSString *)theDomain returnCode:(TKTumblrResponseReturnCode)theReturnCode;
@@ -69,4 +67,3 @@ typedef enum {
- (NSDictionary *)attributesAsDictionary;
@end
-
View
@@ -22,7 +22,6 @@
#include "NSString+TumblrKit.h"
#include "NSDictionary+TumblrKit.h"
-
@implementation TKTumblr
@synthesize delegate, email, password, currentPost, currentElementName, requestedPost;
@@ -80,7 +79,6 @@ - (void)postsWithReadRequest:(TKTumblrReadRequest *)theReadRequest
[parser release];
}
-
- (BOOL)uploadPost:(TKPost *)thePost
{
return [self uploadPost:thePost withDomain:nil];
@@ -102,21 +100,21 @@ - (BOOL)uploadPost:(TKPost *)thePost withDomain:(NSString *)theDomain
[theURLRequest setHTTPMethod:@"POST"];
[theURLRequest setValue:@"8bit"
- forHTTPHeaderField:@"Content-Transfer-Encoding"];
+ forHTTPHeaderField:@"Content-Transfer-Encoding"];
[theURLRequest setValue:[NSString stringWithFormat:@"%d", [postString length]]
- forHTTPHeaderField:@"Content-Length"];
+ forHTTPHeaderField:@"Content-Length"];
[theURLRequest setValue:[NSString stringWithFormat:@"multipart/form-data; boundary=%@", [NSString MIMEBoundary]]
- forHTTPHeaderField:@"Content-Type"];
+ forHTTPHeaderField:@"Content-Type"];
[theURLRequest setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEncoding]];
NSError *error = nil;
NSHTTPURLResponse *theURLResponse = nil;
NSData *responseData = [NSURLConnection sendSynchronousRequest:theURLRequest
- returningResponse:&theURLResponse
- error:&error];
+ returningResponse:&theURLResponse
+ error:&error];
// Release the request before we can enter some potentially danger
// code path.
@@ -126,8 +124,8 @@ - (BOOL)uploadPost:(TKPost *)thePost withDomain:(NSString *)theDomain
if (([theURLResponse statusCode] != TKTumblrCreated)) {
if (delegate && [delegate respondsToSelector:@selector(tumblrDidFailToUploadPost:withDomain:returnCode:)]) {
[delegate tumblrDidFailToUploadPost:thePost
- withDomain:theDomain
- returnCode:[theURLResponse statusCode]];
+ withDomain:theDomain
+ returnCode:[theURLResponse statusCode]];
}
return NO;
}
@@ -141,8 +139,8 @@ - (BOOL)uploadPost:(TKPost *)thePost withDomain:(NSString *)theDomain
if (delegate && [delegate respondsToSelector:@selector(tumblrDidUploadPost:withDomain:postID:)]) {
[delegate tumblrDidUploadPost:thePost
- withDomain:theDomain
- postID:postID];
+ withDomain:theDomain
+ postID:postID];
}
return YES;
@@ -151,9 +149,9 @@ - (BOOL)uploadPost:(TKPost *)thePost withDomain:(NSString *)theDomain
- (NSDictionary *)attributesAsDictionary
{
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
- email, @"email",
- password, @"password",
- nil];
+ email, @"email",
+ password, @"password",
+ nil];
return dict;
}
@@ -186,12 +184,12 @@ - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
if (!elementToSelectorDict) {
elementToSelectorDict = [NSDictionary dictionaryWithObjectsAndKeys:
- @"appendToText:", @"text",
- @"appendToCaption:",@"caption",
- @"appendToPlayer:", @"player",
- @"appendToBody:", @"body",
- @"setURLWithString:", @"url",
- nil];
+ @"appendToText:", @"text",
+ @"appendToCaption:",@"caption",
+ @"appendToPlayer:", @"player",
+ @"appendToBody:", @"body",
+ @"setURLWithString:", @"url",
+ nil];
}
NSString *key = [[currentElementName componentsSeparatedByString:@"-"] lastObject];
@@ -20,7 +20,6 @@
#import "TKTumblrReadRequest.h"
-
static NSString *TKPostTypeAsQueryString[] =
{
@"all",

0 comments on commit 9ad9e2d

Please sign in to comment.