diff options
4 files changed, 98 insertions, 3 deletions
diff --git a/lib/native/mac/libjmacosxaddrbook.jnilib b/lib/native/mac/libjmacosxaddrbook.jnilib Binary files differindex bf7b354..79c3bf2 100755 --- a/lib/native/mac/libjmacosxaddrbook.jnilib +++ b/lib/native/mac/libjmacosxaddrbook.jnilib 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 c4d410e..695b64d 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 @@ -121,6 +121,22 @@ JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_Ma /*
* Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery
+ * Method: kABOrganizationProperty
+ * Signature: ()J
+ */
+JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABOrganizationProperty
+ (JNIEnv *, jclass);
+
+/*
+ * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery
+ * Method: kABPersonFlags
+ * Signature: ()J
+ */
+JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery_kABPersonFlags
+ (JNIEnv *, jclass);
+
+/*
+ * Class: net_java_sip_communicator_plugin_addrbook_macosx_MacOSXAddrBookContactQuery
* Method: kABPhoneProperty
* Signature: ()J
*/
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 23a2e50..f21aabe 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 @@ -121,6 +121,8 @@ DEFINE_ABPERSON_PROPERTY_GETTER(kABMiddleNameProperty) DEFINE_ABPERSON_PROPERTY_GETTER(kABMiddleNamePhoneticProperty)
DEFINE_ABPERSON_PROPERTY_GETTER(kABMSNInstantProperty)
DEFINE_ABPERSON_PROPERTY_GETTER(kABNicknameProperty)
+DEFINE_ABPERSON_PROPERTY_GETTER(kABOrganizationProperty)
+DEFINE_ABPERSON_PROPERTY_GETTER(kABPersonFlags)
DEFINE_ABPERSON_PROPERTY_GETTER(kABPhoneProperty)
DEFINE_ABPERSON_PROPERTY_GETTER(kABYahooInstantProperty)
@@ -166,6 +168,28 @@ MacOSXAddrBookContactQuery_idToJObject }
}
}
+ else if ([o isKindOfClass:[NSNumber class]])
+ {
+ jclass longClass = (*jniEnv)->FindClass(jniEnv, "java/lang/Long");
+
+ jo = NULL;
+ if (longClass)
+ {
+ jmethodID longMethodID
+ = (*jniEnv)->GetMethodID(
+ jniEnv,
+ longClass, "<init>", "(J)V");
+
+ if (longMethodID)
+ {
+ jo
+ = (*jniEnv)->NewObject(
+ jniEnv,
+ longClass, longMethodID,
+ (jlong) ([((NSNumber *) o) longValue]));
+ }
+ }
+ }
else
jo = NULL;
if (jo)
diff --git a/src/net/java/sip/communicator/plugin/addrbook/macosx/MacOSXAddrBookContactQuery.java b/src/net/java/sip/communicator/plugin/addrbook/macosx/MacOSXAddrBookContactQuery.java index 525ebd9..4dbd609 100644 --- a/src/net/java/sip/communicator/plugin/addrbook/macosx/MacOSXAddrBookContactQuery.java +++ b/src/net/java/sip/communicator/plugin/addrbook/macosx/MacOSXAddrBookContactQuery.java @@ -40,7 +40,9 @@ public class MacOSXAddrBookContactQuery kABMSNInstantProperty(),
kABNicknameProperty(),
kABPhoneProperty(),
- kABYahooInstantProperty()
+ kABYahooInstantProperty(),
+ kABPersonFlags(),
+ kABOrganizationProperty()
};
/**
@@ -116,12 +118,36 @@ public class MacOSXAddrBookContactQuery private static final int kABNicknameProperty = 11;
/**
+ * The index of the <tt>kABOrganizationProperty</tt> <tt>ABPerson</tt>
+ * property in {@link #ABPERSON_PROPERTIES}.
+ */
+ private static final int kABOrganizationProperty = 15;
+
+ /**
+ * The index of the <tt>kABPersonFlags</tt> <tt>ABPerson</tt> property in
+ * {@link #ABPERSON_PROPERTIES}.
+ */
+ private static final int kABPersonFlags = 14;
+
+ /**
* The index of the <tt>kABPhoneProperty</tt> <tt>ABPerson</tt> property in
* {@link #ABPERSON_PROPERTIES}.
*/
private static final int kABPhoneProperty = 12;
/**
+ * The flag which indicates that an <tt>ABRecord</tt> is to be displayed as
+ * a company.
+ */
+ private static final long kABShowAsCompany = 1;
+
+ /**
+ * The mask which extracts the <tt>kABShowAsXXX</tt> flag from the
+ * <tt>personFlags</tt> of an <tt>ABPerson</tt>.
+ */
+ private static final long kABShowAsMask = 7;
+
+ /**
* The index of the <tt>kABYahooInstantProperty</tt> <tt>ABPerson</tt>
* property in {@link #ABPERSON_PROPERTIES}.
*/
@@ -242,11 +268,26 @@ public class MacOSXAddrBookContactQuery */
private String getDisplayName(Object[] values)
{
- String displayName
+ long personFlags
+ = (values[kABPersonFlags] instanceof Long)
+ ? ((Long) values[kABPersonFlags]).longValue()
+ : 0;
+ String displayName;
+
+ if ((personFlags & kABShowAsMask) == kABShowAsCompany)
+ {
+ displayName
+ = (values[kABOrganizationProperty] instanceof String)
+ ? (String) values[kABOrganizationProperty]
+ : "";
+ if (displayName.length() != 0)
+ return displayName;
+ }
+
+ displayName
= (values[kABNicknameProperty] instanceof String)
? (String) values[kABNicknameProperty]
: "";
-
if (displayName.length() != 0)
return displayName;
@@ -407,6 +448,20 @@ public class MacOSXAddrBookContactQuery private static native long kABNicknameProperty();
/**
+ * Gets the value of the <tt>kABOrganizationProperty</tt> constant.
+ *
+ * @return the value of the <tt>kABOrganizationProperty</tt> constant
+ */
+ private static native long kABOrganizationProperty();
+
+ /**
+ * Gets the value of the <tt>kABPersonFlags</tt> constant.
+ *
+ * @return the value of the <tt>kABPersonFlags</tt> constant
+ */
+ private static native long kABPersonFlags();
+
+ /**
* Gets the value of the <tt>kABPhoneProperty</tt> constant.
*
* @return the value of the <tt>kABPhoneProperty</tt> constant
|