diff options
author | Damian Minkov <damencho@jitsi.org> | 2013-02-12 13:12:31 +0000 |
---|---|---|
committer | Damian Minkov <damencho@jitsi.org> | 2013-02-12 13:12:31 +0000 |
commit | 6be8af57818618ed93541807447744aa7a695342 (patch) | |
tree | 5d2b8b7b77f0588ce07c0b7d3a2dadc5fcc03cec /src/native/addrbook/macosx | |
parent | 4c74ca0d24eb6615bfaa5fc29b5897d6fbe34bf0 (diff) | |
download | jitsi-6be8af57818618ed93541807447744aa7a695342.zip jitsi-6be8af57818618ed93541807447744aa7a695342.tar.gz jitsi-6be8af57818618ed93541807447744aa7a695342.tar.bz2 |
Implements contact details edit and notification for outside edit of contacts.
Diffstat (limited to 'src/native/addrbook/macosx')
4 files changed, 932 insertions, 1 deletions
diff --git a/src/native/addrbook/macosx/net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery.h b/src/native/addrbook/macosx/net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery.h index d1ea08c..0f4d218 100644 --- a/src/native/addrbook/macosx/net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery.h +++ b/src/native/addrbook/macosx/net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery.h @@ -7,6 +7,76 @@ #ifdef __cplusplus extern "C" { #endif +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABAIMInstantProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABAIMInstantProperty 0L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABEmailProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABEmailProperty 1L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABFirstNameProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABFirstNameProperty 2L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABFirstNamePhoneticProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABFirstNamePhoneticProperty 3L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABICQInstantProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABICQInstantProperty 4L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABJabberInstantProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABJabberInstantProperty 5L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABLastNameProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABLastNameProperty 6L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABLastNamePhoneticProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABLastNamePhoneticProperty 7L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABMiddleNameProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABMiddleNameProperty 8L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABMiddleNamePhoneticProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABMiddleNamePhoneticProperty 9L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABMSNInstantProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABMSNInstantProperty 10L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABNicknameProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABNicknameProperty 11L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABOrganizationProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABOrganizationProperty 15L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABPersonFlags +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABPersonFlags 14L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABPhoneProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABPhoneProperty 12L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABShowAsCompany +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABShowAsCompany 1LL +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABShowAsMask +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABShowAsMask 7LL +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABYahooInstantProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABYahooInstantProperty 13L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABMaidenNameProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABMaidenNameProperty 16L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABBirthdayProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABBirthdayProperty 17L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABBirthdayComponentsProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABBirthdayComponentsProperty 18L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABJobTitleProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABJobTitleProperty 19L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABHomePageProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABHomePageProperty 20L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABURLsProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABURLsProperty 21L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABCalendarURIsProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABCalendarURIsProperty 22L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABAddressProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABAddressProperty 23L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABOtherDatesProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABOtherDatesProperty 24L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABOtherDateComponentsProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABOtherDateComponentsProperty 25L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABRelatedNamesProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABRelatedNamesProperty 26L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABDepartmentProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABDepartmentProperty 27L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABInstantMessageProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABInstantMessageProperty 28L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABNoteProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABNoteProperty 29L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABSocialProfileProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABSocialProfileProperty 30L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABTitleProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABTitleProperty 31L +#undef net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABSuffixProperty +#define net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABSuffixProperty 32L /* * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery * Method: ABPerson_imageData @@ -25,6 +95,30 @@ JNIEXPORT jobjectArray JNICALL Java_net_java_sip_communicator_plugin_addrbook_ma /* * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: ABRecord_uniqueId + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_ABRecord_1uniqueId + (JNIEnv *, jclass, jlong); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: setProperty + * Signature: (Ljava/lang/String;JLjava/lang/String;Ljava/lang/Object;)Z + */ +JNIEXPORT jboolean JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_setProperty + (JNIEnv *, jclass, jstring, jlong, jstring, jobject); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: removeProperty + * Signature: (Ljava/lang/String;J)Z + */ +JNIEXPORT jboolean JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_removeProperty + (JNIEnv *, jclass, jstring, jlong); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery * Method: foreachPerson * Signature: (Ljava/lang/String;Lnet/java/sip/communicator/plugin/addrbook/PtrCallback;)V */ @@ -159,6 +253,310 @@ JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_Ma JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABYahooInstantProperty (JNIEnv *, jclass); +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABMaidenNameProperty + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABMaidenNameProperty + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABBirthdayProperty + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABBirthdayProperty + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABBirthdayComponentsProperty + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABBirthdayComponentsProperty + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABJobTitleProperty + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABJobTitleProperty + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABHomePageProperty + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABHomePageProperty + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABURLsProperty + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABURLsProperty + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABCalendarURIsProperty + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABCalendarURIsProperty + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABAddressProperty + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABAddressProperty + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABOtherDatesProperty + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABOtherDatesProperty + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABOtherDateComponentsProperty + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABOtherDateComponentsProperty + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABRelatedNamesProperty + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABRelatedNamesProperty + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABDepartmentProperty + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABDepartmentProperty + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABInstantMessageProperty + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABInstantMessageProperty + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABNoteProperty + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABNoteProperty + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABSocialProfileProperty + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABSocialProfileProperty + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABTitleProperty + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABTitleProperty + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABSuffixProperty + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABSuffixProperty + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABEmailWorkLabel + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABEmailWorkLabel + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABEmailHomeLabel + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABEmailHomeLabel + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABAddressHomeLabel + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABAddressHomeLabel + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABAddressWorkLabel + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABAddressWorkLabel + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABPhoneWorkLabel + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABPhoneWorkLabel + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABPhoneHomeLabel + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABPhoneHomeLabel + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABPhoneMobileLabel + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABPhoneMobileLabel + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABPhoneMainLabel + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABPhoneMainLabel + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABPhoneWorkFAXLabel + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABPhoneWorkFAXLabel + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABInstantMessageServiceAIM + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABInstantMessageServiceAIM + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABInstantMessageServiceFacebook + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABInstantMessageServiceFacebook + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABInstantMessageServiceGoogleTalk + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABInstantMessageServiceGoogleTalk + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABInstantMessageServiceICQ + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABInstantMessageServiceICQ + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABInstantMessageServiceJabber + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABInstantMessageServiceJabber + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABInstantMessageServiceMSN + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABInstantMessageServiceMSN + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABInstantMessageServiceSkype + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABInstantMessageServiceSkype + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABInstantMessageServiceYahoo + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABInstantMessageServiceYahoo + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABAddressStreetKey + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABAddressStreetKey + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABAddressCityKey + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABAddressCityKey + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABAddressZIPKey + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABAddressZIPKey + (JNIEnv *, jclass); + +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery + * Method: kABAddressCountryKey + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABAddressCountryKey + (JNIEnv *, jclass); + #ifdef __cplusplus } #endif 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 1dcf235..88a01b1 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 @@ -131,6 +131,211 @@ Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery [autoreleasePool release];
}
+/*
+ * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery
+ * Method: ABRecord_uniqueId
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_ABRecord_1uniqueId
+ (JNIEnv *jniEnv, jclass clazz, jlong record)
+{
+ return (*jniEnv)->NewStringUTF(jniEnv, [[(ABRecord *)record uniqueId] UTF8String]);
+}
+
+NSString *JavaStringToNSString(JNIEnv *env, jstring aString)
+{
+ if(aString == NULL)
+ return nil;
+
+ const jchar *chars = (*env)->GetStringChars(env, aString, NULL);
+ NSString *resultString = [NSString stringWithCharacters:(UniChar *)chars length:(*env)->GetStringLength(env, aString)];
+ (*env)->ReleaseStringChars(env, aString, chars);
+ return resultString;
+}
+
+/*
+ * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery
+ * Method: setProperty
+ * Signature: (Ljava/lang/String;JLjava/lang/String;Ljava/lang/Object;)Z
+ */
+JNIEXPORT jboolean JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_setProperty
+ (JNIEnv *jniEnv, jclass clazz, jstring id, jlong prop, jstring subProperty, jobject value)
+{
+ void* data;
+ ABAddressBook *addressBook;
+ ABRecord *r;
+ NSAutoreleasePool *autoreleasePool;
+ NSString *property;
+ BOOL res = FALSE;
+ int i;
+
+ autoreleasePool = [[NSAutoreleasePool alloc] init];
+
+ addressBook = [ABAddressBook sharedAddressBook];
+ r = [addressBook recordForUniqueId:JavaStringToNSString(jniEnv, id)];
+
+ property = (NSString *)prop;
+
+ if(property == kABFirstNameProperty
+ || property == kABLastNameProperty
+ || property == kABFirstNamePhoneticProperty
+ || property == kABLastNamePhoneticProperty
+ || property == kABNicknameProperty
+ || property == kABMaidenNameProperty
+ || property == kABOrganizationProperty
+ || property == kABJobTitleProperty
+ || property == kABHomePageProperty
+ || property == kABDepartmentProperty
+ || property == kABNoteProperty
+ || property == kABMiddleNameProperty
+ || property == kABMiddleNamePhoneticProperty
+ || property == kABTitleProperty
+ || property == kABSuffixProperty)
+ {
+ data = JavaStringToNSString(jniEnv, (jstring)value);
+ }
+ else if(property == kABBirthdayProperty)
+ {
+ data = [NSDate dateWithTimeIntervalSince1970:(jlong)value];
+ }
+ //else if(property == kABBirthdayComponentsProperty: not used for now
+ else if(property == kABURLsProperty
+ || property == kABCalendarURIsProperty
+ || property == kABEmailProperty
+ || property == kABRelatedNamesProperty
+ || property == kABPhoneProperty
+ || property == kABAIMInstantProperty
+ || property == kABJabberInstantProperty
+ || property == kABMSNInstantProperty
+ || property == kABYahooInstantProperty
+ || property == kABICQInstantProperty)
+ {
+ data=[[ABMutableMultiValue alloc] init];
+ jobjectArray arr = (jobjectArray)value;
+ jsize propertyCount = (*jniEnv)->GetArrayLength(jniEnv, arr);
+
+ for (i = 0; i < propertyCount; i+=2)
+ {
+ jstring value = (jstring) (*jniEnv)->GetObjectArrayElement(jniEnv, arr, i);
+ jstring label = (jstring) (*jniEnv)->GetObjectArrayElement(jniEnv, arr, i+1);
+
+ [(ABMutableMultiValue *) data
+ addValue:JavaStringToNSString(jniEnv, value)
+ withLabel:JavaStringToNSString(jniEnv, label)];
+ }
+ }
+ else if(property == kABAddressProperty)
+ {
+ jobjectArray arr = (jobjectArray)value;
+ jsize propertyCount = (*jniEnv)->GetArrayLength(jniEnv, arr);
+
+ NSMutableDictionary *addr;
+ addr = [NSMutableDictionary dictionary];
+
+ for (i = 0; i < propertyCount; i+=2)
+ {
+ jstring value = (jstring) (*jniEnv)->GetObjectArrayElement(jniEnv, arr, i);
+ jstring label = (jstring) (*jniEnv)->GetObjectArrayElement(jniEnv, arr, i+1);
+
+ //NSLog(@"key:%@, value:%@", JavaStringToNSString(jniEnv, label), JavaStringToNSString(jniEnv, value));
+ [addr setObject:JavaStringToNSString(jniEnv, value)
+ forKey:JavaStringToNSString(jniEnv, label)];
+ }
+
+ data=[[ABMutableMultiValue alloc] init];
+ [(ABMutableMultiValue *) data
+ addValue:addr
+ withLabel:JavaStringToNSString(jniEnv, subProperty)];
+ }
+ //else if(property == kABOtherDatesProperty)//kABMultiDateProperty
+ //else if(property == kABOtherDateComponentsProperty: not used for now
+ else if(property == kABInstantMessageProperty)
+ {
+ jobjectArray arr = (jobjectArray)value;
+ jsize propertyCount = (*jniEnv)->GetArrayLength(jniEnv, arr);
+
+ data=[[ABMutableMultiValue alloc] init];
+
+ // The values are
+ // kABInstantMessageUsernameKey -> the user set username
+ // kABInstantMessageServiceKey -> one of
+ // (kABInstantMessageServiceICQ,
+ // kABInstantMessageServiceJabber,
+ // kABInstantMessageServiceGoogleTalk
+ // ...)
+ for (i = 0; i < propertyCount; i+=4)
+ {
+ NSMutableDictionary *addr;
+ addr = [NSMutableDictionary dictionary];
+
+ jstring value = (jstring) (*jniEnv)->GetObjectArrayElement(
+ jniEnv, arr, i);
+ jstring label = (jstring) (*jniEnv)->GetObjectArrayElement(
+ jniEnv, arr, i+1);
+ jstring value2 = (jstring) (*jniEnv)->GetObjectArrayElement(
+ jniEnv, arr, i+2);
+ jstring label2 = (jstring) (*jniEnv)->GetObjectArrayElement(
+ jniEnv, arr, i+3);
+
+ //NSLog(@"key:%@, value:%@", JavaStringToNSString(jniEnv, label), JavaStringToNSString(jniEnv, value));
+ if(label)
+ [addr setObject:JavaStringToNSString(jniEnv, value)
+ forKey:JavaStringToNSString(jniEnv, label)];
+ if(label2)
+ [addr setObject:JavaStringToNSString(jniEnv, value2)
+ forKey:JavaStringToNSString(jniEnv, label2)];
+
+ [(ABMutableMultiValue *) data
+ addValue:addr
+ withLabel:JavaStringToNSString(jniEnv, subProperty)];
+ }
+ }
+ /*else if(property == kABSocialProfileProperty)
+ {
+ // kABSocialProfileURLKey, kABSocialProfileServiceKey,
+ // kABSocialProfileUsernameKey, kABSocialProfileUserIdentifierKey
+ }*/
+ else
+ {
+ data = NULL;
+ }
+
+ if(data)
+ res = [r setValue:data forProperty:(NSString *)property];
+
+ [addressBook save];
+
+ [autoreleasePool release];
+
+ return res;
+}
+
+/*
+ * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery
+ * Method: removeProperty
+ * Signature: (Ljava/lang/String;J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_removeProperty
+ (JNIEnv *jniEnv, jclass clazz, jstring id, jlong property)
+{
+ ABAddressBook *addressBook;
+ ABRecord *r;
+ NSAutoreleasePool *autoreleasePool;
+
+ autoreleasePool = [[NSAutoreleasePool alloc] init];
+
+ addressBook = [ABAddressBook sharedAddressBook];
+ r = [addressBook recordForUniqueId:JavaStringToNSString(jniEnv, id)];
+
+ BOOL res = [r removeValueForProperty:(NSString *)property];
+
+ [addressBook save];
+
+ [autoreleasePool release];
+
+ return res;
+}
+
#define DEFINE_ABPERSON_PROPERTY_GETTER(property) \
JNIEXPORT jlong JNICALL \
Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_##property \
@@ -155,6 +360,86 @@ DEFINE_ABPERSON_PROPERTY_GETTER(kABOrganizationProperty) DEFINE_ABPERSON_PROPERTY_GETTER(kABPersonFlags)
DEFINE_ABPERSON_PROPERTY_GETTER(kABPhoneProperty)
DEFINE_ABPERSON_PROPERTY_GETTER(kABYahooInstantProperty)
+DEFINE_ABPERSON_PROPERTY_GETTER(kABMaidenNameProperty)
+DEFINE_ABPERSON_PROPERTY_GETTER(kABBirthdayProperty)
+DEFINE_ABPERSON_PROPERTY_GETTER(kABBirthdayComponentsProperty)
+DEFINE_ABPERSON_PROPERTY_GETTER(kABJobTitleProperty)
+DEFINE_ABPERSON_PROPERTY_GETTER(kABHomePageProperty)
+DEFINE_ABPERSON_PROPERTY_GETTER(kABURLsProperty)
+DEFINE_ABPERSON_PROPERTY_GETTER(kABCalendarURIsProperty)
+DEFINE_ABPERSON_PROPERTY_GETTER(kABAddressProperty)
+DEFINE_ABPERSON_PROPERTY_GETTER(kABOtherDatesProperty)
+DEFINE_ABPERSON_PROPERTY_GETTER(kABOtherDateComponentsProperty)
+DEFINE_ABPERSON_PROPERTY_GETTER(kABRelatedNamesProperty)
+DEFINE_ABPERSON_PROPERTY_GETTER(kABDepartmentProperty)
+DEFINE_ABPERSON_PROPERTY_GETTER(kABInstantMessageProperty)
+DEFINE_ABPERSON_PROPERTY_GETTER(kABNoteProperty)
+DEFINE_ABPERSON_PROPERTY_GETTER(kABSocialProfileProperty)
+DEFINE_ABPERSON_PROPERTY_GETTER(kABTitleProperty)
+DEFINE_ABPERSON_PROPERTY_GETTER(kABSuffixProperty)
+
+#define DEFINE_ABLABEL_PROPERTY_GETTER(property) \
+ JNIEXPORT jstring JNICALL \
+ Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_##property \
+ (JNIEnv *jniEnv, jclass clazz) \
+ { \
+ return (*jniEnv)->NewStringUTF(jniEnv, [((NSString *) property) UTF8String]); \
+ }
+DEFINE_ABLABEL_PROPERTY_GETTER(kABHomePageLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABEmailWorkLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABEmailHomeLabel)
+//DEFINE_ABLABEL_PROPERTY_GETTER(kABEmailMobileMeLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABAddressHomeLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABAddressWorkLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABAnniversaryLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABFatherLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABMotherLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABParentLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABBrotherLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABSisterLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABChildLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABFriendLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABSpouseLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABPartnerLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABAssistantLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABManagerLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABPhoneWorkLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABPhoneHomeLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABPhoneiPhoneLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABPhoneMobileLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABPhoneMainLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABPhoneHomeFAXLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABPhoneWorkFAXLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABPhonePagerLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABAIMWorkLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABAIMHomeLabel)
+//DEFINE_ABLABEL_PROPERTY_GETTER(kABAIMMobileMeLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABJabberWorkLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABJabberHomeLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABMSNWorkLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABMSNHomeLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABYahooWorkLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABYahooHomeLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABICQWorkLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABICQHomeLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABInstantMessageServiceAIM)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABInstantMessageServiceFacebook)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABInstantMessageServiceGoogleTalk)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABInstantMessageServiceICQ)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABInstantMessageServiceJabber)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABInstantMessageServiceMSN)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABInstantMessageServiceSkype)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABInstantMessageServiceYahoo)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABAddressStreetKey)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABAddressCityKey)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABAddressZIPKey)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABAddressCountryKey)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABWorkLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABHomeLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABOtherLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABMobileMeLabel)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABInstantMessageUsernameKey)
+DEFINE_ABLABEL_PROPERTY_GETTER(kABInstantMessageServiceKey)
static void
MacOSXAddrBookContactQuery_idToJObject
@@ -185,7 +470,8 @@ MacOSXAddrBookContactQuery_idToJObject jobjectArray joArray
= (*jniEnv)->NewObjectArray(
jniEnv,
- mvCount * 2 /* value, label */, objectClass, NULL);
+ mvCount * 2 /* value, label */,
+ objectClass, NULL);
jo = joArray;
if (joArray)
@@ -195,6 +481,10 @@ MacOSXAddrBookContactQuery_idToJObject for (j = 0; j < mvCount; j++)
{
j2 = j * 2;
+
+ //NSLog(@"key:%@, label:%@",
+ // [mv valueAtIndex:j], [mv labelAtIndex:j]);
+
MacOSXAddrBookContactQuery_idToJObject(
jniEnv,
[mv valueAtIndex:j],
@@ -240,8 +530,58 @@ MacOSXAddrBookContactQuery_idToJObject }
}
}
+ else if ([o isKindOfClass:[NSDictionary class]])
+ {
+ NSDictionary *dict = (NSDictionary *)o;
+
+ NSUInteger dictCount = [dict count];
+ jobjectArray joArray
+ = (*jniEnv)->NewObjectArray(
+ jniEnv,
+ dictCount * 2, objectClass, NULL);
+ jo = joArray;
+ if (joArray)
+ {
+ NSEnumerator *enumerator = [dict keyEnumerator];
+ id key;
+ NSUInteger j, j2;
+ j = 0;
+ while ((key = [enumerator nextObject]))
+ {
+ //NSLog(@"key:%@, value:%@", key, [dict objectForKey: key]);
+
+ j2 = j * 2;
+
+ MacOSXAddrBookContactQuery_idToJObject(
+ jniEnv,
+ [dict objectForKey: key],
+ joArray, j2,
+ objectClass);
+ if (JNI_TRUE == (*jniEnv)->ExceptionCheck(jniEnv))
+ {
+ jo = NULL;
+ break;
+ }
+ MacOSXAddrBookContactQuery_idToJObject(
+ jniEnv,
+ key,
+ joArray, j2 + 1,
+ objectClass);
+ if (JNI_TRUE == (*jniEnv)->ExceptionCheck(jniEnv))
+ {
+ jo = NULL;
+ break;
+ }
+
+ j++;
+ }
+ }
+ }
else
+ {
+ //NSLog(@"type:%@", NSStringFromClass([o class]));
jo = NULL;
+ }
if (jo)
(*jniEnv)->SetObjectArrayElement(jniEnv, jos, i, jo);
}
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 index ae75978..f200da0 100644 --- 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 @@ -23,6 +23,14 @@ JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_Ma JNIEXPORT void JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourceService_stop (JNIEnv *, jclass, jlong); +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourceService + * Method: setDelegate + * Signature: (JLnet/java/sip/communicator/plugin/addrbook/macosx/MacOSXAddrBookContactSourceService/NotificationsDelegate;)V + */ +JNIEXPORT void JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourceService_setDelegate + (JNIEnv *, jclass, jlong, jobject); + #ifdef __cplusplus } #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 index 6645bc5..1a769ce 100644 --- 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 @@ -8,16 +8,24 @@ #include "net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourceService.h" #import <AddressBook/ABGlobals.h> +#import <AddressBook/AddressBook.h> #import <Foundation/NSAutoreleasePool.h> #import <Foundation/NSNotification.h> #import <Foundation/NSObject.h> @interface MacOSXAddrBookContactSourceService : NSObject { +@private + jobject delegateObject; + JavaVM *vm; } - (void)abDatabaseChangedExternallyNotification:(NSNotification *)notification; - (void)abDatabaseChangedNotification:(NSNotification *)notification; + +-(void)clean; +-(void) setDelegate:(jobject)delegate inJNIEnv:(JNIEnv *)jniEnv; +-(void) notify:(id)param methodName:(NSString *)mtdName; @end /* MacOSXAddrBookContactSourceService */ JNIEXPORT jlong JNICALL @@ -62,14 +70,191 @@ Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourc pool = [[NSAutoreleasePool alloc] init]; [[NSNotificationCenter defaultCenter] removeObserver:mabcss]; + [mabcss clean]; [mabcss release]; [pool release]; } +/* + * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourceService + * Method: setDelegate + * Signature: (JLnet/java/sip/communicator/plugin/addrbook/macosx/MacOSXAddrBookContactSourceService/NotificationsDelegate;)V + */ +JNIEXPORT void JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactSourceService_setDelegate + (JNIEnv *jniEnv, jclass clazz, jlong ptr, jobject m_delegate) +{ + MacOSXAddrBookContactSourceService *oDelegate; + + if (m_delegate) + { + oDelegate = (MacOSXAddrBookContactSourceService *) ptr; + [oDelegate setDelegate:m_delegate inJNIEnv:jniEnv]; + } + else + oDelegate = nil; +} + @implementation MacOSXAddrBookContactSourceService +- (void)clean +{ + [self setDelegate:NULL inJNIEnv:NULL]; +} + +- (void)setDelegate:(jobject) delegate inJNIEnv:(JNIEnv *)jniEnv +{ + if (self->delegateObject) + { + if (!jniEnv) + (*(self->vm))->AttachCurrentThread(self->vm, (void **)&jniEnv, NULL); + (*jniEnv)->DeleteGlobalRef(jniEnv, self->delegateObject); + self->delegateObject = NULL; + self->vm = NULL; + } + if (delegate) + { + delegate = (*jniEnv)->NewGlobalRef(jniEnv, delegate); + if (delegate) + { + (*jniEnv)->GetJavaVM(jniEnv, &(self->vm)); + self->delegateObject = delegate; + } + } +} + +-(void) notify:(id)param methodName:(NSString *)mName +{ + jobject delegate; + JNIEnv *jniEnv; + jclass delegateClass = NULL; + + delegate = self->delegateObject; + if (!delegate) + return; + + vm = self->vm; + if (0 != (*vm)->AttachCurrentThreadAsDaemon(vm, (void **)&jniEnv, NULL)) + return; + + delegateClass = (*jniEnv)->GetObjectClass(jniEnv, delegate); + if(delegateClass) + { + jmethodID methodid = NULL; + + if ([param isKindOfClass:[NSString class]]) + { + methodid = (*jniEnv)->GetMethodID(jniEnv, + delegateClass, + [mName UTF8String], + "(Ljava/lang/String;)V"); + + if(methodid) + (*jniEnv)->CallVoidMethod(jniEnv, + delegate, + methodid, + (*jniEnv)->NewStringUTF( + jniEnv, + [param UTF8String])); + + } + else + { + methodid = (*jniEnv)->GetMethodID(jniEnv, + delegateClass, + [mName UTF8String], + "(J)V"); + if(methodid) + (*jniEnv)->CallVoidMethod(jniEnv, + delegate, + methodid, + (jlong)param); + } + } + (*jniEnv)->ExceptionClear(jniEnv); +} + - (void)abDatabaseChangedExternallyNotification:(NSNotification *)notification { + ABAddressBook *addressBook; + id inserted = + [[notification userInfo] objectForKey:kABInsertedRecords]; + id updated = + [[notification userInfo] objectForKey:kABUpdatedRecords]; + id deleted = + [[notification userInfo] objectForKey:kABDeletedRecords]; + + addressBook = [ABAddressBook sharedAddressBook]; + + NSUInteger peopleCount; + NSUInteger i; + NSString *personID; + + if (inserted) + { + NSArray *people; + + if ([inserted isKindOfClass:[NSArray class]]) + { + people = inserted; + } else + { + people = [NSArray arrayWithObject:(ABPerson *)[addressBook recordForUniqueId:inserted]]; + } + + peopleCount = [people count]; + for (i = 0; i < peopleCount; i++) + { + personID = [people objectAtIndex:i]; + ABPerson *person = + (ABPerson *)[addressBook recordForUniqueId:personID]; + [self notify:person methodName:@"inserted"]; + } + } + + if (updated) + { + NSArray *people; + + if ([updated isKindOfClass:[NSArray class]]) + { + people = updated; + } + else + { + people = [NSArray arrayWithObject:(ABPerson *)[addressBook recordForUniqueId:updated]]; + } + + peopleCount = [people count]; + for (i = 0; i < peopleCount; i++) + { + personID = [people objectAtIndex:i]; + ABPerson *person = + (ABPerson *)[addressBook recordForUniqueId:personID]; + [self notify:person methodName:@"updated"]; + } + } + + if (deleted) + { + NSArray *people; + + if ([deleted isKindOfClass:[NSArray class]]) + { + people = deleted; + } + else + { + people = [NSArray arrayWithObject:(ABPerson *)[addressBook recordForUniqueId:deleted]]; + } + + peopleCount = [people count]; + for (i = 0; i < peopleCount; i++) + { + personID = [people objectAtIndex:i]; + + [self notify:personID methodName:@"deleted"]; + } + } } - (void)abDatabaseChangedNotification:(NSNotification *)notification |