diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index d13583bf8..1423e1713 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -2752,10 +2752,20 @@ LINPHONE_PUBLIC LinphoneProxyConfig * linphone_core_create_proxy_config(Linphone LINPHONE_PUBLIC int linphone_core_add_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *config); +/** + * Erase all proxies from config. + * + * @ingroup proxy +**/ LINPHONE_PUBLIC void linphone_core_clear_proxy_config(LinphoneCore *lc); LINPHONE_PUBLIC void linphone_core_remove_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *config); +/** + * Returns an unmodifiable list of entered proxy configurations. + * @param[in] lc The LinphoneCore object + * @return \mslist{LinphoneProxyConfig} +**/ LINPHONE_PUBLIC const MSList *linphone_core_get_proxy_config_list(const LinphoneCore *lc); /** @deprecated Use linphone_core_set_default_proxy_config() instead. */ diff --git a/coreapi/proxy.c b/coreapi/proxy.c index 1620c67be..6afa2d679 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -1215,31 +1215,27 @@ void linphone_core_remove_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *cf lc->sip_conf.proxies=ms_list_remove(lc->sip_conf.proxies,cfg); /* add to the list of destroyed proxies, so that the possible unREGISTER request can succeed authentication */ lc->sip_conf.deleted_proxies=ms_list_append(lc->sip_conf.deleted_proxies,cfg); + + if (lc->default_proxy==cfg){ + lc->default_proxy=NULL; + } + cfg->deletion_date=ms_time(NULL); if (cfg->state==LinphoneRegistrationOk){ - /* unREGISTER */ + /* UNREGISTER */ linphone_proxy_config_edit(cfg); linphone_proxy_config_enable_register(cfg,FALSE); linphone_proxy_config_done(cfg); linphone_proxy_config_update(cfg); } - if (lc->default_proxy==cfg){ - lc->default_proxy=NULL; - } linphone_proxy_config_write_all_to_config_file(lc); } -/** - * Erase all proxies from config. - * - * @ingroup proxy -**/ + void linphone_core_clear_proxy_config(LinphoneCore *lc){ - MSList* list=ms_list_copy(linphone_core_get_proxy_config_list((const LinphoneCore*)lc)); - MSList* copy=list; + const MSList* list=linphone_core_get_proxy_config_list(lc); for(;list!=NULL;list=list->next){ linphone_core_remove_proxy_config(lc,(LinphoneProxyConfig *)list->data); } - ms_list_free(copy); linphone_proxy_config_write_all_to_config_file(lc); } @@ -1297,11 +1293,6 @@ LinphoneProxyConfig * linphone_core_get_default_proxy_config(LinphoneCore *lc) { return lc->default_proxy; } -/** - * Returns an unmodifiable list of entered proxy configurations. - * @param[in] lc The LinphoneCore object - * @return \mslist{LinphoneProxyConfig} -**/ const MSList *linphone_core_get_proxy_config_list(const LinphoneCore *lc){ return lc->sip_conf.proxies; }