diff --git a/coreapi/friend.c b/coreapi/friend.c index 32da85edb..9e535152c 100644 --- a/coreapi/friend.c +++ b/coreapi/friend.c @@ -356,17 +356,10 @@ LinphoneOnlineStatus linphone_friend_get_status(const LinphoneFriend *lf){ return online_status; } -LinphonePresenceModel * linphone_friend_get_presence_model(LinphoneFriend *lf) { +const LinphonePresenceModel * linphone_friend_get_presence_model(LinphoneFriend *lf) { return lf->presence; } -void linphone_friend_set_presence_model(LinphoneFriend *lf, LinphonePresenceModel *model) { - if (lf->presence != NULL) { - linphone_presence_model_delete(lf->presence); - } - lf->presence = model; -} - BuddyInfo * linphone_friend_get_info(const LinphoneFriend *lf){ return lf->info; } diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index bf3045de8..4278ca466 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -2009,22 +2009,11 @@ extern "C" jint Java_org_linphone_core_LinphoneFriendImpl_getStatus(JNIEnv* env */ JNIEXPORT jobject JNICALL Java_org_linphone_core_LinphoneFriendImpl_getPresenceModel(JNIEnv *env, jobject jobj, jlong ptr) { LinphoneFriend *lf = (LinphoneFriend *)ptr; - LinphonePresenceModel *model = linphone_friend_get_presence_model(lf); + const LinphonePresenceModel *model = linphone_friend_get_presence_model(lf); if (model == NULL) return NULL; RETURN_USER_DATA_OBJECT("PresenceModelImpl", linphone_presence_model, model); } -/* - * Class: org_linphone_core_LinphoneFriendImpl - * Method: setPresenceModel - * Signature: (JJ)V - */ -JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneFriendImpl_setPresenceModel(JNIEnv *env, jobject jobj, jlong ptr, jlong presencePtr) { - LinphoneFriend *lf = (LinphoneFriend *)ptr; - LinphonePresenceModel *model = (LinphonePresenceModel *)presencePtr; - linphone_friend_set_presence_model(lf, model); -} - extern "C" void Java_org_linphone_core_LinphoneFriendImpl_edit(JNIEnv* env ,jobject thiz ,jlong ptr) { diff --git a/coreapi/linphonefriend.h b/coreapi/linphonefriend.h index 3f1680c63..d7c7cd8d8 100644 --- a/coreapi/linphonefriend.h +++ b/coreapi/linphonefriend.h @@ -219,14 +219,7 @@ LinphoneOnlineStatus linphone_friend_get_status(const LinphoneFriend *lf); * @param[in] lf A #LinphoneFriend object * @return A #LinphonePresenceModel object, or NULL if the friend do not have presence information (in which case he is considered offline) */ -LinphonePresenceModel * linphone_friend_get_presence_model(LinphoneFriend *lf); - -/** - * @brief Set the presence information of a friend - * @param[in] lf A #LinphoneFriend object - * @param[in] presence A #LinphonePresenceModel object. It can be NULL to remove the presence information of the friend. - */ -void linphone_friend_set_presence_model(LinphoneFriend *lf, LinphonePresenceModel *presence); +const LinphonePresenceModel * linphone_friend_get_presence_model(LinphoneFriend *lf); BuddyInfo * linphone_friend_get_info(const LinphoneFriend *lf); void linphone_friend_set_ref_key(LinphoneFriend *lf, const char *key); diff --git a/coreapi/presence.c b/coreapi/presence.c index 889190d4c..ddd65b515 100644 --- a/coreapi/presence.c +++ b/coreapi/presence.c @@ -1668,7 +1668,10 @@ void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeStatus ss, Sa activity_str = linphone_presence_activity_to_string(activity); ms_message("We are notified that [%s] has presence [%s]", tmp, activity_str); if (activity_str != NULL) ms_free(activity_str); - linphone_friend_set_presence_model(lf, presence); + if (lf->presence != NULL) { + linphone_presence_model_delete(lf->presence); + } + lf->presence = presence; lf->subscribe_active=TRUE; if (lc->vtable.notify_presence_recv) lc->vtable.notify_presence_recv(lc,(LinphoneFriend*)lf); diff --git a/java/common/org/linphone/core/LinphoneFriend.java b/java/common/org/linphone/core/LinphoneFriend.java index d4a33fe45..1a84498ce 100644 --- a/java/common/org/linphone/core/LinphoneFriend.java +++ b/java/common/org/linphone/core/LinphoneFriend.java @@ -113,11 +113,6 @@ 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 presence A #PresenceModel object. It can be null to remove the presence information of the friend. - */ - void setPresenceModel(PresenceModel presence); /** * 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 da37b15ac..3b116f8ae 100644 --- a/java/impl/org/linphone/core/LinphoneFriendImpl.java +++ b/java/impl/org/linphone/core/LinphoneFriendImpl.java @@ -74,9 +74,6 @@ class LinphoneFriendImpl implements LinphoneFriend, Serializable { public PresenceModel getPresenceModel() { return (PresenceModel)getPresenceModel(nativePtr); } - public void setPresenceModel(PresenceModel presence) { - setPresenceModel(nativePtr, ((PresenceModelImpl)presence).getNativePtr()); - } public void edit() { edit(nativePtr); } diff --git a/tester/liblinphone_tester.h b/tester/liblinphone_tester.h index 5d9b5b49c..36dc323af 100644 --- a/tester/liblinphone_tester.h +++ b/tester/liblinphone_tester.h @@ -151,7 +151,7 @@ typedef struct _stats { int number_of_LinphonePresenceActivityVacation; int number_of_LinphonePresenceActivityWorking; int number_of_LinphonePresenceActivityWorship; - LinphonePresenceModel *last_received_presence; + const LinphonePresenceModel *last_received_presence; int number_of_inforeceived; int number_of_inforeceived_with_body;