adium 5699:7c1b8533e9e5: Merged with Rob's typo fix.

commits at adium.im commits at adium.im
Tue Sep 10 11:48:44 UTC 2013


details:	http://hg.adium.im/adium/rev/7c1b8533e9e5
revision:	5699:7c1b8533e9e5
branch:		libotr4.0.0
author:		Thijs Alkemade <me at thijsalkema.de>
date:		Tue Sep 10 13:47:46 2013 +0200

Merged with Rob's typo fix.

diffs (truncated from 1309 to 1000 lines):

diff -r 4fd1f218c9b2 -r 7c1b8533e9e5 Adium.xcodeproj/project.pbxproj
--- a/Adium.xcodeproj/project.pbxproj	Sat Aug 10 16:27:38 2013 +0200
+++ b/Adium.xcodeproj/project.pbxproj	Tue Sep 10 13:47:46 2013 +0200
@@ -1377,8 +1377,6 @@
 		76AA110C1635585E00A6EC4B /* AIAccountSelectionTopBar.xib in Resources */ = {isa = PBXBuildFile; fileRef = 76AA11091635585E00A6EC4B /* AIAccountSelectionTopBar.xib */; };
 		76AA110D1635585E00A6EC4B /* AIAccountSelectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 76AA110B1635585E00A6EC4B /* AIAccountSelectionViewController.m */; };
 		76AA1110163558B200A6EC4B /* AIRejoinGroupChatViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 76AA110F163558B200A6EC4B /* AIRejoinGroupChatViewController.m */; };
-		76B8B8EC16AF3A46009126FE /* AIOTRTopBarLoggingWarningController.m in Sources */ = {isa = PBXBuildFile; fileRef = 76B8B8EA16AF3A46009126FE /* AIOTRTopBarLoggingWarningController.m */; };
-		76B8B8ED16AF3A46009126FE /* AIOTRTopBarLoggingWarningController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 76B8B8EB16AF3A46009126FE /* AIOTRTopBarLoggingWarningController.xib */; };
 		76C1AF9C125A906A00D269A9 /* AIAdiumURLProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = 76C1AF9B125A906A00D269A9 /* AIAdiumURLProtocol.m */; };
 		76FBDAC91733B9CA00C9F10B /* STTwitterHTML.m in Sources */ = {isa = PBXBuildFile; fileRef = 76FBDAC61733B9C900C9F10B /* STTwitterHTML.m */; };
 		76FF925A14B524B40043E23B /* AIIRCConsoleController.h in Headers */ = {isa = PBXBuildFile; fileRef = 76FF925814B524B40043E23B /* AIIRCConsoleController.h */; };
@@ -4463,9 +4461,6 @@
 		76AA110B1635585E00A6EC4B /* AIAccountSelectionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIAccountSelectionViewController.m; path = "Plugins/Dual Window Interface/AIAccountSelectionViewController.m"; sourceTree = "<group>"; };
 		76AA110E163558B200A6EC4B /* AIRejoinGroupChatViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIRejoinGroupChatViewController.h; path = "Plugins/Dual Window Interface/AIRejoinGroupChatViewController.h"; sourceTree = "<group>"; };
 		76AA110F163558B200A6EC4B /* AIRejoinGroupChatViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIRejoinGroupChatViewController.m; path = "Plugins/Dual Window Interface/AIRejoinGroupChatViewController.m"; sourceTree = "<group>"; };
-		76B8B8E916AF3A46009126FE /* AIOTRTopBarLoggingWarningController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIOTRTopBarLoggingWarningController.h; path = Source/AIOTRTopBarLoggingWarningController.h; sourceTree = "<group>"; };
-		76B8B8EA16AF3A46009126FE /* AIOTRTopBarLoggingWarningController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIOTRTopBarLoggingWarningController.m; path = Source/AIOTRTopBarLoggingWarningController.m; sourceTree = "<group>"; };
-		76B8B8EB16AF3A46009126FE /* AIOTRTopBarLoggingWarningController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = AIOTRTopBarLoggingWarningController.xib; path = Resources/AIOTRTopBarLoggingWarningController.xib; sourceTree = "<group>"; };
 		76C1AF9A125A906A00D269A9 /* AIAdiumURLProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIAdiumURLProtocol.h; path = "Plugins/WebKit Message View/AIAdiumURLProtocol.h"; sourceTree = "<group>"; };
 		76C1AF9B125A906A00D269A9 /* AIAdiumURLProtocol.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIAdiumURLProtocol.m; path = "Plugins/WebKit Message View/AIAdiumURLProtocol.m"; sourceTree = "<group>"; };
 		76FBDAC51733B9C900C9F10B /* STTwitterHTML.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = STTwitterHTML.h; path = "Plugins/Twitter Plugin/STTwitter/STTwitterHTML.h"; sourceTree = "<group>"; };
@@ -5251,9 +5246,6 @@
 				765F5D72162F48FA00C57904 /* AIOTRSMPSharedSecretWindowController.h */,
 				765F5D73162F48FB00C57904 /* AIOTRSMPSharedSecretWindowController.m */,
 				765F5D70162F483F00C57904 /* AIOTRSMPSharedSecretWindowController.xib */,
