Adium

Changeset 22501

Show
Ignore:
Timestamp:
01/28/2008 05:20:57 PM (10 months ago)
Author:
evands
Message:

Merged [22500]: Handle Google Talk certificates properly, including Google Talk for Domains. Fixes #8529.
Also, fixed a visual glitch as the certificate sheet closes; there's no reason to wait a run loop to close its parent window.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/adium-1.2/Plugins/Purple Service/AIPurpleCertificateTrustWarningAlert.m

    r22481 r22501  
    1717#import <AIUtilities/AITigerCompatibility.h> 
    1818 
    19 #define ALWAYS_SHOW_TRUST_WARNING 
     19//#define ALWAYS_SHOW_TRUST_WARNING 
    2020 
    2121static NSMutableDictionary *acceptedCertificates = nil; 
     
    3737@implementation AIPurpleCertificateTrustWarningAlert 
    3838 
    39 + (void)displayTrustWarningAlertWithAccount:(AIAccount*)account 
    40                                                                    hostname:(NSString*)hostname 
     39+ (void)displayTrustWarningAlertWithAccount:(AIAccount *)account 
     40                                                                   hostname:(NSString *)hostname 
    4141                                                           certificates:(CFArrayRef)certs 
    4242                                                         resultCallback:(void (*)(gboolean trusted, void *userdata))_query_cert_cb 
    4343                                                                   userData:(void*)ud 
    4444{ 
    45         if([account isKindOfClass:[AIPurpleGTalkAccount class]]) 
    46                 hostname = @"gmail.com"; // messed up certificate CN of gtalk 
     45        if ([hostname caseInsensitiveCompare:@"talk.google.com"] == NSOrderedSame) { 
     46                NSString *UID = [account UID]; 
     47                NSRange startOfDomain = [UID rangeOfString:@"@"]; 
     48                if (startOfDomain.location == NSNotFound || 
     49                        ([[UID substringFromIndex:NSMaxRange(startOfDomain)] caseInsensitiveCompare:@"gmail.com"] == NSOrderedSame)) { 
     50                        /* Google Talk accounts end up with a cert signed using gmail.com as the server. 
     51                         * However, Google For Domains accounts are signed using talk.google.com. 
     52                         */ 
     53                        hostname = @"gmail.com"; 
     54                } 
     55        } 
     56 
    4757        AIPurpleCertificateTrustWarningAlert *alert = [[self alloc] initWithAccount:account hostname:hostname certificates:certs resultCallback:_query_cert_cb userData:ud]; 
    4858        [alert showWindow:nil]; 
     
    289299        CFRelease(trustRef); 
    290300 
    291         [parentWindow performSelector:@selector(performClose:) withObject:nil afterDelay:0.0]; 
     301        [parentWindow performClose:nil]; 
    292302         
    293303        [self release];