adium 5129:91871fd68339: Rewrote the handling of a number of OTR...

commits at adium.im commits at adium.im
Wed Oct 17 19:35:19 UTC 2012


details:	http://hg.adium.im/adium/rev/91871fd68339
revision:	5129:91871fd68339
branch:		libotr4.0.0
author:		Thijs Alkemade <thijsalkemade at gmail.com>
date:		Wed Oct 17 21:33:47 2012 +0200

Rewrote the handling of a number of OTR errors to the new API.
Subject: adium 5130:1f8eef14db92: Implemented the "answering a secret question" part of SMP.

details:	http://hg.adium.im/adium/rev/1f8eef14db92
revision:	5130:1f8eef14db92
branch:		libotr4.0.0
author:		Thijs Alkemade <thijsalkemade at gmail.com>
date:		Wed Oct 17 21:34:48 2012 +0200

Implemented the "answering a secret question" part of SMP.

diffs (926 lines):

diff -r a26a835bb266 -r 1f8eef14db92 Adium.xcodeproj/project.pbxproj
--- a/Adium.xcodeproj/project.pbxproj	Wed Oct 17 18:42:05 2012 +0200
+++ b/Adium.xcodeproj/project.pbxproj	Wed Oct 17 21:34:48 2012 +0200
@@ -1359,6 +1359,8 @@
 		6EC1684D06C170A000F9FAD3 /* DCInviteToChatPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 6EC1684806C170A000F9FAD3 /* DCInviteToChatPlugin.m */; };
 		6EC1684F06C170A000F9FAD3 /* DCInviteToChatWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6EC1684A06C170A000F9FAD3 /* DCInviteToChatWindowController.m */; };
 		6EC1685006C170A000F9FAD3 /* InviteToChatWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6EC1684B06C170A000F9FAD3 /* InviteToChatWindow.xib */; };
+		765F5D67162F30E800C57904 /* AIOTRSMPSecretQuestionWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 765F5D65162F30E800C57904 /* AIOTRSMPSecretQuestionWindowController.m */; };
+		765F5D6F162F357E00C57904 /* AIOTRSMPSecretQuestionWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 765F5D6E162F357E00C57904 /* AIOTRSMPSecretQuestionWindowController.xib */; };
 		766ABAB61306D1020049FFB7 /* AIUnreadMessagesTooltip.m in Sources */ = {isa = PBXBuildFile; fileRef = 766ABAB51306D1020049FFB7 /* AIUnreadMessagesTooltip.m */; };
 		76731DE215F90538007728C3 /* libgcrypt.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76731DE015F90538007728C3 /* libgcrypt.framework */; };
 		76731DE315F90538007728C3 /* libgpgerror.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76731DE115F90538007728C3 /* libgpgerror.framework */; };
@@ -4384,6 +4386,9 @@
 		6FB330A20C7235BF00B001A8 /* EKEzvIncomingFileTransfer.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = EKEzvIncomingFileTransfer.m; path = Plugins/Bonjour/libezv/Classes/EKEzvIncomingFileTransfer.m; sourceTree = SOURCE_ROOT; };
 		6FB330A30C7235BF00B001A8 /* EKEzvOutgoingFileTransfer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = EKEzvOutgoingFileTransfer.h; path = Plugins/Bonjour/libezv/Classes/EKEzvOutgoingFileTransfer.h; sourceTree = SOURCE_ROOT; };
 		6FB330A40C7235BF00B001A8 /* EKEzvOutgoingFileTransfer.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = EKEzvOutgoingFileTransfer.m; path = Plugins/Bonjour/libezv/Classes/EKEzvOutgoingFileTransfer.m; sourceTree = SOURCE_ROOT; };
+		765F5D64162F30E800C57904 /* AIOTRSMPSecretQuestionWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIOTRSMPSecretQuestionWindowController.h; path = Source/AIOTRSMPSecretQuestionWindowController.h; sourceTree = "<group>"; };
+		765F5D65162F30E800C57904 /* AIOTRSMPSecretQuestionWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIOTRSMPSecretQuestionWindowController.m; path = Source/AIOTRSMPSecretQuestionWindowController.m; sourceTree = "<group>"; };
+		765F5D6E162F357E00C57904 /* AIOTRSMPSecretQuestionWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = AIOTRSMPSecretQuestionWindowController.xib; path = Resources/AIOTRSMPSecretQuestionWindowController.xib; sourceTree = "<group>"; };
 		766ABAB41306D1020049FFB7 /* AIUnreadMessagesTooltip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIUnreadMessagesTooltip.h; path = Source/AIUnreadMessagesTooltip.h; sourceTree = "<group>"; };
 		766ABAB51306D1020049FFB7 /* AIUnreadMessagesTooltip.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIUnreadMessagesTooltip.m; path = Source/AIUnreadMessagesTooltip.m; sourceTree = "<group>"; };
 		76731DE015F90538007728C3 /* libgcrypt.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = libgcrypt.framework; path = Frameworks/libgcrypt.framework; sourceTree = "<group>"; };
@@ -5164,6 +5169,9 @@
 				341BD55A0965E97F00CF83F5 /* ESOTRUnknownFingerprintController.h */,
 				341BD55B0965E97F00CF83F5 /* ESOTRFingerprintDetailsWindowController.m */,
 				341BD5660965E99200CF83F5 /* OTRCommon.h */,
+				765F5D64162F30E800C57904 /* AIOTRSMPSecretQuestionWindowController.h */,
+				765F5D65162F30E800C57904 /* AIOTRSMPSecretQuestionWindowController.m */,
+				765F5D6E162F357E00C57904 /* AIOTRSMPSecretQuestionWindowController.xib */,
 			);
 			name = OTR;
 			sourceTree = "<group>";
@@ -9769,6 +9777,7 @@
 				C6B545AA15D3390F0005F1F8 /* ABSearch at 2x.png in Resources */,
 				C61AFA9A15DD43C80001EDEF /* AboutDialog_bg at 2x.png in Resources */,
 				C6BC7F9B15DD666600C5FF52 /* events-notification.tiff in Resources */,
+				765F5D6F162F357E00C57904 /* AIOTRSMPSecretQuestionWindowController.xib in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -10418,6 +10427,7 @@
 				5A4BD52513F8653D00A4D3F7 /* ESContactListAdvancedPreferences.m in Sources */,
 				5A4BD55413F86A6200A4D3F7 /* AIMessagePreferences.m in Sources */,
 				5A5EC831154649140043FFAA /* AIPreferenceCollectionItem.m in Sources */,
+				765F5D67162F30E800C57904 /* AIOTRSMPSecretQuestionWindowController.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff -r a26a835bb266 -r 1f8eef14db92 Resources/AIOTRSMPSecretQuestionWindowController.xib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/AIOTRSMPSecretQuestionWindowController.xib	Wed Oct 17 21:34:48 2012 +0200
@@ -0,0 +1,569 @@
+<?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">12C60</string>
+		<string key="IBDocument.InterfaceBuilderVersion">2843</string>
+		<string key="IBDocument.AppKitVersion">1187.34</string>
+		<string key="IBDocument.HIToolboxVersion">625.00</string>
+		<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
+			<string key="NS.object.0">2843</string>
+		</object>
+		<array key="IBDocument.IntegratedClassDependencies">
+			<string>NSButton</string>
+			<string>NSButtonCell</string>
+			<string>NSCustomObject</string>
+			<string>NSTextField</string>
+			<string>NSTextFieldCell</string>
+			<string>NSView</string>
+			<string>NSWindowTemplate</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="1000">
+			<object class="NSCustomObject" id="1001">
+				<string key="NSClassName">AIOTRSMPSecretQuestionWindowController</string>
+			</object>
+			<object class="NSCustomObject" id="1003">
+				<string key="NSClassName">FirstResponder</string>
+			</object>
+			<object class="NSCustomObject" id="1004">
+				<string key="NSClassName">NSApplication</string>
+			</object>
+			<object class="NSWindowTemplate" id="1005">
+				<int key="NSWindowStyleMask">15</int>
+				<int key="NSWindowBacking">2</int>
+				<string key="NSWindowRect">{{196, 240}, {480, 286}}</string>
+				<int key="NSWTFlags">544735232</int>
+				<string key="NSWindowTitle">Identity verification</string>
+				<string key="NSWindowClass">NSWindow</string>
+				<nil key="NSViewClass"/>
+				<nil key="NSUserInterfaceItemIdentifier"/>
+				<object class="NSView" key="NSWindowView" id="1006">
+					<reference key="NSNextResponder"/>
+					<int key="NSvFlags">256</int>
+					<array class="NSMutableArray" key="NSSubviews">
+						<object class="NSTextField" id="969285535">
+							<reference key="NSNextResponder" ref="1006"/>
+							<int key="NSvFlags">268</int>
+							<string key="NSFrame">{{17, 232}, {446, 34}}</string>
+							<reference key="NSSuperview" ref="1006"/>
+							<reference key="NSWindow"/>
+							<reference key="NSNextKeyView" ref="797746567"/>
+							<string key="NSReuseIdentifierKey">_NS:9</string>
+							<string key="NSAntiCompressionPriority">{250, 750}</string>
+							<bool key="NSEnabled">YES</bool>
+							<object class="NSTextFieldCell" key="NSCell" id="380929229">
+								<int key="NSCellFlags">67108864</int>
+								<int key="NSCellFlags2">272629760</int>
+								<string key="NSContents">%@ asks you to answer the following secret question to verify your identity:</string>
+								<object class="NSFont" key="NSSupport" id="222388975">
+									<string key="NSName">LucidaGrande</string>
+									<double key="NSSize">13</double>
+									<int key="NSfFlags">16</int>
+								</object>
+								<string key="NSCellIdentifier">_NS:9</string>
+								<reference key="NSControlView" ref="969285535"/>
+								<object class="NSColor" key="NSBackgroundColor" id="716823106">
+									<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" id="764232297">
+									<int key="NSColorSpace">6</int>
+									<string key="NSCatalogName">System</string>
+									<string key="NSColorName">controlTextColor</string>
+									<object class="NSColor" key="NSColor" id="775991746">
+										<int key="NSColorSpace">3</int>
+										<bytes key="NSWhite">MAA</bytes>
+									</object>
+								</object>
+							</object>
+							<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
+							<bool key="NSControlAutosetMaxLayoutWidth">YES</bool>
+						</object>
+						<object class="NSTextField" id="877465751">
+							<reference key="NSNextResponder" ref="1006"/>
+							<int key="NSvFlags">268</int>
+							<string key="NSFrame">{{17, 134}, {87, 17}}</string>
+							<reference key="NSSuperview" ref="1006"/>
+							<reference key="NSWindow"/>
+							<reference key="NSNextKeyView" ref="520708757"/>
+							<string key="NSReuseIdentifierKey">_NS:9</string>
+							<string key="NSAntiCompressionPriority">{250, 750}</string>
+							<bool key="NSEnabled">YES</bool>
+							<object class="NSTextFieldCell" key="NSCell" id="1053289715">
+								<int key="NSCellFlags">67108864</int>
+								<int key="NSCellFlags2">272629760</int>
+								<string key="NSContents">Your answer:</string>
+								<reference key="NSSupport" ref="222388975"/>
+								<string key="NSCellIdentifier">_NS:9</string>
+								<reference key="NSControlView" ref="877465751"/>
+								<reference key="NSBackgroundColor" ref="716823106"/>
+								<reference key="NSTextColor" ref="764232297"/>
+							</object>
+							<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
+							<bool key="NSControlAutosetMaxLayoutWidth">YES</bool>
+						</object>
+						<object class="NSTextField" id="797746567">
+							<reference key="NSNextResponder" ref="1006"/>
+							<int key="NSvFlags">268</int>
+							<string key="NSFrame">{{20, 159}, {440, 65}}</string>
+							<reference key="NSSuperview" ref="1006"/>
+							<reference key="NSWindow"/>
+							<reference key="NSNextKeyView" ref="877465751"/>
+							<string key="NSReuseIdentifierKey">_NS:9</string>
+							<string key="NSAntiCompressionPriority">{250, 750}</string>
+							<bool key="NSEnabled">YES</bool>
+							<object class="NSTextFieldCell" key="NSCell" id="525495892">
+								<int key="NSCellFlags">-2074083327</int>
+								<int key="NSCellFlags2">272629760</int>
+								<string key="NSContents"/>
+								<object class="NSFont" key="NSSupport" id="929360575">
+									<string key="NSName">LucidaGrande</string>
+									<double key="NSSize">13</double>
+									<int key="NSfFlags">1044</int>
+								</object>
+								<string key="NSCellIdentifier">_NS:9</string>
+								<reference key="NSControlView" ref="797746567"/>
+								<bool key="NSDrawsBackground">YES</bool>
+								<object class="NSColor" key="NSBackgroundColor" id="938446914">
+									<int key="NSColorSpace">6</int>
+									<string key="NSCatalogName">System</string>
+									<string key="NSColorName">textBackgroundColor</string>
+									<object class="NSColor" key="NSColor">
+										<int key="NSColorSpace">3</int>
+										<bytes key="NSWhite">MQA</bytes>
+									</object>
+								</object>
+								<object class="NSColor" key="NSTextColor" id="487596849">
+									<int key="NSColorSpace">6</int>
+									<string key="NSCatalogName">System</string>
+									<string key="NSColorName">textColor</string>
+									<reference key="NSColor" ref="775991746"/>
+								</object>
+							</object>
+							<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
+						</object>
+						<object class="NSTextField" id="520708757">
+							<reference key="NSNextResponder" ref="1006"/>
+							<int key="NSvFlags">268</int>
+							<string key="NSFrame">{{20, 61}, {440, 65}}</string>
+							<reference key="NSSuperview" ref="1006"/>
+							<reference key="NSWindow"/>
+							<reference key="NSNextKeyView" ref="652951602"/>
+							<string key="NSReuseIdentifierKey">_NS:9</string>
+							<string key="NSAntiCompressionPriority">{250, 750}</string>
+							<bool key="NSEnabled">YES</bool>
+							<object class="NSTextFieldCell" key="NSCell" id="841222555">
+								<int key="NSCellFlags">-1805647871</int>
+								<int key="NSCellFlags2">272629760</int>
+								<string key="NSContents"/>
+								<reference key="NSSupport" ref="929360575"/>
+								<string key="NSCellIdentifier">_NS:9</string>
+								<reference key="NSControlView" ref="520708757"/>
+								<bool key="NSDrawsBackground">YES</bool>
+								<reference key="NSBackgroundColor" ref="938446914"/>
+								<reference key="NSTextColor" ref="487596849"/>
+							</object>
+							<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
+						</object>
+						<object class="NSButton" id="872076107">
+							<reference key="NSNextResponder" ref="1006"/>
+							<int key="NSvFlags">268</int>
+							<string key="NSFrame">{{375, 13}, {91, 32}}</string>
+							<reference key="NSSuperview" ref="1006"/>
+							<reference key="NSWindow"/>
+							<string key="NSReuseIdentifierKey">_NS:9</string>
+							<bool key="NSEnabled">YES</bool>
+							<object class="NSButtonCell" key="NSCell" id="44075337">
+								<int key="NSCellFlags">67108864</int>
+								<int key="NSCellFlags2">134217728</int>
+								<string key="NSContents">OK</string>
+								<reference key="NSSupport" ref="222388975"/>
+								<string key="NSCellIdentifier">_NS:9</string>
+								<reference key="NSControlView" ref="872076107"/>
+								<int key="NSButtonFlags">-2034876416</int>
+								<int key="NSButtonFlags2">1</int>
+								<reference key="NSAlternateImage" ref="222388975"/>
+								<string key="NSAlternateContents"/>
+								<string type="base64-UTF8" key="NSKeyEquivalent">DQ</string>
+								<int key="NSPeriodicDelay">200</int>
+								<int key="NSPeriodicInterval">25</int>
+							</object>
+							<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
+						</object>
+						<object class="NSButton" id="652951602">
+							<reference key="NSNextResponder" ref="1006"/>
+							<int key="NSvFlags">268</int>
+							<string key="NSFrame">{{284, 13}, {91, 32}}</string>
+							<reference key="NSSuperview" ref="1006"/>
+							<reference key="NSWindow"/>
+							<reference key="NSNextKeyView" ref="872076107"/>
+							<string key="NSReuseIdentifierKey">_NS:9</string>
+							<bool key="NSEnabled">YES</bool>
+							<object class="NSButtonCell" key="NSCell" id="1040537040">
+								<int key="NSCellFlags">67108864</int>
+								<int key="NSCellFlags2">134217728</int>
+								<string key="NSContents">Cancel</string>
+								<reference key="NSSupport" ref="222388975"/>
+								<string key="NSCellIdentifier">_NS:9</string>
+								<reference key="NSControlView" ref="652951602"/>
+								<int key="NSButtonFlags">-2034876416</int>
+								<int key="NSButtonFlags2">1</int>
+								<reference key="NSAlternateImage" ref="222388975"/>
+								<string key="NSAlternateContents"/>
+								<string type="base64-UTF8" key="NSKeyEquivalent">Gw</string>
+								<int key="NSPeriodicDelay">200</int>
+								<int key="NSPeriodicInterval">25</int>
+							</object>
+							<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
+						</object>
+					</array>
+					<string key="NSFrameSize">{480, 286}</string>
+					<reference key="NSSuperview"/>
+					<reference key="NSWindow"/>
+					<reference key="NSNextKeyView" ref="969285535"/>
+				</object>
+				<string key="NSScreenRect">{{0, 0}, {1920, 1058}}</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">label_intro</string>
+						<reference key="source" ref="1001"/>
+						<reference key="destination" ref="969285535"/>
+					</object>
+					<int key="connectionID">19</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBOutletConnection" key="connection">
+						<string key="label">label_question</string>
+						<reference key="source" ref="1001"/>
+						<reference key="destination" ref="797746567"/>
+					</object>
+					<int key="connectionID">20</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBOutletConnection" key="connection">
+						<string key="label">field_answer</string>
+						<reference key="source" ref="1001"/>
+						<reference key="destination" ref="520708757"/>
+					</object>
+					<int key="connectionID">21</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBActionConnection" key="connection">
+						<string key="label">cancel:</string>
+						<reference key="source" ref="1001"/>
+						<reference key="destination" ref="652951602"/>
+					</object>
+					<int key="connectionID">22</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBActionConnection" key="connection">
+						<string key="label">okay:</string>
+						<reference key="source" ref="1001"/>
+						<reference key="destination" ref="872076107"/>
+					</object>
+					<int key="connectionID">23</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="1000"/>
+						<nil key="parent"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">-2</int>
+						<reference key="object" ref="1001"/>
+						<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="1003"/>
+						<reference key="parent" ref="0"/>
+						<string key="objectName">First Responder</string>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">-3</int>
+						<reference key="object" ref="1004"/>
+						<reference key="parent" ref="0"/>
+						<string key="objectName">Application</string>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">1</int>
+						<reference key="object" ref="1005"/>
+						<array class="NSMutableArray" key="children">
+							<reference ref="1006"/>
+						</array>
+						<reference key="parent" ref="0"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">2</int>
+						<reference key="object" ref="1006"/>
+						<array class="NSMutableArray" key="children">
+							<reference ref="797746567"/>
+							<reference ref="877465751"/>
+							<reference ref="520708757"/>
+							<reference ref="872076107"/>
+							<reference ref="652951602"/>
+							<reference ref="969285535"/>
+						</array>
+						<reference key="parent" ref="1005"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">5</int>
+						<reference key="object" ref="969285535"/>
+						<array class="NSMutableArray" key="children">
+							<reference ref="380929229"/>
+						</array>
+						<reference key="parent" ref="1006"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">6</int>
+						<reference key="object" ref="380929229"/>
+						<reference key="parent" ref="969285535"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">7</int>
+						<reference key="object" ref="797746567"/>
+						<array class="NSMutableArray" key="children">
+							<reference ref="525495892"/>
+						</array>
+						<reference key="parent" ref="1006"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">8</int>
+						<reference key="object" ref="525495892"/>
+						<reference key="parent" ref="797746567"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">9</int>
+						<reference key="object" ref="877465751"/>
+						<array class="NSMutableArray" key="children">
+							<reference ref="1053289715"/>
+						</array>
+						<reference key="parent" ref="1006"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">10</int>
+						<reference key="object" ref="1053289715"/>
+						<reference key="parent" ref="877465751"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">11</int>
+						<reference key="object" ref="520708757"/>
+						<array class="NSMutableArray" key="children">
+							<reference ref="841222555"/>
+						</array>
+						<reference key="parent" ref="1006"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">12</int>
+						<reference key="object" ref="841222555"/>
+						<reference key="parent" ref="520708757"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">13</int>
+						<reference key="object" ref="872076107"/>
+						<array class="NSMutableArray" key="children">
+							<reference ref="44075337"/>
+						</array>
+						<reference key="parent" ref="1006"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">14</int>
+						<reference key="object" ref="44075337"/>
+						<reference key="parent" ref="872076107"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">17</int>
+						<reference key="object" ref="652951602"/>
+						<array class="NSMutableArray" key="children">
+							<reference ref="1040537040"/>
+						</array>
+						<reference key="parent" ref="1006"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">18</int>
+						<reference key="object" ref="1040537040"/>
+						<reference key="parent" ref="652951602"/>
+					</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="1.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+				<string key="1.IBWindowTemplateEditedContentRect">{{357, 418}, {480, 270}}</string>
+				<integer value="1" key="1.NSWindowTemplate.visibleAtLaunch"/>
+				<string key="10.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+				<string key="11.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+				<string key="12.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+				<string key="13.CustomClassName">AILocalizationButton</string>
+				<string key="13.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+				<string key="14.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+				<string key="17.CustomClassName">AILocalizationButton</string>
+				<string key="17.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+				<string key="18.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+				<string key="2.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>
+				<string key="9.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">23</int>
+		</object>
+		<object class="IBClassDescriber" key="IBDocument.Classes">
+			<array class="NSMutableArray" key="referencedPartialClassDescriptions">
+				<object class="IBPartialClassDescription">
+					<string key="className">AILocalizationButton</string>
+					<string key="superclassName">NSButton</string>
+					<dictionary class="NSMutableDictionary" key="outlets">
+						<string key="view_anchorToLeftSide">NSView</string>
+						<string key="view_anchorToRightSide">NSView</string>
+						<string key="window_anchorOnLeftSide">NSWindow</string>
+						<string key="window_anchorOnRightSide">NSWindow</string>
+					</dictionary>
+					<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
+						<object class="IBToOneOutletInfo" key="view_anchorToLeftSide">
+							<string key="name">view_anchorToLeftSide</string>
+							<string key="candidateClassName">NSView</string>
+						</object>
+						<object class="IBToOneOutletInfo" key="view_anchorToRightSide">
+							<string key="name">view_anchorToRightSide</string>
+							<string key="candidateClassName">NSView</string>
+						</object>
+						<object class="IBToOneOutletInfo" key="window_anchorOnLeftSide">
+							<string key="name">window_anchorOnLeftSide</string>
+							<string key="candidateClassName">NSWindow</string>
+						</object>
+						<object class="IBToOneOutletInfo" key="window_anchorOnRightSide">
+							<string key="name">window_anchorOnRightSide</string>
+							<string key="candidateClassName">NSWindow</string>
+						</object>
+					</dictionary>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBProjectSource</string>
+						<string key="minorKey">./Classes/AILocalizationButton.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">AIOTRSMPSecretQuestionWindowController</string>
+					<string key="superclassName">AIWindowController</string>
+					<dictionary class="NSMutableDictionary" key="actions">
+						<string key="cancel:">id</string>
+						<string key="okay:">id</string>
+					</dictionary>
+					<dictionary class="NSMutableDictionary" key="actionInfosByName">
+						<object class="IBActionInfo" key="cancel:">
+							<string key="name">cancel:</string>
+							<string key="candidateClassName">id</string>
+						</object>
+						<object class="IBActionInfo" key="okay:">
+							<string key="name">okay:</string>
+							<string key="candidateClassName">id</string>
+						</object>
+					</dictionary>
+					<dictionary class="NSMutableDictionary" key="outlets">
+						<string key="field_answer">NSTextField</string>
+						<string key="label_intro">NSTextField</string>
+						<string key="label_question">NSTextField</string>
+					</dictionary>
+					<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
+						<object class="IBToOneOutletInfo" key="field_answer">
+							<string key="name">field_answer</string>
+							<string key="candidateClassName">NSTextField</string>
+						</object>
+						<object class="IBToOneOutletInfo" key="label_intro">
+							<string key="name">label_intro</string>
+							<string key="candidateClassName">NSTextField</string>
+						</object>
+						<object class="IBToOneOutletInfo" key="label_question">
+							<string key="name">label_question</string>
+							<string key="candidateClassName">NSTextField</string>
+						</object>
+					</dictionary>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBProjectSource</string>
+						<string key="minorKey">./Classes/AIOTRSMPSecretQuestionWindowController.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">AIWindowController</string>
+					<string key="superclassName">NSWindowController</string>
+					<object class="NSMutableDictionary" key="actions">
+						<string key="NS.key.0">closeWindow:</string>
+						<string key="NS.object.0">id</string>
+					</object>
+					<object class="NSMutableDictionary" key="actionInfosByName">
+						<string key="NS.key.0">closeWindow:</string>
+						<object class="IBActionInfo" key="NS.object.0">
+							<string key="name">closeWindow:</string>
+							<string key="candidateClassName">id</string>
+						</object>
+					</object>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBProjectSource</string>
+						<string key="minorKey">./Classes/AIWindowController.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="NSMutableDictionary" key="actions">
+						<string key="NS.key.0">selectServiceType:</string>
+						<string key="NS.object.0">id</string>
+					</object>
+					<object class="NSMutableDictionary" key="actionInfosByName">
+						<string key="NS.key.0">selectServiceType:</string>
+						<object class="IBActionInfo" key="NS.object.0">
+							<string key="name">selectServiceType:</string>
+							<string key="candidateClassName">id</string>
+						</object>
+					</object>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBProjectSource</string>
+						<string key="minorKey">./Classes/NSObject.h</string>
+					</object>
+				</object>
+			</array>
+		</object>
+		<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.PluginDeclaredDevelopmentDependencies">
+			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
+			<real value="4000" key="NS.object.0"/>
+		</object>
+		<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+		<int key="IBDocument.defaultPropertyAccessControl">3</int>
+	</data>
+</archive>
diff -r a26a835bb266 -r 1f8eef14db92 Source/AIOTRSMPSecretQuestionWindowController.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Source/AIOTRSMPSecretQuestionWindowController.h	Wed Oct 17 21:34:48 2012 +0200
@@ -0,0 +1,27 @@
+//
+//  AIOTRSMPSecretQuestionWindowController.h
+//  Adium
+//
+//  Created by Thijs Alkemade on 17-10-12.
+//  Copyright (c) 2012 The Adium Team. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+#import <Adium/AIWindowController.h>
+#import <Adium/AIListContact.h>
+
+ at interface AIOTRSMPSecretQuestionWindowController : AIWindowController {
+	IBOutlet	NSTextField *label_intro;
+	IBOutlet	NSTextField *label_question;
+	IBOutlet	NSTextField	*field_answer;
+	
+	NSString *secretQuestion;
+	AIListContact *contact;
+	void(^handler)(NSString *answer);
+}
+
+- (IBAction)okay:(id)sender;
+- (IBAction)cancel:(id)sender;
+- (id)initWithQuestion:(NSString *)inQuestion from:(AIListContact *)inContact completionHandler:(void(^)(NSString *answer))inHandler;
+
+ at end
diff -r a26a835bb266 -r 1f8eef14db92 Source/AIOTRSMPSecretQuestionWindowController.m
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Source/AIOTRSMPSecretQuestionWindowController.m	Wed Oct 17 21:34:48 2012 +0200
@@ -0,0 +1,60 @@
+//
+//  AIOTRSMPSecretQuestionWindowController.m
+//  Adium
+//
+//  Created by Thijs Alkemade on 17-10-12.
+//  Copyright (c) 2012 The Adium Team. All rights reserved.
+//
+
+#import "AIOTRSMPSecretQuestionWindowController.h"
+
+ at interface AIOTRSMPSecretQuestionWindowController ()
+
+ at end
+
+ at implementation AIOTRSMPSecretQuestionWindowController
+
+- (id)initWithQuestion:(NSString *)inQuestion from:(AIListContact *)inContact completionHandler:(void(^)(NSString *answer))inHandler
+{
+	if (self = [super initWithWindowNibName:@"AIOTRSMPSecretQuestionWindowController"]) {
+		secretQuestion = [inQuestion retain];
+		contact = [inContact retain];
+		handler = Block_copy(inHandler);
+	}
+	
+	return self;
+}
+
+- (void)dealloc
+{
+	[secretQuestion release];
+	[contact release];
+	
+	[super dealloc];
+}
+
+- (void)windowDidLoad
+{
+    [super windowDidLoad];
+    
+	[label_intro setStringValue:[NSString stringWithFormat:AILocalizedString(@"%@ asks you to answer the following secret question to verify your identity:", nil), contact.UID]];
+	[label_question setStringValue:secretQuestion ?: @""];
+}
+
+- (IBAction)okay:(id)sender
+{
+	handler([field_answer stringValue]);
+	
+	[self close];
+	[self release];
+}
+
+- (IBAction)cancel:(id)sender
+{
+	handler(nil);
+	
+	[self close];
+	[self release];
+}
+
+ at end
diff -r a26a835bb266 -r 1f8eef14db92 Source/AdiumOTREncryption.m
--- a/Source/AdiumOTREncryption.m	Wed Oct 17 18:42:05 2012 +0200
+++ b/Source/AdiumOTREncryption.m	Wed Oct 17 21:34:48 2012 +0200
@@ -36,6 +36,7 @@
 #import "ESOTRPreferences.h"
 #import "ESOTRUnknownFingerprintController.h"
 #import "OTRCommon.h"
+#import "AIOTRSMPSecretQuestionWindowController.h"
 
 #import <stdlib.h>
 
@@ -663,7 +664,7 @@
 																   withSource:listContact
 																  destination:chat.account
 																		 date:nil
-																	  message:[AIHTMLDecoder decodeHTML:[NSString stringWithFormat:AILocalizedStringFromTableInBundle(@"The following message was received <b>unencrypted:</b> %s", @"libotr error message", [NSBundle bundleForClass:[AdiumOTREncryption class]], nil), message]]
+																	  message:[AIHTMLDecoder decodeHTML:[AILocalizedStringFromTableInBundle(@"The following message was <b>not encrypted</b>: ", @"libotr error message", [NSBundle bundleForClass:[AdiumOTREncryption class]], nil) stringByAppendingString:[NSString stringWithUTF8String:message]]]
 																	autoreply:NO];
 			
 			[adium.contentController receiveContentObject:messageObject];
@@ -677,7 +678,25 @@
 		case OTRL_MSGEVENT_LOG_HEARTBEAT_SENT:
 			AILogWithSignature(@"I'm still alive");
 			break;
+		case OTRL_MSGEVENT_RCVDMSG_UNRECOGNIZED:
+		case OTRL_MSGEVENT_RCVDMSG_MALFORMED:
+		case OTRL_MSGEVENT_RCVDMSG_NOT_IN_PRIVATE:
+		case OTRL_MSGEVENT_RCVDMSG_UNREADABLE: {
+			NSString *localizedMessage = [NSString stringWithFormat:AILocalizedStringFromTableInBundle(@"An encrypted message from %@ could not be decrypted.", @"libotr error message", [NSBundle bundleForClass:[AdiumOTREncryption class]], nil), listContact.UID];
 			
+			if (!chat) chat = [adium.chatController chatWithContact:listContact];
+			[adium.contentController displayEvent:[[AIHTMLDecoder decodeHTML:localizedMessage] string]
+										   ofType:@"encryption"
+										   inChat:chat];
+		}
+		case OTRL_MSGEVENT_CONNECTION_ENDED: {
+			NSString *localizedMessage = [NSString stringWithFormat:AILocalizedStringFromTableInBundle(@"%@ is no longer using encryption; you should cancel encryption on your side.", @"Message when the remote contact cancels his half of an encrypted conversation. %@ will be a name.", [NSBundle bundleForClass:[AdiumOTREncryption class]], nil), listContact.UID];
+			
+			if (!chat) chat = [adium.chatController chatWithContact:listContact];
+			[adium.contentController displayEvent:[[AIHTMLDecoder decodeHTML:localizedMessage] string]
+										   ofType:@"encryption"
+										   inChat:chat];
+		}
 		default:
 			break;
 	}
@@ -689,6 +708,34 @@
 	otrl_instag_generate(otrg_plugin_userstate, INSTAG_PATH, accountname, protocol);
 }
 
+static void
+handle_smp_event_cb(void *opdata, OtrlSMPEvent smp_event,
+					ConnContext *context, unsigned short progress_percent,
+					char *question)
+{
+	switch (smp_event) {
+		case OTRL_SMPEVENT_ASK_FOR_ANSWER: {
+			AIOTRSMPSecretQuestionWindowController *questionController = [[AIOTRSMPSecretQuestionWindowController alloc] initWithQuestion:[NSString stringWithUTF8String:question]
+																																	 from:contactForContext(context)
+																														completionHandler:^(NSString *answer){
+																															otrl_message_respond_smp(otrg_get_userstate(), &ui_ops, opdata, context, (const unsigned char*)[answer UTF8String], answer.length);
+																														}];
+			
+			[questionController showWindow:nil];
+			[questionController.window orderFront:nil];
+			[questionController.window becomeKeyWindow];
+			
+			break;
+		}
+		case OTRL_SMPEVENT_FAILURE: {
+			AILogWithSignature(@"SMP verification failed");
+		}
+			
+		default:
+			break;
+	}
+}
+
 static OtrlMessageAppOps ui_ops = {
     policy_cb,
     create_privkey_cb,
@@ -708,7 +755,7 @@
 	error_message_free_cb,
 	resent_msg_prefix_cb,
 	resent_msg_prefix_free_cb,
-	NULL /* handle_smp_event */,
+	handle_smp_event_cb,
 	handle_msg_event_cb,
 	create_instag_cb,
 	NULL /* convert_msg */,