-				76B8B8E916AF3A46009126FE /* AIOTRTopBarLoggingWarningController.h */,
-				76B8B8EA16AF3A46009126FE /* AIOTRTopBarLoggingWarningController.m */,
-				76B8B8EB16AF3A46009126FE /* AIOTRTopBarLoggingWarningController.xib */,
 				76674645178D8A8F00F65048 /* AIOTRTopBarUnverifiedContactController.h */,
 				76674646178D8A9000F65048 /* AIOTRTopBarUnverifiedContactController.m */,
 				7667464B178D8B2700F65048 /* AIOTRTopBarUnverifiedContactController.xib */,
@@ -10012,7 +10004,6 @@
 				C613B1111640C370006683FF /* pref-profile.tiff in Resources */,
 				C613B143164112B3006683FF /* events-dock-name.tiff in Resources */,
 				C613B1451641210B006683FF /* events-contact.tiff in Resources */,
-				76B8B8ED16AF3A46009126FE /* AIOTRTopBarLoggingWarningController.xib in Resources */,
 				5A0BBC4317400544002A7BE0 /* emoticons_menu at 2x.png in Resources */,
 				7667464C178D8B2700F65048 /* AIOTRTopBarUnverifiedContactController.xib in Resources */,
 			);
@@ -10664,7 +10655,6 @@
 				761D58831636EDE100210B12 /* AINewMessageTextFieldCell.m in Sources */,
 				761D58861636F94300210B12 /* AINewMessageSearchField.m in Sources */,
 				5A44595E169143130078AB0A /* AIPreferenceCVPrototypeView.m in Sources */,
-				76B8B8EC16AF3A46009126FE /* AIOTRTopBarLoggingWarningController.m in Sources */,
 				5A3B4D7916D878AC00903E40 /* NSString+STTwitter.m in Sources */,
 				5A3B4D7A16D878AC00903E40 /* STTwitterAPIWrapper.m in Sources */,
 				5A3B4D7C16D878AC00903E40 /* STTwitterOAuth.m in Sources */,
diff -r 4fd1f218c9b2 -r 7c1b8533e9e5 Frameworks/Adium Framework/Source/AIChat.h
--- a/Frameworks/Adium Framework/Source/AIChat.h	Sat Aug 10 16:27:38 2013 +0200
+++ b/Frameworks/Adium Framework/Source/AIChat.h	Tue Sep 10 13:47:46 2013 +0200
@@ -132,6 +132,8 @@
 	NSDictionary		*securityDetails;
     
     AIListContact       *_listObject;
+	
+	NSNumber			*overrideLogging;
 }
 
 + (id)chatForAccount:(AIAccount *)inAccount;
diff -r 4fd1f218c9b2 -r 7c1b8533e9e5 Frameworks/Adium Framework/Source/AIChat.m
--- a/Frameworks/Adium Framework/Source/AIChat.m	Sat Aug 10 16:27:38 2013 +0200
+++ b/Frameworks/Adium Framework/Source/AIChat.m	Tue Sep 10 13:47:46 2013 +0200
@@ -438,6 +438,10 @@
 
 - (BOOL)shouldLog
 {
+	if (overrideLogging) {
+		return [overrideLogging boolValue];
+	}
+	
 	BOOL shouldLog = [self.account shouldLogChat:self];
 	
 	if(shouldLog && self.isSecure) {
diff -r 4fd1f218c9b2 -r 7c1b8533e9e5 Frameworks/Adium Framework/Source/AIInterfaceControllerProtocol.h
--- a/Frameworks/Adium Framework/Source/AIInterfaceControllerProtocol.h	Sat Aug 10 16:27:38 2013 +0200
+++ b/Frameworks/Adium Framework/Source/AIInterfaceControllerProtocol.h	Tue Sep 10 13:47:46 2013 +0200
@@ -57,6 +57,7 @@
 #define KEY_CONFIRM_QUIT_FT				@"Suppress Quit Confirmation for File Transfers"
 #define KEY_CONFIRM_QUIT_UNREAD			@"Suppress Quit Confirmation for Unread Messages"
 #define KEY_CONFIRM_MSG_CLOSE			@"Confirm Message Window Close"
+#define KEY_CONFIRM_LOGGED_OTR			@"Confirm Logging When Using OTR"
 
 typedef enum {
 	AINormalWindowLevel = 0,
diff -r 4fd1f218c9b2 -r 7c1b8533e9e5 Plugins/Bonjour/AWBonjourAccount.m
--- a/Plugins/Bonjour/AWBonjourAccount.m	Sat Aug 10 16:27:38 2013 +0200
+++ b/Plugins/Bonjour/AWBonjourAccount.m	Tue Sep 10 13:47:46 2013 +0200
@@ -326,10 +326,10 @@
 
 - (BOOL)sendMessageObject:(AIContentMessage *)inContentMessage
 {
-	[libezv sendMessage:inContentMessage.messageString 
-	                                   to:inContentMessage.destination.UID
-	                             withHtml:inContentMessage.encodedMessage];
-
+	[libezv sendMessage:inContentMessage.messageString
+					 to:inContentMessage.destination.UID
+			   withHtml:inContentMessage.encodedMessage];
+	
 	return YES;
 }
 
diff -r 4fd1f218c9b2 -r 7c1b8533e9e5 Plugins/Bonjour/libezv/Classes/AWEzvContact.m
--- a/Plugins/Bonjour/libezv/Classes/AWEzvContact.m	Sat Aug 10 16:27:38 2013 +0200
+++ b/Plugins/Bonjour/libezv/Classes/AWEzvContact.m	Tue Sep 10 13:47:46 2013 +0200
@@ -91,46 +91,51 @@
 	fixedHTML = [self fixHTML:html];
 	//XXX if self.ipAddr is nil, we should do something
 	if (self.ipAddr != nil) {
-
+		
 		if (self.stream == nil) {
 			[self createConnection];
 		}
-
-	/* Message cleanup */
-	/* actual message */
+		
+		/* Message cleanup */
+		/* actual message */
 		mutableString = [message mutableCopy];
 		[mutableString replaceOccurrencesOfString:@"<br>" withString:@"<br />"
-			options:NSCaseInsensitiveSearch range:NSMakeRange(0, [mutableString length])];
+										  options:NSCaseInsensitiveSearch range:NSMakeRange(0, [mutableString length])];
 		[mutableString replaceOccurrencesOfString:@"&" withString:@"&"
-			options:NSLiteralSearch range:NSMakeRange(0, [mutableString length])];
+										  options:NSLiteralSearch range:NSMakeRange(0, [mutableString length])];
 		[mutableString replaceOccurrencesOfString:@"<" withString:@"<"
-			options:NSLiteralSearch range:NSMakeRange(0, [mutableString length])];
+										  options:NSLiteralSearch range:NSMakeRange(0, [mutableString length])];
 		[mutableString replaceOccurrencesOfString:@">" withString:@">"
-			options:NSLiteralSearch range:NSMakeRange(0, [mutableString length])];
+										  options:NSLiteralSearch range:NSMakeRange(0, [mutableString length])];
 		messageExtraEscapedString = [mutableString copy];
 		[mutableString release];
