adium 2464:c18f126c7516: Add "runs an open proxy monitor to prev...

commits at adium.im commits at adium.im
Sat Jun 6 01:23:01 UTC 2009


details:	http://hg.adium.im/adium/rev/c18f126c7516
revision:	2464:c18f126c7516
author:		Zachary West <zacw at adium.im>
date:		Tue Jun 02 23:51:36 2009 -0400

Add "runs an open proxy monitor to prevent abuse" to the hiding list.
Subject: adium 2465:6af1d85561ec: Immediately post the first GROWL_QUEUE_POST_COUNT growls for a particular event key. Afterwards, queue them up and post the total count (or the next one, if only 1 exists). Fixes #12327.

details:	http://hg.adium.im/adium/rev/6af1d85561ec
revision:	2465:6af1d85561ec
author:		Zachary West <zacw at adium.im>
date:		Fri Jun 05 21:22:17 2009 -0400

Immediately post the first GROWL_QUEUE_POST_COUNT growls for a particular event key. Afterwards, queue them up and post the total count (or the next one, if only 1 exists). Fixes #12327.

This has behavior which should make the queue go unnoticed except in cases where >5 events come in all at once. In which case, the first 5 will post, followed "shortly" thereafter by the count of remaining ones.

diffs (73 lines):

diff -r 5ef748004186 -r 6af1d85561ec Plugins/Purple Service/AIAnnoyingIRCMessagesHiderPlugin.m
--- a/Plugins/Purple Service/AIAnnoyingIRCMessagesHiderPlugin.m	Thu Jun 04 01:58:12 2009 -0700
+++ b/Plugins/Purple Service/AIAnnoyingIRCMessagesHiderPlugin.m	Fri Jun 05 21:22:17 2009 -0400
@@ -53,6 +53,7 @@
 							   @"if you see",
 							   @"please disregard them, as they are",
 							   @"for more information please visit",
+							   @"runs an open proxy monitor to prevent abuse",
 							   nil];
 	
 	if ([contentObject.source.UID rangeOfString:@"."].location != NSNotFound) {
diff -r 5ef748004186 -r 6af1d85561ec Source/NEHGrowlPlugin.h
--- a/Source/NEHGrowlPlugin.h	Thu Jun 04 01:58:12 2009 -0700
+++ b/Source/NEHGrowlPlugin.h	Fri Jun 05 21:22:17 2009 -0400
@@ -20,6 +20,7 @@
 #define KEY_GROWL_ALERT_STICKY	@"Growl Sticky"
 #define KEY_GROWL_PRIORITY		@"Growl Priority"
 #define GROWL_QUEUE_WAIT		0.75 // Seconds to wait before clearing an event type's queue
+#define GROWL_QUEUE_POST_COUNT	5
 
 @protocol GrowlApplicationBridgeDelegate;
 
diff -r 5ef748004186 -r 6af1d85561ec Source/NEHGrowlPlugin.m
--- a/Source/NEHGrowlPlugin.m	Thu Jun 04 01:58:12 2009 -0700
+++ b/Source/NEHGrowlPlugin.m	Fri Jun 05 21:22:17 2009 -0400
@@ -240,6 +240,14 @@
 	[self performSelector:@selector(clearQueue:)
 			   withObject:queueCall
 			   afterDelay:GROWL_QUEUE_WAIT];
+	
+	// If the queue has <GROWL_QUEUE_POST_COUNT entries already, post this one immediately.
+	if (events.count < GROWL_QUEUE_POST_COUNT) {
+		[self postSingleEventID:eventID
+				  forListObject:listObject
+					withDetails:details
+					   userInfo:userInfo];
+	}
 
 	return YES;
 }
@@ -289,17 +297,23 @@
 		return;
 	}
 	
-	if (events.count <= 5) {
-		// If we only have a few events, just post them individually.
+	// Remove the first GROWL_QUEUE_POST_COUNT entries, since we've already posted about them.
+	NSRange removeRange = NSMakeRange(0,
+									  (events.count > GROWL_QUEUE_POST_COUNT ? GROWL_QUEUE_POST_COUNT : events.count));
+
+	[events removeObjectsInRange:removeRange];
+	
+	if (events.count == 1) {
+		// Seeing "1 message" is just silly!
 		
-		for (NSDictionary *event in events) {
-			[self postSingleEventID:eventID
-					  forListObject:[event objectForKey:@"AIListObject"]
-						withDetails:[event objectForKey:@"Details"]
-						   userInfo:[event objectForKey:@"UserInfo"]];
-		}
+		NSDictionary *event = [events objectAtIndex:0];
 		
-	} else {
+		[self postSingleEventID:eventID
+				  forListObject:[event objectForKey:@"AIListObject"]
+					withDetails:[event objectForKey:@"Details"]
+					   userInfo:[event objectForKey:@"UserInfo"]];
+		
+	} else if(events.count) {		
 		// We have a bunch of events; let's combine them.
 		AIListObject *overallListObject = nil;
 




More information about the commits mailing list