forked from mirrors/linphone-iphone
fix presence tests
This commit is contained in:
parent
c7b943b40d
commit
7b5da68fd8
3 changed files with 11 additions and 5 deletions
|
|
@ -139,7 +139,7 @@ void* linphone_friend_get_user_data(const LinphoneFriend *lf){
|
|||
}
|
||||
|
||||
bool_t linphone_friend_in_list(const LinphoneFriend *lf){
|
||||
return lf->lc!=NULL;
|
||||
return lf->in_list;
|
||||
}
|
||||
|
||||
void linphone_core_interpret_friend_uri(LinphoneCore *lc, const char *uri, char **result){
|
||||
|
|
@ -475,7 +475,7 @@ void linphone_friend_edit(LinphoneFriend *fr){
|
|||
|
||||
void linphone_friend_done(LinphoneFriend *fr){
|
||||
ms_return_if_fail(fr!=NULL);
|
||||
if (fr->lc==NULL) return;
|
||||
if (fr->lc == NULL || !fr->in_list) return;
|
||||
linphone_friend_apply(fr,fr->lc);
|
||||
}
|
||||
|
||||
|
|
@ -494,7 +494,7 @@ void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *lf) {
|
|||
lc->subscribers = ms_list_remove(lc->subscribers, lf);
|
||||
linphone_friend_unref(lf);
|
||||
}
|
||||
lf->lc = lc;
|
||||
lf->lc = lc; /*I would prefer this to be done in linphone_friend_list_add_friend()*/
|
||||
if (linphone_core_ready(lc)) linphone_friend_apply(lf, lc);
|
||||
else lf->commit = TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -291,7 +291,10 @@ void linphone_friend_list_set_rls_uri(LinphoneFriendList *list, const char *rls_
|
|||
}
|
||||
|
||||
LinphoneFriendListStatus linphone_friend_list_add_friend(LinphoneFriendList *list, LinphoneFriend *friend) {
|
||||
if ((friend->lc != NULL) || (friend->uri == NULL)) return LinphoneFriendListInvalidFriend;
|
||||
if (friend->uri == NULL || friend->in_list) {
|
||||
ms_error("linphone_friend_list_add_friend(): invalid friend");
|
||||
return LinphoneFriendListInvalidFriend;
|
||||
}
|
||||
if (ms_list_find(list->friends, friend) != NULL) {
|
||||
char *tmp = NULL;
|
||||
const LinphoneAddress *addr = linphone_friend_get_address(friend);
|
||||
|
|
@ -299,6 +302,7 @@ LinphoneFriendListStatus linphone_friend_list_add_friend(LinphoneFriendList *lis
|
|||
ms_warning("Friend %s already in list [%s], ignored.", tmp ? tmp : "unknown", list->display_name);
|
||||
if (tmp) ms_free(tmp);
|
||||
} else {
|
||||
friend->in_list = TRUE;
|
||||
list->friends = ms_list_append(list->friends, linphone_friend_ref(friend));
|
||||
}
|
||||
return LinphoneFriendListOK;
|
||||
|
|
@ -307,7 +311,8 @@ LinphoneFriendListStatus linphone_friend_list_add_friend(LinphoneFriendList *lis
|
|||
LinphoneFriendListStatus linphone_friend_list_remove_friend(LinphoneFriendList *list, LinphoneFriend *friend) {
|
||||
MSList *elem = ms_list_find(list->friends, friend);
|
||||
if (elem == NULL) return LinphoneFriendListNonExistentFriend;
|
||||
linphone_friend_unref((LinphoneFriend *)elem->data);
|
||||
friend->in_list = FALSE;
|
||||
linphone_friend_unref(friend);
|
||||
list->friends = ms_list_remove_link(list->friends, elem);
|
||||
return LinphoneFriendListOK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -651,6 +651,7 @@ struct _LinphoneFriend{
|
|||
struct _LinphoneCore *lc;
|
||||
BuddyInfo *info;
|
||||
char *refkey;
|
||||
bool_t in_list;
|
||||
bool_t subscribe;
|
||||
bool_t subscribe_active;
|
||||
bool_t inc_subscribe_pending;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue