adium 5269:522f5ad1b16c: Removed the "generating a new key" proc...

commits at adium.im commits at adium.im
Wed Jan 23 10:55:33 UTC 2013


details:	http://hg.adium.im/adium/rev/522f5ad1b16c
revision:	5269:522f5ad1b16c
branch:		libotr4.0.0
author:		Thijs Alkemade <me at thijsalkema.de>
date:		Wed Jan 23 11:54:44 2013 +0100

Removed the "generating a new key" process window. It takes less than a second on my machine, and it is now asynchronous, so I think this window is unnecessary.

Fix a possible crash when otrl_privkey_generate_start is called again before otrl_privkey_generate_finish was called.

diffs (519 lines):

diff -r 88235175776a -r 522f5ad1b16c Adium.xcodeproj/project.pbxproj
--- a/Adium.xcodeproj/project.pbxproj	Wed Jan 23 03:39:03 2013 +0100
+++ b/Adium.xcodeproj/project.pbxproj	Wed Jan 23 11:54:44 2013 +0100
@@ -250,12 +250,10 @@
 		341BCF850961354D00CF83F5 /* AIMessageWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 341BCF810961354D00CF83F5 /* AIMessageWindow.m */; };
 		341BCF870961354D00CF83F5 /* AIClickThroughThemeDocumentButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 341BCF830961354D00CF83F5 /* AIClickThroughThemeDocumentButton.m */; };
 		341BD55D0965E97F00CF83F5 /* ESOTRPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 341BD5550965E97F00CF83F5 /* ESOTRPreferences.m */; };
-		341BD55F0965E97F00CF83F5 /* ESOTRPrivateKeyGenerationWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 341BD5570965E97F00CF83F5 /* ESOTRPrivateKeyGenerationWindowController.m */; };
 		341BD5610965E97F00CF83F5 /* ESOTRUnknownFingerprintController.m in Sources */ = {isa = PBXBuildFile; fileRef = 341BD5590965E97F00CF83F5 /* ESOTRUnknownFingerprintController.m */; };
 		341BD5630965E97F00CF83F5 /* ESOTRFingerprintDetailsWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 341BD55B0965E97F00CF83F5 /* ESOTRFingerprintDetailsWindowController.m */; };
 		341BD56C0965E9A500CF83F5 /* AdiumOTREncryption.m in Sources */ = {isa = PBXBuildFile; fileRef = 341BD56A0965E9A500CF83F5 /* AdiumOTREncryption.m */; };
 		341BD5700965EC3500CF83F5 /* OTRFingerprintDetailsWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 341BD56E0965EC3500CF83F5 /* OTRFingerprintDetailsWindow.xib */; };
-		341BD5710965EC3500CF83F5 /* OTRPrivateKeyGenerationWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 341BD56F0965EC3500CF83F5 /* OTRPrivateKeyGenerationWindow.xib */; };
 		342353D709D45726009FF634 /* AILogViewerWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 342353D509D45725009FF634 /* AILogViewerWindowController.m */; };
 		3428328907D2643F004F01C9 /* ESStatusPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 3428328507D2643F004F01C9 /* ESStatusPreferences.m */; };
 		3428328B07D2643F004F01C9 /* ESStatusPreferencesPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 3428328707D2643F004F01C9 /* ESStatusPreferencesPlugin.m */; };
@@ -2153,8 +2151,6 @@
 		341BCF830961354D00CF83F5 /* AIClickThroughThemeDocumentButton.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = AIClickThroughThemeDocumentButton.m; path = Source/AIClickThroughThemeDocumentButton.m; sourceTree = "<group>"; };
 		341BD5550965E97F00CF83F5 /* ESOTRPreferences.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = ESOTRPreferences.m; path = Source/ESOTRPreferences.m; sourceTree = "<group>"; };
 		341BD5560965E97F00CF83F5 /* ESOTRFingerprintDetailsWindowController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ESOTRFingerprintDetailsWindowController.h; path = Source/ESOTRFingerprintDetailsWindowController.h; sourceTree = "<group>"; };
-		341BD5570965E97F00CF83F5 /* ESOTRPrivateKeyGenerationWindowController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = ESOTRPrivateKeyGenerationWindowController.m; path = Source/ESOTRPrivateKeyGenerationWindowController.m; sourceTree = "<group>"; };
-		341BD5580965E97F00CF83F5 /* ESOTRPrivateKeyGenerationWindowController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ESOTRPrivateKeyGenerationWindowController.h; path = Source/ESOTRPrivateKeyGenerationWindowController.h; sourceTree = "<group>"; };
 		341BD5590965E97F00CF83F5 /* ESOTRUnknownFingerprintController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = ESOTRUnknownFingerprintController.m; path = Source/ESOTRUnknownFingerprintController.m; sourceTree = "<group>"; };
 		341BD55A0965E97F00CF83F5 /* ESOTRUnknownFingerprintController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ESOTRUnknownFingerprintController.h; path = Source/ESOTRUnknownFingerprintController.h; sourceTree = "<group>"; };
 		341BD55B0965E97F00CF83F5 /* ESOTRFingerprintDetailsWindowController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = ESOTRFingerprintDetailsWindowController.m; path = Source/ESOTRFingerprintDetailsWindowController.m; sourceTree = "<group>"; };
@@ -2163,7 +2159,6 @@
 		341BD5690965E9A500CF83F5 /* AdiumOTREncryption.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = AdiumOTREncryption.h; path = Source/AdiumOTREncryption.h; sourceTree = "<group>"; };
 		341BD56A0965E9A500CF83F5 /* AdiumOTREncryption.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = AdiumOTREncryption.m; path = Source/AdiumOTREncryption.m; sourceTree = "<group>"; };
 		341BD56E0965EC3500CF83F5 /* OTRFingerprintDetailsWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xib; name = OTRFingerprintDetailsWindow.xib; path = Resources/OTRFingerprintDetailsWindow.xib; sourceTree = "<group>"; };
-		341BD56F0965EC3500CF83F5 /* OTRPrivateKeyGenerationWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xib; name = OTRPrivateKeyGenerationWindow.xib; path = Resources/OTRPrivateKeyGenerationWindow.xib; sourceTree = "<group>"; };
 		341DE02F07FE104700EB7B06 /* de */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xib; name = de; path = Resources/de.lproj/ESFileTransferProgressView.xib; sourceTree = "<group>"; };
 		341DE03407FE105600EB7B06 /* ja */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xib; name = ja; path = Resources/ja.lproj/ESFileTransferProgressView.xib; sourceTree = "<group>"; };
 		341DE03507FE106400EB7B06 /* ja */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xib; name = ja; path = Resources/ja.lproj/PasswordPrompt.xib; sourceTree = "<group>"; };
@@ -5209,12 +5204,9 @@
 				341BD5690965E9A500CF83F5 /* AdiumOTREncryption.h */,
 				341BD56A0965E9A500CF83F5 /* AdiumOTREncryption.m */,
 				341BD56E0965EC3500CF83F5 /* OTRFingerprintDetailsWindow.xib */,
-				341BD56F0965EC3500CF83F5 /* OTRPrivateKeyGenerationWindow.xib */,
 				341BD55C0965E97F00CF83F5 /* ESOTRPreferences.h */,
 				341BD5550965E97F00CF83F5 /* ESOTRPreferences.m */,
 				341BD5560965E97F00CF83F5 /* ESOTRFingerprintDetailsWindowController.h */,
-				341BD5570965E97F00CF83F5 /* ESOTRPrivateKeyGenerationWindowController.m */,
-				341BD5580965E97F00CF83F5 /* ESOTRPrivateKeyGenerationWindowController.h */,
 				341BD5590965E97F00CF83F5 /* ESOTRUnknownFingerprintController.m */,
 				341BD55A0965E97F00CF83F5 /* ESOTRUnknownFingerprintController.h */,
 				341BD55B0965E97F00CF83F5 /* ESOTRFingerprintDetailsWindowController.m */,
@@ -9697,7 +9689,6 @@
 				34CA22300A671BEF00B11032 /* ProfilePreferences.xib in Resources */,
 				34D0FF8509569FE500DCB678 /* ProfilePreferencesDefaults.plist in Resources */,
 				341BD5700965EC3500CF83F5 /* OTRFingerprintDetailsWindow.xib in Resources */,
-				341BD5710965EC3500CF83F5 /* OTRPrivateKeyGenerationWindow.xib in Resources */,
 				349710DD096C4C7700699948 /* Buttons.strings in Resources */,
 				343EC9810970C29400349098 /* OfflineContactHidingDefaults.plist in Resources */,
 				343ECBEE0971B18E00349098 /* ShowContactInfoPrompt.xib in Resources */,
