char *friend=NULL;
const char *route=NULL;
const char *from=NULL;
+ const char *fixed_contact=NULL;
LinphoneProxyConfig *cfg;
friend=linphone_address_as_string(fr->uri);
if (cfg!=NULL){
route=linphone_proxy_config_get_route(cfg);
from=linphone_proxy_config_get_identity(cfg);
+ if (cfg->op){
+ fixed_contact=sal_op_get_contact(cfg->op);
+ if (fixed_contact) {
+ ms_message("Contact for subscribe has been fixed using proxy to %s",fixed_contact);
+ }
+ }
}else from=linphone_core_get_primary_contact(fr->lc);
if (fr->outsub==NULL){
/* people for which we don't have yet an answer should appear as offline */
}
fr->outsub=sal_op_new(fr->lc->sal);
sal_op_set_route(fr->outsub,route);
+ sal_op_set_contact(fr->outsub,fixed_contact);
sal_subscribe_presence(fr->outsub,from,friend);
fr->subscribe_active=TRUE;
ms_free(friend);
}
ms_message("linphone_friend_apply() done.");
lc->bl_refresh=TRUE;
+ fr->commit=FALSE;
}
void linphone_friend_edit(LinphoneFriend *fr){
return ;
}
lc->friends=ms_list_append(lc->friends,lf);
- linphone_friend_apply(lf,lc);
+ if ( linphone_core_ready(lc)) linphone_friend_apply(lf,lc);
+ else lf->commit=TRUE;
return ;
}
}
}
+void linphone_core_send_initial_subscribes(LinphoneCore *lc){
+ const MSList *elem;
+ for(elem=lc->friends;elem!=NULL;elem=elem->next){
+ LinphoneFriend *f=(LinphoneFriend*)elem->data;
+ if (f->commit)
+ linphone_friend_apply(f,lc);
+ }
+}
+
void linphone_friend_set_ref_key(LinphoneFriend *lf, const char *key){
if (lf->refkey!=NULL){
ms_free(lf->refkey);
{
MSList *elem;
int i;
- if (!lc->ready) return; /*dont write config when reading it !*/
+ if (! linphone_core_ready(lc)) return; /*dont write config when reading it !*/
for (elem=lc->friends,i=0; elem!=NULL; elem=ms_list_next(elem),i++){
linphone_friend_write_to_config_file(lc->config,(LinphoneFriend*)elem->data,i);
}