William Bowling is sharing code with you

Bitbucket is a code hosting site. Unlimited public and private repositories. Free for small teams.

Don't show this again

wbowling / adium (fork of adium / adium)

Fork of Adium for patches/improvements

Clone this repository (size: 338.7 MB): HTTPS / SSH
hg clone https://bitbucket.org/wbowling/adium
hg clone ssh://hg@bitbucket.org/wbowling/adium

adium / Plugins / Purple Service / adiumPurpleCertificateTrustWarning.m

/*
 *  adiumPurpleCertificateTrustWarning.m
 *  Adium
 *
 *  Created by Andreas Monitzer on 2007-11-05.
 *  Copyright 2007 Andreas Monitzer. All rights reserved.
 *
 */

#import "adiumPurpleCertificateTrustWarning.h"
#import "AIPurpleCertificateTrustWarningAlert.h"

#import <Adium/AIAccount.h>
#import <Adium/AIAccountControllerProtocol.h>
#import "ESPurpleJabberAccount.h"

void adium_query_cert_chain(PurpleSslConnection *gsc, const char *hostname, CFArrayRef certs, void (*query_cert_cb)(gboolean trusted, void *userdata), void *userdata) {
        // only the jabber service supports this right now
        for (ESPurpleJabberAccount *account in [adium.accountController accountsCompatibleWithService:[adium.accountController firstServiceWithServiceID:@"Jabber"]]) {
                if([account secureConnection] == gsc) {
                        if([account shouldVerifyCertificates])
                                [AIPurpleCertificateTrustWarningAlert displayTrustWarningAlertWithAccount:account
                                                                                                                                                                 hostname:[NSString stringWithUTF8String:hostname]
                                                                                                                                                         certificates:certs
                                                                                                                                                   resultCallback:query_cert_cb
                                                                                                                                                                 userData:userdata];
                        else
                                query_cert_cb(true, userdata);
                        return;
                }
        }
        // default fallback
        query_cert_cb(true, userdata);
}