Created
January 2, 2011 01:25
-
-
Save skyzyx/762179 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- DIBookmarksController-old.m 2011-01-01 15:04:30.000000000 -0800 | |
+++ DIBookmarksController.m 2011-01-01 15:19:23.000000000 -0800 | |
@@ -86,21 +86,21 @@ | |
@"loginwindow", kCFPreferencesCurrentUser, kCFPreferencesAnyHost); | |
CFPreferencesSynchronize((CFStringRef) @"loginwindow", kCFPreferencesCurrentUser, kCFPreferencesAnyHost); | |
} | |
[loginItems release]; | |
} | |
- (KeychainItem *)getKeychainUserAndPass | |
{ | |
KeychainSearch * search = [[KeychainSearch alloc] init]; | |
- [search setServer:@"del.icio.us"]; | |
+ [search setServer:@"pinboard.in"]; | |
NSArray *results = [search internetSearchResults]; | |
[search release]; | |
if ([results count] <= 0) { | |
return nil; | |
} | |
KeychainItem *item = [results objectAtIndex:0]; | |
[username release]; | |
username = [[item account] retain]; | |
[password release]; | |
@@ -137,25 +137,25 @@ | |
- (void)applicationDidFinishLaunching:(NSNotification *)notification | |
{ | |
[self addToLoginItems]; | |
[self getKeychainUserAndPass]; | |
[self updateList:nil]; | |
} | |
- (NSXMLDocument *)deliciousAPIResponseToRequest:(NSString *)request | |
{ | |
- NSString *apiPath = [NSString stringWithFormat:@"https://%@:%@@api.del.icio.us/v1/", username, password, nil]; | |
+ NSString *apiPath = [NSString stringWithFormat:@"https://%@:%@@api.pinboard.in/v1/", username, password, nil]; | |
NSError *error; | |
NSURL *requestURL = [NSURL URLWithString:[apiPath stringByAppendingString:request]]; | |
NSMutableURLRequest *URLRequest = [NSMutableURLRequest requestWithURL:requestURL]; | |
- [URLRequest setValue: @"delimport/0.3" forHTTPHeaderField: @"User-Agent"]; | |
+ [URLRequest setValue: @"delimport/0.3.1-unofficial" forHTTPHeaderField: @"User-Agent"]; | |
// NSLog(@"%f", [URLRequest timeoutInterval]); | |
NSHTTPURLResponse *response; | |
NSData * xmlData = [NSURLConnection sendSynchronousRequest:URLRequest returningResponse:&response error:&error]; | |
NSLog(@"API request: '%@', response: %i, d/l size: %i", request, [response statusCode], [xmlData length], nil); | |
if ([response statusCode] == 401) { | |
[self logIn]; | |
return nil; | |
} | |
if ([response statusCode] == 503) { | |
@@ -190,21 +190,21 @@ | |
{ | |
[username release]; | |
[password release]; | |
[loginController getUsername:&username password:&password]; | |
[username retain]; | |
[password retain]; | |
Keychain *keychain = [Keychain defaultKeychain]; | |
- [keychain addInternetPassword:password onServer:@"del.icio.us" forAccount:username port:80 path:@"" inSecurityDomain:@"" protocol:kSecProtocolTypeHTTP auth:kSecAuthenticationTypeHTTPDigest replaceExisting:YES]; | |
+ [keychain addInternetPassword:password onServer:@"pinboard.in" forAccount:username port:443 path:@"" inSecurityDomain:@"" protocol:kSecProtocolTypeHTTP auth:kSecAuthenticationTypeHTTPDigest replaceExisting:YES]; | |
} | |
- (NSDate *)dateFromXMLDateString:(NSString *)string | |
{ | |
NSMutableString *dateString = [[string mutableCopy] autorelease]; | |
[dateString replaceOccurrencesOfString:@"T" withString:@" " options:NSLiteralSearch range:NSMakeRange(0, [dateString length])]; | |
[dateString replaceOccurrencesOfString:@"Z" withString:@" " options:NSLiteralSearch range:NSMakeRange(0, [dateString length])]; | |
[dateString appendString:@"+0000"]; | |
return [NSDate dateWithString:dateString]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment