aboutsummaryrefslogtreecommitdiffstats
path: root/src/native/addrbook
diff options
context:
space:
mode:
authorLyubomir Marinov <lyubomir.marinov@jitsi.org>2011-02-17 12:40:44 +0000
committerLyubomir Marinov <lyubomir.marinov@jitsi.org>2011-02-17 12:40:44 +0000
commit1ade1b3317facf9e95ac8000f2a4165d433a177a (patch)
tree2de86df8b24370ded322a21988810d19723f48b4 /src/native/addrbook
parentab2a92f0a6023e5ca920b54d979a8f3f6bcec84a (diff)
downloadjitsi-1ade1b3317facf9e95ac8000f2a4165d433a177a.zip
jitsi-1ade1b3317facf9e95ac8000f2a4165d433a177a.tar.gz
jitsi-1ade1b3317facf9e95ac8000f2a4165d433a177a.tar.bz2
Fixes an issue reported by Emil Ivov and found to cause modifications to the Mac OS X Address Book to not be picked up by SIP Communicator upon subsequent searches.
Diffstat (limited to 'src/native/addrbook')
-rw-r--r--src/native/addrbook/macosx/Makefile3
-rw-r--r--src/native/addrbook/macosx/net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery.m2
-rw-r--r--src/native/addrbook/macosx/net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourceService.h29
-rw-r--r--src/native/addrbook/macosx/net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourceService.m78
4 files changed, 110 insertions, 2 deletions
diff --git a/src/native/addrbook/macosx/Makefile b/src/native/addrbook/macosx/Makefile
index 6b71ff5..cce1ce9 100644
--- a/src/native/addrbook/macosx/Makefile
+++ b/src/native/addrbook/macosx/Makefile
@@ -11,6 +11,7 @@ TARGET = ../../../../lib/native/mac/lib$(TARGET_BASENAME).jnilib
$(TARGET): \
../AddrBookContactQuery.c \
- net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery.m
+ net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery.m \
+ net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourceService.m
$(CC) $(CPPFLAGS) $^ $(LDFLAGS) -o $@ $(LIBS)
-strip $(TARGET)
diff --git a/src/native/addrbook/macosx/net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery.m b/src/native/addrbook/macosx/net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery.m
index be3ddd3..780431a 100644
--- a/src/native/addrbook/macosx/net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery.m
+++ b/src/native/addrbook/macosx/net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery.m
@@ -110,7 +110,7 @@ Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery
autoreleasePool = [[NSAutoreleasePool alloc] init];
- addressBook = [ABAddressBook addressBook];
+ addressBook = [ABAddressBook sharedAddressBook];
people = [addressBook people];
peopleCount = [people count];
for (i = 0; i < peopleCount; i++)
diff --git a/src/native/addrbook/macosx/net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourceService.h b/src/native/addrbook/macosx/net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourceService.h
new file mode 100644
index 0000000..ae75978
--- /dev/null
+++ b/src/native/addrbook/macosx/net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourceService.h
@@ -0,0 +1,29 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourceService */
+
+#ifndef _Included_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourceService
+#define _Included_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourceService
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourceService
+ * Method: start
+ * Signature: ()J
+ */
+JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourceService_start
+ (JNIEnv *, jclass);
+
+/*
+ * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourceService
+ * Method: stop
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourceService_stop
+ (JNIEnv *, jclass, jlong);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/native/addrbook/macosx/net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourceService.m b/src/native/addrbook/macosx/net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourceService.m
new file mode 100644
index 0000000..6645bc5
--- /dev/null
+++ b/src/native/addrbook/macosx/net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourceService.m
@@ -0,0 +1,78 @@
+/*
+ * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+#include "net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourceService.h"
+
+#import <AddressBook/ABGlobals.h>
+#import <Foundation/NSAutoreleasePool.h>
+#import <Foundation/NSNotification.h>
+#import <Foundation/NSObject.h>
+
+@interface MacOSXAddrBookContactSourceService : NSObject
+{
+}
+
+- (void)abDatabaseChangedExternallyNotification:(NSNotification *)notification;
+- (void)abDatabaseChangedNotification:(NSNotification *)notification;
+@end /* MacOSXAddrBookContactSourceService */
+
+JNIEXPORT jlong JNICALL
+Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourceService_start
+ (JNIEnv *jniEnv, jclass clazz)
+{
+ NSAutoreleasePool *pool;
+ MacOSXAddrBookContactSourceService *mabcss;
+
+ pool = [[NSAutoreleasePool alloc] init];
+
+ mabcss = [[MacOSXAddrBookContactSourceService alloc] init];
+ if (mabcss)
+ {
+ NSNotificationCenter *notificationCenter
+ = [NSNotificationCenter defaultCenter];
+
+ [notificationCenter
+ addObserver:mabcss
+ selector:@selector(abDatabaseChangedExternallyNotification:)
+ name:kABDatabaseChangedExternallyNotification
+ object:nil];
+ [notificationCenter
+ addObserver:mabcss
+ selector:@selector(abDatabaseChangedNotification:)
+ name:kABDatabaseChangedNotification
+ object:nil];
+ }
+
+ [pool release];
+ return (jlong) mabcss;
+}
+
+JNIEXPORT void JNICALL
+Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourceService_stop
+ (JNIEnv *jniEnv, jclass clazz, jlong ptr)
+{
+ MacOSXAddrBookContactSourceService *mabcss
+ = (MacOSXAddrBookContactSourceService *) ptr;
+ NSAutoreleasePool *pool;
+
+ pool = [[NSAutoreleasePool alloc] init];
+
+ [[NSNotificationCenter defaultCenter] removeObserver:mabcss];
+ [mabcss release];
+
+ [pool release];
+}
+
+@implementation MacOSXAddrBookContactSourceService
+- (void)abDatabaseChangedExternallyNotification:(NSNotification *)notification
+{
+}
+
+- (void)abDatabaseChangedNotification:(NSNotification *)notification
+{
+}
+@end /* MacOSXAddrBookContactSourceService */