adium 2181:212b01ebcbf9: Fix a few OTR-related problems.

commits at adium.im commits at adium.im
Thu May 14 03:41:37 UTC 2009


details:	http://hg.adium.im/adium/rev/212b01ebcbf9
revision:	2181:212b01ebcbf9
author:		Zachary West <zacw at adium.im>
date:		Wed May 13 23:41:16 2009 -0400

Fix a few OTR-related problems.

When setting the state of the preference menu items, set them properly *and* use their per-contact preference in the list. Fixes #11893.

During the recursion from contact -> group -> account for an OTR preference, drop the contact level if it's set to default.

diffstat:

 Frameworks/Adium Framework/Source/AIListContact.m  |   2 +-
 Plugins/Secure Messaging/ESSecureMessagingPlugin.m |  13 +++++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)

diffs (49 lines):

diff -r 7b29d466a157 -r 212b01ebcbf9 Frameworks/Adium Framework/Source/AIListContact.m
--- a/Frameworks/Adium Framework/Source/AIListContact.m	Wed May 13 23:13:35 2009 -0400
+++ b/Frameworks/Adium Framework/Source/AIListContact.m	Wed May 13 23:41:16 2009 -0400
@@ -595,7 +595,7 @@
 	NSNumber *prefNumber = [self.parentContact preferenceForKey:KEY_ENCRYPTED_CHAT_PREFERENCE group:GROUP_ENCRYPTION];
 	
 	//If that turned up nothing, check all the groups it's in
-	if (!prefNumber) {
+	if (!prefNumber || [prefNumber integerValue] == EncryptedChat_Default) {
 		for (AIListGroup *group in self.parentContact.groups)
 		{
 			if ((prefNumber = [group preferenceForKey:KEY_ENCRYPTED_CHAT_PREFERENCE group:GROUP_ENCRYPTION]))
diff -r 7b29d466a157 -r 212b01ebcbf9 Plugins/Secure Messaging/ESSecureMessagingPlugin.m
--- a/Plugins/Secure Messaging/ESSecureMessagingPlugin.m	Wed May 13 23:13:35 2009 -0400
+++ b/Plugins/Secure Messaging/ESSecureMessagingPlugin.m	Wed May 13 23:41:16 2009 -0400
@@ -362,13 +362,19 @@
 	if ([[[menuItem menu] title] isEqualToString:ENCRYPTION_MENU_TITLE]) {
 		/* Options submenu */
 		AIEncryptedChatPreference tag = [menuItem tag];
+		
+		AIListContact	*listContact = chat.listObject.parentContact;
+		
+		AIEncryptedChatPreference userPreference = [[listContact preferenceForKey:KEY_ENCRYPTED_CHAT_PREFERENCE
+																			group:GROUP_ENCRYPTION] integerValue];
+		
 		switch (tag) {
 			case EncryptedChat_Default:
 			{
-				AIListContact	*listContact = chat.listObject.parentContact;
 				if (listContact) {
 					//Set the state (checked or unchecked) as appropriate. Default = no pref or the actual 'default' value.
-					[menuItem setState:listContact.encryptedChatPreferences];
+					[menuItem setState:(tag == userPreference || ![listContact preferenceForKey:KEY_ENCRYPTED_CHAT_PREFERENCE
+																						  group:GROUP_ENCRYPTION])];
 				}
 				return YES;
 				break;
@@ -378,10 +384,9 @@
 			case EncryptedChat_Automatically:
 			case EncryptedChat_RejectUnencryptedMessages:
 			{
-				AIListContact	*listContact = chat.listObject.parentContact;
 				if (listContact) {
 					//Set the state (checked or unchecked) as appropriate
-					[menuItem setState:listContact.encryptedChatPreferences];
+					[menuItem setState:(tag == userPreference)];
 				}
 				return YES;
 				break;




More information about the commits mailing list