Commit 9702eeb2 authored by jehan's avatar jehan

wait until linphone friend proxy config is registered before sending

first subscribe
parent 37ca2d40
......@@ -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){
......
......@@ -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;
......
......@@ -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*/
};
......
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