From 16e21507be68b24d8beb95775fe639a903efcefe Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 19 Apr 2016 15:38:49 +0200 Subject: [PATCH] Added method to set PreseceModel to a LinphoneFriend --- coreapi/linphonecore_jni.cc | 8 +++++++- java/common/org/linphone/core/LinphoneFriend.java | 5 +++++ java/impl/org/linphone/core/LinphoneFriendImpl.java | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 84ccf5342..feee57122 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -3643,7 +3643,7 @@ extern "C" void Java_org_linphone_core_LinphoneFriendImpl_finalize(JNIEnv* env linphone_friend_unref(lfriend); } -extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_finalize(JNIEnv* env +extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_finalize(JNIEnv* env ,jobject thiz ,jlong ptr) { LinphoneFriendList *lfriendList=(LinphoneFriendList*)ptr; @@ -3651,6 +3651,12 @@ extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_finalize(JNIEnv* linphone_friend_list_unref(lfriendList); } +extern "C" void Java_org_linphone_core_LinphoneFriendImpl_setPresenceModel(JNIEnv *env, jobject jobj, jlong ptr, jlong modelPtr) { + LinphoneFriend *lf = (LinphoneFriend *)ptr; + LinphonePresenceModel *model = (LinphonePresenceModel *)modelPtr; + linphone_friend_set_presence_model(lf, model); +} + /* * Class: org_linphone_core_LinphoneFriendImpl * Method: getPresenceModel diff --git a/java/common/org/linphone/core/LinphoneFriend.java b/java/common/org/linphone/core/LinphoneFriend.java index a44b2546e..2e23c2a96 100644 --- a/java/common/org/linphone/core/LinphoneFriend.java +++ b/java/common/org/linphone/core/LinphoneFriend.java @@ -113,6 +113,11 @@ public interface LinphoneFriend { * @return A #PresenceModel object, or null if the friend do not have presence information (in which case he is considered offline) */ PresenceModel getPresenceModel(); + /** + * @brief Set the presence information of a friend + * @param presenceModel A #PresenceModel object + */ + void setPresenceModel(PresenceModel presenceModel); /** * Starts editing a friend configuration. *
Because friend configuration must be consistent, applications MUST call {@link #edit()} before doing any attempts to modify friend configuration (such as address or subscription policy and so on). diff --git a/java/impl/org/linphone/core/LinphoneFriendImpl.java b/java/impl/org/linphone/core/LinphoneFriendImpl.java index 86240d8c9..5db973977 100644 --- a/java/impl/org/linphone/core/LinphoneFriendImpl.java +++ b/java/impl/org/linphone/core/LinphoneFriendImpl.java @@ -88,6 +88,9 @@ class LinphoneFriendImpl implements LinphoneFriend, Serializable { public PresenceModel getPresenceModel() { return (PresenceModel)getPresenceModel(nativePtr); } + public void setPresenceModel(PresenceModel presenceModel) { + setPresenceModel(nativePtr, ((PresenceModelImpl)presenceModel).getNativePtr()); + } public void edit() { synchronized(getSyncObject()){ edit(nativePtr);