adium-1.4 2721:70c7d70b49cb: Allow menu items to be validated if...

commits at adium.im commits at adium.im
Sun Nov 1 02:58:08 UTC 2009


details:	http://hg.adium.im/adium-1.4/rev/70c7d70b49cb
revision:	2721:70c7d70b49cb
author:		Zachary West <zacw at adium.im>
date:		Sat Oct 31 22:58:03 2009 -0400

Allow menu items to be validated if they aren't channel operations. Fixes #13280.

diffs (52 lines):

diff -r 1e4e0a864d53 -r 70c7d70b49cb Plugins/Purple Service/ESIRCAccount.h
--- a/Plugins/Purple Service/ESIRCAccount.h	Sat Oct 31 22:52:55 2009 -0400
+++ b/Plugins/Purple Service/ESIRCAccount.h	Sat Oct 31 22:58:03 2009 -0400
@@ -14,6 +14,8 @@
 #define KEY_IRC_ENCODING	@"IRC:Encoding"
 
 typedef enum {
+	AIUnspecifiedOperation = 0,
+	AIRequiresNoLevel,
 	AIRequiresOp,
 	AIRequiresHalfop
 } AIOperationRequirement;
diff -r 1e4e0a864d53 -r 70c7d70b49cb Plugins/Purple Service/ESIRCAccount.m
--- a/Plugins/Purple Service/ESIRCAccount.m	Sat Oct 31 22:52:55 2009 -0400
+++ b/Plugins/Purple Service/ESIRCAccount.m	Sat Oct 31 22:58:03 2009 -0400
@@ -454,24 +454,27 @@
 {
 	AIOperationRequirement req = menuItem.tag;
 	AIChat *chat = adium.interfaceController.activeChat;
-	
-	if (!chat.chatContainer.messageViewController.selectedListObjects.count) {
-		return NO;
-	}
-	
+	BOOL anySelected = chat.chatContainer.messageViewController.selectedListObjects.count > 0;
+		
 	AIGroupChatFlags flags = [self flagsInChat:chat];
 	
 	switch (req) {
 		case AIRequiresHalfop:
-			return ((flags & AIGroupChatOp) == AIGroupChatOp || (flags & AIGroupChatHalfOp) == AIGroupChatHalfOp);
+			return (anySelected && ((flags & AIGroupChatOp) == AIGroupChatOp || (flags & AIGroupChatHalfOp) == AIGroupChatHalfOp));
 			break;
 			
 		case AIRequiresOp:
-			return ((flags & AIGroupChatOp) == AIGroupChatOp);
+			return (anySelected && ((flags & AIGroupChatOp) == AIGroupChatOp));
+			break;
+			
+		case AIRequiresNoLevel:
+			return anySelected;
+			break;
+			
+		default:
+			return YES;
 			break;
 	}
-	
-	return NO;
 }
 
 #pragma mark Action Menu's Actions



More information about the commits mailing list