Commit 7d07ca75 authored by Ghislain MARY's avatar Ghislain MARY

Apply the user agent as soon as it is changed.

The user agent is no longer global and now depends on the linphone core
(kind of, there is still a global variable behind to hold its value).
parent 70955212
......@@ -1671,9 +1671,10 @@ static void apply_user_agent(LinphoneCore *lc){
*
* @ingroup misc
**/
void linphone_core_set_user_agent(const char *name, const char *ver){
void linphone_core_set_user_agent(LinphoneCore *lc, const char *name, const char *ver){
strncpy(_ua_name,name,sizeof(_ua_name)-1);
strncpy(_ua_version,ver,sizeof(_ua_version));
apply_user_agent(lc);
}
const char *linphone_core_get_user_agent_name(void){
......
......@@ -901,8 +901,6 @@ typedef void * (*LinphoneWaitingCallback)(struct _LinphoneCore *lc, void *contex
void linphone_core_enable_logs(FILE *file);
void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc);
void linphone_core_disable_logs(void);
/*sets the user-agent string in sip messages, must be set before linphone_core_new() or linphone_core_init() */
void linphone_core_set_user_agent(const char *ua_name, const char *version);
const char *linphone_core_get_version(void);
const char *linphone_core_get_user_agent_name(void);
const char *linphone_core_get_user_agent_version(void);
......@@ -932,6 +930,9 @@ const char* linphone_core_get_device_identifier(const LinphoneCore *lc);
#endif
/*sets the user-agent string in sip messages, ideally called just after linphone_core_new() or linphone_core_init() */
void linphone_core_set_user_agent(LinphoneCore *lc, const char *ua_name, const char *version);
LinphoneAddress * linphone_core_interpret_url(LinphoneCore *lc, const char *url);
LinphoneCall * linphone_core_invite(LinphoneCore *lc, const char *url);
......
......@@ -2141,7 +2141,7 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_tunnelEnable(JNIEnv *env
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUserAgent(JNIEnv *env,jobject thiz,jlong pCore, jstring name, jstring version){
const char* cname=env->GetStringUTFChars(name, NULL);
const char* cversion=env->GetStringUTFChars(version, NULL);
linphone_core_set_user_agent(cname,cversion);
linphone_core_set_user_agent((LinphoneCore *)pCore,cname,cversion);
env->ReleaseStringUTFChars(name, cname);
env->ReleaseStringUTFChars(version, cversion);
}
......
......@@ -239,8 +239,8 @@ static void linphone_gtk_init_liblinphone(const char *config_file,
vtable.call_encryption_changed=linphone_gtk_call_encryption_changed;
vtable.transfer_state_changed=linphone_gtk_transfer_state_changed;
linphone_core_set_user_agent("Linphone", LINPHONE_VERSION);
the_core=linphone_core_new(&vtable,config_file,factory_config_file,NULL);
linphone_core_set_user_agent(the_core,"Linphone", LINPHONE_VERSION);
linphone_core_set_waiting_callback(the_core,linphone_gtk_wait,NULL);
linphone_core_set_zrtp_secrets_file(the_core,secrets_file);
g_free(secrets_file);
......
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