Changeset 6170


Ignore:
Timestamp:
Jun 13, 2008, 4:52:46 AM (14 years ago)
Author:
livings124
Message:

if setting the proxy password to blank, delete it from the keychain

Location:
trunk/macosx
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r6168 r6170  
    229229                                [fDefaults boolForKey: @"ProxyAuthorize"],
    230230                                [[fDefaults stringForKey: @"ProxyUsername"] UTF8String],
    231                                 ""); /* reset in prefs - from Keychain (leave blank instead of NULL) */
     231                                NULL); /* reset in prefs - from Keychain */
    232232       
    233233        [NSApp setDelegate: self];
  • trunk/macosx/EMKeychain/EMKeychainItem.h

    r6158 r6170  
    4141- (BOOL)setUsername:(NSString *)newUsername;
    4242- (BOOL)setLabel:(NSString *)newLabel;
     43
     44//added by ML
     45- (void)removeFromKeychain;
    4346@end
    4447
  • trunk/macosx/EMKeychain/EMKeychainItem.m

    r6158 r6170  
    8383        return [self modifyAttributeWithTag:kSecLabelItemAttr toBeString:newLabel];
    8484}
     85
     86- (void)removeFromKeychain
     87{
     88    SecKeychainItemDelete(coreKeychainItem);
     89}
     90
    8591@end
    8692
  • trunk/macosx/PrefsController.m

    r6169 r6170  
    758758                                            withUsername: @"Proxy"];
    759759    if (keychainItem)
    760         [keychainItem setPassword: password];
     760    {
     761        if (![password isEqualToString: @""])
     762            [keychainItem setPassword: password];
     763        else
     764            [keychainItem removeFromKeychain];
     765    }
    761766    else
    762         [[EMKeychainProxy sharedProxy] addGenericKeychainItemForService: @"Transmission:Proxy" withUsername: @"Proxy"
    763             password: password];
     767    {
     768        if (![password isEqualToString: @""])
     769            [[EMKeychainProxy sharedProxy] addGenericKeychainItemForService: @"Transmission:Proxy" withUsername: @"Proxy"
     770                password: password];
     771    }
    764772   
    765773    tr_sessionSetProxyPassword(fHandle, [password UTF8String]);
Note: See TracChangeset for help on using the changeset viewer.