adium 3259:a71c719e9271: Add a "Do Nothing" event. Technically a...
commits at adium.im
commits at adium.im
Sun Jul 18 03:27:54 UTC 2010
details: http://hg.adium.im/adium/rev/a71c719e9271
revision: 3259:a71c719e9271
author: Frank Dowsett <wixardy at adium.im>
date: Sat Jul 17 23:23:51 2010 -0400
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.
diffs (230 lines):
diff -r 9cb82de71c1b -r a71c719e9271 Adium.xcodeproj/project.pbxproj
--- a/Adium.xcodeproj/project.pbxproj Sat Jul 17 18:12:47 2010 -0400
+++ b/Adium.xcodeproj/project.pbxproj Sat Jul 17 23:23:51 2010 -0400
@@ -1149,6 +1149,8 @@
4F1CB6420D640DA40073A1E6 /* info_segment.png in Resources */ = {isa = PBXBuildFile; fileRef = 4F1CB63E0D640DA40073A1E6 /* info_segment.png */; };
4F1CB64C0D640F4F0073A1E6 /* ContactInfoInspector.nib in Resources */ = {isa = PBXBuildFile; fileRef = 4F1CB64B0D640F4F0073A1E6 /* ContactInfoInspector.nib */; };
5A1781860EC1215D00BA1E04 /* AIAutoScrollTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A1781850EC1215D00BA1E04 /* AIAutoScrollTextView.m */; };
+ 5A9A9F8911F2951400328DF9 /* AIDoNothingContactAlertPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A9A9F8811F2951400328DF9 /* AIDoNothingContactAlertPlugin.m */; };
+ 5A9A9F8B11F295EB00328DF9 /* Stop sign.png in Resources */ = {isa = PBXBuildFile; fileRef = 5A9A9F8A11F295EB00328DF9 /* Stop sign.png */; };
63093C2F0892143500F118D3 /* newContentThreeDigits.png in Resources */ = {isa = PBXBuildFile; fileRef = 63093C2D0892143500F118D3 /* newContentThreeDigits.png */; };
63093C300892143500F118D3 /* newContentTwoDigits.png in Resources */ = {isa = PBXBuildFile; fileRef = 63093C2E0892143500F118D3 /* newContentTwoDigits.png */; };
6311F4710E340DD2004234B8 /* AISharedAdium.h in Headers */ = {isa = PBXBuildFile; fileRef = 6311F46F0E340DD2004234B8 /* AISharedAdium.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -4287,6 +4289,9 @@
5A7645BB11E0486300E5E0AF /* sk_SK */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = sk_SK; path = "Plugins/Twitter Plugin/sk_SK.lproj/AITwitterAccountView.nib"; sourceTree = "<group>"; };
5A76477F11E04B8400E5E0AF /* sk_SK */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = sk_SK; path = "Frameworks/Adium Framework/Resources/sk_SK.lproj/EditStateSheet.nib"; sourceTree = "<group>"; };
5A76478911E04B8F00E5E0AF /* sk_SK */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sk_SK; path = sk_SK.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 5A9A9F8711F2951400328DF9 /* AIDoNothingContactAlertPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AIDoNothingContactAlertPlugin.h; sourceTree = "<group>"; };
+ 5A9A9F8811F2951400328DF9 /* AIDoNothingContactAlertPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AIDoNothingContactAlertPlugin.m; sourceTree = "<group>"; };
+ 5A9A9F8A11F295EB00328DF9 /* Stop sign.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Stop sign.png"; path = "Resources/Stop sign.png"; sourceTree = SOURCE_ROOT; };
63093C2D0892143500F118D3 /* newContentThreeDigits.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = newContentThreeDigits.png; sourceTree = "<group>"; };
63093C2E0892143500F118D3 /* newContentTwoDigits.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = newContentTwoDigits.png; sourceTree = "<group>"; };
6311F46F0E340DD2004234B8 /* AISharedAdium.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AISharedAdium.h; path = "Frameworks/Adium Framework/Source/AISharedAdium.h"; sourceTree = "<group>"; };
@@ -6073,6 +6078,7 @@
343EAB8306EF857F001CDAFF /* Applescript Contact Alert */,
4B18A51F0459F89300A8010A /* Contact and Chat Dock Overlays */,
4BAA1B3F0632EDDE00D8B92C /* Contact Status Events */,
+ 5AF6824311C46E6B005B3AF5 /* Do Nothing Contact Alert */,
9EB7C05703D52AFA00415B22 /* Dock Behavior Contact Alert */,
346BA3330774C21300628F06 /* Global Events Preferences */,
52C623DE06697AFA0006C387 /* Growl */,
@@ -7561,6 +7567,17 @@
name = Growl;
sourceTree = "<group>";
};
+ 5AF6824311C46E6B005B3AF5 /* Do Nothing Contact Alert */ = {
+ isa = PBXGroup;
+ children = (
+ 5A9A9F8A11F295EB00328DF9 /* Stop sign.png */,
+ 5A9A9F8711F2951400328DF9 /* AIDoNothingContactAlertPlugin.h */,
+ 5A9A9F8811F2951400328DF9 /* AIDoNothingContactAlertPlugin.m */,
+ );
+ name = "Do Nothing Contact Alert";
+ path = "Plugins/Do Nothing Contact Alert";
+ sourceTree = "<group>";
+ };
6302F7DE0F9D9D4C001E3EC7 /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
@@ -10094,6 +10111,7 @@
1130EA9E109B445D00FB3454 /* pref-messagealerts.png in Resources */,
11AE5555109CC88C0074BDC2 /* pref-confirmations.png in Resources */,
1147FCC810D1CB83004E9E8D /* AIMediaWindow.nib in Resources */,
+ 5A9A9F8B11F295EB00328DF9 /* Stop sign.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -10760,6 +10778,7 @@
11000D041098863B0096A1E2 /* AIDefaultFontRemovalPlugin.m in Sources */,
11819A0410D0B8BE003E8ECA /* AIMediaController.m in Sources */,
1147FCC410D1CB4C004E9E8D /* AIMediaWindowController.m in Sources */,
+ 5A9A9F8911F2951400328DF9 /* AIDoNothingContactAlertPlugin.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff -r 9cb82de71c1b -r a71c719e9271 Plugins/Do Nothing Contact Alert/AIDoNothingContactAlertPlugin.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Plugins/Do Nothing Contact Alert/AIDoNothingContactAlertPlugin.h Sat Jul 17 23:23:51 2010 -0400
@@ -0,0 +1,25 @@
+/*
+ * Adium is the legal property of its developers, whose names are listed in the copyright file included
+ * with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+ * Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with this program; if not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#import <Adium/AIContactAlertsControllerProtocol.h>
+
+#define DO_NOTHING_ALERT_IDENTIFIER @"Do Nothing"
+
+ at interface AIDoNothingContactAlertPlugin : AIPlugin <AIActionHandler> {
+
+}
+
+ at end
diff -r 9cb82de71c1b -r a71c719e9271 Plugins/Do Nothing Contact Alert/AIDoNothingContactAlertPlugin.m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Plugins/Do Nothing Contact Alert/AIDoNothingContactAlertPlugin.m Sat Jul 17 23:23:51 2010 -0400
@@ -0,0 +1,60 @@
+/*
+ * Adium is the legal property of its developers, whose names are listed in the copyright file included
+ * with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+ * Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with this program; if not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#import "AIDoNothingContactAlertPlugin.h"
+#import <AIUtilities/AIImageAdditions.h>
+
+#define DO_NOTHING_ALERT_SHORT AILocalizedString(@"Do Nothing", nil)
+#define DO_NOTHING_ALERT_LONG AILocalizedString(@"Do Not perform any further actions", nil)
+
+ at implementation AIDoNothingContactAlertPlugin
+
+- (void)installPlugin
+{
+ [adium.contactAlertsController registerActionID:DO_NOTHING_ALERT_IDENTIFIER withHandler:self];
+}
+
+- (NSString *)shortDescriptionForActionID:(NSString *)actionID
+{
+ return DO_NOTHING_ALERT_SHORT;
+}
+
+- (NSString *)longDescriptionForActionID:(NSString *)actionID withDetails:(NSDictionary *)details
+{
+ return DO_NOTHING_ALERT_LONG;
+}
+
+- (NSImage *)imageForActionID:(NSString *)actionID
+{
+ return [NSImage imageNamed:@"Stop sign" forClass:[self class]];
+}
+
+- (AIModularPane *)detailsPaneForActionID:(NSString *)actionID
+{
+ return nil;
+}
+
+- (BOOL)performActionID:(NSString *)actionID forListObject:(AIListObject *)listObject withDetails:(NSDictionary *)details triggeringEventID:(NSString *)eventID userInfo:(id)userInfo
+{
+ return YES;
+}
+
+- (BOOL)allowMultipleActionsWithID:(NSString *)actionID
+{
+ return YES;
+}
+
+ at end
diff -r 9cb82de71c1b -r a71c719e9271 Resources/Stop sign.png
Binary file Resources/Stop sign.png has changed
diff -r 9cb82de71c1b -r a71c719e9271 Source/AICoreComponentLoader.m
--- a/Source/AICoreComponentLoader.m Sat Jul 17 18:12:47 2010 -0400
+++ b/Source/AICoreComponentLoader.m Sat Jul 17 23:23:51 2010 -0400
@@ -163,6 +163,7 @@
@"CBPurpleServicePlugin",
@"AIImageUploaderPlugin",
@"AITwitterStatusFollowup",
+ @"AIDoNothingContactAlertPlugin",
nil
];
//Load each component
diff -r 9cb82de71c1b -r a71c719e9271 Source/ESContactAlertsController.m
--- a/Source/ESContactAlertsController.m Sat Jul 17 18:12:47 2010 -0400
+++ b/Source/ESContactAlertsController.m Sat Jul 17 23:23:51 2010 -0400
@@ -15,7 +15,7 @@
*/
#import "ESContactAlertsController.h"
-
+#import "AIDoNothingContactAlertPlugin.h"
#import <Adium/AIListObject.h>
#import <AIUtilities/AIMenuAdditions.h>
#import <AIUtilities/AIImageDrawingAdditions.h>
@@ -291,8 +291,6 @@
NSMutableSet *performedActionIDs = nil;
if (alerts && [alerts count]) {
- NSDictionary *alert;
-
performedActionIDs = (previouslyPerformedActionIDs ?
[[previouslyPerformedActionIDs mutableCopy] autorelease]:
[NSMutableSet set]);
@@ -300,12 +298,9 @@
//We go from contact->group->root; a given action will only fire once for this event
//Process each alert (There may be more than one for an event)
- for (alert in alerts) {
- NSString *actionID;
- id <AIActionHandler> actionHandler;
-
- actionID = [alert objectForKey:KEY_ACTION_ID];
- actionHandler = [actionHandlers objectForKey:actionID];
+ for (NSDictionary *alert in alerts) {
+ NSString *actionID = [alert objectForKey:KEY_ACTION_ID];
+ id <AIActionHandler> actionHandler = [actionHandlers objectForKey:actionID];
if ((![performedActionIDs containsObject:actionID]) || ([actionHandler allowMultipleActionsWithID:actionID])) {
if ([actionHandler performActionID:actionID
@@ -341,7 +336,7 @@
* @brief Append events for the passed object to the specified array.
*
* @param events The array of events so far. Create the array if passed nil.
- * @param The object for which we'ere retrieving events. If nil, we retrieve the global preferences.
+ * @param The object for which we're retrieving events. If nil, we retrieve the global preferences.
*
* This method is intended to be called recursively; it should generate an array which has alerts from:
* contact->metaContact->group->global preferences (skipping any which don't exist).
@@ -360,6 +355,13 @@
if (newEvents && [newEvents count]) {
if (!events) events = [NSMutableArray array];
[events addObjectsFromArray:newEvents];
+
+ //Don't add any more events if there's a Do Nothing action
+ for (NSDictionary *event in newEvents){
+ NSString *actionID = [event objectForKey:KEY_ACTION_ID];
+ if ([actionID isEqualToString:DO_NOTHING_ALERT_IDENTIFIER])
+ return events;
+ }
}
//Get all events from the contanining object if we have an object
More information about the commits
mailing list