Implements contact details edit and notification for outside edit of contacts.

cusax-fix
Damian Minkov 13 years ago
parent 4c74ca0d24
commit 6be8af5781

@ -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
@ -23,6 +93,30 @@ JNIEXPORT jbyteArray JNICALL Java_net_java_sip_communicator_plugin_addrbook_maco
JNIEXPORT jobjectArray JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_ABRecord_1valuesForProperties
(JNIEnv *, jclass, jlong, jlongArray);
/*
* 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
@ -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

@ -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);
}

@ -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

@ -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

@ -69,7 +69,7 @@ public class NetworkConfigurationWatcher
{
try
{
checkNetworkInterfaces(false, 0);
checkNetworkInterfaces(false, 0, true);
} catch (SocketException e)
{
logger.error("Error checking network interfaces", e);
@ -341,7 +341,7 @@ else if(event.getEventID() == SystemActivityEvent.EVENT_NETWORK_CHANGE)
{
try
{
checkNetworkInterfaces(true, 0);
checkNetworkInterfaces(true, 0, true);
} catch (SocketException e)
{
logger.error("Error checking network interfaces", e);
@ -385,10 +385,14 @@ private void downAllInterfaces()
* @param waitBeforeFiringUpEvents milliseconds to wait before
* firing events for interfaces up, sometimes we must wait a little bit
* and give time for interfaces to configure fully (dns on linux).
* @param printDebugInfo whether to print debug info, do not print
* anything if we are constantly checking as it will flood logs and made
* them unusable.
*/
private void checkNetworkInterfaces(
boolean fireEvents,
int waitBeforeFiringUpEvents)
int waitBeforeFiringUpEvents,
boolean printDebugInfo)
throws SocketException
{
Enumeration<NetworkInterface> e =
@ -429,7 +433,7 @@ private void checkNetworkInterfaces(
}
// add network debug info, to track wake up problems
if(logger.isInfoEnabled())
if(logger.isInfoEnabled() && printDebugInfo)
{
for(Map.Entry<String, List<InetAddress>> en :
activeInterfaces.entrySet())
@ -627,7 +631,7 @@ public void run()
{
boolean networkIsUP = activeInterfaces.size() > 0;
checkNetworkInterfaces(true, 1000);
checkNetworkInterfaces(true, 1000, false);
// fire that network has gone up
if(!networkIsUP && activeInterfaces.size() > 0)

@ -0,0 +1,122 @@
/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.plugin.addrbook;
import net.java.sip.communicator.service.contactsource.*;
import java.util.*;
import java.util.regex.*;
/**
* Abstract query that keep tracks of the source contacts
* that were created.
*
* @author Damian Minkov
*/
public abstract class AbstractAddrBookContactQuery<T extends ContactSourceService>
extends AsyncContactQuery<T>
{
/**
* The key we used for the id of the source contact.
*/
protected static final String SOURCE_CONTACT_ID_DATA_KEY =
AbstractAddrBookContactQuery.class.getName() + ".id";
/**
* A list of all source contact results.
*/
protected final List<SourceContact> sourceContacts
= new LinkedList<SourceContact>();
/**
* Initializes a new <tt>AbstractAddrBookContactQuery</tt> which is to perform
* a specific <tt>query</tt> in the Address Book on behalf of a
* specific <tt>ContactSourceService</tt>.
*
* @param contactSource the <tt>ContactSourceService</tt> which is to
* perform the new <tt>ContactQuery</tt> instance
* @param query the <tt>Pattern</tt> for which <tt>contactSource</tt> is
* being queried
**/
public AbstractAddrBookContactQuery(
T contactSource,
Pattern query)
{
super(contactSource, query);
}
/**
* Notifies the <tt>ContactQueryListener</tt>s registered with this
* <tt>ContactQuery</tt> that a new <tt>SourceContact</tt> has been
* received.
*
* @param contact the <tt>SourceContact</tt> which has been received and
* which the registered <tt>ContactQueryListener</tt>s are to be notified
* about
*/
protected void fireContactReceived(SourceContact contact)
{
synchronized (sourceContacts)
{
sourceContacts.add(contact);
}
super.fireContactReceived(contact);
}
/**
* Notifies the <tt>ContactQueryListener</tt>s registered with this
* <tt>ContactQuery</tt> that a <tt>SourceContact</tt> has been
* removed.
*
* @param contact the <tt>SourceContact</tt> which has been removed and
* which the registered <tt>ContactQueryListener</tt>s are to be notified
* about
*/
protected void fireContactRemoved(SourceContact contact)
{
synchronized (sourceContacts)
{
sourceContacts.remove(contact);
}
super.fireContactRemoved(contact);
}
/**
* Clear.
*/
public void clear()
{
synchronized (sourceContacts)
{
sourceContacts.clear();
}
}
/**
* Searches for source contact with the specified id.
* @param id the id to search for
* @return the source contact found or null.
*/
protected SourceContact findSourceContactByID(String id)
{
synchronized(sourceContacts)
{
for(SourceContact sc : sourceContacts)
{
Object scID = sc.getData(SOURCE_CONTACT_ID_DATA_KEY);
if(id.equals(scID))
return sc;
}
}
// not found
return null;
}
}

@ -36,6 +36,11 @@ public class MacOSXAddrBookContactSourceService
*/
private long ptr;
/**
* The latest query created.
*/
private MacOSXAddrBookContactQuery latestQuery;
/**
* Initializes a new <tt>MacOSXAddrBookContactSourceService</tt> instance.
*/
@ -44,6 +49,7 @@ public MacOSXAddrBookContactSourceService()
ptr = start();
if (0 == ptr)
throw new IllegalStateException("ptr");
setDelegate(ptr, new NotificationsDelegate());
}
/**
@ -86,11 +92,13 @@ public int getType()
*/
public ContactQuery queryContactSource(Pattern query)
{
MacOSXAddrBookContactQuery mosxabcq
= new MacOSXAddrBookContactQuery(this, query);
if(latestQuery != null)
latestQuery.clear();
mosxabcq.start();
return mosxabcq;
latestQuery = new MacOSXAddrBookContactQuery(this, query);
latestQuery.start();
return latestQuery;
}
/**
@ -111,6 +119,12 @@ public synchronized void stop()
{
if (0 != ptr)
{
if(latestQuery != null)
{
latestQuery.clear();
latestQuery = null;
}
stop(ptr);
ptr = 0;
}
@ -145,4 +159,44 @@ public int getIndex()
* <tt>MacOSXAddrBookContactSourceService</tt> to stop
*/
private static native void stop(long ptr);
/**
* Sets notifier delegate.
* @param ptr
* @param delegate
*/
public static native void setDelegate(long ptr, NotificationsDelegate delegate);
/**
* Delegate class to be notified for addressbook changes.
*/
public class NotificationsDelegate
{
/**
* Callback method when receiving notifications for inserted items.
*/
public void inserted(long person)
{
if(latestQuery != null)
latestQuery.inserted(person);
}
/**
* Callback method when receiving notifications for updated items.
*/
public void updated(long person)
{
if(latestQuery != null)
latestQuery.updated(person);
}
/**
* Callback method when receiving notifications for deleted items.
*/
public void deleted(String id)
{
if(latestQuery != null)
latestQuery.deleted(id);
}
}
}

@ -114,6 +114,54 @@ protected void fireContactReceived(SourceContact contact)
l.contactReceived(ev);
}
/**
* Notifies the <tt>ContactQueryListener</tt>s registered with this
* <tt>ContactQuery</tt> that a <tt>SourceContact</tt> has been
* removed.
*
* @param contact the <tt>SourceContact</tt> which has been removed and
* which the registered <tt>ContactQueryListener</tt>s are to be notified
* about
*/
protected void fireContactRemoved(SourceContact contact)
{
ContactQueryListener[] ls;
synchronized (listeners)
{
ls = listeners.toArray(new ContactQueryListener[listeners.size()]);
}
ContactRemovedEvent ev = new ContactRemovedEvent(this, contact);
for (ContactQueryListener l : ls)
l.contactRemoved(ev);
}
/**
* Notifies the <tt>ContactQueryListener</tt>s registered with this
* <tt>ContactQuery</tt> that a <tt>SourceContact</tt> has been
* changed.
*
* @param contact the <tt>SourceContact</tt> which has been changed and
* which the registered <tt>ContactQueryListener</tt>s are to be notified
* about
*/
protected void fireContactChanged(SourceContact contact)
{
ContactQueryListener[] ls;
synchronized (listeners)
{
ls = listeners.toArray(new ContactQueryListener[listeners.size()]);
}
ContactChangedEvent ev = new ContactChangedEvent(this, contact);
for (ContactQueryListener l : ls)
l.contactChanged(ev);
}
/**
* Notifies the <tt>ContactQueryListener</tt>s registered with this
* <tt>ContactQuery</tt> that its state has changed.

@ -277,8 +277,7 @@ public static SubCategory fromString(String value)
}
/**
* The category of this <tt>ContactQuery</tt>. For example,
* {@link #CATEGORY_PHONE} or {@link #CATEGORY_EMAIL}.
* The category of this <tt>ContactQuery</tt>.
*/
private final Category category;
@ -409,8 +408,7 @@ public void setSupportedOpSets(
}
/**
* Gets the category, if any, of this <tt>ContactQuery</tt>. For example,
* {@link #CATEGORY_PHONE} or {@link #CATEGORY_EMAIL}.
* Gets the category, if any, of this <tt>ContactQuery</tt>.
*
* @return the category of this <tt>ContactQuery</tt> if it has any;
* otherwise, <tt>null</tt>
@ -488,14 +486,14 @@ public List<Class<? extends OperationSet>> getSupportedOperationSets()
* any of the standard/well-known labels defined by the <tt>LABEL_XXX</tt>
* constants of the <tt>ContactDetail</tt> class.
*
* @param label the label to be determined whether it is contained in the
* set of labels of this <tt>ContactDetail</tt>
* @param subCategory the subCategory to be determined whether
* it is contained in this <tt>ContactDetail</tt>
* @return <tt>true</tt> if the specified <tt>label</tt> is contained in the
* set of labels of this <tt>ContactDetail</tt>
*/
public boolean containsSubCategory(SubCategory label)
public boolean containsSubCategory(SubCategory subCategory)
{
return subCategories.contains(label);
return subCategories.contains(subCategory);
}
/**

@ -24,7 +24,7 @@ public class GenericSourceContact
/**
* The <tt>ContactDetail</tt>s of this <tt>SourceContact</tt>.
*/
private final List<ContactDetail> contactDetails;
protected final List<ContactDetail> contactDetails;
/**
* The <tt>ContactSourceService</tt> which has created this

Loading…
Cancel
Save