adium 4116:7faa57914381: Disable Encryption -> Initiate Encrypte...

commits at adium.im commits at adium.im
Thu Aug 4 16:29:02 UTC 2011


details:	http://hg.adium.im/adium/rev/7faa57914381
revision:	4116:7faa57914381
branch:		(none)
author:		Adrian Godoroja <robotive at me.com>
date:		Thu Aug 04 19:28:12 2011 +0300

Disable Encryption -> Initiate Encrypted OTR Chat, menu item, if encrypted chat is disabled from settings. r=robotive. Refs #7389.

diffs (39 lines):

diff -r 8b468697519b -r 7faa57914381 ChangeLogs/Changes.txt
--- a/ChangeLogs/Changes.txt	Thu Aug 04 17:44:50 2011 +0200
+++ b/ChangeLogs/Changes.txt	Thu Aug 04 19:28:12 2011 +0300
@@ -33,6 +33,7 @@
  Encryption
   * Made it easier to delete a fingerprint. (Aleksei Gorny) (#1654)
   * The "Generate" button is now labelled "Regenerate" when a fingerprint already exists. (Tyler Funnell) (#1128)
+  * Disable Encryption -> Initiate Encrypted OTR Chat, menu item, if encrypted chat is disabled from settings. (Tyler Funnell) (#7389)
 
  Events and Notifications
   * Added the ability to add timestamps to Growl notifications. (Stuart Connolly) (#9920)
diff -r 8b468697519b -r 7faa57914381 Plugins/Secure Messaging/ESSecureMessagingPlugin.m
--- a/Plugins/Secure Messaging/ESSecureMessagingPlugin.m	Thu Aug 04 17:44:50 2011 +0200
+++ b/Plugins/Secure Messaging/ESSecureMessagingPlugin.m	Thu Aug 04 19:28:12 2011 +0300
@@ -401,8 +401,22 @@
 				break;
 
 			case AISecureMessagingMenu_Toggle:
-				//The menu item should indicate what will happen if it is selected.. the opposite of our secure state
-				[menuItem setTitle:([chat isSecure] ? TITLE_MAKE_INSECURE : TITLE_MAKE_SECURE)];
+				// The menu item should indicate what will happen if it is selected.. the opposite of our secure state
+				if ([chat isSecure]) {
+					[menuItem setTitle:TITLE_MAKE_INSECURE];
+				} else {
+					[menuItem setTitle:TITLE_MAKE_SECURE];
+				
+					AIListContact *listContact = chat.listObject.parentContact;
+					AIEncryptedChatPreference userPreference = [[listContact preferenceForKey:KEY_ENCRYPTED_CHAT_PREFERENCE
+																						group:GROUP_ENCRYPTION] intValue];
+					
+					// Disable 'Initiate Encrypted OTR Chat' menu item if chat encryption is disabled
+					if (userPreference == EncryptedChat_Never) {
+                    	return NO;
+                    }
+				}
+
 				return YES;
 				break;
 				




More information about the commits mailing list