From 480144c98f95c6fc02b5cee86542eef2118063d4 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 10 Sep 2013 13:07:55 +0200 Subject: [PATCH] Update JNI one more time. --- coreapi/linphonecore_jni.cc | 8 +++++--- java/common/org/linphone/core/LinphoneCoreFactory.java | 4 +++- java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java | 4 ++-- java/impl/org/linphone/core/PresenceServiceImpl.java | 6 +++--- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index e7d5a7092..3b61d7438 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -3621,13 +3621,15 @@ JNIEXPORT jint JNICALL Java_org_linphone_core_PresenceActivityImpl_setDescriptio /* * Class: org_linphone_core_PresenceServiceImpl * Method: newPresenceServiceImpl - * Signature: (Ljava/lang/String;)J + * Signature: (Ljava/lang/String;ILjava/lang/String;)J */ -JNIEXPORT jlong JNICALL Java_org_linphone_core_PresenceServiceImpl_newPresenceServiceImpl(JNIEnv *env, jobject jobj, jstring id) { +JNIEXPORT jlong JNICALL Java_org_linphone_core_PresenceServiceImpl_newPresenceServiceImpl(JNIEnv *env, jobject jobj, jstring id, jint basic_status, jstring contact) { LinphonePresenceService *service; const char *cid = id ? env->GetStringUTFChars(id, NULL) : NULL; - service = linphone_presence_service_new(cid); + const char *ccontact = contact ? env->GetStringUTFChars(contact, NULL) : NULL; + service = linphone_presence_service_new(cid, (LinphonePresenceBasicStatus)basic_status, ccontact); if (cid) env->ReleaseStringUTFChars(id, cid); + if (ccontact) env->ReleaseStringUTFChars(contact, ccontact); return (jlong)service; } diff --git a/java/common/org/linphone/core/LinphoneCoreFactory.java b/java/common/org/linphone/core/LinphoneCoreFactory.java index b7287801e..91f026ae0 100644 --- a/java/common/org/linphone/core/LinphoneCoreFactory.java +++ b/java/common/org/linphone/core/LinphoneCoreFactory.java @@ -120,9 +120,11 @@ abstract public class LinphoneCoreFactory { /** * Create a PresenceService object. * @param id The id of the presence service. Can be null to generate it automatically. + * @param status The PresenceBasicStatus to set for the PresenceService object. + * @param contact The contact to set for the PresenceService object. Can be null. * @return A new PresenceService object. */ - abstract public PresenceService createPresenceService(String id); + abstract public PresenceService createPresenceService(String id, PresenceBasicStatus status, String contact); /** * Create a PresenceModel object. diff --git a/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java b/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java index 581b6acba..6c1f370ae 100644 --- a/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java @@ -186,8 +186,8 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { } @Override - public PresenceService createPresenceService(String id) { - return new PresenceServiceImpl(id); + public PresenceService createPresenceService(String id, PresenceBasicStatus status, String contact) { + return new PresenceServiceImpl(id, status, contact); } @Override diff --git a/java/impl/org/linphone/core/PresenceServiceImpl.java b/java/impl/org/linphone/core/PresenceServiceImpl.java index 5a3a31416..a3c53a890 100644 --- a/java/impl/org/linphone/core/PresenceServiceImpl.java +++ b/java/impl/org/linphone/core/PresenceServiceImpl.java @@ -26,9 +26,9 @@ public class PresenceServiceImpl implements PresenceService { mNativePtr = nativePtr; } - private native long newPresenceServiceImpl(String id); - protected PresenceServiceImpl(String id) { - mNativePtr = newPresenceServiceImpl(id); + private native long newPresenceServiceImpl(String id, int status, String contact); + protected PresenceServiceImpl(String id, PresenceBasicStatus status, String contact) { + mNativePtr = newPresenceServiceImpl(id, status.toInt(), contact); } private native void unref(long nativePtr);