@@ -752,47 +799,6 @@
     }
 }
 
-/* Abort the SMP protocol.  Used when malformed or unexpected messages
- * are received. */
-static void otrg_plugin_abort_smp(ConnContext *context)
-{
-	otrl_message_abort_smp(otrg_plugin_userstate, &ui_ops, NULL, context);
-}
-
-/* Start the Socialist Millionaires' Protocol over the current connection,
- * using the given initial secret. */
-void otrg_plugin_start_smp(ConnContext *context,
-						   const unsigned char *secret, size_t secretlen)
-{
-    otrl_message_initiate_smp(otrg_plugin_userstate, &ui_ops, NULL,
-							  context, secret, secretlen);	
-}
-
-/* Continue the Socialist Millionaires' Protocol over the current connection,
- * using the given initial secret (ie finish step 2). */
-void otrg_plugin_continue_smp(ConnContext *context,
-							  const unsigned char *secret, size_t secretlen)
-{
-	otrl_message_respond_smp(otrg_plugin_userstate, &ui_ops, NULL,
-							 context, secret, secretlen);
-}
-
-/* Show a dialog asking the user to respond to an SMP secret sent by a remote contact.
- * Our user should enter the same secret entered by the remote contact. */
-static void otrg_dialogue_respond_socialist_millionaires(ConnContext *context)
-{
-    if (context == NULL || context->msgstate != OTRL_MSGSTATE_ENCRYPTED)
-		return;
-
-	/* XXX Implement me - prompt to respond to a secret, and then call
-	 * otrg_plugin_continue_smp() with the secret and the appropriate context */
-}
-
-static void otrg_dialog_update_smp(ConnContext *context, CGFloat percentage)
-{
-	/* SMP status update */
-}
-
 - (NSString *)decryptIncomingMessage:(NSString *)inString fromContact:(AIListContact *)inListContact onAccount:(AIAccount *)inAccount
 {
 	NSString	*decryptedMessage = nil;
@@ -833,71 +839,6 @@
 	if (newMessage)
 		otrl_message_free(newMessage);
 
-    tlv = otrl_tlv_find(tlvs, OTRL_TLV_DISCONNECTED);
-    if (tlv) {
-		/* Notify the user that the other side disconnected. */
-		
-		NSString *localizedMessage = [NSString stringWithFormat:AILocalizedString(@"%s is no longer using encryption; you should cancel encryption on your side.", "Message when the remote contact cancels his half of an encrypted conversation. %s will be a name."), username];
-		AIChat *chat = [adium.chatController chatWithContact:inListContact];
-		
-		if (chat) {
-			[adium.contentController displayEvent:[[AIHTMLDecoder decodeHTML:localizedMessage] string]
-										   ofType:@"encryption"
-										   inChat:chat];
-		}
-
-		otrg_ui_update_keylist();
-    }
-
-	/* Keep track of our current progress in the Socialist Millionaires'
-     * Protocol. */
-	ConnContext *context = otrl_context_find(otrg_plugin_userstate, username,
-											 accountname, protocol, OTRL_INSTAG_BEST, 0, NULL, NULL, NULL);
-    if (context) {
-		NextExpectedSMP nextMsg = context->smstate->nextExpected;
-		
-		tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP1);
-		if (tlv) {
-			if (nextMsg != OTRL_SMP_EXPECT1)
-				otrg_plugin_abort_smp(context);
-			else {
-				otrg_dialogue_respond_socialist_millionaires(context);
-			}
-		}
-		tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP2);
-		if (tlv) {
-			if (nextMsg != OTRL_SMP_EXPECT2)
-				otrg_plugin_abort_smp(context);
-			else {
-				otrg_dialog_update_smp(context, 0.6f);
-				context->smstate->nextExpected = OTRL_SMP_EXPECT4;
-			}
-		}
-		tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP3);
-		if (tlv) {
-			if (nextMsg != OTRL_SMP_EXPECT3)
-				otrg_plugin_abort_smp(context);
-			else {
-				otrg_dialog_update_smp(context, 1.0f);
-				context->smstate->nextExpected = OTRL_SMP_EXPECT1;
-			}
-		}
-		tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP4);
-		if (tlv) {
-			if (nextMsg != OTRL_SMP_EXPECT4)
-				otrg_plugin_abort_smp(context);
-			else {
-				otrg_dialog_update_smp(context, 1.0f);
-				context->smstate->nextExpected = OTRL_SMP_EXPECT1;
-			}
-		}
-		tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP_ABORT);
-		if (tlv) {
-			otrg_dialog_update_smp(context, 0.0f);
-			context->smstate->nextExpected = OTRL_SMP_EXPECT1;
-		}
-	}
-
     otrl_tlv_free(tlvs);
 	
 	return decryptedMessage;




More information about the commits mailing list