Commit ee35e8e4 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Remove linphone_friend_set_presence_model() and make...

Remove linphone_friend_set_presence_model() and make linphone_friend_get_presence_model() return a const pointer because the user should not be able to change his friends' presence.
parent 3c1f7ace
......@@ -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;
}
......
......@@ -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) {
......
......@@ -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);
......
......@@ -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);
......
......@@ -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.
*<br> 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).
......
......@@ -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);
}
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment