Commits

Peter Hosey  committed 8da49fc

Attempting to get the MobileMe password in MailMe. If successful, fixes #105.

  • Participants
  • Parent commits 0af179d
  • Branches maintenance-1.2

Comments (0)

Files changed (1)

File Plugins/Displays/MailMe/GrowlMailMeDisplay.m

 				kSecProtocolTypeSMTP, kSecAuthenticationTypeAny,
 				&passwordLength, &passwordBytes,
 				/*itemRef*/ NULL);
+
 			if (err != noErr) {
-				NSLog(@"MailMe: Could not get password for SMTP account %@: %i/%s", userAtHostPort, (int)err, GetMacOSStatusCommentString(err));
+				//Try looking it up as a MobileMe account.
+				NSMutableArray *usernameComponents = [[[username componentsSeparatedByString:@"@"] mutableCopy] autorelease];
+				[usernameComponents removeLastObject];
+				username = [usernameComponents componentsJoinedByString:@"@"];
+
+				NSString *serviceName = @"iTools";
+
+				err = SecKeychainFindGenericPassword(/*keychainOrArray*/ NULL,
+					(UInt32)[serviceName length], [serviceName UTF8String],
+					(UInt32)[username length],    [username UTF8String],
+					&passwordLength,              &passwordBytes,
+					/*itemRef*/ NULL);
+
+				if (err != noErr) {
+					NSLog(@"MailMe: Could not get password for SMTP account %@: %i/%s", userAtHostPort, (int)err, GetMacOSStatusCommentString(err));
+				}
 			} else {
 				NSData *passwordData = [NSData dataWithBytesNoCopy:passwordBytes length:passwordLength freeWhenDone:NO];