@@ -10341,7 +10332,6 @@
 				341BCF850961354D00CF83F5 /* AIMessageWindow.m in Sources */,
 				341BCF870961354D00CF83F5 /* AIClickThroughThemeDocumentButton.m in Sources */,
 				341BD55D0965E97F00CF83F5 /* ESOTRPreferences.m in Sources */,
-				341BD55F0965E97F00CF83F5 /* ESOTRPrivateKeyGenerationWindowController.m in Sources */,
 				341BD5610965E97F00CF83F5 /* ESOTRUnknownFingerprintController.m in Sources */,
 				341BD5630965E97F00CF83F5 /* ESOTRFingerprintDetailsWindowController.m in Sources */,
 				341BD56C0965E9A500CF83F5 /* AdiumOTREncryption.m in Sources */,
diff -r 88235175776a -r 522f5ad1b16c Resources/OTRPrivateKeyGenerationWindow.xib
--- a/Resources/OTRPrivateKeyGenerationWindow.xib	Wed Jan 23 03:39:03 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,233 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
-	<data>
-		<int key="IBDocument.SystemTarget">1060</int>
-		<string key="IBDocument.SystemVersion">11D50b</string>
-		<string key="IBDocument.InterfaceBuilderVersion">2182</string>
-		<string key="IBDocument.AppKitVersion">1138.32</string>
-		<string key="IBDocument.HIToolboxVersion">568.00</string>
-		<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
-			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
-			<string key="NS.object.0">2182</string>
-		</object>
-		<array key="IBDocument.IntegratedClassDependencies">
-			<string>NSTextField</string>
-			<string>NSTextFieldCell</string>
-			<string>NSWindowTemplate</string>
-			<string>NSView</string>
-			<string>NSProgressIndicator</string>
-			<string>NSCustomObject</string>
-		</array>
-		<array key="IBDocument.PluginDependencies">
-			<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-		</array>
-		<object class="NSMutableDictionary" key="IBDocument.Metadata">
-			<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
-			<integer value="1" key="NS.object.0"/>
-		</object>
-		<array class="NSMutableArray" key="IBDocument.RootObjects" id="560603597">
-			<object class="NSCustomObject" id="323364032">
-				<string key="NSClassName">ESGaimOTRPrivateKeyGenerationWindowController</string>
-			</object>
-			<object class="NSCustomObject" id="813923194">
-				<string key="NSClassName">FirstResponder</string>
-			</object>
-			<object class="NSCustomObject" id="701542123">
-				<string key="NSClassName">NSApplication</string>
-			</object>
-			<object class="NSWindowTemplate" id="630244868">
-				<int key="NSWindowStyleMask">1</int>
-				<int key="NSWindowBacking">2</int>
-				<string key="NSWindowRect">{{361, 463}, {325, 139}}</string>
-				<int key="NSWTFlags">813170688</int>
-				<string key="NSWindowTitle"/>
-				<string key="NSWindowClass">NSPanel</string>
-				<object class="NSMutableString" key="NSViewClass">
-					<characters key="NS.bytes">View</characters>
-				</object>
-				<nil key="NSUserInterfaceItemIdentifier"/>
-				<string key="NSWindowContentMinSize">{213, 50}</string>
-				<object class="NSView" key="NSWindowView" id="177031615">
-					<nil key="NSNextResponder"/>
-					<int key="NSvFlags">256</int>
-					<array class="NSMutableArray" key="NSSubviews">
-						<object class="NSProgressIndicator" id="704654791">
-							<reference key="NSNextResponder" ref="177031615"/>
-							<int key="NSvFlags">1280</int>
-							<object class="NSPSMatrix" key="NSDrawMatrix"/>
-							<string key="NSFrame">{{146, 20}, {32, 32}}</string>
-							<reference key="NSSuperview" ref="177031615"/>
-							<int key="NSpiFlags">20490</int>
-							<double key="NSMaxValue">100</double>
-						</object>
-						<object class="NSTextField" id="1000478475">
-							<reference key="NSNextResponder" ref="177031615"/>
-							<int key="NSvFlags">256</int>
-							<string key="NSFrame">{{17, 68}, {291, 51}}</string>
-							<reference key="NSSuperview" ref="177031615"/>
-							<bool key="NSEnabled">YES</bool>
-							<object class="NSTextFieldCell" key="NSCell" id="693205921">
-								<int key="NSCellFlags">67239424</int>
-								<int key="NSCellFlags2">138412032</int>
-								<string key="NSContents">Generating private encryption key for TekJew (AIM)</string>
-								<object class="NSFont" key="NSSupport">
-									<string key="NSName">LucidaGrande</string>
-									<double key="NSSize">13</double>
-									<int key="NSfFlags">1044</int>
-								</object>
-								<reference key="NSControlView" ref="1000478475"/>
-								<object class="NSColor" key="NSBackgroundColor">
-									<int key="NSColorSpace">6</int>
-									<string key="NSCatalogName">System</string>
-									<string key="NSColorName">controlColor</string>
-									<object class="NSColor" key="NSColor">
-										<int key="NSColorSpace">3</int>
-										<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
-									</object>
-								</object>
-								<object class="NSColor" key="NSTextColor">
-									<int key="NSColorSpace">6</int>
-									<string key="NSCatalogName">System</string>
-									<string key="NSColorName">controlTextColor</string>
-									<object class="NSColor" key="NSColor">
-										<int key="NSColorSpace">3</int>
-										<bytes key="NSWhite">MAA</bytes>
-									</object>
-								</object>
-							</object>
-						</object>
-					</array>
-					<string key="NSFrameSize">{325, 139}</string>
-				</object>
-				<string key="NSScreenRect">{{0, 0}, {1400, 1050}}</string>
-				<string key="NSMinSize">{213, 72}</string>
-				<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
-				<bool key="NSWindowIsRestorable">YES</bool>
-			</object>
-		</array>
-		<object class="IBObjectContainer" key="IBDocument.Objects">
-			<array class="NSMutableArray" key="connectionRecords">
-				<object class="IBConnectionRecord">
-					<object class="IBOutletConnection" key="connection">
-						<string key="label">window</string>
-						<reference key="source" ref="323364032"/>
-						<reference key="destination" ref="630244868"/>
-					</object>
-					<int key="connectionID">9</int>
-				</object>
-				<object class="IBConnectionRecord">
-					<object class="IBOutletConnection" key="connection">
-						<string key="label">progressIndicator</string>
-						<reference key="source" ref="323364032"/>
-						<reference key="destination" ref="704654791"/>
-					</object>
-					<int key="connectionID">10</int>
-				</object>
-				<object class="IBConnectionRecord">
-					<object class="IBOutletConnection" key="connection">
-						<string key="label">textField_message</string>
-						<reference key="source" ref="323364032"/>
-						<reference key="destination" ref="1000478475"/>
-					</object>
-					<int key="connectionID">11</int>
-				</object>
-			</array>
-			<object class="IBMutableOrderedSet" key="objectRecords">
-				<array key="orderedObjects">
-					<object class="IBObjectRecord">
-						<int key="objectID">0</int>
-						<array key="object" id="0"/>
-						<reference key="children" ref="560603597"/>
-						<nil key="parent"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">-2</int>
-						<reference key="object" ref="323364032"/>
-						<reference key="parent" ref="0"/>
-						<string key="objectName">File's Owner</string>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">-1</int>
-						<reference key="object" ref="813923194"/>
-						<reference key="parent" ref="0"/>
-						<string key="objectName">First Responder</string>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">6</int>
-						<reference key="object" ref="630244868"/>
-						<array class="NSMutableArray" key="children">
-							<reference ref="177031615"/>
-						</array>
-						<reference key="parent" ref="0"/>
-						<string key="objectName">Key Generation</string>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">5</int>
-						<reference key="object" ref="177031615"/>
-						<array class="NSMutableArray" key="children">
-							<reference ref="704654791"/>
-							<reference ref="1000478475"/>
-						</array>
-						<reference key="parent" ref="630244868"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">7</int>
-						<reference key="object" ref="704654791"/>
-						<reference key="parent" ref="177031615"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">8</int>
-						<reference key="object" ref="1000478475"/>
-						<array class="NSMutableArray" key="children">
-							<reference ref="693205921"/>
-						</array>
-						<reference key="parent" ref="177031615"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">13</int>
-						<reference key="object" ref="693205921"/>
-						<reference key="parent" ref="1000478475"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">-3</int>
-						<reference key="object" ref="701542123"/>
-						<reference key="parent" ref="0"/>
-						<string key="objectName">Application</string>
-					</object>
-				</array>
-			</object>
-			<dictionary class="NSMutableDictionary" key="flattenedProperties">
-				<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-				<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-				<string key="-3.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-				<string key="13.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-				<string key="5.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-				<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-				<string key="7.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-				<string key="8.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-			</dictionary>
-			<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
-			<nil key="activeLocalization"/>
-			<dictionary class="NSMutableDictionary" key="localizations"/>
-			<nil key="sourceID"/>
-			<int key="maxID">13</int>
-		</object>
-		<object class="IBClassDescriber" key="IBDocument.Classes"/>
-		<int key="IBDocument.localizationMode">0</int>
-		<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
-		<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
-			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
-			<real value="1060" key="NS.object.0"/>
-		</object>
-		<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
-			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
-			<real value="1060" key="NS.object.0"/>
-		</object>
-		<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
-			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
-			<real value="3200" key="NS.object.0"/>
-		</object>
-		<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
-		<int key="IBDocument.defaultPropertyAccessControl">3</int>
-	</data>
-</archive>
diff -r 88235175776a -r 522f5ad1b16c Source/AdiumOTREncryption.m
--- a/Source/AdiumOTREncryption.m	Wed Jan 23 03:39:03 2013 +0100
+++ b/Source/AdiumOTREncryption.m	Wed Jan 23 11:54:44 2013 +0100
@@ -32,7 +32,6 @@
 
 #import <AIUtilities/AIStringAdditions.h>
 
