adium/adium

Merged adium-1.5.7 into adium-1.6.
adium-1.6
2013-06-25, Thijs Alkemade
b21557d6db30
Merged adium-1.5.7 into adium-1.6.
--- a/Plugins/Purple Service/AIPurpleCertificateTrustWarningAlert.m Tue Jun 25 21:29:29 2013 +0200
+++ b/Plugins/Purple Service/AIPurpleCertificateTrustWarningAlert.m Tue Jun 25 21:49:22 2013 +0200
@@ -26,8 +26,6 @@
//#define ALWAYS_SHOW_TRUST_WARNING
-static NSMutableDictionary *acceptedCertificates = nil;
-
@interface AIPurpleCertificateTrustWarningAlert ()
- (id)initWithAccount:(AIAccount*)account
hostname:(NSString*)hostname
@@ -76,8 +74,6 @@
userData:(void*)ud
{
if((self = [super init])) {
- if(!acceptedCertificates)
- acceptedCertificates = [[NSMutableDictionary alloc] init];
query_cert_cb = _query_cert_cb;
certificates = certs;
@@ -107,23 +103,6 @@
CSSM_DATA data;
err = SecCertificateGetData((SecCertificateRef)CFArrayGetValueAtIndex(certificates, 0), &data);
- if(err == noErr) {
- // Did we ask the user to confirm this certificate before?
- // Note that this information is not stored on the disk, which is on purpose.
- NSUInteger oldCertHash = [[acceptedCertificates objectForKey:hostname] unsignedIntegerValue];
- if (oldCertHash) {
- NSData *certData = [[NSData alloc] initWithBytesNoCopy:data.Data length:data.Length freeWhenDone:NO];
- NSUInteger newCertHash = [certData hash];
- [certData release];
-
- if (oldCertHash == newCertHash) {
- query_cert_cb(true, userdata);
- [self release];
- return;
- }
- }
- }
-
err = SecPolicySearchCreate(CSSM_CERT_X_509v3, &CSSMOID_APPLE_TP_SSL, NULL, &searchRef);
if(err != noErr) {
@@ -272,7 +251,7 @@
didEndSelector:@selector(certificateTrustSheetDidEnd:returnCode:contextInfo:)
contextInfo:window
trust:trustRef
- message:title];
+ message:title];
}
@@ -286,17 +265,6 @@
NSWindow *parentWindow = (NSWindow *)contextInfo;
query_cert_cb(didTrustCerficate, userdata);
- /* If the user confirmed this cert, we store this information until the app is closed so the user doesn't have to re-confirm it every time
- * (doing otherwise might be particularily annoying on auto-reconnect)
- */
- if (didTrustCerficate) {
- CSSM_DATA certdata;
- OSStatus err = SecCertificateGetData((SecCertificateRef)CFArrayGetValueAtIndex(certificates, 0), &certdata);
- if(err == noErr) {
- [acceptedCertificates setObject:[NSNumber numberWithUnsignedInteger:[[NSData dataWithBytes:certdata.Data length:certdata.Length] hash]]
- forKey:hostname];
- }
- }
[trustpanel release];
--- a/Plugins/Twitter Plugin/AITwitterAccount.m Tue Jun 25 21:29:29 2013 +0200
+++ b/Plugins/Twitter Plugin/AITwitterAccount.m Tue Jun 25 21:49:22 2013 +0200
@@ -1036,37 +1036,45 @@
[listContact setValue:[NSNumber numberWithBool:YES] forProperty:TWITTER_PROPERTY_REQUESTED_USER_ICON notify:NotifyNever];
static dispatch_semaphore_t imageDownloadSemaphore;
+ static dispatch_queue_t imageDownloadScheduleQueue;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
imageDownloadSemaphore = dispatch_semaphore_create(16);
+ imageDownloadScheduleQueue = dispatch_queue_create("im.adium.AITwitterAccount.imageDownloadScheduleQueue", NULL);
+ dispatch_set_target_queue(imageDownloadScheduleQueue, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0));
});
- // Grab the user icon and set it as their serverside icon.
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
- NSString *imageURL = [url stringByReplacingOccurrencesOfString:@"_normal." withString:@"_bigger."];
- NSURLRequest *imageRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:imageURL]];
- NSError *error = nil;
+ dispatch_async(imageDownloadScheduleQueue, ^{
dispatch_semaphore_wait(imageDownloadSemaphore, DISPATCH_TIME_FOREVER);
- NSData *data = [NSURLConnection sendSynchronousRequest:imageRequest returningResponse:nil error:&error];
- dispatch_semaphore_signal(imageDownloadSemaphore);
- NSImage *image = [[[NSImage alloc] initWithData:data] autorelease];
-
- if (image) {
- dispatch_async(dispatch_get_main_queue(), ^{
- AILogWithSignature(@"%@ Updated user icon for %@", self, listContact);
- [listContact setServersideIconData:[image TIFFRepresentation]
- notify:NotifyLater];
-
- [listContact setValue:nil forProperty:TWITTER_PROPERTY_REQUESTED_USER_ICON notify:NotifyNever];
- [listContact setValue:url forProperty:TWITTER_PROPERTY_USER_ICON_URL afterDelay:NotifyNever];
- });
- } else {
- dispatch_async(dispatch_get_main_queue(), ^{
- [self requestFailed:AITwitterUserIconPull withError:error userInfo:@{ @"ListContact" : listContact }];
- });
- }
+ // Grab the user icon and set it as their serverside icon.
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
+ NSString *imageURL = [url stringByReplacingOccurrencesOfString:@"_normal." withString:@"_bigger."];
+ NSURLRequest *imageRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:imageURL]];
+ NSError *error = nil;
+
+ NSData *data = [NSURLConnection sendSynchronousRequest:imageRequest returningResponse:nil error:&error];
+
+ NSImage *image = [[[NSImage alloc] initWithData:data] autorelease];
+
+ if (image) {
+ dispatch_async(dispatch_get_main_queue(), ^{
+ AILogWithSignature(@"%@ Updated user icon for %@", self, listContact);
+ [listContact setServersideIconData:[image TIFFRepresentation]
+ notify:NotifyLater];
+
+ [listContact setValue:nil forProperty:TWITTER_PROPERTY_REQUESTED_USER_ICON notify:NotifyNever];
+ [listContact setValue:url forProperty:TWITTER_PROPERTY_USER_ICON_URL afterDelay:NotifyNever];
+ });
+ } else {
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [self requestFailed:AITwitterUserIconPull withError:error userInfo:@{ @"ListContact" : listContact }];
+ });
+ }
+
+ dispatch_semaphore_signal(imageDownloadSemaphore);
+ });
});
}
}