Commit 3bba8ea3 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Normalize default proxy getter signature so that it can be automatically wrapped.

parent 5d6f9c0b
......@@ -2121,12 +2121,17 @@ LINPHONE_PUBLIC void linphone_core_remove_proxy_config(LinphoneCore *lc, Linphon
LINPHONE_PUBLIC const MSList *linphone_core_get_proxy_config_list(const LinphoneCore *lc);
LINPHONE_PUBLIC void linphone_core_set_default_proxy(LinphoneCore *lc, LinphoneProxyConfig *config);
/** @deprecated Use linphone_core_set_default_proxy_config() instead. */
#define linphone_core_set_default_proxy(lc, config) linphone_core_set_default_proxy_config(lc, config)
void linphone_core_set_default_proxy_index(LinphoneCore *lc, int index);
LINPHONE_PUBLIC int linphone_core_get_default_proxy(LinphoneCore *lc, LinphoneProxyConfig **config);
LINPHONE_PUBLIC LinphoneProxyConfig * linphone_core_get_default_proxy_config(LinphoneCore *lc);
LINPHONE_PUBLIC void linphone_core_set_default_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *config);
/**
* Create an authentication information with default values from Linphone core.
* @param[in] lc #LinphoneCore object
......
......@@ -1184,14 +1184,25 @@ void linphone_core_clear_proxy_config(LinphoneCore *lc){
ms_list_free(copy);
linphone_proxy_config_write_all_to_config_file(lc);
}
static int linphone_core_get_default_proxy_config_index(LinphoneCore *lc) {
int pos = -1;
if (lc->default_proxy != NULL) {
pos = ms_list_position(lc->sip_conf.proxies, ms_list_find(lc->sip_conf.proxies, (void *)lc->default_proxy));
}
return pos;
}
/**
* Sets the default proxy.
*
* This default proxy must be part of the list of already entered LinphoneProxyConfig.
* Toggling it as default will make LinphoneCore use the identity associated with
* the proxy configuration in all incoming and outgoing calls.
* @param[in] lc LinphoneCore object
* @param[in] config The proxy configuration to use as the default one.
**/
void linphone_core_set_default_proxy(LinphoneCore *lc, LinphoneProxyConfig *config){
void linphone_core_set_default_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *config){
/* check if this proxy is in our list */
if (config!=NULL){
if (ms_list_find(lc->sip_conf.proxies,config)==NULL){
......@@ -1202,7 +1213,7 @@ void linphone_core_set_default_proxy(LinphoneCore *lc, LinphoneProxyConfig *conf
}
lc->default_proxy=config;
if (linphone_core_ready(lc))
lp_config_set_int(lc->config,"sip","default_proxy",linphone_core_get_default_proxy(lc,NULL));
lp_config_set_int(lc->config,"sip","default_proxy",linphone_core_get_default_proxy_config_index(lc));
}
void linphone_core_set_default_proxy_index(LinphoneCore *lc, int index){
......@@ -1212,14 +1223,20 @@ void linphone_core_set_default_proxy_index(LinphoneCore *lc, int index){
/**
* Returns the default proxy configuration, that is the one used to determine the current identity.
* @deprecated Use linphone_core_get_default_proxy_config() instead.
**/
int linphone_core_get_default_proxy(LinphoneCore *lc, LinphoneProxyConfig **config){
int pos=-1;
if (config!=NULL) *config=lc->default_proxy;
if (lc->default_proxy!=NULL){
pos=ms_list_position(lc->sip_conf.proxies,ms_list_find(lc->sip_conf.proxies,(void *)lc->default_proxy));
}
return pos;
return linphone_core_get_default_proxy_config_index(lc);
}
/**
* Returns the default proxy configuration, that is the one used to determine the current identity.
* @param[in] lc LinphoneCore object
* @return The default proxy configuration.
**/
LinphoneProxyConfig * linphone_core_get_default_proxy_config(LinphoneCore *lc) {
return lc->default_proxy;
}
/**
......
......@@ -48,7 +48,6 @@ blacklisted_functions = [
'linphone_chat_room_create_file_transfer_message', # missing LinphoneContent
'linphone_core_can_we_add_call', # private function
'linphone_core_get_audio_port_range', # to be handwritten because of result via arguments
'linphone_core_get_default_proxy', # to be handwritten because of double pointer indirection
'linphone_core_get_sip_transports', # missing LCSipTransports
'linphone_core_get_sip_transports_used', # missing LCSipTransports
'linphone_core_get_supported_video_sizes', # missing MSVideoSizeDef
......
......@@ -309,10 +309,9 @@ class CoreManager:
assert_equals(self.stats.number_of_LinphoneRegistrationOk, proxy_count)
self.enable_audio_codec("PCMU", 8000)
# TODO: Need to wrap getter of default proxy
#if self.lc.default_proxy is not None:
# self.identity = linphone.Address.new(self.lc.default_proxy.identity)
# self.identity.clean()
if self.lc.default_proxy_config is not None:
self.identity = linphone.Address.new(self.lc.default_proxy_config.identity)
self.identity.clean()
def stop(self):
self.lc = None
......
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