-
+		
 		mutableString = [fixedHTML mutableCopy];
 		[mutableString replaceOccurrencesOfString:@"<br>" withString:@"<br />"
-			options:NSCaseInsensitiveSearch range:NSMakeRange(0, [mutableString length])];
+										  options:NSCaseInsensitiveSearch range:NSMakeRange(0, [mutableString length])];
 		htmlFiltered = [mutableString copy];
 		[mutableString release];
-
-	/* setup XML tree */
+		
+		/* setup XML tree */
 		messageNode = [[AWEzvXMLNode alloc] initWithType:AWEzvXMLElement name:@"message"];
 		//[messageNode addAttribute:@"to" withValue:self.ipAddr];
 		[messageNode addAttribute:@"to" withValue:self.uniqueID];
 		[messageNode addAttribute:@"from" withValue: [self.manager myInstanceName]];
 		[messageNode addAttribute:@"type" withValue:@"chat"];
-
-		bodyNode = [[AWEzvXMLNode alloc] initWithType:AWEzvXMLElement name:@"body"];
-		[messageNode addChild:bodyNode];
-
-		textNode = [[AWEzvXMLNode alloc] initWithType:AWEzvXMLText name:messageExtraEscapedString];
-		[bodyNode addChild:textNode];
-
-	
+		
+		if (messageExtraEscapedString) {
+			bodyNode = [[AWEzvXMLNode alloc] initWithType:AWEzvXMLElement name:@"body"];
+		
+			[messageNode addChild:bodyNode];
 			
+			textNode = [[AWEzvXMLNode alloc] initWithType:AWEzvXMLText name:messageExtraEscapedString];
+			
+			[bodyNode addChild:textNode];
+			
+			[textNode release];
+			[bodyNode release];
+		}
+				
 		htmlNode = [[AWEzvXMLNode alloc] initWithType:AWEzvXMLElement name:@"html"];
 		[htmlNode addAttribute:@"xmlns" withValue:@"http://www.w3.org/1999/xhtml"];
 		[messageNode addChild:htmlNode];
@@ -140,26 +145,22 @@
         
 		htmlMessageNode = [[AWEzvXMLNode alloc] initWithType:AWEzvXMLRaw name:htmlFiltered];
 		[htmlBodyNode addChild:htmlMessageNode];
-				
+		
 		/* send the data */
 		[self.stream sendString:[messageNode xmlString]];
-
 		
-
-
-	/* release messages */
+		
+		/* release messages */
 		[htmlMessageNode release];
 		[htmlBodyNode release];
 		[htmlNode release];
-		[textNode release];
-		[bodyNode release];
 		[messageNode release];
 		[messageExtraEscapedString release];
 		[htmlFiltered release];
-
+		
 	} else {
 		[self setStatus: AWEzvUndefined];
-
+		
 		/* and notify */
 		[self.manager.client.client userChangedState:self];
 		[self.manager.client.client reportError:@"Could Not Send" ofLevel:AWEzvError forUser:[self uniqueID]];
@@ -428,7 +429,7 @@
 	}
 	
 	/* if we've got a message then we can send it to the client to display */
-	if (plaintext.length > 0)
+	if (plaintext.length > 0 || html.length > 0)
 		[self.manager.client.client user:self sentMessage:plaintext withHtml:html];
 }
 
diff -r 4fd1f218c9b2 -r 7c1b8533e9e5 Plugins/Secure Messaging/ESSecureMessagingPlugin.h
--- a/Plugins/Secure Messaging/ESSecureMessagingPlugin.h	Sat Aug 10 16:27:38 2013 +0200
+++ b/Plugins/Secure Messaging/ESSecureMessagingPlugin.h	Tue Sep 10 13:47:46 2013 +0200
@@ -22,7 +22,6 @@
 	AISecureMessagingMenu_Root = 1,
 	AISecureMessagingMenu_Toggle,
 	AISecureMessagingMenu_ShowDetails,
