adium 4494:962310cfb7a0: Rewrote the AdiumApplescriptRunner to u...
commits at adium.im
commits at adium.im
Wed Jan 11 22:31:17 UTC 2012
details: http://hg.adium.im/adium/rev/962310cfb7a0
revision: 4494:962310cfb7a0
branch: AdiumApplescriptRunnerUsingXPC
author: Thijs Alkemade <thijsalkemade at gmail.com>
date: Wed Jan 11 23:30:27 2012 +0100
Rewrote the AdiumApplescriptRunner to use XPC instead of distributed notifications.
diffs (truncated from 1199 to 1000 lines):
diff -r bb71775097bf -r 962310cfb7a0 Adium.xcodeproj/project.pbxproj
--- a/Adium.xcodeproj/project.pbxproj Wed Jan 11 19:14:11 2012 +0100
+++ b/Adium.xcodeproj/project.pbxproj Wed Jan 11 23:30:27 2012 +0100
@@ -574,9 +574,6 @@
349195670C9662AA00595A04 /* AIListBookmark.h in Headers */ = {isa = PBXBuildFile; fileRef = 349195650C9662AA00595A04 /* AIListBookmark.h */; settings = {ATTRIBUTES = (Public, ); }; };
3496A8C207CE6B880055BBAB /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3496A8C107CE6B880055BBAB /* InfoPlist.strings */; };
349710DD096C4C7700699948 /* Buttons.strings in Resources */ = {isa = PBXBuildFile; fileRef = 349710DB096C4C7700699948 /* Buttons.strings */; };
- 349C2F470867AD16000BF883 /* ApplescriptRunner.m in Sources */ = {isa = PBXBuildFile; fileRef = 349C2F460867AD16000BF883 /* ApplescriptRunner.m */; };
- 349C2FF00867AD65000BF883 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 349C2FEF0867AD65000BF883 /* Foundation.framework */; };
- 349C30790867ADA3000BF883 /* AdiumApplescriptRunner in Resources */ = {isa = PBXBuildFile; fileRef = 349C2EFA0867AC97000BF883 /* AdiumApplescriptRunner */; };
349C6E4907C96D45005EB896 /* CBContactCountingDisplayPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 349C6E4607C96D44005EB896 /* CBContactCountingDisplayPlugin.m */; };
349C6E8E07C972B2005EB896 /* AIExtendedStatusPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 349C6E8C07C972B2005EB896 /* AIExtendedStatusPlugin.m */; };
349C6F6607C99ACF005EB896 /* ESContactListAdvancedPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 349C6F6407C99ACE005EB896 /* ESContactListAdvancedPreferences.m */; };
@@ -1402,6 +1399,9 @@
766ABAB61306D1020049FFB7 /* AIUnreadMessagesTooltip.m in Sources */ = {isa = PBXBuildFile; fileRef = 766ABAB51306D1020049FFB7 /* AIUnreadMessagesTooltip.m */; };
76889DEB12D3CA17007AEF00 /* GetInfo.png in Resources */ = {isa = PBXBuildFile; fileRef = 76889DEA12D3CA17007AEF00 /* GetInfo.png */; };
76889DEF12D3CA40007AEF00 /* Personal.png in Resources */ = {isa = PBXBuildFile; fileRef = 76889DEE12D3CA40007AEF00 /* Personal.png */; };
+ 76B73B2114BE287D00A58BAB /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76B73B2014BE287D00A58BAB /* Foundation.framework */; };
+ 76B73B3014BE29AB00A58BAB /* im.adium.AIApplescriptRunner.xpc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 76B73B1E14BE287D00A58BAB /* im.adium.AIApplescriptRunner.xpc */; };
+ 76B73B3414BE3B9400A58BAB /* AIApplescriptRunner.m in Sources */ = {isa = PBXBuildFile; fileRef = 76B73B3314BE3B9400A58BAB /* AIApplescriptRunner.m */; };
76C1AF9C125A906A00D269A9 /* AIAdiumURLProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = 76C1AF9B125A906A00D269A9 /* AIAdiumURLProtocol.m */; };
7E6F8A94105611B700C6D80D /* libotr.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7E6F8A93105611B700C6D80D /* libotr.framework */; };
7E6F8ACD105613AD00C6D80D /* libotr.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 7E6F8A93105611B700C6D80D /* libotr.framework */; };
@@ -1552,13 +1552,6 @@
remoteGlobalIDString = 8DC2EF5B0486A6940098B216;
remoteInfo = AutoHyperlinks.framework;
};
- 349C31620867D199000BF883 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
- proxyType = 1;
- remoteGlobalIDString = 349C2EF90867AC97000BF883;
- remoteInfo = AdiumApplescriptRunner;
- };
6329EFB40F9D33A600112489 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
@@ -1615,6 +1608,13 @@
remoteGlobalIDString = F53C25AE0A2F95F100F7B73D;
remoteInfo = "Setup Build Directory";
};
+ 76B73B3114BE2A5200A58BAB /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 76B73B1D14BE287D00A58BAB;
+ remoteInfo = AIApplescriptRunner;
+ };
7E78DA9B0DD135DE00B9388F /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 3496A8E707CE6CA30055BBAB /* AutoHyperlinks.framework.xcodeproj */;
@@ -1707,6 +1707,16 @@
name = "Copy Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
+ 76B73B2F14BE294900A58BAB /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = Contents/XPCServices;
+ dstSubfolderSpec = 1;
+ files = (
+ 76B73B3014BE29AB00A58BAB /* im.adium.AIApplescriptRunner.xpc in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
F51BCD3E0A156281000FDC06 /* Copy Spotlight Importer */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
@@ -3134,8 +3144,6 @@
3499F4A706309AF60035B468 /* ESPurpleRequestWindowController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ESPurpleRequestWindowController.h; path = "Plugins/Purple Service/ESPurpleRequestWindowController.h"; sourceTree = "<group>"; };
349B39290A5FB150008BE092 /* AIContentEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIContentEvent.h; path = "Frameworks/Adium Framework/Source/AIContentEvent.h"; sourceTree = "<group>"; };
349B392A0A5FB150008BE092 /* AIContentEvent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIContentEvent.m; path = "Frameworks/Adium Framework/Source/AIContentEvent.m"; sourceTree = "<group>"; };
- 349C2EFA0867AC97000BF883 /* AdiumApplescriptRunner */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = AdiumApplescriptRunner; sourceTree = BUILT_PRODUCTS_DIR; };
- 349C2F460867AD16000BF883 /* ApplescriptRunner.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = ApplescriptRunner.m; path = Source/ApplescriptRunner.m; sourceTree = "<group>"; };
349C2FEF0867AD65000BF883 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
349C6E4607C96D44005EB896 /* CBContactCountingDisplayPlugin.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = CBContactCountingDisplayPlugin.m; path = Source/CBContactCountingDisplayPlugin.m; sourceTree = "<group>"; };
349C6E4707C96D45005EB896 /* CBContactCountingDisplayPlugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CBContactCountingDisplayPlugin.h; path = Source/CBContactCountingDisplayPlugin.h; sourceTree = "<group>"; };
@@ -4548,6 +4556,10 @@
766ABAB51306D1020049FFB7 /* AIUnreadMessagesTooltip.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIUnreadMessagesTooltip.m; path = Source/AIUnreadMessagesTooltip.m; sourceTree = "<group>"; };
76889DEA12D3CA17007AEF00 /* GetInfo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = GetInfo.png; path = Resources/GetInfo.png; sourceTree = "<group>"; };
76889DEE12D3CA40007AEF00 /* Personal.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Personal.png; path = Resources/Personal.png; sourceTree = "<group>"; };
+ 76B73B1E14BE287D00A58BAB /* im.adium.AIApplescriptRunner.xpc */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = im.adium.AIApplescriptRunner.xpc; sourceTree = BUILT_PRODUCTS_DIR; };
+ 76B73B2014BE287D00A58BAB /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ 76B73B3314BE3B9400A58BAB /* AIApplescriptRunner.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIApplescriptRunner.m; path = Source/AIApplescriptRunner.m; sourceTree = SOURCE_ROOT; };
+ 76B73B3514BE3BEB00A58BAB /* AIApplescriptRunner-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "AIApplescriptRunner-Info.plist"; path = "Plists/AIApplescriptRunner-Info.plist"; sourceTree = SOURCE_ROOT; };
76C1AF9A125A906A00D269A9 /* AIAdiumURLProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIAdiumURLProtocol.h; path = "Plugins/WebKit Message View/AIAdiumURLProtocol.h"; sourceTree = "<group>"; };
76C1AF9B125A906A00D269A9 /* AIAdiumURLProtocol.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIAdiumURLProtocol.m; path = "Plugins/WebKit Message View/AIAdiumURLProtocol.m"; sourceTree = "<group>"; };
77D903500B78CF1000B86C42 /* zhm */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; name = zhm; path = "Plugins/Purple Service/zhm"; sourceTree = "<group>"; };
@@ -4836,14 +4848,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
- 349C2EF80867AC97000BF883 /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 349C2FF00867AD65000BF883 /* Foundation.framework in Frameworks */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
34BD9D57053146CC000AB133 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@@ -4919,6 +4923,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 76B73B1B14BE287D00A58BAB /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 76B73B2114BE287D00A58BAB /* Foundation.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
@@ -5163,11 +5175,11 @@
children = (
34BD9DA9053146CC000AB133 /* Adium.app */,
34BD9DE105314751000AB133 /* Adium.framework */,
- 349C2EFA0867AC97000BF883 /* AdiumApplescriptRunner */,
3485D68009EB416300232CC4 /* AdiumLibpurple.framework */,
312ED3CA0C7E875B00A6BDA9 /* Unit tests.octest */,
6334FBFC0F9C11DC003C77A9 /* AIUtilities.framework */,
633D4FA40F9D3073004F491E /* AdiumSpotlightImporter.mdimporter */,
+ 76B73B1E14BE287D00A58BAB /* im.adium.AIApplescriptRunner.xpc */,
);
name = Products;
sourceTree = "<group>";
@@ -5187,7 +5199,7 @@
344458F3070B5BF500D8E932 /* Debugging */,
9EB3C52304F94DB7001D1F74 /* Source */,
F50A325A03B5798301A8010A /* Resources */,
- 349C2F310867ACF7000BF883 /* ApplescriptRunner */,
+ 76B73B2214BE287D00A58BAB /* AIApplescriptRunner */,
312ED3D80C7E89CC00A6BDA9 /* Unit tests */,
29B97323FDCFA39411CA2CEA /* Linked Frameworks */,
63C7E0280FAF9B7D00B310AC /* xcconfigs */,
@@ -5199,6 +5211,7 @@
29B97323FDCFA39411CA2CEA /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
+ 76B73B2014BE287D00A58BAB /* Foundation.framework */,
7E9A8CB2104DEBC400F210CC /* Growl.framework */,
34C846E5101E518F00140B4B /* QuickTime.framework */,
34C846AE101E515900140B4B /* QTKit.framework */,
@@ -6068,14 +6081,6 @@
name = "Views and Cells";
sourceTree = "<group>";
};
- 349C2F310867ACF7000BF883 /* ApplescriptRunner */ = {
- isa = PBXGroup;
- children = (
- 349C2F460867AD16000BF883 /* ApplescriptRunner.m */,
- );
- name = ApplescriptRunner;
- sourceTree = "<group>";
- };
349C6E8207C9728B005EB896 /* Contact List */ = {
isa = PBXGroup;
children = (
@@ -8223,6 +8228,15 @@
name = "HTTP Server";
sourceTree = "<group>";
};
+ 76B73B2214BE287D00A58BAB /* AIApplescriptRunner */ = {
+ isa = PBXGroup;
+ children = (
+ 76B73B3514BE3BEB00A58BAB /* AIApplescriptRunner-Info.plist */,
+ 76B73B3314BE3B9400A58BAB /* AIApplescriptRunner.m */,
+ );
+ path = AIApplescriptRunner;
+ sourceTree = "<group>";
+ };
7E824CCD06387FAF00813072 /* Link Management */ = {
isa = PBXGroup;
children = (
@@ -9268,22 +9282,6 @@
productReference = 3485D68009EB416300232CC4 /* AdiumLibpurple.framework */;
productType = "com.apple.product-type.framework";
};
- 349C2EF90867AC97000BF883 /* AdiumApplescriptRunner */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = 349C2F220867ACA9000BF883 /* Build configuration list for PBXNativeTarget "AdiumApplescriptRunner" */;
- buildPhases = (
- 349C2EF70867AC97000BF883 /* Sources */,
- 349C2EF80867AC97000BF883 /* Frameworks */,
- );
- buildRules = (
- );
- dependencies = (
- );
- name = AdiumApplescriptRunner;
- productName = ApplescriptRunner;
- productReference = 349C2EFA0867AC97000BF883 /* AdiumApplescriptRunner */;
- productType = "com.apple.product-type.tool";
- };
34BD9CD1053146CC000AB133 /* Adium */ = {
isa = PBXNativeTarget;
buildConfigurationList = DADE8E22085507450062B664 /* Build configuration list for PBXNativeTarget "Adium" */;
@@ -9296,14 +9294,15 @@
4BF2E91F067CB76300743318 /* Copy Built-in Xtras */,
34BD9D6A053146CC000AB133 /* Copy AdiumPlugins */,
345DFF4A05564DB200CEE7B3 /* Run Generate Buildnum File Script */,
+ 76B73B2F14BE294900A58BAB /* CopyFiles */,
);
buildRules = (
81F9D1DF0A7F81A5004A35BD /* PBXBuildRule */,
);
dependencies = (
+ 76B73B3214BE2A5200A58BAB /* PBXTargetDependency */,
11F6CB2E109BC6AC0070022D /* PBXTargetDependency */,
639DF9E30F97E687003C9A32 /* PBXTargetDependency */,
- 349C31630867D199000BF883 /* PBXTargetDependency */,
6329EFB50F9D33A600112489 /* PBXTargetDependency */,
F5B17CDF0A16C767004AE99E /* PBXTargetDependency */,
);
@@ -9372,6 +9371,23 @@
productReference = 633D4FA40F9D3073004F491E /* AdiumSpotlightImporter.mdimporter */;
productType = "com.apple.product-type.bundle";
};
+ 76B73B1D14BE287D00A58BAB /* AIApplescriptRunner */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 76B73B2B14BE287D00A58BAB /* Build configuration list for PBXNativeTarget "AIApplescriptRunner" */;
+ buildPhases = (
+ 76B73B1A14BE287D00A58BAB /* Sources */,
+ 76B73B1B14BE287D00A58BAB /* Frameworks */,
+ 76B73B1C14BE287D00A58BAB /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = AIApplescriptRunner;
+ productName = AIApplescriptRunner;
+ productReference = 76B73B1E14BE287D00A58BAB /* im.adium.AIApplescriptRunner.xpc */;
+ productType = "com.apple.product-type.bundle";
+ };
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@@ -9442,12 +9458,12 @@
34BD9DAF05314751000AB133 /* Adium.Framework */,
3485D67F09EB416300232CC4 /* AdiumLibpurple */,
6334FBFB0F9C11DC003C77A9 /* AIUtilities.framework */,
- 349C2EF90867AC97000BF883 /* AdiumApplescriptRunner */,
F5B17CCF0A16C6AC004AE99E /* Plist Macros */,
F53C25AE0A2F95F100F7B73D /* Setup Build Directory */,
34F3B9510BDF15F40011AB34 /* Touch Framework Bundles to Executable Date */,
312ED3C90C7E875B00A6BDA9 /* Unit tests */,
633D4FA30F9D3073004F491E /* Spotlight Importer */,
+ 76B73B1D14BE287D00A58BAB /* AIApplescriptRunner */,
);
};
/* End PBXProject section */
@@ -9586,7 +9602,6 @@
9EF0DBFA09D944C200FBCC1E /* Resources/block.png in Resources */,
9EF0DBFB09D944C200FBCC1E /* Resources/unblock.png in Resources */,
346F5D3208A43E7B0055C610 /* CurrentTunes.scpt in Resources */,
- 349C30790867ADA3000BF883 /* AdiumApplescriptRunner in Resources */,
349C7C7A07C9AE1B005EB896 /* ContactListAdvancedPrefs.nib in Resources */,
34E0EA0807CC53ED00A82198 /* NewMessagePrompt.nib in Resources */,
347E781A07CA962100350507 /* userIconToolbar.png in Resources */,
@@ -9882,6 +9897,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 76B73B1C14BE287D00A58BAB /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
@@ -10126,14 +10148,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
- 349C2EF70867AC97000BF883 /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 349C2F470867AD16000BF883 /* ApplescriptRunner.m in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
34BD9D42053146CC000AB133 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -10703,6 +10717,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 76B73B1A14BE287D00A58BAB /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 76B73B3414BE3B9400A58BAB /* AIApplescriptRunner.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
@@ -10726,11 +10748,6 @@
target = 34BD9DAF05314751000AB133 /* Adium.Framework */;
targetProxy = 340BAB4E09EC6FA7000EC441 /* PBXContainerItemProxy */;
};
- 349C31630867D199000BF883 /* PBXTargetDependency */ = {
- isa = PBXTargetDependency;
- target = 349C2EF90867AC97000BF883 /* AdiumApplescriptRunner */;
- targetProxy = 349C31620867D199000BF883 /* PBXContainerItemProxy */;
- };
6329EFB50F9D33A600112489 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 633D4FA30F9D3073004F491E /* Spotlight Importer */;
@@ -10771,6 +10788,11 @@
target = F53C25AE0A2F95F100F7B73D /* Setup Build Directory */;
targetProxy = 63DE4C520F9C77D50034ED3A /* PBXContainerItemProxy */;
};
+ 76B73B3214BE2A5200A58BAB /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 76B73B1D14BE287D00A58BAB /* AIApplescriptRunner */;
+ targetProxy = 76B73B3114BE2A5200A58BAB /* PBXContainerItemProxy */;
+ };
F5B17CDF0A16C767004AE99E /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = F5B17CCF0A16C6AC004AE99E /* Plist Macros */;
@@ -12451,27 +12473,6 @@
};
name = "Release-Debug";
};
- 349C2F230867ACA9000BF883 /* Debug */ = {
- isa = XCBuildConfiguration;
- baseConfigurationReference = 63C7E11A0FAFA35E00B310AC /* AdiumApplescriptRunner.xcconfig */;
- buildSettings = {
- };
- name = Debug;
- };
- 349C2F240867ACA9000BF883 /* Release */ = {
- isa = XCBuildConfiguration;
- baseConfigurationReference = 63C7E11A0FAFA35E00B310AC /* AdiumApplescriptRunner.xcconfig */;
- buildSettings = {
- };
- name = Release;
- };
- 349C2F250867ACA9000BF883 /* Release-Debug */ = {
- isa = XCBuildConfiguration;
- baseConfigurationReference = 63C7E11A0FAFA35E00B310AC /* AdiumApplescriptRunner.xcconfig */;
- buildSettings = {
- };
- name = "Release-Debug";
- };
34F3B95B0BDF16130011AB34 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 63C7E1150FAFA35E00B310AC /* Touch Framework Bundles to Executable Date.xcconfig */;
@@ -12535,6 +12536,88 @@
};
name = "Release-Debug";
};
+ 76B73B2C14BE287D00A58BAB /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
+ COPY_PHASE_STRIP = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "";
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ INFOPLIST_FILE = "Plists/AIApplescriptRunner-Info.plist";
+ MACH_O_TYPE = mh_execute;
+ MACOSX_DEPLOYMENT_TARGET = 10.7;
+ ONLY_ACTIVE_ARCH = YES;
+ PRODUCT_NAME = "im.adium.$(TARGET_NAME)";
+ SDKROOT = macosx;
+ WRAPPER_EXTENSION = xpc;
+ };
+ name = Debug;
+ };
+ 76B73B2D14BE287D00A58BAB /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
+ COPY_PHASE_STRIP = YES;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "";
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ INFOPLIST_FILE = "Plists/AIApplescriptRunner-Info.plist";
+ MACH_O_TYPE = mh_execute;
+ MACOSX_DEPLOYMENT_TARGET = 10.7;
+ PRODUCT_NAME = "im.adium.$(TARGET_NAME)";
+ SDKROOT = macosx;
+ WRAPPER_EXTENSION = xpc;
+ };
+ name = Release;
+ };
+ 76B73B2E14BE287D00A58BAB /* Release-Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
+ COPY_PHASE_STRIP = YES;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "";
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ INFOPLIST_FILE = "Plists/AIApplescriptRunner-Info.plist";
+ MACH_O_TYPE = mh_execute;
+ MACOSX_DEPLOYMENT_TARGET = 10.7;
+ PRODUCT_NAME = "im.adium.$(TARGET_NAME)";
+ SDKROOT = macosx;
+ WRAPPER_EXTENSION = xpc;
+ };
+ name = "Release-Debug";
+ };
DADE8E00085507450062B664 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 63C7E2070FAFAA4700B310AC /* Adium.framework.xcconfig */;
@@ -12686,16 +12769,6 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
};
- 349C2F220867ACA9000BF883 /* Build configuration list for PBXNativeTarget "AdiumApplescriptRunner" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 349C2F230867ACA9000BF883 /* Debug */,
- 349C2F240867ACA9000BF883 /* Release */,
- 349C2F250867ACA9000BF883 /* Release-Debug */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Debug;
- };
34F3B95A0BDF16130011AB34 /* Build configuration list for PBXAggregateTarget "Touch Framework Bundles to Executable Date" */ = {
isa = XCConfigurationList;
buildConfigurations = (
@@ -12726,6 +12799,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
};
+ 76B73B2B14BE287D00A58BAB /* Build configuration list for PBXNativeTarget "AIApplescriptRunner" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 76B73B2C14BE287D00A58BAB /* Debug */,
+ 76B73B2D14BE287D00A58BAB /* Release */,
+ 76B73B2E14BE287D00A58BAB /* Release-Debug */,
+ );
+ defaultConfigurationIsVisible = 0;
+ };
DADE8DFF085507450062B664 /* Build configuration list for PBXNativeTarget "Adium.Framework" */ = {
isa = XCConfigurationList;
buildConfigurations = (
diff -r bb71775097bf -r 962310cfb7a0 Other/Adium Spotlight Importer/GetMetadataForHTMLLog.m
--- a/Other/Adium Spotlight Importer/GetMetadataForHTMLLog.m Wed Jan 11 19:14:11 2012 +0100
+++ b/Other/Adium Spotlight Importer/GetMetadataForHTMLLog.m Wed Jan 11 23:30:27 2012 +0100
@@ -146,14 +146,14 @@
/* Find the length of STRING, but scan at most MAXLEN characters.
If no '\0' terminator is found in that many characters, return MAXLEN. */
-static size_t
+size_t
strnlen (const char *string, size_t maxlen)
{
const char *end = memchr (string, '\0', maxlen);
return end ? (size_t) (end - string) : maxlen;
}
-static char *strndup (const char *s, size_t n)
+char *strndup (const char *s, size_t n)
{
size_t len = strnlen (s, n);
char *nouveau = malloc (len + 1);
diff -r bb71775097bf -r 962310cfb7a0 Plists/AIApplescriptRunner-Info.plist
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Plists/AIApplescriptRunner-Info.plist Wed Jan 11 23:30:27 2012 +0100
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>XPC!</string>
+ <key>LSUIElement</key>
+ <true/>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>Copyright 2001-2012 The Adium Team</string>
+ <key>XPCService</key>
+ <dict>
+ <key>ServiceType</key>
+ <string>Application</string>
+ </dict>
+</dict>
+</plist>
diff -r bb71775097bf -r 962310cfb7a0 Source/AIApplescriptRunner.m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Source/AIApplescriptRunner.m Wed Jan 11 23:30:27 2012 +0100
@@ -0,0 +1,121 @@
+/*
+ * 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 <xpc/xpc.h>
+#import <Foundation/Foundation.h>
+
+static void AIApplescriptRunner_peer_event_handler(xpc_connection_t peer, xpc_object_t event)
+{
+ xpc_type_t type = xpc_get_type(event);
+ if (type == XPC_TYPE_ERROR) {
+ if (event == XPC_ERROR_CONNECTION_INVALID) {
+ NSLog(@"Our connection terminated!");
+ }
+ } else {
+ assert(type == XPC_TYPE_DICTIONARY);
+
+ NSString *path = [NSString stringWithUTF8String:xpc_dictionary_get_string(event, "path")];
+ NSString *functionName = [NSString stringWithUTF8String:xpc_dictionary_get_string(event, "function")];
+
+ xpc_object_t array = xpc_dictionary_get_value(event, "arguments");
+
+ assert(xpc_get_type(array) == XPC_TYPE_ARRAY);
+
+ NSInteger count = xpc_array_get_count(array);
+
+ NSAppleScript *appleScript = [[NSAppleScript alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path]
+ error:NULL];
+ NSAppleEventDescriptor *thisApplication, *containerEvent;
+ NSString *resultString = nil;
+
+ if (appleScript) {
+ if (functionName && [functionName length]) {
+ /* If we have a functionName (and potentially arguments), we build
+ * an NSAppleEvent to execute the script. */
+
+ //Get a descriptor for ourself
+ int pid = [[NSProcessInfo processInfo] processIdentifier];
+ thisApplication = [NSAppleEventDescriptor descriptorWithDescriptorType:typeKernelProcessID
+ bytes:&pid
+ length:sizeof(pid)];
+
+ //Create the container event
+
+ //We need these constants from the Carbon OpenScripting framework, but we don't actually need Carbon.framework...
+#define kASAppleScriptSuite 'ascr'
+#define kASSubroutineEvent 'psbr'
+#define keyASSubroutineName 'snam'
+ containerEvent = [NSAppleEventDescriptor appleEventWithEventClass:kASAppleScriptSuite
+ eventID:kASSubroutineEvent
+ targetDescriptor:thisApplication
+ returnID:kAutoGenerateReturnID
+ transactionID:kAnyTransactionID];
+
+ //Set the target function
+ [containerEvent setParamDescriptor:[NSAppleEventDescriptor descriptorWithString:functionName]
+ forKeyword:keyASSubroutineName];
+
+ //Pass arguments
+ if (count) {
+ NSAppleEventDescriptor *arguments = [[NSAppleEventDescriptor alloc] initListDescriptor];
+
+ NSInteger i;
+ for (i = 0; i < count; i++) {
+ [arguments insertDescriptor:[NSAppleEventDescriptor descriptorWithString:[NSString stringWithUTF8String:xpc_array_get_string(array, i)]]
+ atIndex:([arguments numberOfItems] + 1)]; //This +1 seems wrong... but it's not
+ }
+
+ [containerEvent setParamDescriptor:arguments forKeyword:keyDirectObject];
+ [arguments release];
+ }
+
+ //Execute the event
+ resultString = [[appleScript executeAppleEvent:containerEvent error:NULL] stringValue];
+
+ } else {
+ resultString = [[appleScript executeAndReturnError:NULL] stringValue];
+ }
+ }
+
+ xpc_object_t reply = xpc_dictionary_create_reply(event);
+
+ xpc_dictionary_set_string(reply, "result", (resultString ? [resultString UTF8String] : ""));
+
+ xpc_connection_t connection = xpc_dictionary_get_remote_connection(reply);
+
+ xpc_connection_send_message(connection, reply);
+
+ xpc_release(reply);
+
+ [appleScript release];
+ }
+}
+
+static void AIApplescriptRunner_event_handler(xpc_connection_t peer)
+{
+ xpc_connection_set_event_handler(peer, ^(xpc_object_t event) {
+ AIApplescriptRunner_peer_event_handler(peer, event);
+ });
+
+ xpc_connection_resume(peer);
+}
+
+int main(int argc, const char *argv[])
+{
+ xpc_main(AIApplescriptRunner_event_handler);
+
+ return 0;
+}
diff -r bb71775097bf -r 962310cfb7a0 Source/AdiumApplescriptRunner.h
--- a/Source/AdiumApplescriptRunner.h Wed Jan 11 19:14:11 2012 +0100
+++ b/Source/AdiumApplescriptRunner.h Wed Jan 11 23:30:27 2012 +0100
@@ -14,11 +14,10 @@
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#import <xpc/xpc.h>
@interface AdiumApplescriptRunner : NSObject {
- NSMutableDictionary *runningApplescriptsDict;
- NSMutableArray *pendingApplescriptsArray;
- BOOL applescriptRunnerIsReady;
+ xpc_connection_t applescriptRunner;
}
- (void)runApplescriptAtPath:(NSString *)path
diff -r bb71775097bf -r 962310cfb7a0 Source/AdiumApplescriptRunner.m
--- a/Source/AdiumApplescriptRunner.m Wed Jan 11 19:14:11 2012 +0100
+++ b/Source/AdiumApplescriptRunner.m Wed Jan 11 23:30:27 2012 +0100
@@ -16,177 +16,68 @@
#import "AdiumApplescriptRunner.h"
- at interface AdiumApplescriptRunner ()
-- (void)applescriptRunnerIsReady:(NSNotification *)inNotification;
-- (void)applescriptRunnerDidQuit:(NSNotification *)inNotification;
-- (void)applescriptDidRun:(NSNotification *)inNotification;
- at end
-
@implementation AdiumApplescriptRunner
-- (id)init
-{
- if ((self = [super init])) {
- NSDistributedNotificationCenter *distributedNotificationCenter = [NSDistributedNotificationCenter defaultCenter];
- [distributedNotificationCenter addObserver:self
- selector:@selector(applescriptRunnerIsReady:)
- name:@"AdiumApplescriptRunner_IsReady"
- object:nil];
- [distributedNotificationCenter addObserver:self
- selector:@selector(applescriptRunnerDidQuit:)
- name:@"AdiumApplescriptRunner_DidQuit"
- object:nil];
-
- [distributedNotificationCenter addObserver:self
- selector:@selector(applescriptDidRun:)
- name:@"AdiumApplescript_DidRun"
- object:nil];
-
- //Check for an existing AdiumApplescriptRunner; if there is one, it will respond with AdiumApplescriptRunner_IsReady
- [distributedNotificationCenter postNotificationName:@"AdiumApplescriptRunner_RespondIfReady"
- object:nil
- userInfo:nil
- deliverImmediately:NO];
- }
-
- return self;
-}
- (void)dealloc
{
- [[NSDistributedNotificationCenter defaultCenter] removeObserver:self];
+ if (applescriptRunner) {
+ xpc_connection_cancel(applescriptRunner);
+ applescriptRunner = NULL;
+ }
- [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"AdiumApplescriptRunner_Quit"
- object:nil
- userInfo:nil
- deliverImmediately:NO];
-
[super dealloc];
}
-- (void)_executeApplescriptWithDict:(NSDictionary *)executionDict
-{
- [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"AdiumApplescriptRunner_ExecuteScript"
- object:nil
- userInfo:executionDict
- deliverImmediately:NO];
-}
-
-- (void)launchApplescriptRunner
-{
- NSString *applescriptRunnerPath = [[NSBundle mainBundle] pathForResource:@"AdiumApplescriptRunner"
- ofType:nil
- inDirectory:nil];
-
- //Houston, we are go for launch.
- if (applescriptRunnerPath) {
- LSLaunchFSRefSpec spec;
- FSRef appRef;
- OSStatus err = FSPathMakeRef((UInt8 *)[applescriptRunnerPath fileSystemRepresentation], &appRef, NULL);
- if (err == noErr) {
- spec.appRef = &appRef;
- spec.numDocs = 0;
- spec.itemRefs = NULL;
- spec.passThruParams = NULL;
- spec.launchFlags = kLSLaunchDontAddToRecents | kLSLaunchDontSwitch | kLSLaunchNoParams | kLSLaunchAsync;
- spec.asyncRefCon = NULL;
- err = LSOpenFromRefSpec(&spec, NULL);
-
- if (err != noErr) {
- NSLog(@"Could not launch %@",applescriptRunnerPath);
- }
- }
- } else {
- NSLog(@"Could not find AdiumApplescriptRunner...");
- }
-}
-
/*!
* @brief Run an applescript, optinally calling a function with arguments, and notify a target/selector with its output when it is done
*/
- (void)runApplescriptAtPath:(NSString *)path function:(NSString *)function arguments:(NSArray *)arguments notifyingTarget:(id)target selector:(SEL)selector userInfo:(id)userInfo
{
- NSString *uniqueID = [[NSProcessInfo processInfo] globallyUniqueString];
-
- if (!runningApplescriptsDict) runningApplescriptsDict = [[NSMutableDictionary alloc] init];
-
- if (target && selector) {
- [runningApplescriptsDict setObject:[NSDictionary dictionaryWithObjectsAndKeys:
- target, @"target",
- NSStringFromSelector(selector), @"selector",
- userInfo, @"userInfo", nil]
- forKey:uniqueID];
- }
-
- NSDictionary *executionDict = [NSDictionary dictionaryWithObjectsAndKeys:
- path, @"path",
- (function ? function : @""), @"function",
- (arguments ? arguments : [NSArray array]), @"arguments",
- uniqueID, @"uniqueID",
- nil];
-
- if (applescriptRunnerIsReady) {
- [self _executeApplescriptWithDict:executionDict];
+ if (!applescriptRunner) {
+ applescriptRunner = xpc_connection_create("im.adium.AIApplescriptRunner", NULL);
+ xpc_connection_set_event_handler(applescriptRunner, ^(xpc_object_t obj){
+ AILogWithSignature(@"Received something.");
+
+ xpc_type_t type = xpc_get_type(obj);
+ if (type == XPC_TYPE_ERROR) {
+ AILogWithSignature(@"Received an error");
+ if (obj == XPC_ERROR_CONNECTION_INVALID) {
+ AILogWithSignature(@"Our connection terminated!");
+ } else if (obj == XPC_ERROR_CONNECTION_INTERRUPTED) {
+ AILogWithSignature(@"Our connection was interrupted!");
+ }
+ }
+ });
- } else {
- if (!pendingApplescriptsArray) pendingApplescriptsArray = [[NSMutableArray alloc] init];
-
- [pendingApplescriptsArray addObject:executionDict];
-
- [self launchApplescriptRunner];
- }
-}
-
-- (void)applescriptRunnerIsReady:(NSNotification *)inNotification
-{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- NSDictionary *executionDict;
-
- applescriptRunnerIsReady = YES;
-
- for (executionDict in pendingApplescriptsArray) {
- [self _executeApplescriptWithDict:executionDict];
+ xpc_connection_resume(applescriptRunner);
}
- [pendingApplescriptsArray release]; pendingApplescriptsArray = nil;
- [pool release];
-}
-
-- (void)applescriptRunnerDidQuit:(NSNotification *)inNotification
-{
- applescriptRunnerIsReady = NO;
-}
-
-- (void)applescriptDidRun:(NSNotification *)inNotification
-{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- NSDictionary *userInfo = [inNotification userInfo];
- NSString *uniqueID = [userInfo objectForKey:@"uniqueID"];
-
- NSDictionary *targetDict = [runningApplescriptsDict objectForKey:uniqueID];
- if (targetDict) {
- // Prevent a secondary "finish" from returning in the middle of the invocation.
- [targetDict retain];
+ xpc_object_t obj = xpc_dictionary_create(NULL, NULL, 0);
+
+ xpc_dictionary_set_string(obj, "path", [path UTF8String]);
+ xpc_dictionary_set_string(obj, "function", (function ? [function UTF8String] : ""));
+ xpc_object_t array = xpc_array_create(NULL, 0);
+
+ for (NSString *argument in arguments) {
+ xpc_object_t argObject = xpc_string_create([argument UTF8String]);
- //No further need for this dictionary entry
- [runningApplescriptsDict removeObjectForKey:uniqueID];
+ xpc_array_set_value(array, XPC_ARRAY_APPEND, argObject);
- //If there's no others, release the dictionary.
- if (![runningApplescriptsDict count]) {
- [runningApplescriptsDict release]; runningApplescriptsDict = nil;
+ xpc_release(argObject);
+ }
+
+ xpc_dictionary_set_value(obj, "arguments", array);
+ xpc_release(array);
+
+ xpc_connection_send_message_with_reply(applescriptRunner, obj, dispatch_get_main_queue(), ^(xpc_object_t reply){
+ if (target && selector) {
+ const char *resultStr = xpc_dictionary_get_string(reply, "result");
+ NSString *result = (resultStr ? [NSString stringWithUTF8String:resultStr] : @"");
+ [target performSelector:selector withObject:userInfo withObject:result];
}
-
- id target = [targetDict objectForKey:@"target"];
- //Selector will be of the form applescriptDidRun:resultString:
- SEL selector = NSSelectorFromString([targetDict objectForKey:@"selector"]);
-
- //Notify our target
- [target performSelector:selector
- withObject:[targetDict objectForKey:@"userInfo"]
- withObject:[userInfo objectForKey:@"resultString"]];
-
- [targetDict release];
- }
- [pool release];
+ });
+
+ xpc_release(obj);
}
@end
diff -r bb71775097bf -r 962310cfb7a0 Source/ApplescriptRunner.m
--- a/Source/ApplescriptRunner.m Wed Jan 11 19:14:11 2012 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,275 +0,0 @@
-/*
- * 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 <Foundation/Foundation.h>
-
-/*!
- * @brief Daemon to run applescripts, optionally with a function name and arguments, and respond over NSDistributedNotificationCenter
- */
-
-//After SECONDS_INACTIVITY_BEFORE_AUTOMATIC_QUIT seconds without any activity, the daemon will quit itself
-#define SECONDS_INACTIVITY_BEFORE_AUTOMATIC_QUIT 600 /* 10 minutes */
-
- at interface AIApplescriptRunner : NSObject {}
-- (void)applescriptRunnerIsReady;
-- (void)resetAutomaticQuitTimer;
- at end
-
- at interface AIApplescriptRunner ()
-- (void)beginObservingForDistributedNotifications;
-- (void)respondIfReady:(NSNotification *)inNotification;
-- (void)executeScript:(NSNotification *)inNotification;
-- (void)quit:(NSNotification *)inNotification;
- at end
-
- at implementation AIApplescriptRunner
-- (id)init
-{
- if ((self = [super init])) {
- NSNotificationCenter *localNotificationCenter = [NSNotificationCenter defaultCenter];
-
- [localNotificationCenter addObserver:self
- selector:@selector(executeScript:)
- name:@"AdiumApplescriptRunner_ExecuteScript"
- object:nil];
- }
-
- return self;
-}
-
-- (void)beginObservingForDistributedNotifications
-{
- NSDistributedNotificationCenter *distributedNotificationCenter = [NSDistributedNotificationCenter defaultCenter];
-
- [distributedNotificationCenter addObserver:self
- selector:@selector(respondIfReady:)
- name:@"AdiumApplescriptRunner_RespondIfReady"
- object:nil];
-
- [distributedNotificationCenter addObserver:self
- selector:@selector(executeScript:)
- name:@"AdiumApplescriptRunner_ExecuteScript"
- object:nil];
-
- [distributedNotificationCenter addObserver:self
- selector:@selector(quit:)
- name:@"AdiumApplescriptRunner_Quit"
- object:nil];
-
- [self applescriptRunnerIsReady];
-
- [self resetAutomaticQuitTimer];
-}
-/*!
- * @brief Inform observers on the NSDistributedNotificationCenter that the applesript runner is ready
- */
-- (void)applescriptRunnerIsReady
-{
- //Check for an existing AdiumApplescriptRunner; if there is one, it will respond with AdiumApplescriptRunnerIsReady
- [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"AdiumApplescriptRunner_IsReady"
- object:nil
- userInfo:nil
- deliverImmediately:NO];
-}
-
-/*!
- * @brief Observer method which responds to the @"AdiumApplescriptRunner_RespondIfReady" distributed notification
- *
More information about the commits
mailing list