Disable Encryption -> Initiate Encrypted OTR Chat, menu item, if encrypted chat is disabled from settings. r=robotive. Refs #7389.
authorAdrian Godoroja <robotive@me.com>
Thu, 04 Aug 2011 19:28:12 +0300
changeset 41167faa57914381
parent 4115 8b468697519b
child 4117 dcf2d6c4559f
Disable Encryption -> Initiate Encrypted OTR Chat, menu item, if encrypted chat is disabled from settings. r=robotive. Refs #7389.
ChangeLogs/Changes.txt
Plugins/Secure Messaging/ESSecureMessagingPlugin.m
     1.1 --- a/ChangeLogs/Changes.txt	Thu Aug 04 17:44:50 2011 +0200
     1.2 +++ b/ChangeLogs/Changes.txt	Thu Aug 04 19:28:12 2011 +0300
     1.3 @@ -33,6 +33,7 @@
     1.4   Encryption
     1.5    * Made it easier to delete a fingerprint. (Aleksei Gorny) (#1654)
     1.6    * The "Generate" button is now labelled "Regenerate" when a fingerprint already exists. (Tyler Funnell) (#1128)
     1.7 +  * Disable Encryption -> Initiate Encrypted OTR Chat, menu item, if encrypted chat is disabled from settings. (Tyler Funnell) (#7389)
     1.8  
     1.9   Events and Notifications
    1.10    * Added the ability to add timestamps to Growl notifications. (Stuart Connolly) (#9920)
     2.1 --- a/Plugins/Secure Messaging/ESSecureMessagingPlugin.m	Thu Aug 04 17:44:50 2011 +0200
     2.2 +++ b/Plugins/Secure Messaging/ESSecureMessagingPlugin.m	Thu Aug 04 19:28:12 2011 +0300
     2.3 @@ -401,8 +401,22 @@
     2.4  				break;
     2.5  
     2.6  			case AISecureMessagingMenu_Toggle:
     2.7 -				//The menu item should indicate what will happen if it is selected.. the opposite of our secure state
     2.8 -				[menuItem setTitle:([chat isSecure] ? TITLE_MAKE_INSECURE : TITLE_MAKE_SECURE)];
     2.9 +				// The menu item should indicate what will happen if it is selected.. the opposite of our secure state
    2.10 +				if ([chat isSecure]) {
    2.11 +					[menuItem setTitle:TITLE_MAKE_INSECURE];
    2.12 +				} else {
    2.13 +					[menuItem setTitle:TITLE_MAKE_SECURE];
    2.14 +				
    2.15 +					AIListContact *listContact = chat.listObject.parentContact;
    2.16 +					AIEncryptedChatPreference userPreference = [[listContact preferenceForKey:KEY_ENCRYPTED_CHAT_PREFERENCE
    2.17 +																						group:GROUP_ENCRYPTION] intValue];
    2.18 +					
    2.19 +					// Disable 'Initiate Encrypted OTR Chat' menu item if chat encryption is disabled
    2.20 +					if (userPreference == EncryptedChat_Never) {
    2.21 +                    	return NO;
    2.22 +                    }
    2.23 +				}
    2.24 +
    2.25  				return YES;
    2.26  				break;
    2.27