-	AISecureMessagingMenu_Verify,
 	AISecureMessagingMenu_Options,
 	AISecureMessagingMenu_ShowAbout,
 	AISecureMessagingMenu_VerifyManually,
diff -r 4fd1f218c9b2 -r 7c1b8533e9e5 Plugins/Secure Messaging/ESSecureMessagingPlugin.m
--- a/Plugins/Secure Messaging/ESSecureMessagingPlugin.m	Sat Aug 10 16:27:38 2013 +0200
+++ b/Plugins/Secure Messaging/ESSecureMessagingPlugin.m	Tue Sep 10 13:47:46 2013 +0200
@@ -34,6 +34,9 @@
 #import <Adium/AIListContact.h>
 #import <Adium/AIContentControllerProtocol.h>
 
+#import "ESTextAndButtonsWindowController.h"
+#import "AILoggerPlugin.h"
+
 #define	TITLE_MAKE_SECURE		AILocalizedString(@"Initiate Encrypted OTR Chat",nil)
 #define	TITLE_MAKE_INSECURE		AILocalizedString(@"Cancel Encrypted Chat",nil)
 #define TITLE_SHOW_DETAILS		[AILocalizedString(@"Show Details",nil) stringByAppendingEllipsis]
@@ -47,7 +50,7 @@
 #define TITLE_ENCRYPTION		AILocalizedString(@"Encryption",nil)
 
 #define CHAT_NOW_SECURE				AILocalizedString(@"Encrypted OTR chat initiated.", nil)
-#define CHAT_NOW_SECURE_UNVERIFIED	AILocalizedString(@"Encrypted OTR chat initiated. %@'s identity not verified.", nil)
+#define CHAT_NOW_SECURE_UNVERIFIED	AILocalizedString(@"Encrypted OTR chat initiated. <b>%@</b>’s identity <b>not</b> verified.", nil)
 #define CHAT_NO_LONGER_SECURE		AILocalizedString(@"Ended encrypted OTR chat.", nil)
 
 @interface ESSecureMessagingPlugin ()
@@ -223,6 +226,40 @@
 						  inWindow:[[notification userInfo] objectForKey:@"NSWindow"]];
 }
 
+- (void)logOTRQuestion:(NSNumber *)number userInfo:(AIChat *)chat suppression:(NSNumber *)suppressed
+{
+	if ([suppressed boolValue]) {
+		//Don't Ask Again
+		[adium.preferenceController setPreference:@(NO)
+										   forKey:KEY_CONFIRM_LOGGED_OTR
+											group:PREF_GROUP_CONFIRMATIONS];
+	}
+	
+	AITextAndButtonsReturnCode result = [number intValue];
+	switch(result)
+	{
+		case AITextAndButtonsDefaultReturn:
+			// If should not ask again, update the "Log secure chats" setting in the preferences.
+			if ([suppressed boolValue]) {
+				[adium.preferenceController setPreference:@(NO)
+												   forKey:KEY_LOGGER_SECURE_CHATS
+													group:PREF_GROUP_LOGGING];
+			} else {
+				// Otherwise, we just override it for the current chat.
+				[chat setValue:@(NO) forProperty:@"overrideLogging" notify:NotifyNow];
+				
+				[adium.contentController displayEvent:[NSString stringWithFormat:AILocalizedString(@"Logging for this conversation is now %@.",
+																								   "Message displayed in the chat when overriding logging. %@ is either on or off"),
+													  AILocalizedString(@"off", nil)]
+											   ofType:@"loggingOff"
+											   inChat:chat];
+			}
+			break;
+		default:
+			break;
+	}
+}
+
 //When the IsSecure key of a chat changes, update the @"Encryption" item immediately
 - (NSSet *)updateChat:(AIChat *)inChat keys:(NSSet *)inModifiedKeys silent:(BOOL)silent
 {
@@ -260,16 +297,37 @@
 				type = @"encryptionEnded";
 			}
 			
-			if (inChat.shouldLog) {
-				message = [message stringByAppendingString:AILocalizedString(@" Logging for this conversation is on.", nil)];
-			} else {
-				message = [message stringByAppendingString:AILocalizedString(@" Logging for this conversation is off.", nil)];
+			if (chatIsSecure) {
+				if (inChat.shouldLog) {
+					message = [message stringByAppendingString:AILocalizedString(@" Logging for this conversation is on.", nil)];
+					
+					BOOL confirmLoggedOTR = [[adium.preferenceController preferenceForKey:KEY_CONFIRM_LOGGED_OTR
+																					group:PREF_GROUP_CONFIRMATIONS] boolValue];
+					
+					if (confirmLoggedOTR) {
+						NSString	*question = AILocalizedString(@"Would you like to turn off logging for the rest of this conversation?", nil);
+						
+						[adium.interfaceController displayQuestion:AILocalizedString(@"Your conversation is now encrypted.", nil)
+												   withDescription:question
+												   withWindowTitle:AILocalizedString(@"Confirm logging", nil)
+													 defaultButton:AILocalizedString(@"Turn Off", nil)
+												   alternateButton:AILocalizedString(@"Continue Logging", nil)
+													   otherButton:nil
+													   suppression:AILocalizedString(@"Don’t ask again", nil)
+															target:self
+														  selector:@selector(logOTRQuestion:userInfo:suppression:)
+														  userInfo:inChat];
+					}
+					
+				} else {
+					message = [message stringByAppendingString:AILocalizedString(@" Logging for this conversation is off.", nil)];
+				}
 			}
 
 			if ([inChat isOpen]) {
 				[adium.contentController displayEvent:message
-												 ofType:type
-												 inChat:inChat];
+											   ofType:type
+											   inChat:inChat];
 			}
 		}
 	}
