@class SelectIdentityController;
@class AuthenticationController;
+@class Identities;
@interface IPCClient : NSObject {
mach_port_t port;
@property (readonly, retain) AuthenticationController *authController;
- (void) cleanup;
+- (void) saveIdentityToFavoritesIfSuccessful;
- (kim_error) selectIdentity: (NSDictionary *) info;
- (kim_error) enterIdentity: (NSDictionary *) info;
#import "SelectIdentityController.h"
#import "AuthenticationController.h"
#import "KerberosAgentListener.h"
+#import "Identities.h"
enum krb_agent_client_state {
ipc_client_state_idle,
- (void) cleanup
{
+ if (![[self.selectController window] isVisible]) {
+ [self saveIdentityToFavoritesIfSuccessful];
+ }
[self.selectController close];
[self.authController close];
self.selectController = nil;
self.currentInfo = nil;
}
+- (void) saveIdentityToFavoritesIfSuccessful
+{
+ NSString *identityString = [self.currentInfo valueForKeyPath:@"identity_string"];
+ NSDictionary *options = [self.currentInfo valueForKeyPath:@"options"];
+
+ Identities *identities = [[Identities alloc] init];
+ Identity *theIdentity = [[Identity alloc] initWithIdentity:identityString
+ options:options];
+ for (Identity *anIdentity in [identities identities]) {
+ if ([anIdentity isEqual:theIdentity]) {
+ if (!anIdentity.favorite) {
+ anIdentity.favorite = YES;
+ [identities synchronizePreferences];
+ }
+ break;
+ }
+ }
+}
+
- (void) didCancel
{
kim_error err = KIM_USER_CANCELED_ERR;
}
//NSLog(@"waited %@", [[NSThread currentThread] description]);
- [(Identities *) [connection rootProxy] update];
+ [(Identities *) [connection rootProxy] reload];
sleep (1);
}