spaces to tabs for /Mac/ and /Linux/
This commit is contained in:
parent
093f8e4333
commit
f7240ea2e5
18 changed files with 700 additions and 700 deletions
|
@ -13,109 +13,109 @@
|
|||
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
// Initialization code here.
|
||||
d = [NSUserDefaults standardUserDefaults];
|
||||
//[d removeObjectForKey:@"user_access_token"];
|
||||
}
|
||||
|
||||
return self;
|
||||
self = [super init];
|
||||
if (self) {
|
||||
// Initialization code here.
|
||||
d = [NSUserDefaults standardUserDefaults];
|
||||
//[d removeObjectForKey:@"user_access_token"];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setString:(NSString *)string forKey:(NSString *)aKey
|
||||
{
|
||||
[d setObject:string forKey:aKey];
|
||||
[d synchronize];
|
||||
[d setObject:string forKey:aKey];
|
||||
[d synchronize];
|
||||
}
|
||||
|
||||
- (NSString *)stringForKey:(NSString *)aKey
|
||||
{
|
||||
return [d objectForKey:aKey];
|
||||
return [d objectForKey:aKey];
|
||||
}
|
||||
|
||||
- (void)setAccessToken:(NSString *)_accessToken
|
||||
{
|
||||
[d synchronize];
|
||||
[d synchronize];
|
||||
}
|
||||
|
||||
- (NSString *)accessToken
|
||||
{
|
||||
return [d objectForKey:@"accessToken"];
|
||||
return [d objectForKey:@"accessToken"];
|
||||
}
|
||||
|
||||
- (void)setSecret:(NSString *)_secret
|
||||
{
|
||||
UInt32 _passwordLength = 0;
|
||||
char *_password = nil;
|
||||
SecKeychainItemRef item = nil;
|
||||
SecKeychainFindGenericPassword(NULL, 6, "Bungloo", 17, "BunglooUserAccount", &_passwordLength, (void **)&_password, &item);
|
||||
|
||||
OSStatus status;
|
||||
void * passwordData = (void*)[_secret cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
UInt32 passwordLength = strlen((char*)passwordData);
|
||||
if (!item)
|
||||
{
|
||||
status = SecKeychainAddGenericPassword(
|
||||
NULL, // default keychain
|
||||
6, // length of service name
|
||||
"Bungloo", // service name
|
||||
17, // length of account name
|
||||
"BunglooUserAccount", // account name
|
||||
passwordLength, // length of password
|
||||
passwordData, // pointer to password data
|
||||
NULL // the item reference
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
status = SecKeychainItemModifyContent(
|
||||
item,
|
||||
NULL,
|
||||
passwordLength,
|
||||
passwordData
|
||||
);
|
||||
}
|
||||
NSLog(@"%@",(NSString *)SecCopyErrorMessageString (status,NULL));
|
||||
UInt32 _passwordLength = 0;
|
||||
char *_password = nil;
|
||||
SecKeychainItemRef item = nil;
|
||||
SecKeychainFindGenericPassword(NULL, 6, "Bungloo", 17, "BunglooUserAccount", &_passwordLength, (void **)&_password, &item);
|
||||
|
||||
OSStatus status;
|
||||
void * passwordData = (void*)[_secret cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
UInt32 passwordLength = strlen((char*)passwordData);
|
||||
if (!item)
|
||||
{
|
||||
status = SecKeychainAddGenericPassword(
|
||||
NULL, // default keychain
|
||||
6, // length of service name
|
||||
"Bungloo", // service name
|
||||
17, // length of account name
|
||||
"BunglooUserAccount", // account name
|
||||
passwordLength, // length of password
|
||||
passwordData, // pointer to password data
|
||||
NULL // the item reference
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
status = SecKeychainItemModifyContent(
|
||||
item,
|
||||
NULL,
|
||||
passwordLength,
|
||||
passwordData
|
||||
);
|
||||
}
|
||||
NSLog(@"%@",(NSString *)SecCopyErrorMessageString (status,NULL));
|
||||
}
|
||||
|
||||
- (NSString *)secret
|
||||
{
|
||||
UInt32 passwordLength = 0;
|
||||
char *password = nil;
|
||||
SecKeychainItemRef item = nil;
|
||||
SecKeychainFindGenericPassword(NULL, 6, "Bungloo", 17, "BunglooUserAccount", &passwordLength, (void **)&password, &item);
|
||||
|
||||
if (!item) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
//Get password
|
||||
NSString *passwordString = [[[NSString alloc] initWithData:[NSData dataWithBytes:password length:passwordLength] encoding:NSUTF8StringEncoding] autorelease];
|
||||
SecKeychainItemFreeContent(NULL, password);
|
||||
return passwordString;
|
||||
UInt32 passwordLength = 0;
|
||||
char *password = nil;
|
||||
SecKeychainItemRef item = nil;
|
||||
SecKeychainFindGenericPassword(NULL, 6, "Bungloo", 17, "BunglooUserAccount", &passwordLength, (void **)&password, &item);
|
||||
|
||||
if (!item) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
//Get password
|
||||
NSString *passwordString = [[[NSString alloc] initWithData:[NSData dataWithBytes:password length:passwordLength] encoding:NSUTF8StringEncoding] autorelease];
|
||||
SecKeychainItemFreeContent(NULL, password);
|
||||
return passwordString;
|
||||
}
|
||||
|
||||
- (void)setUserId:(NSString *)_userId
|
||||
{
|
||||
[d setObject:_userId forKey:@"userId"];
|
||||
[d synchronize];
|
||||
[d setObject:_userId forKey:@"userId"];
|
||||
[d synchronize];
|
||||
}
|
||||
|
||||
- (NSString *)userId
|
||||
{
|
||||
return [d objectForKey:@"userId"];
|
||||
return [d objectForKey:@"userId"];
|
||||
}
|
||||
|
||||
- (void)setScreenName:(NSString *)_screenName
|
||||
{
|
||||
[d setObject:_screenName forKey:@"screenName"];
|
||||
[d synchronize];
|
||||
[d setObject:_screenName forKey:@"screenName"];
|
||||
[d synchronize];
|
||||
}
|
||||
|
||||
- (NSString *)screenName
|
||||
{
|
||||
return [d objectForKey:@"screenName"];
|
||||
return [d objectForKey:@"screenName"];
|
||||
}
|
||||
|
||||
+ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector {
|
||||
|
|
Reference in a new issue