@@ -487,7 +545,6 @@
 										   target:nil
 										   action:nil
 									keyEquivalent:@""] autorelease];
-		[item setTag:AISecureMessagingMenu_Verify];
 		NSMenu *verifySubmenu = [[NSMenu allocWithZone:[NSMenu menuZone]] init];
 		[item setSubmenu:verifySubmenu];
 		
diff -r 4fd1f218c9b2 -r 7c1b8533e9e5 Plugins/WebKit Message View/AIWebkitMessageViewStyle.m
--- a/Plugins/WebKit Message View/AIWebkitMessageViewStyle.m	Sat Aug 10 16:27:38 2013 +0200
+++ b/Plugins/WebKit Message View/AIWebkitMessageViewStyle.m	Tue Sep 10 13:47:46 2013 +0200
@@ -1168,7 +1168,7 @@
 												 fontTags:NO
 									   includingColorTags:NO
 											closeFontTags:YES
-												styleTags:NO
+												styleTags:YES
 							   closeStyleTagsOnFontChange:YES
 										   encodeNonASCII:YES
 											 encodeSpaces:YES
diff -r 4fd1f218c9b2 -r 7c1b8533e9e5 Resources/AIOTRTopBarLoggingWarningController.xib
--- a/Resources/AIOTRTopBarLoggingWarningController.xib	Sat Aug 10 16:27:38 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,425 +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">12D78</string>
-		<string key="IBDocument.InterfaceBuilderVersion">3084</string>
-		<string key="IBDocument.AppKitVersion">1187.37</string>
-		<string key="IBDocument.HIToolboxVersion">626.00</string>
-		<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
-			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
-			<string key="NS.object.0">3084</string>
-		</object>
-		<array key="IBDocument.IntegratedClassDependencies">
-			<string>NSButton</string>
-			<string>NSButtonCell</string>
-			<string>NSCustomObject</string>
-			<string>NSCustomView</string>
-			<string>NSTextField</string>
-			<string>NSTextFieldCell</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">AIOTRTopBarLoggingWarningController</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="NSCustomView" id="209947746">
-				<reference key="NSNextResponder"/>
-				<int key="NSvFlags">266</int>
-				<array class="NSMutableArray" key="NSSubviews">
-					<object class="NSCustomView" id="709009510">
-						<reference key="NSNextResponder" ref="209947746"/>
-						<int key="NSvFlags">290</int>
-						<array class="NSMutableArray" key="NSSubviews">
-							<object class="NSButton" id="382479864">
-								<reference key="NSNextResponder" ref="709009510"/>
-								<int key="NSvFlags">265</int>
-								<string key="NSFrame">{{551, 5}, {83, 19}}</string>
-								<reference key="NSSuperview" ref="709009510"/>
-								<reference key="NSWindow"/>
-								<reference key="NSNextKeyView"/>
-								<string key="NSReuseIdentifierKey">_NS:9</string>
-								<bool key="NSEnabled">YES</bool>
-								<object class="NSButtonCell" key="NSCell" id="271828053">
-									<int key="NSCellFlags">-2080374784</int>
-									<int key="NSCellFlags2">134217728</int>
-									<string key="NSContents">Configure...</string>
-									<object class="NSFont" key="NSSupport">
-										<string key="NSName">LucidaGrande</string>
-										<double key="NSSize">12</double>
-										<int key="NSfFlags">16</int>
-									</object>
-									<string key="NSCellIdentifier">_NS:9</string>
-									<reference key="NSControlView" ref="382479864"/>
-									<int key="NSButtonFlags">-2038153216</int>
-									<int key="NSButtonFlags2">164</int>
-									<string key="NSAlternateContents"/>
-									<string key="NSKeyEquivalent"/>
-									<int key="NSPeriodicDelay">400</int>
-									<int key="NSPeriodicInterval">75</int>
-								</object>
-								<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
-							</object>
-							<object class="NSTextField" id="453567343">
-								<reference key="NSNextResponder" ref="709009510"/>
-								<int key="NSvFlags">270</int>
-								<string key="NSFrame">{{7, 7}, {354, 17}}</string>
-								<reference key="NSSuperview" ref="709009510"/>
-								<reference key="NSWindow"/>
-								<reference key="NSNextKeyView" ref="382479864"/>
-								<string key="NSReuseIdentifierKey">_NS:1535</string>
-								<bool key="NSEnabled">YES</bool>
-								<object class="NSTextFieldCell" key="NSCell" id="667515101">
-									<int key="NSCellFlags">68157504</int>
-									<int key="NSCellFlags2">4195328</int>
-									<string key="NSContents">Your conversation is encrypted, but still logged by you.</string>
-									<object class="NSFont" key="NSSupport">
-										<string key="NSName">LucidaGrande</string>
-										<double key="NSSize">13</double>
-										<int key="NSfFlags">1044</int>
-									</object>
-									<string key="NSCellIdentifier">_NS:1535</string>
-									<reference key="NSControlView" ref="453567343"/>
-									<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>
-								<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
-							</object>
-						</array>
-						<string key="NSFrameSize">{641, 30}</string>
-						<reference key="NSSuperview" ref="209947746"/>
-						<reference key="NSWindow"/>
-						<reference key="NSNextKeyView" ref="453567343"/>
-						<string key="NSClassName">AITopBarGradientView</string>
-					</object>
-				</array>
-				<string key="NSFrameSize">{641, 30}</string>
-				<reference key="NSSuperview"/>
-				<reference key="NSWindow"/>
-				<reference key="NSNextKeyView" ref="709009510"/>
-				<string key="NSReuseIdentifierKey">_NS:9</string>
-				<string key="NSClassName">NSView</string>
-			</object>
-		</array>
-		<object class="IBObjectContainer" key="IBDocument.Objects">
-			<array class="NSMutableArray" key="connectionRecords">
-				<object class="IBConnectionRecord">
-					<object class="IBOutletConnection" key="connection">
-						<string key="label">view</string>
-						<reference key="source" ref="1001"/>
-						<reference key="destination" ref="209947746"/>
-					</object>
-					<int key="connectionID">18</int>
-				</object>
-				<object class="IBConnectionRecord">
-					<object class="IBOutletConnection" key="connection">
-						<string key="label">view_backgroundView</string>
-						<reference key="source" ref="1001"/>
-						<reference key="destination" ref="709009510"/>
-					</object>
-					<int key="connectionID">19</int>
-				</object>
-				<object class="IBConnectionRecord">
-					<object class="IBActionConnection" key="connection">
-						<string key="label">configureLogging:</string>
-						<reference key="source" ref="1001"/>
-						<reference key="destination" ref="382479864"/>
-					</object>
-					<int key="connectionID">20</int>
-				</object>
-				<object class="IBConnectionRecord">
-					<object class="IBOutletConnection" key="connection">
-						<string key="label">label_description</string>
-						<reference key="source" ref="1001"/>
-						<reference key="destination" ref="453567343"/>
-					</object>
-					<int key="connectionID">21</int>
-				</object>
-				<object class="IBConnectionRecord">
-					<object class="IBOutletConnection" key="connection">
-						<string key="label">button_configure</string>
-						<reference key="source" ref="1001"/>
-						<reference key="destination" ref="382479864"/>
-					</object>
-					<int key="connectionID">22</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">3</int>
-						<reference key="object" ref="209947746"/>
-						<array class="NSMutableArray" key="children">
-							<reference ref="709009510"/>
-						</array>
-						<reference key="parent" ref="0"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">4</int>
-						<reference key="object" ref="709009510"/>
-						<array class="NSMutableArray" key="children">
-							<reference ref="382479864"/>
-							<reference ref="453567343"/>
-						</array>
-						<reference key="parent" ref="209947746"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">5</int>
-						<reference key="object" ref="382479864"/>
-						<array class="NSMutableArray" key="children">
-							<reference ref="271828053"/>
-						</array>
-						<reference key="parent" ref="709009510"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">8</int>
-						<reference key="object" ref="271828053"/>
-						<reference key="parent" ref="382479864"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">6</int>
-						<reference key="object" ref="453567343"/>
-						<array class="NSMutableArray" key="children">
-							<reference ref="667515101"/>
-						</array>
-						<reference key="parent" ref="709009510"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">7</int>
-						<reference key="object" ref="667515101"/>
-						<reference key="parent" ref="453567343"/>
-					</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="3.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-				<string key="4.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-				<string key="5.CustomClassName">AILocalizationButton</string>
-				<string key="5.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-				<string key="6.CustomClassName">AILocalizationTextField</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">22</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">AILocalizationTextField</string>
-					<string key="superclassName">NSTextField</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/AILocalizationTextField.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">AIMessageViewTopBarController</string>
-					<string key="superclassName">NSViewController</string>
-					<object class="NSMutableDictionary" key="actions">
-						<string key="NS.key.0">close:</string>
-						<string key="NS.object.0">id</string>
-					</object>
-					<object class="NSMutableDictionary" key="actionInfosByName">
-						<string key="NS.key.0">close:</string>
-						<object class="IBActionInfo" key="NS.object.0">
-							<string key="name">close:</string>
-							<string key="candidateClassName">id</string>
-						</object>
-					</object>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBProjectSource</string>
-						<string key="minorKey">./Classes/AIMessageViewTopBarController.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">AIOTRTopBarLoggingWarningController</string>
-					<string key="superclassName">AIMessageViewTopBarController</string>
-					<object class="NSMutableDictionary" key="actions">
-						<string key="NS.key.0">configureLogging:</string>
-						<string key="NS.object.0">id</string>
-					</object>
-					<object class="NSMutableDictionary" key="actionInfosByName">
-						<string key="NS.key.0">configureLogging:</string>
-						<object class="IBActionInfo" key="NS.object.0">
-							<string key="name">configureLogging:</string>
-							<string key="candidateClassName">id</string>
-						</object>
-					</object>
-					<dictionary class="NSMutableDictionary" key="outlets">
-						<string key="button_configure">NSButton</string>
-						<string key="label_description">NSTextField</string>
-						<string key="view_backgroundView">AITopBarGradientView</string>
-					</dictionary>
-					<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
-						<object class="IBToOneOutletInfo" key="button_configure">
-							<string key="name">button_configure</string>
-							<string key="candidateClassName">NSButton</string>
-						</object>
-						<object class="IBToOneOutletInfo" key="label_description">
-							<string key="name">label_description</string>
-							<string key="candidateClassName">NSTextField</string>
-						</object>
-						<object class="IBToOneOutletInfo" key="view_backgroundView">
-							<string key="name">view_backgroundView</string>
-							<string key="candidateClassName">AITopBarGradientView</string>
-						</object>
-					</dictionary>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBProjectSource</string>
-						<string key="minorKey">./Classes/AIOTRTopBarLoggingWarningController.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">AITopBarGradientView</string>
-					<string key="superclassName">NSView</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBProjectSource</string>
-						<string key="minorKey">./Classes/AITopBarGradientView.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>
-		<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
-		<int key="IBDocument.defaultPropertyAccessControl">3</int>
-	</data>
-</archive>
diff -r 4fd1f218c9b2 -r 7c1b8533e9e5 Resources/AIOTRTopBarUnverifiedContactController.xib
--- a/Resources/AIOTRTopBarUnverifiedContactController.xib	Sat Aug 10 16:27:38 2013 +0200
+++ b/Resources/AIOTRTopBarUnverifiedContactController.xib	Tue Sep 10 13:47:46 2013 +0200
@@ -2,9 +2,9 @@
 <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
 	<data>
 		<int key="IBDocument.SystemTarget">1060</int>
