adium 5696:065178d1bc3e: Prompt the user whether to continue log...
commits at adium.im
commits at adium.im
Mon Sep 9 23:46:41 UTC 2013
details: http://hg.adium.im/adium/rev/065178d1bc3e
revision: 5696:065178d1bc3e
branch: libotr4.0.0
author: Thijs Alkemade <me at thijsalkema.de>
date: Tue Sep 10 01:44:51 2013 +0200
Prompt the user whether to continue logging when enabling OTR when logging was on. Fix a couple of cases where the log toolbar button wasn't consistent anymore.
Also improve some of the OTR messages.
Fixes #15729
diffs (344 lines):
diff -r a531abb7d093 -r 065178d1bc3e Frameworks/Adium Framework/Source/AIChat.h
--- a/Frameworks/Adium Framework/Source/AIChat.h Mon Sep 09 22:33:40 2013 +0200
+++ b/Frameworks/Adium Framework/Source/AIChat.h Tue Sep 10 01:44:51 2013 +0200
@@ -197,8 +197,6 @@
@property (readwrite, nonatomic) BOOL hideUserIconAndStatus;
- at property (readwrite, nonatomic, retain) NSNumber *overrideLogging;
-
// Compatibility. I don't like this here.
- (NSArray *)containedObjects;
- (BOOL)isGroupChat;
diff -r a531abb7d093 -r 065178d1bc3e Frameworks/Adium Framework/Source/AIChat.m
--- a/Frameworks/Adium Framework/Source/AIChat.m Mon Sep 09 22:33:40 2013 +0200
+++ b/Frameworks/Adium Framework/Source/AIChat.m Tue Sep 10 01:44:51 2013 +0200
@@ -436,8 +436,6 @@
#pragma mark Logging
- at synthesize overrideLogging;
-
- (BOOL)shouldLog
{
if (overrideLogging) {
diff -r a531abb7d093 -r 065178d1bc3e Frameworks/Adium Framework/Source/AIInterfaceControllerProtocol.h
--- a/Frameworks/Adium Framework/Source/AIInterfaceControllerProtocol.h Mon Sep 09 22:33:40 2013 +0200
+++ b/Frameworks/Adium Framework/Source/AIInterfaceControllerProtocol.h Tue Sep 10 01:44:51 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 a531abb7d093 -r 065178d1bc3e Plugins/Secure Messaging/ESSecureMessagingPlugin.m
--- a/Plugins/Secure Messaging/ESSecureMessagingPlugin.m Mon Sep 09 22:33:40 2013 +0200
+++ b/Plugins/Secure Messaging/ESSecureMessagingPlugin.m Tue Sep 10 01:44:51 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];
}
}
}
diff -r a531abb7d093 -r 065178d1bc3e Plugins/WebKit Message View/AIWebkitMessageViewStyle.m
--- a/Plugins/WebKit Message View/AIWebkitMessageViewStyle.m Mon Sep 09 22:33:40 2013 +0200
+++ b/Plugins/WebKit Message View/AIWebkitMessageViewStyle.m Tue Sep 10 01:44:51 2013 +0200
@@ -1168,7 +1168,7 @@
fontTags:NO
includingColorTags:NO
closeFontTags:YES
- styleTags:NO
+ styleTags:YES
closeStyleTagsOnFontChange:YES
encodeNonASCII:YES
encodeSpaces:YES
diff -r a531abb7d093 -r 065178d1bc3e Resources/AIOTRTopBarUnverifiedContactController.xib
--- a/Resources/AIOTRTopBarUnverifiedContactController.xib Mon Sep 09 22:33:40 2013 +0200
+++ b/Resources/AIOTRTopBarUnverifiedContactController.xib Tue Sep 10 01:44:51 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 a531abb7d093 -r 065178d1bc3e Resources/ConfirmationDefaults.plist
--- a/Resources/ConfirmationDefaults.plist Mon Sep 09 22:33:40 2013 +0200
+++ b/Resources/ConfirmationDefaults.plist Tue Sep 10 01:44:51 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 a531abb7d093 -r 065178d1bc3e Source/AILoggerPlugin.m
--- a/Source/AILoggerPlugin.m Mon Sep 09 22:33:40 2013 +0200
+++ b/Source/AILoggerPlugin.m Tue Sep 10 01:44:51 2013 +0200
@@ -1770,14 +1770,39 @@
if ([object isKindOfClass:[AIListContact class]]) {
AIChat *chat = [adium.chatController openChatWithContact:(AIListContact *)object
onPreferredAccount:YES];
- chat.overrideLogging = @(![chat shouldLog]);
+ BOOL shouldLog = ![chat shouldLog];
- AILogWithSignature(@"Logging for this conversation is now %@", chat.overrideLogging);
+ [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];
@@ -1804,6 +1829,12 @@
[[NSNotificationCenter defaultCenter] removeObserver:self
name:@"AIChatDidBecomeVisible"
object:nil];
+
+ [[NSNotificationCenter defaultCenter] removeObserver:self
+ name:Chat_StatusChanged
+ object:nil];
+
+ [adium.preferenceController unregisterPreferenceObserver:self];
}
}
}
@@ -1820,10 +1851,37 @@
selector:@selector(chatDidBecomeVisible:)
name:@"AIChatDidBecomeVisible"
object:nil];
+
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(chatStatusChanged:)
+ name:Chat_StatusChanged
+ object:nil];
+
+ [adium.preferenceController registerPreferenceObserver:self
+ forGroup:PREF_GROUP_LOGGING];
}
[toolbarItems addObject:item];
}
}
+- (void)preferencesChangedForGroup:(NSString *)group key:(NSString *)key object:(AIListObject *)object preferenceDict:(NSDictionary *)prefDict firstTime:(BOOL)firstTime
+{
+ if ([key isEqualToString:KEY_LOGGER_SECURE_CHATS] || [key isEqualToString:KEY_LOGGER_CERTAIN_ACCOUNTS]
+ || [key isEqualToString:KEY_LOGGER_OBJECT_DISABLE] || [key isEqualToString:KEY_LOGGER_ENABLE]) {
+
+ for(AIChat *chat in adium.interfaceController.openChats) {
+ NSWindow *window = [adium.interfaceController windowForChat:chat];
+
+ if ([adium.interfaceController activeChatInWindow:window] != chat) continue;
+
+ for (NSToolbarItem *item in window.toolbar.items) {
+ if ([[item itemIdentifier] isEqualToString:LOGGING_OVERRIDE_ITEM]) {
+ [self updateToolbarItem:item forChat:chat];
+ }
+ }
+ }
+ }
+}
+
@end
diff -r a531abb7d093 -r 065178d1bc3e Source/AIOTRTopBarUnverifiedContactController.m
--- a/Source/AIOTRTopBarUnverifiedContactController.m Mon Sep 09 22:33:40 2013 +0200
+++ b/Source/AIOTRTopBarUnverifiedContactController.m Tue Sep 10 01:44:51 2013 +0200
@@ -36,7 +36,6 @@
view_backgroundView.endColor = [NSColor colorWithCalibratedWhite:0.91f alpha:1.0f];
- [label_description setStringValue:AILocalizedString(@"Your conversation is encrypted, but the contact's identity is unverified.", nil)];
[button_configure setStringValue:[AILocalizedString(@"Verify", nil) stringByAppendingEllipsis]];
}
@@ -114,9 +113,27 @@
[chat release];
chat = [inChat retain];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(chatStatusChanged:)
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(chatStatusChanged:)
name:Chat_StatusChanged
object:chat];
+
+ NSMutableAttributedString *label = [[[NSMutableAttributedString alloc]
+ initWithString:AILocalizedString(@"Your conversation is encrypted, but ",
+ "after this a contact's UID, followed by \"s identity is unverified.\"")] autorelease];
+
+ NSAttributedString *uid = [[[NSAttributedString alloc]
+ initWithString:[[chat listObject] formattedUID]
+ attributes:@{ NSFontAttributeName : [NSFont boldSystemFontOfSize:[NSFont systemFontSize]] }] autorelease];
+
+ [label appendAttributedString:uid];
+
+ NSAttributedString *label2 = [[[NSMutableAttributedString alloc]
+ initWithString:AILocalizedString(@"âs identity is unverified.", "See \"Your conversation is encrypted, but\"")] autorelease];
+
+ [label appendAttributedString:label2];
+
+ [label_description setAttributedStringValue:label];
}
@end
More information about the commits
mailing list