commit 0ec34d7154d42a04d115ae3bf1429857a69252a3
parent 405918fefc557d80115d82dfb8440eccf5293f51
Author: Jaromil <jaromil@dyne.org>
Date:   Mon, 19 Mar 2012 21:10:24 +0100
lbdb module for Apple/OSX
Diffstat:
7 files changed, 414 insertions(+), 0 deletions(-)
diff --git a/aux/lbdb-ABQuery/ABQuery.m b/aux/lbdb-ABQuery/ABQuery.m
@@ -0,0 +1,72 @@
+/* ABQuery
+ *
+ *    Copyright 2003 Brendan Cully <brendan@kublai.com>
+ *              2012 Denis Roio <jaromil@dyne.org>
+ *
+ *    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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,, USA.
+ *
+ */
+
+#import <Foundation/Foundation.h>
+#import <AddressBook/AddressBook.h>
+
+int main (int argc, const char *argv[]) {
+    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+    ABAddressBook *book = [ABAddressBook sharedAddressBook];
+    ABSearchElement *firstNameSearch, *lastNameSearch, *emailSearch, *search;
+    NSArray *searchTerms;
+    NSArray *results;
+    NSEnumerator *addressEnum;
+    ABPerson *person;
+    if(argc<2) exit(0);
+    NSString *key = [NSString stringWithUTF8String:argv[1]];
+    firstNameSearch = [ABPerson searchElementForProperty:kABFirstNameProperty
+		                  label:nil
+		                  key:nil
+				  value:key
+                                  comparison:kABContainsSubStringCaseInsensitive];
+    lastNameSearch = [ABPerson searchElementForProperty:kABLastNameProperty
+		                  label:nil
+		                  key:nil
+				  value:key
+                                  comparison:kABContainsSubStringCaseInsensitive];
+    emailSearch = [ABPerson searchElementForProperty:kABEmailProperty
+                              label:nil
+			      key:nil
+			      value:key
+			      comparison:kABContainsSubStringCaseInsensitive];
+    searchTerms = [NSArray arrayWithObjects:firstNameSearch, lastNameSearch, emailSearch, nil];
+    search = [ABSearchElement searchElementForConjunction:kABSearchOr
+                                children:searchTerms];
+    results = [book recordsMatchingSearchElement:search];
+
+    addressEnum = [results objectEnumerator];
+
+    while (person = (ABPerson*)[addressEnum nextObject]) {
+        NSString *fullName = [NSString stringWithFormat:@"%@ %@", [[person valueForProperty:kABFirstNameProperty] description], [[person valueForProperty:kABLastNameProperty] description]];
+      
+        ABMultiValue *emails = [person valueForProperty:kABEmailProperty];
+        int count = [emails count];
+        int i;
+        for (i = 0; i < count; i++) {
+            NSString *email = [emails valueAtIndex:i];
+            printf("%s\t%s\t(AddressBook)\n", [email cString], [fullName UTF8String]);
+      }
+    }
+
+    [pool release];
+
+    return 0;
+}
diff --git a/aux/lbdb-ABQuery/ABQuery_Prefix.h b/aux/lbdb-ABQuery/ABQuery_Prefix.h
@@ -0,0 +1,7 @@
+//
+// Prefix header for all source files of the 'ABQuery' target in the 'ABQuery' project.
+//
+
+#ifdef __OBJC__
+    #import <Foundation/Foundation.h>
+#endif
diff --git a/aux/lbdb-ABQuery/lbdb-ABQuery.xcodeproj/project.pbxproj b/aux/lbdb-ABQuery/lbdb-ABQuery.xcodeproj/project.pbxproj
@@ -0,0 +1,221 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 46;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		58D5E1831517C541005AD1D6 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 58D5E1821517C541005AD1D6 /* CoreFoundation.framework */; };
+		58D5E1861517C541005AD1D6 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 58D5E1851517C541005AD1D6 /* main.c */; };
+		58D5E1881517C541005AD1D6 /* lbdb_ABQuery.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 58D5E1871517C541005AD1D6 /* lbdb_ABQuery.1 */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+		58D5E17C1517C541005AD1D6 /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 2147483647;
+			dstPath = /usr/share/man/man1/;
+			dstSubfolderSpec = 0;
+			files = (
+				58D5E1881517C541005AD1D6 /* lbdb_ABQuery.1 in CopyFiles */,
+			);
+			runOnlyForDeploymentPostprocessing = 1;
+		};
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+		58D5E17E1517C541005AD1D6 /* lbdb-ABQuery */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "lbdb-ABQuery"; sourceTree = BUILT_PRODUCTS_DIR; };
+		58D5E1821517C541005AD1D6 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
+		58D5E1851517C541005AD1D6 /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
+		58D5E1871517C541005AD1D6 /* lbdb_ABQuery.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = lbdb_ABQuery.1; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		58D5E17B1517C541005AD1D6 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				58D5E1831517C541005AD1D6 /* CoreFoundation.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		58D5E1731517C541005AD1D6 = {
+			isa = PBXGroup;
+			children = (
+				58D5E1841517C541005AD1D6 /* lbdb-ABQuery */,
+				58D5E1811517C541005AD1D6 /* Frameworks */,
+				58D5E17F1517C541005AD1D6 /* Products */,
+			);
+			sourceTree = "<group>";
+		};
+		58D5E17F1517C541005AD1D6 /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				58D5E17E1517C541005AD1D6 /* lbdb-ABQuery */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		58D5E1811517C541005AD1D6 /* Frameworks */ = {
+			isa = PBXGroup;
+			children = (
+				58D5E1821517C541005AD1D6 /* CoreFoundation.framework */,
+			);
+			name = Frameworks;
+			sourceTree = "<group>";
+		};
+		58D5E1841517C541005AD1D6 /* lbdb-ABQuery */ = {
+			isa = PBXGroup;
+			children = (
+				58D5E1851517C541005AD1D6 /* main.c */,
+				58D5E1871517C541005AD1D6 /* lbdb_ABQuery.1 */,
+			);
+			path = "lbdb-ABQuery";
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+		58D5E17D1517C541005AD1D6 /* lbdb-ABQuery */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 58D5E18B1517C541005AD1D6 /* Build configuration list for PBXNativeTarget "lbdb-ABQuery" */;
+			buildPhases = (
+				58D5E17A1517C541005AD1D6 /* Sources */,
+				58D5E17B1517C541005AD1D6 /* Frameworks */,
+				58D5E17C1517C541005AD1D6 /* CopyFiles */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "lbdb-ABQuery";
+			productName = "lbdb-ABQuery";
+			productReference = 58D5E17E1517C541005AD1D6 /* lbdb-ABQuery */;
+			productType = "com.apple.product-type.tool";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		58D5E1751517C541005AD1D6 /* Project object */ = {
+			isa = PBXProject;
+			attributes = {
+				LastUpgradeCheck = 0430;
+				ORGANIZATIONNAME = Dyne.org;
+			};
+			buildConfigurationList = 58D5E1781517C541005AD1D6 /* Build configuration list for PBXProject "lbdb-ABQuery" */;
+			compatibilityVersion = "Xcode 3.2";
+			developmentRegion = English;
+			hasScannedForEncodings = 0;
+			knownRegions = (
+				en,
+			);
+			mainGroup = 58D5E1731517C541005AD1D6;
+			productRefGroup = 58D5E17F1517C541005AD1D6 /* Products */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				58D5E17D1517C541005AD1D6 /* lbdb-ABQuery */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXSourcesBuildPhase section */
+		58D5E17A1517C541005AD1D6 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				58D5E1861517C541005AD1D6 /* main.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+		58D5E1891517C541005AD1D6 /* 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_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_RETURN_TYPE = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				MACOSX_DEPLOYMENT_TARGET = 10.7;
+				ONLY_ACTIVE_ARCH = YES;
+				SDKROOT = macosx;
+			};
+			name = Debug;
+		};
+		58D5E18A1517C541005AD1D6 /* 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_VERSION = com.apple.compilers.llvm.clang.1_0;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				MACOSX_DEPLOYMENT_TARGET = 10.7;
+				SDKROOT = macosx;
+			};
+			name = Release;
+		};
+		58D5E18C1517C541005AD1D6 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Debug;
+		};
+		58D5E18D1517C541005AD1D6 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Release;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		58D5E1781517C541005AD1D6 /* Build configuration list for PBXProject "lbdb-ABQuery" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				58D5E1891517C541005AD1D6 /* Debug */,
+				58D5E18A1517C541005AD1D6 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		58D5E18B1517C541005AD1D6 /* Build configuration list for PBXNativeTarget "lbdb-ABQuery" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				58D5E18C1517C541005AD1D6 /* Debug */,
+				58D5E18D1517C541005AD1D6 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 58D5E1751517C541005AD1D6 /* Project object */;
+}
diff --git a/aux/lbdb-ABQuery/lbdb-ABQuery.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/aux/lbdb-ABQuery/lbdb-ABQuery.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+   version = "1.0">
+   <FileRef
+      location = "self:lbdb-ABQuery.xcodeproj">
+   </FileRef>
+</Workspace>
diff --git a/aux/lbdb-ABQuery/lbdb-ABQuery.xcodeproj/project.xcworkspace/xcuserdata/jaromil.xcuserdatad/UserInterfaceState.xcuserstate b/aux/lbdb-ABQuery/lbdb-ABQuery.xcodeproj/project.xcworkspace/xcuserdata/jaromil.xcuserdatad/UserInterfaceState.xcuserstate
Binary files differ.
diff --git a/aux/lbdb-ABQuery/lbdb-ABQuery.xcodeproj/xcuserdata/jaromil.xcuserdatad/xcschemes/lbdb-ABQuery.xcscheme b/aux/lbdb-ABQuery/lbdb-ABQuery.xcodeproj/xcuserdata/jaromil.xcuserdatad/xcschemes/lbdb-ABQuery.xcscheme
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+   version = "1.3">
+   <BuildAction
+      parallelizeBuildables = "YES"
+      buildImplicitDependencies = "YES">
+      <BuildActionEntries>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "YES"
+            buildForArchiving = "YES"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "58D5E17D1517C541005AD1D6"
+               BuildableName = "lbdb-ABQuery"
+               BlueprintName = "lbdb-ABQuery"
+               ReferencedContainer = "container:lbdb-ABQuery.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+      </BuildActionEntries>
+   </BuildAction>
+   <TestAction
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      buildConfiguration = "Debug">
+      <Testables>
+      </Testables>
+      <MacroExpansion>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "58D5E17D1517C541005AD1D6"
+            BuildableName = "lbdb-ABQuery"
+            BlueprintName = "lbdb-ABQuery"
+            ReferencedContainer = "container:lbdb-ABQuery.xcodeproj">
+         </BuildableReference>
+      </MacroExpansion>
+   </TestAction>
+   <LaunchAction
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      launchStyle = "0"
+      useCustomWorkingDirectory = "NO"
+      buildConfiguration = "Debug"
+      ignoresPersistentStateOnLaunch = "NO"
+      debugDocumentVersioning = "YES"
+      allowLocationSimulation = "YES">
+      <BuildableProductRunnable>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "58D5E17D1517C541005AD1D6"
+            BuildableName = "lbdb-ABQuery"
+            BlueprintName = "lbdb-ABQuery"
+            ReferencedContainer = "container:lbdb-ABQuery.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+      <AdditionalOptions>
+      </AdditionalOptions>
+   </LaunchAction>
+   <ProfileAction
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      savedToolIdentifier = ""
+      useCustomWorkingDirectory = "NO"
+      buildConfiguration = "Release"
+      debugDocumentVersioning = "YES">
+      <BuildableProductRunnable>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "58D5E17D1517C541005AD1D6"
+            BuildableName = "lbdb-ABQuery"
+            BlueprintName = "lbdb-ABQuery"
+            ReferencedContainer = "container:lbdb-ABQuery.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+   </ProfileAction>
+   <AnalyzeAction
+      buildConfiguration = "Debug">
+   </AnalyzeAction>
+   <ArchiveAction
+      buildConfiguration = "Release"
+      revealArchiveInOrganizer = "YES">
+   </ArchiveAction>
+</Scheme>
diff --git a/aux/lbdb-ABQuery/lbdb-ABQuery.xcodeproj/xcuserdata/jaromil.xcuserdatad/xcschemes/xcschememanagement.plist b/aux/lbdb-ABQuery/lbdb-ABQuery.xcodeproj/xcuserdata/jaromil.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,22 @@
+<?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>SchemeUserState</key>
+	<dict>
+		<key>lbdb-ABQuery.xcscheme</key>
+		<dict>
+			<key>orderHint</key>
+			<integer>0</integer>
+		</dict>
+	</dict>
+	<key>SuppressBuildableAutocreation</key>
+	<dict>
+		<key>58D5E17D1517C541005AD1D6</key>
+		<dict>
+			<key>primary</key>
+			<true/>
+		</dict>
+	</dict>
+</dict>
+</plist>