-#import "ESOTRPrivateKeyGenerationWindowController.h"
 #import "ESOTRPreferences.h"
 #import "ESOTRUnknownFingerprintController.h"
 #import "OTRCommon.h"
@@ -388,20 +387,28 @@
 /* Generate a private key for the given accountname/protocol */
 void otrg_plugin_create_privkey(const char *accountname,
 								const char *protocol)
-{	
-	AIAccount	*account = accountFromAccountID(accountname);
-	AIService	*service = serviceFromServiceID(protocol);
+{
+	static BOOL alreadyGenerating = FALSE;
+	static dispatch_queue_t keyGenerationQueue = NULL;
+	static dispatch_once_t onceToken;
 	
-	NSString	*identifier = [NSString stringWithFormat:@"%@ (%@)",account.formattedUID, [service shortDescription]];
+	dispatch_once(&onceToken, ^{
+		keyGenerationQueue = dispatch_queue_create("im.adium.OTR.KeyGenerationQueue", NULL);
+	});
 	
-	[ESOTRPrivateKeyGenerationWindowController startedGeneratingForIdentifier:identifier];
+	if (alreadyGenerating) {
+		AILogWithSignature(@"A key generation is already running. Canceling");
+		return;
+	}
 	
     /* Generate the key */
 	void *newkeyp;
     otrl_privkey_generate_start(otrg_get_userstate(),
-						  accountname, protocol, &newkeyp);
+								accountname, protocol, &newkeyp);
+	alreadyGenerating = TRUE;
 	
-	dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
+	dispatch_async(keyGenerationQueue, ^{
+		AILogWithSignature(@"Generating a new private key");
 		otrl_privkey_generate_calculate(newkeyp);
 		
 		dispatch_sync(dispatch_get_main_queue(), ^{
@@ -409,8 +416,9 @@
 			
 			otrg_ui_update_keylist();
 			
-			/* Mark the dialog as done. */
-			[ESOTRPrivateKeyGenerationWindowController finishedGeneratingForIdentifier:identifier];
+			AILogWithSignature(@"Done.");
+			
+			alreadyGenerating = FALSE;
 		});
 	});
 }
diff -r 88235175776a -r 522f5ad1b16c Source/ESOTRPrivateKeyGenerationWindowController.h
--- a/Source/ESOTRPrivateKeyGenerationWindowController.h	Wed Jan 23 03:39:03 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/* 
- * Adium is the legal property of its developers, whose names are listed in the copyright file included
- * with this source distribution.
- * 
- * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
- * General Public License as published by the Free Software Foundation; either version 2 of the License,
- * or (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
- * Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License along with this program; if not,
- * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-#import <Adium/AIWindowController.h>
-
- at interface ESOTRPrivateKeyGenerationWindowController : AIWindowController {
-	IBOutlet	NSProgressIndicator	*progressIndicator;
-	IBOutlet	NSTextField			*textField_message;
-	
-	NSString	*identifier;
-}
-
-+ (void)startedGeneratingForIdentifier:(NSString *)identifier;
-+ (void)finishedGeneratingForIdentifier:(NSString *)identifier;
-
- at end
diff -r 88235175776a -r 522f5ad1b16c Source/ESOTRPrivateKeyGenerationWindowController.m
--- a/Source/ESOTRPrivateKeyGenerationWindowController.m	Wed Jan 23 03:39:03 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-/* 
- * Adium is the legal property of its developers, whose names are listed in the copyright file included
- * with this source distribution.
- * 
- * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
- * General Public License as published by the Free Software Foundation; either version 2 of the License,
- * or (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
- * Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License along with this program; if not,
- * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-#import "ESOTRPrivateKeyGenerationWindowController.h"
-#import <AIUtilities/AIStringAdditions.h>
-
- at interface ESOTRPrivateKeyGenerationWindowController ()
-- (id)initWithWindowNibName:(NSString *)windowNibName forIdentifier:(NSString *)inIdentifier;
- at end
-
- at implementation ESOTRPrivateKeyGenerationWindowController
-
-static NSMutableDictionary	*keyGenerationControllerDict = nil;
-
-+ (void)mainThreadStartedGeneratingForIdentifier:(NSString *)inIdentifier
-{
-	if (!keyGenerationControllerDict) keyGenerationControllerDict = [[NSMutableDictionary alloc] init];
-	
-	if (![keyGenerationControllerDict objectForKey:inIdentifier]) {
-		ESOTRPrivateKeyGenerationWindowController	*controller;
-		
-		if ((controller = [[self alloc] initWithWindowNibName:@"OTRPrivateKeyGenerationWindow" 
-												forIdentifier:inIdentifier])) {
-			[controller showWindow:nil];
-			[[controller window] makeKeyAndOrderFront:nil];
-			
-			[keyGenerationControllerDict setObject:controller
-											forKey:inIdentifier];
-			
-			/* Contrary to most other NSWindowControllers, this doesn't need it to release itself
-			 * in -windowWillClose, as it's in keyGenerationControllerDict.
-			 */
-			[controller autorelease];
-		}
-	}
-}
-
-/*!
-* @brief We started generating a private key.
- *
- * Create a window controller for inIdentifier and tell it to display.
- * Has no effect if a window is already open for inIdentifier.
- */
-+ (void)startedGeneratingForIdentifier:(NSString *)inIdentifier
-{
-	[self performSelectorOnMainThread:@selector(mainThreadStartedGeneratingForIdentifier:)
-						   withObject:inIdentifier
-						waitUntilDone:NO];
-}
-
-/*!
- * @brief Initialize
- */
-- (id)initWithWindowNibName:(NSString *)windowNibName forIdentifier:(NSString *)inIdentifier
-{
-	if ((self = [super initWithWindowNibName:windowNibName])) {
-		identifier = [inIdentifier retain];
-	}
-
-	return self;
-}
-
-/*!
- * @brief Window loaded
- *
- * Start our spinning progress indicator and set up our window
- */
-- (void)windowDidLoad
-{
-	[super windowDidLoad];
-
-	[[self window] setTitle:[AILocalizedString(@"Please wait",nil) stringByAppendingEllipsis]];
-	[[self window] center];
-
-	[progressIndicator startAnimation:nil];
-	[textField_message setStringValue:
-		[NSString stringWithFormat:AILocalizedString(@"Generating private encryption key for %@",nil),identifier]];
-}
-
-/*!
- * @brief Deallocate
- */
-- (void)dealloc
-{
-	[identifier release];
-	[super dealloc];
-}
-
-+ (void)mainThreadFinishedGeneratingForIdentifier:(NSString *)inIdentifier
-{	
-	ESOTRPrivateKeyGenerationWindowController	*controller;
-
-	controller = [keyGenerationControllerDict objectForKey:inIdentifier];
-	[controller closeWindow:nil];
-	
-	[keyGenerationControllerDict removeObjectForKey:inIdentifier];
-}
-
-/*!
- * @brief Finished generating a private key
- *
- * Closes the window assosiated with inIdentifier, if it is open.
- */
-+ (void)finishedGeneratingForIdentifier:(NSString *)inIdentifier
-{
-	[self performSelectorOnMainThread:@selector(mainThreadFinishedGeneratingForIdentifier:)
-						   withObject:inIdentifier
-						waitUntilDone:NO];
-}
-
- at end




More information about the commits mailing list