Add a "Do Nothing" event. Technically a "do nothing further" event as it will keep the events that have already been added. Fixes #3590.
authorFrank Dowsett <wixardy@adium.im>
Sat, 17 Jul 2010 23:23:51 -0400
changeset 3259a71c719e9271
parent 3258 9cb82de71c1b
child 3260 af2eb0ac74e7
Add a "Do Nothing" event. Technically a "do nothing further" event as it will keep the events that have already been added. Fixes #3590.
I don't know if it will need a better name or description or implementation.
Adium.xcodeproj/project.pbxproj
Plugins/Do Nothing Contact Alert/AIDoNothingContactAlertPlugin.h
Plugins/Do Nothing Contact Alert/AIDoNothingContactAlertPlugin.m
Resources/Stop sign.png
Source/AICoreComponentLoader.m
Source/ESContactAlertsController.m
     1.1 --- a/Adium.xcodeproj/project.pbxproj	Sat Jul 17 18:12:47 2010 -0400
     1.2 +++ b/Adium.xcodeproj/project.pbxproj	Sat Jul 17 23:23:51 2010 -0400
     1.3 @@ -1149,6 +1149,8 @@
     1.4  		4F1CB6420D640DA40073A1E6 /* info_segment.png in Resources */ = {isa = PBXBuildFile; fileRef = 4F1CB63E0D640DA40073A1E6 /* info_segment.png */; };
     1.5  		4F1CB64C0D640F4F0073A1E6 /* ContactInfoInspector.nib in Resources */ = {isa = PBXBuildFile; fileRef = 4F1CB64B0D640F4F0073A1E6 /* ContactInfoInspector.nib */; };
     1.6  		5A1781860EC1215D00BA1E04 /* AIAutoScrollTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A1781850EC1215D00BA1E04 /* AIAutoScrollTextView.m */; };
     1.7 +		5A9A9F8911F2951400328DF9 /* AIDoNothingContactAlertPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A9A9F8811F2951400328DF9 /* AIDoNothingContactAlertPlugin.m */; };
     1.8 +		5A9A9F8B11F295EB00328DF9 /* Stop sign.png in Resources */ = {isa = PBXBuildFile; fileRef = 5A9A9F8A11F295EB00328DF9 /* Stop sign.png */; };
     1.9  		63093C2F0892143500F118D3 /* newContentThreeDigits.png in Resources */ = {isa = PBXBuildFile; fileRef = 63093C2D0892143500F118D3 /* newContentThreeDigits.png */; };
    1.10  		63093C300892143500F118D3 /* newContentTwoDigits.png in Resources */ = {isa = PBXBuildFile; fileRef = 63093C2E0892143500F118D3 /* newContentTwoDigits.png */; };
    1.11  		6311F4710E340DD2004234B8 /* AISharedAdium.h in Headers */ = {isa = PBXBuildFile; fileRef = 6311F46F0E340DD2004234B8 /* AISharedAdium.h */; settings = {ATTRIBUTES = (Public, ); }; };
    1.12 @@ -4287,6 +4289,9 @@
    1.13  		5A7645BB11E0486300E5E0AF /* sk_SK */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = sk_SK; path = "Plugins/Twitter Plugin/sk_SK.lproj/AITwitterAccountView.nib"; sourceTree = "<group>"; };
    1.14  		5A76477F11E04B8400E5E0AF /* sk_SK */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = sk_SK; path = "Frameworks/Adium Framework/Resources/sk_SK.lproj/EditStateSheet.nib"; sourceTree = "<group>"; };
    1.15  		5A76478911E04B8F00E5E0AF /* sk_SK */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sk_SK; path = sk_SK.lproj/Localizable.strings; sourceTree = "<group>"; };
    1.16 +		5A9A9F8711F2951400328DF9 /* AIDoNothingContactAlertPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AIDoNothingContactAlertPlugin.h; sourceTree = "<group>"; };
    1.17 +		5A9A9F8811F2951400328DF9 /* AIDoNothingContactAlertPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AIDoNothingContactAlertPlugin.m; sourceTree = "<group>"; };
    1.18 +		5A9A9F8A11F295EB00328DF9 /* Stop sign.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Stop sign.png"; path = "Resources/Stop sign.png"; sourceTree = SOURCE_ROOT; };
    1.19  		63093C2D0892143500F118D3 /* newContentThreeDigits.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = newContentThreeDigits.png; sourceTree = "<group>"; };
    1.20  		63093C2E0892143500F118D3 /* newContentTwoDigits.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = newContentTwoDigits.png; sourceTree = "<group>"; };
    1.21  		6311F46F0E340DD2004234B8 /* AISharedAdium.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AISharedAdium.h; path = "Frameworks/Adium Framework/Source/AISharedAdium.h"; sourceTree = "<group>"; };
    1.22 @@ -6073,6 +6078,7 @@
    1.23  				343EAB8306EF857F001CDAFF /* Applescript Contact Alert */,
    1.24  				4B18A51F0459F89300A8010A /* Contact and Chat Dock Overlays */,
    1.25  				4BAA1B3F0632EDDE00D8B92C /* Contact Status Events */,
    1.26 +				5AF6824311C46E6B005B3AF5 /* Do Nothing Contact Alert */,
    1.27  				9EB7C05703D52AFA00415B22 /* Dock Behavior Contact Alert */,
    1.28  				346BA3330774C21300628F06 /* Global Events Preferences */,
    1.29  				52C623DE06697AFA0006C387 /* Growl */,
    1.30 @@ -7561,6 +7567,17 @@
    1.31  			name = Growl;
    1.32  			sourceTree = "<group>";
    1.33  		};
    1.34 +		5AF6824311C46E6B005B3AF5 /* Do Nothing Contact Alert */ = {
    1.35 +			isa = PBXGroup;
    1.36 +			children = (
    1.37 +				5A9A9F8A11F295EB00328DF9 /* Stop sign.png */,
    1.38 +				5A9A9F8711F2951400328DF9 /* AIDoNothingContactAlertPlugin.h */,
    1.39 +				5A9A9F8811F2951400328DF9 /* AIDoNothingContactAlertPlugin.m */,
    1.40 +			);
    1.41 +			name = "Do Nothing Contact Alert";
    1.42 +			path = "Plugins/Do Nothing Contact Alert";
    1.43 +			sourceTree = "<group>";
    1.44 +		};
    1.45  		6302F7DE0F9D9D4C001E3EC7 /* Linked Frameworks */ = {
    1.46  			isa = PBXGroup;
    1.47  			children = (
    1.48 @@ -10094,6 +10111,7 @@
    1.49  				1130EA9E109B445D00FB3454 /* pref-messagealerts.png in Resources */,
    1.50  				11AE5555109CC88C0074BDC2 /* pref-confirmations.png in Resources */,
    1.51  				1147FCC810D1CB83004E9E8D /* AIMediaWindow.nib in Resources */,
    1.52 +				5A9A9F8B11F295EB00328DF9 /* Stop sign.png in Resources */,
    1.53  			);
    1.54  			runOnlyForDeploymentPostprocessing = 0;
    1.55  		};
    1.56 @@ -10760,6 +10778,7 @@
    1.57  				11000D041098863B0096A1E2 /* AIDefaultFontRemovalPlugin.m in Sources */,
    1.58  				11819A0410D0B8BE003E8ECA /* AIMediaController.m in Sources */,
    1.59  				1147FCC410D1CB4C004E9E8D /* AIMediaWindowController.m in Sources */,
    1.60 +				5A9A9F8911F2951400328DF9 /* AIDoNothingContactAlertPlugin.m in Sources */,
    1.61  			);
    1.62  			runOnlyForDeploymentPostprocessing = 0;
    1.63  		};
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/Plugins/Do Nothing Contact Alert/AIDoNothingContactAlertPlugin.h	Sat Jul 17 23:23:51 2010 -0400
     2.3 @@ -0,0 +1,25 @@
     2.4 +/* 
     2.5 + * Adium is the legal property of its developers, whose names are listed in the copyright file included
     2.6 + * with this source distribution.
     2.7 + * 
     2.8 + * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
     2.9 + * General Public License as published by the Free Software Foundation; either version 2 of the License,
    2.10 + * or (at your option) any later version.
    2.11 + * 
    2.12 + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
    2.13 + * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
    2.14 + * Public License for more details.
    2.15 + * 
    2.16 + * You should have received a copy of the GNU General Public License along with this program; if not,
    2.17 + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    2.18 + */
    2.19 +
    2.20 +#import <Adium/AIContactAlertsControllerProtocol.h>
    2.21 +
    2.22 +#define DO_NOTHING_ALERT_IDENTIFIER            @"Do Nothing"
    2.23 +
    2.24 +@interface AIDoNothingContactAlertPlugin : AIPlugin <AIActionHandler> {
    2.25 +
    2.26 +}
    2.27 +
    2.28 +@end
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/Plugins/Do Nothing Contact Alert/AIDoNothingContactAlertPlugin.m	Sat Jul 17 23:23:51 2010 -0400
     3.3 @@ -0,0 +1,60 @@
     3.4 +/* 
     3.5 + * Adium is the legal property of its developers, whose names are listed in the copyright file included
     3.6 + * with this source distribution.
     3.7 + * 
     3.8 + * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
     3.9 + * General Public License as published by the Free Software Foundation; either version 2 of the License,
    3.10 + * or (at your option) any later version.
    3.11 + * 
    3.12 + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
    3.13 + * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
    3.14 + * Public License for more details.
    3.15 + * 
    3.16 + * You should have received a copy of the GNU General Public License along with this program; if not,
    3.17 + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    3.18 + */
    3.19 +
    3.20 +#import "AIDoNothingContactAlertPlugin.h"
    3.21 +#import <AIUtilities/AIImageAdditions.h>
    3.22 +
    3.23 +#define DO_NOTHING_ALERT_SHORT	AILocalizedString(@"Do Nothing", nil)
    3.24 +#define DO_NOTHING_ALERT_LONG	AILocalizedString(@"Do Not perform any further actions", nil)
    3.25 +
    3.26 +@implementation AIDoNothingContactAlertPlugin
    3.27 +
    3.28 +- (void)installPlugin
    3.29 +{
    3.30 +	[adium.contactAlertsController registerActionID:DO_NOTHING_ALERT_IDENTIFIER withHandler:self];
    3.31 +}
    3.32 +
    3.33 +- (NSString *)shortDescriptionForActionID:(NSString *)actionID
    3.34 +{
    3.35 +	return DO_NOTHING_ALERT_SHORT;
    3.36 +}
    3.37 +
    3.38 +- (NSString *)longDescriptionForActionID:(NSString *)actionID withDetails:(NSDictionary *)details
    3.39 +{
    3.40 +	return DO_NOTHING_ALERT_LONG;
    3.41 +}
    3.42 +
    3.43 +- (NSImage *)imageForActionID:(NSString *)actionID
    3.44 +{
    3.45 +	return [NSImage imageNamed:@"Stop sign" forClass:[self class]];
    3.46 +}
    3.47 +
    3.48 +- (AIModularPane *)detailsPaneForActionID:(NSString *)actionID
    3.49 +{
    3.50 +	return nil;
    3.51 +}
    3.52 +
    3.53 +- (BOOL)performActionID:(NSString *)actionID forListObject:(AIListObject *)listObject withDetails:(NSDictionary *)details triggeringEventID:(NSString *)eventID userInfo:(id)userInfo
    3.54 +{
    3.55 +	return YES;
    3.56 +}
    3.57 +
    3.58 +- (BOOL)allowMultipleActionsWithID:(NSString *)actionID
    3.59 +{
    3.60 +	return YES;
    3.61 +}
    3.62 +
    3.63 +@end
     4.1 Binary file Resources/Stop sign.png has changed
     5.1 --- a/Source/AICoreComponentLoader.m	Sat Jul 17 18:12:47 2010 -0400
     5.2 +++ b/Source/AICoreComponentLoader.m	Sat Jul 17 23:23:51 2010 -0400
     5.3 @@ -163,6 +163,7 @@
     5.4  		@"CBPurpleServicePlugin",
     5.5  		@"AIImageUploaderPlugin",
     5.6  		@"AITwitterStatusFollowup",
     5.7 +		@"AIDoNothingContactAlertPlugin",
     5.8  		nil
     5.9  	];
    5.10  	//Load each component
     6.1 --- a/Source/ESContactAlertsController.m	Sat Jul 17 18:12:47 2010 -0400
     6.2 +++ b/Source/ESContactAlertsController.m	Sat Jul 17 23:23:51 2010 -0400
     6.3 @@ -15,7 +15,7 @@
     6.4   */
     6.5  
     6.6  #import "ESContactAlertsController.h"
     6.7 -
     6.8 +#import "AIDoNothingContactAlertPlugin.h"
     6.9  #import <Adium/AIListObject.h>
    6.10  #import <AIUtilities/AIMenuAdditions.h>
    6.11  #import <AIUtilities/AIImageDrawingAdditions.h>
    6.12 @@ -291,8 +291,6 @@
    6.13  	NSMutableSet	*performedActionIDs = nil;
    6.14  	
    6.15  	if (alerts && [alerts count]) {
    6.16 -		NSDictionary		*alert;
    6.17 -
    6.18  		performedActionIDs = (previouslyPerformedActionIDs ?
    6.19  							  [[previouslyPerformedActionIDs mutableCopy] autorelease]:
    6.20  							  [NSMutableSet set]);
    6.21 @@ -300,12 +298,9 @@
    6.22  		//We go from contact->group->root; a given action will only fire once for this event
    6.23  
    6.24  		//Process each alert (There may be more than one for an event)
    6.25 -		for (alert in alerts) {
    6.26 -			NSString	*actionID;
    6.27 -			id <AIActionHandler>	actionHandler;			
    6.28 -			
    6.29 -			actionID = [alert objectForKey:KEY_ACTION_ID];
    6.30 -			actionHandler = [actionHandlers objectForKey:actionID];		
    6.31 +		for (NSDictionary *alert in alerts) {
    6.32 +			NSString *actionID = [alert objectForKey:KEY_ACTION_ID];
    6.33 +			id <AIActionHandler> actionHandler = [actionHandlers objectForKey:actionID];
    6.34  			
    6.35  			if ((![performedActionIDs containsObject:actionID]) || ([actionHandler allowMultipleActionsWithID:actionID])) {
    6.36  				if ([actionHandler performActionID:actionID
    6.37 @@ -341,7 +336,7 @@
    6.38   * @brief Append events for the passed object to the specified array.
    6.39   *
    6.40   * @param events The array of events so far. Create the array if passed nil.
    6.41 - * @param The object for which we'ere retrieving events. If nil, we retrieve the global preferences.
    6.42 + * @param The object for which we're retrieving events. If nil, we retrieve the global preferences.
    6.43   *
    6.44   * This method is intended to be called recursively; it should generate an array which has alerts from:
    6.45   * contact->metaContact->group->global preferences (skipping any which don't exist).
    6.46 @@ -360,6 +355,13 @@
    6.47  	if (newEvents && [newEvents count]) {
    6.48  		if (!events) events = [NSMutableArray array];
    6.49  		[events addObjectsFromArray:newEvents];
    6.50 +		
    6.51 +		//Don't add any more events if there's a Do Nothing action
    6.52 +		for (NSDictionary *event in newEvents){
    6.53 +			NSString *actionID = [event objectForKey:KEY_ACTION_ID];
    6.54 +			if ([actionID isEqualToString:DO_NOTHING_ALERT_IDENTIFIER])
    6.55 +				return events;
    6.56 +		}
    6.57  	}
    6.58  
    6.59  	//Get all events from the contanining object if we have an object