mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
Remove useless minutes_away and contact parameters to the linphone_core_set_presence_model() function.
This commit is contained in:
parent
15952e46fb
commit
2d862f98ba
7 changed files with 24 additions and 30 deletions
|
|
@ -168,7 +168,7 @@ int main(int argc, char *argv[]){
|
|||
}
|
||||
|
||||
/*set my status to online*/
|
||||
linphone_core_set_presence_model(lc, 0, NULL, linphone_presence_model_new_with_activity(LinphonePresenceActivityOnline, NULL));
|
||||
linphone_core_set_presence_model(lc, linphone_presence_model_new_with_activity(LinphonePresenceActivityOnline, NULL));
|
||||
|
||||
/* main loop for receiving notifications and doing background linphone core work: */
|
||||
while(running){
|
||||
|
|
@ -177,7 +177,7 @@ int main(int argc, char *argv[]){
|
|||
}
|
||||
|
||||
/* change my presence status to offline*/
|
||||
linphone_core_set_presence_model(lc, 0, NULL, linphone_presence_model_new_with_activity(LinphonePresenceActivityOffline, NULL));
|
||||
linphone_core_set_presence_model(lc, linphone_presence_model_new_with_activity(LinphonePresenceActivityOffline, NULL));
|
||||
linphone_core_iterate(lc); /* just to make sure new status is initiate message is issued */
|
||||
|
||||
linphone_friend_edit(my_friend); /* start editing friend */
|
||||
|
|
|
|||
|
|
@ -3646,6 +3646,14 @@ void linphone_core_set_presence_info(LinphoneCore *lc, int minutes_away, const c
|
|||
LinphonePresenceModel *presence = NULL;
|
||||
char *description = NULL;
|
||||
LinphonePresenceActivityType acttype = LinphonePresenceActivityUnknown;
|
||||
|
||||
if (minutes_away>0) lc->minutes_away=minutes_away;
|
||||
if (lc->alt_contact!=NULL) {
|
||||
ms_free(lc->alt_contact);
|
||||
lc->alt_contact=NULL;
|
||||
}
|
||||
if (contact) lc->alt_contact=ms_strdup(contact);
|
||||
|
||||
switch (os) {
|
||||
case LinphoneStatusOffline:
|
||||
acttype = LinphonePresenceActivityOffline;
|
||||
|
|
@ -3691,18 +3699,10 @@ void linphone_core_set_presence_info(LinphoneCore *lc, int minutes_away, const c
|
|||
return;
|
||||
}
|
||||
presence = linphone_presence_model_new_with_activity(acttype, description);
|
||||
linphone_core_set_presence_model(lc, minutes_away, contact, presence);
|
||||
linphone_core_set_presence_model(lc, presence);
|
||||
}
|
||||
|
||||
void linphone_core_set_presence_model(LinphoneCore *lc, int minutes_away, const char *contact, LinphonePresenceModel *presence) {
|
||||
if (minutes_away>0) lc->minutes_away=minutes_away;
|
||||
|
||||
if (lc->alt_contact!=NULL) {
|
||||
ms_free(lc->alt_contact);
|
||||
lc->alt_contact=NULL;
|
||||
}
|
||||
if (contact) lc->alt_contact=ms_strdup(contact);
|
||||
|
||||
void linphone_core_set_presence_model(LinphoneCore *lc, LinphonePresenceModel *presence) {
|
||||
// TODO: Check that the presence timestamp is newer than the last sent presence.
|
||||
linphone_core_notify_all_friends(lc,presence);
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1099,12 +1099,10 @@ extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getPresenceInfo(JNIEnv *
|
|||
* Method: setPresenceModel
|
||||
* Signature: (JILjava/lang/String;J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setPresenceModel(JNIEnv *env, jobject jobj, jlong ptr, jint minutes_away, jstring jalternative_contact, jlong modelPtr) {
|
||||
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneCoreImpl_setPresenceModel(JNIEnv *env, jobject jobj, jlong ptr, jlong modelPtr) {
|
||||
LinphoneCore *lc = (LinphoneCore *)ptr;
|
||||
const char *calternative_contact = jalternative_contact ? env->GetStringUTFChars(jalternative_contact, NULL) : NULL;
|
||||
LinphonePresenceModel *model = (LinphonePresenceModel *)modelPtr;
|
||||
linphone_core_set_presence_model(lc, minutes_away, calternative_contact, model);
|
||||
if (calternative_contact) env->ReleaseStringUTFChars(jalternative_contact, calternative_contact);
|
||||
linphone_core_set_presence_model(lc, model);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -249,11 +249,9 @@ LINPHONE_PUBLIC void linphone_core_set_presence_info(LinphoneCore *lc,int minute
|
|||
/**
|
||||
* @brief Set my presence status
|
||||
* @param[in] lc #LinphoneCore object
|
||||
* @param[in] minutes_away how long in away
|
||||
* @param[in] alternative_contact sip uri used to redirect call in state #LinphoneStatusMoved
|
||||
* @param[in] presence #LinphonePresenceModel
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_core_set_presence_model(LinphoneCore *lc, int minutes_away, const char *alternative_contact, LinphonePresenceModel *presence);
|
||||
LINPHONE_PUBLIC void linphone_core_set_presence_model(LinphoneCore *lc, LinphonePresenceModel *presence);
|
||||
|
||||
/**
|
||||
* @brief Get my presence status
|
||||
|
|
|
|||
|
|
@ -671,7 +671,7 @@ public interface LinphoneCore {
|
|||
/**
|
||||
* @brief Set my presence status
|
||||
* @param minutes_away how long in away
|
||||
* @param status sip uri used to redirect call in state LinphoneStatusMoved
|
||||
* @param alternative_contact sip uri used to redirect call in state LinphoneStatusMoved
|
||||
* @param status OnlineStatus
|
||||
* @deprecated Use setPresenceModel() instead
|
||||
*/
|
||||
|
|
@ -684,11 +684,9 @@ public interface LinphoneCore {
|
|||
OnlineStatus getPresenceInfo();
|
||||
/**
|
||||
* @brief Set my presence status
|
||||
* @param minutess_away how long in away
|
||||
* @param alternative_contact sip uri used to redirect call in state #LinphoneStatusMoved
|
||||
* @param presence #LinphonePresenceModel
|
||||
*/
|
||||
void setPresenceModel(int minutes_away, String alternative_contact, PresenceModel presence);
|
||||
void setPresenceModel(PresenceModel presence);
|
||||
/**
|
||||
* @brief Get my presence status
|
||||
* @return A #PresenceModel object, or null if no presence model has been set.
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
private native void addFriend(long nativePtr,long friend);
|
||||
private native void setPresenceInfo(long nativePtr, int minutes_away, String alternative_contact, int status);
|
||||
private native int getPresenceInfo(long nativePtr);
|
||||
private native void setPresenceModel(long nativePtr, int minutes_away, String alternative_contact, long presencePtr);
|
||||
private native void setPresenceModel(long nativePtr, long presencePtr);
|
||||
private native Object getPresenceModel(long nativePtr);
|
||||
private native long createChatRoom(long nativePtr,String to);
|
||||
private native void enableVideo(long nativePtr,boolean vcap_enabled,boolean display_enabled);
|
||||
|
|
@ -378,8 +378,8 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
public synchronized OnlineStatus getPresenceInfo() {
|
||||
return OnlineStatus.fromInt(getPresenceInfo(nativePtr));
|
||||
}
|
||||
public synchronized void setPresenceModel(int minutes_away, String alternative_contact, PresenceModel presence) {
|
||||
setPresenceModel(nativePtr, minutes_away, alternative_contact, ((PresenceModelImpl)presence).getNativePtr());
|
||||
public synchronized void setPresenceModel(PresenceModel presence) {
|
||||
setPresenceModel(nativePtr, ((PresenceModelImpl)presence).getNativePtr());
|
||||
}
|
||||
public synchronized PresenceModel getPresenceModel() {
|
||||
return (PresenceModel)getPresenceModel(nativePtr);
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ static void simple_publish(void) {
|
|||
linphone_proxy_config_done(proxy);
|
||||
wait_core(marie->lc);
|
||||
presence =linphone_presence_model_new_with_activity(LinphonePresenceActivityOffline,NULL);
|
||||
linphone_core_set_presence_model(marie->lc,0,NULL,presence);
|
||||
linphone_core_set_presence_model(marie->lc,presence);
|
||||
wait_core(marie->lc);
|
||||
linphone_core_manager_destroy(marie);
|
||||
}
|
||||
|
|
@ -222,7 +222,7 @@ static void presence_information(void) {
|
|||
|
||||
/* Presence activity without description. */
|
||||
presence = linphone_presence_model_new_with_activity(LinphonePresenceActivityDinner, NULL);
|
||||
linphone_core_set_presence_model(pauline->lc, 0, NULL, presence);
|
||||
linphone_core_set_presence_model(pauline->lc, presence);
|
||||
wait_core(marie->lc);
|
||||
CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePresenceActivityDinner, 1);
|
||||
activity = linphone_presence_model_get_activity(marie->stat.last_received_presence);
|
||||
|
|
@ -233,7 +233,7 @@ static void presence_information(void) {
|
|||
|
||||
/* Presence activity with description. */
|
||||
presence = linphone_presence_model_new_with_activity(LinphonePresenceActivitySteering, bike_description);
|
||||
linphone_core_set_presence_model(pauline->lc, 0, NULL, presence);
|
||||
linphone_core_set_presence_model(pauline->lc, presence);
|
||||
wait_core(marie->lc);
|
||||
CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePresenceActivitySteering, 1);
|
||||
activity = linphone_presence_model_get_activity(marie->stat.last_received_presence);
|
||||
|
|
@ -245,7 +245,7 @@ static void presence_information(void) {
|
|||
|
||||
/* Presence activity with description and note. */
|
||||
presence = linphone_presence_model_new_with_activity_and_note(LinphonePresenceActivityVacation, NULL, vacation_note, vacation_lang);
|
||||
linphone_core_set_presence_model(pauline->lc, 0, NULL, presence);
|
||||
linphone_core_set_presence_model(pauline->lc, presence);
|
||||
wait_core(marie->lc);
|
||||
CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePresenceActivityVacation, 1);
|
||||
activity = linphone_presence_model_get_activity(marie->stat.last_received_presence);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue