diff --git a/coreapi/friend.c b/coreapi/friend.c index 5437a5a03..7f77e9b94 100644 --- a/coreapi/friend.c +++ b/coreapi/friend.c @@ -449,11 +449,28 @@ void linphone_core_remove_friend(LinphoneCore *lc, LinphoneFriend* fl){ void linphone_core_send_initial_subscribes(LinphoneCore *lc){ const MSList *elem; if (lc->initial_subscribes_sent) return; + lc->initial_subscribes_sent=TRUE; /*set to true and see if looping on friends will change this status*/ for(elem=lc->friends;elem!=NULL;elem=elem->next){ LinphoneFriend *f=(LinphoneFriend*)elem->data; - linphone_friend_apply(f,lc); + LinphoneProxyConfig* cfg; + if (!f->initial_subscribes_sent) { + lc->initial_subscribes_sent=FALSE; /*at least 1 was not sent */ + if ((cfg=linphone_core_lookup_known_proxy(f->lc,linphone_friend_get_address(f)))) { + /*check if already registered*/ + if (linphone_proxy_config_get_state(cfg) != LinphoneRegistrationOk) + continue; /*skip this friend because not registered yet*/ + else { + char* lf_string = linphone_address_as_string(linphone_friend_get_address(f)); + ms_message("Identity [%s] registered, we can now subscribe to [%s]",linphone_proxy_config_get_identity(cfg),lf_string); + ms_free(lf_string); + } + } + linphone_friend_apply(f,lc); + f->initial_subscribes_sent=TRUE; + } + } - lc->initial_subscribes_sent=TRUE; + } void linphone_core_invalidate_friend_subscriptions(LinphoneCore *lc){ diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 2ef871b29..888b07dda 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2414,7 +2414,7 @@ LinphoneProxyConfig * linphone_core_lookup_known_proxy(LinphoneCore *lc, const L } end: if (found_cfg!=NULL && found_cfg!=default_cfg){ - ms_message("Overriding default proxy setting for this call/message/subscribe operation."); + ms_debug("Overriding default proxy setting for this call/message/subscribe operation."); }else found_cfg=default_cfg; return found_cfg; diff --git a/coreapi/private.h b/coreapi/private.h index 71cd69136..c6ef374f9 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -439,6 +439,7 @@ struct _LinphoneFriend{ bool_t subscribe_active; bool_t inc_subscribe_pending; bool_t commit; + bool_t initial_subscribes_sent; /*used to know if initial subscribe message was sent or not*/ };