-		<string key="IBDocument.SystemVersion">12D78</string>
+		<string key="IBDocument.SystemVersion">12E55</string>
 		<string key="IBDocument.InterfaceBuilderVersion">3084</string>
-		<string key="IBDocument.AppKitVersion">1187.37</string>
+		<string key="IBDocument.AppKitVersion">1187.39</string>
 		<string key="IBDocument.HIToolboxVersion">626.00</string>
 		<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
 			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -52,7 +52,6 @@
 								<string key="NSFrame">{{575, 5}, {59, 19}}</string>
 								<reference key="NSSuperview" ref="709009510"/>
 								<reference key="NSWindow"/>
-								<reference key="NSNextKeyView"/>
 								<string key="NSReuseIdentifierKey">_NS:9</string>
 								<bool key="NSEnabled">YES</bool>
 								<object class="NSButtonCell" key="NSCell" id="271828053">
@@ -77,8 +76,8 @@
 							</object>
 							<object class="NSTextField" id="453567343">
 								<reference key="NSNextResponder" ref="709009510"/>
-								<int key="NSvFlags">270</int>
-								<string key="NSFrame">{{7, 7}, {389, 17}}</string>
+								<int key="NSvFlags">266</int>
+								<string key="NSFrame">{{7, 7}, {563, 17}}</string>
 								<reference key="NSSuperview" ref="709009510"/>
 								<reference key="NSWindow"/>
 								<reference key="NSNextKeyView" ref="382479864"/>
@@ -341,7 +340,6 @@
 							<string key="NSFrame">{{396, 13}, {70, 32}}</string>
 							<reference key="NSSuperview" ref="793506965"/>
 							<reference key="NSWindow"/>
-							<reference key="NSNextKeyView"/>
 							<string key="NSReuseIdentifierKey">_NS:9</string>
 							<bool key="NSEnabled">YES</bool>
 							<object class="NSButtonCell" key="NSCell" id="784593831">
diff -r 4fd1f218c9b2 -r 7c1b8533e9e5 Resources/ConfirmationDefaults.plist
--- a/Resources/ConfirmationDefaults.plist	Sat Aug 10 16:27:38 2013 +0200
+++ b/Resources/ConfirmationDefaults.plist	Tue Sep 10 13:47:46 2013 +0200
@@ -2,6 +2,8 @@
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
+	<key>Confirm Logging When Using OTR</key>
+	<true/>
 	<key>Confirm Message Window Close</key>
 	<true/>
 	<key>Suppress Quit Confirmation for File Transfers</key>
diff -r 4fd1f218c9b2 -r 7c1b8533e9e5 Source/AILoggerPlugin.h
--- a/Source/AILoggerPlugin.h	Sat Aug 10 16:27:38 2013 +0200
+++ b/Source/AILoggerPlugin.h	Tue Sep 10 13:47:46 2013 +0200
@@ -58,6 +58,9 @@
 	BOOL                 isIndexing;
 	SInt64               logsToIndex;
 	SInt64               logsIndexed;
+	
+	// Chat window toolbar item
+	NSMutableSet		*toolbarItems;
 }
 @property(assign,readonly) BOOL                 indexIsFlushing;
 @property(assign,readonly) BOOL                 isIndexing;
diff -r 4fd1f218c9b2 -r 7c1b8533e9e5 Source/AILoggerPlugin.m
--- a/Source/AILoggerPlugin.m	Sat Aug 10 16:27:38 2013 +0200
+++ b/Source/AILoggerPlugin.m	Tue Sep 10 13:47:46 2013 +0200
@@ -74,6 +74,8 @@
 
 #define	LOG_VIEWER_IDENTIFIER		@"LogViewer"
 
+#define LOGGING_OVERRIDE_ITEM		@"LoggingOverride"
+
 #define ENABLE_PROXIMITY_SEARCH		TRUE
 
 #pragma mark -
@@ -138,6 +140,10 @@
 - (void)_closeLogIndex;
 - (void)_flushIndex:(SKIndexRef)inIndex;
 
+// Toolbar item
+- (IBAction)toggleLogging:(NSToolbarItem *)sender;
+- (void)updateToolbarItem:(NSToolbarItem *)item forChat:(AIChat *)chat;
+
 // properties
 @property(retain,readwrite) NSMutableDictionary *activeAppenders;
 @property(retain,readwrite) AIHTMLDecoder       *xhtmlDecoder;
@@ -218,6 +224,8 @@
 	logAppendingGroup = dispatch_group_create();
 	loggerPluginGroup = dispatch_group_create();
 	
+	toolbarItems = [[NSMutableSet alloc] init];
+	
 	ioQueue = dispatch_queue_create("im.adium.AILoggerPlugin.ioQueue", 0);
 	
 	NSUInteger cpuCount = [[NSProcessInfo processInfo] activeProcessorCount];	
@@ -304,6 +312,26 @@
 											 selector:@selector(showLogViewerAndReindex:)
 												 name:AIShowLogViewerAndReindexNotification
 											   object:nil];
+	
+	toolbarItem = [AIToolbarUtilities toolbarItemWithIdentifier:LOGGING_OVERRIDE_ITEM
+														  label:AILocalizedString(@"Toggle Logging",nil)
+												   paletteLabel:AILocalizedString(@"Toggle Logging",nil)
+														toolTip:AILocalizedString(@"Turn logging on or off for this conversation.",nil)
+														 target:self
+												settingSelector:@selector(setImage:)
+													itemContent:[NSImage imageNamed:@"Authorize" forClass:NSClassFromString(@"AIAuthorizationRequestsWindowController")]
+														 action:@selector(toggleLogging:)
+														   menu:nil];
+	[[NSNotificationCenter defaultCenter] addObserver:self
+											 selector:@selector(toolbarWillAddItem:)
+												 name:NSToolbarWillAddItemNotification
+											   object:nil];
+	[[NSNotificationCenter defaultCenter] addObserver:self
+											 selector:@selector(toolbarDidRemoveItem:)
+												 name:NSToolbarDidRemoveItemNotification
+											   object:nil];
+	
+	[adium.toolbarController registerToolbarItem:toolbarItem forToolbarType:@"TextEntry"];
 }
 
 - (void)uninstallPlugin
@@ -1722,4 +1750,138 @@
 	[pool release];
 }
 
+#pragma mark Toolbar item
+
+- (void)updateToolbarItem:(NSToolbarItem *)item forChat:(AIChat *)chat
+{
+	if ([chat shouldLog]) {
+		[item setImage:[NSImage imageNamed:@"Authorize" forClass:NSClassFromString(@"AIAuthorizationRequestsWindowController")]];
+		[item setLabel:AILocalizedString(@"Turn Logging Off", nil)];
+	} else {
+		[item setImage:[NSImage imageNamed:@"Deny" forClass:NSClassFromString(@"AIAuthorizationRequestsWindowController")]];
+		[item setLabel:AILocalizedString(@"Turn Logging On", nil)];
+	}
+}
+
+- (IBAction)toggleLogging:(NSToolbarItem *)sender
+{
+	AIListObject	*object = adium.interfaceController.selectedListObject;
+	
+    if ([object isKindOfClass:[AIListContact class]]) {
+		AIChat  *chat = [adium.chatController openChatWithContact:(AIListContact *)object
+											   onPreferredAccount:YES];
+		BOOL shouldLog = ![chat shouldLog];
+		
+		[chat setValue:@(shouldLog) forProperty:@"overrideLogging" afterDelay:NotifyLater];
+		
+		[adium.contentController displayEvent:[NSString stringWithFormat:AILocalizedString(@"Logging for this conversation is now %@.",
+																						   "Message displayed in the chat when overriding logging. %@ is either on or off"),
+											   shouldLog ? AILocalizedString(@"on", nil) : AILocalizedString(@"off", nil)]
+									   ofType:shouldLog ? @"loggingOn" : @"loggingOff"
+									   inChat:chat];
+		
+		[self updateToolbarItem:sender forChat:chat];
+    }
+}
+
+- (void)chatStatusChanged:(NSNotification *)notification
+{
+	AIChat *chat = [notification object];
+	NSArray	*modifiedKeys = [[notification userInfo] objectForKey:@"Keys"];
+	
+	if ([modifiedKeys containsObject:@"overrideLogging"] || [modifiedKeys containsObject:@"securityDetails"]) {
+		NSWindow *window = [adium.interfaceController windowForChat:chat];
+		
+		for (NSToolbarItem *item in window.toolbar.items) {
+			if ([[item itemIdentifier] isEqualToString:LOGGING_OVERRIDE_ITEM]) {
+				
+				[self updateToolbarItem:item forChat:chat];
+				
+				break;
+			}
+		}
+	}
+}
+
+- (void)chatDidBecomeVisible:(NSNotification *)notification
+{
+	AIChat *chat = [notification object];
+	NSWindow *window = [[notification userInfo] objectForKey:@"NSWindow"];
+	
+	for (NSToolbarItem *item in window.toolbar.items) {
+		if ([[item itemIdentifier] isEqualToString:LOGGING_OVERRIDE_ITEM]) {
+			
+			[self updateToolbarItem:item forChat:chat];
+			
+			break;
+		}
+	}
+}
+
+- (void)toolbarDidRemoveItem:(NSNotification *)notification
+{
+	NSToolbarItem	*item = [[notification userInfo] objectForKey:@"item"];
+	if ([toolbarItems containsObject:item]) {
+		[item setView:nil];
+		[toolbarItems removeObject:item];
+		
+		if ([toolbarItems count] == 0) {
+			[[NSNotificationCenter defaultCenter] removeObserver:self
+															name:@"AIChatDidBecomeVisible"
+														  object:nil];
+			
+			[[NSNotificationCenter defaultCenter] removeObserver:self
+															name:Chat_StatusChanged
+														  object:nil];
+			




More information about the commits mailing list