diff --git a/coreapi/proxy.c b/coreapi/proxy.c index 214aabea8..0c710cb3a 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -1120,7 +1120,7 @@ static void linphone_proxy_config_activate_sip_setup(LinphoneProxyConfig *cfg){ } caps=sip_setup_context_get_capabilities(ssc); if (caps & SIP_SETUP_CAP_ACCOUNT_MANAGER){ - if (sip_setup_context_login_account(ssc,cfg->reg_identity,NULL)!=0){ + if (sip_setup_context_login_account(ssc,cfg->reg_identity,NULL,NULL)!=0){ if (lc->vtable.display_warning){ char *tmp=ms_strdup_printf(_("Could not login as %s"),cfg->reg_identity); lc->vtable.display_warning(lc,tmp); diff --git a/coreapi/siplogin.c b/coreapi/siplogin.c index c63d8af1e..b70f50f0e 100644 --- a/coreapi/siplogin.c +++ b/coreapi/siplogin.c @@ -49,7 +49,7 @@ static void guess_display_name(LinphoneAddress *from){ ms_free(dn); } -static int sip_login_do_login(SipSetupContext * ctx, const char *uri, const char *passwd){ +static int sip_login_do_login(SipSetupContext * ctx, const char *uri, const char *passwd, const char *userid){ LinphoneProxyConfig *cfg=sip_setup_context_get_proxy_config(ctx); LinphoneCore *lc=linphone_proxy_config_get_core(cfg); LinphoneAuthInfo *auth; @@ -66,7 +66,8 @@ static int sip_login_do_login(SipSetupContext * ctx, const char *uri, const char tmp=linphone_address_as_string(parsed_uri); linphone_proxy_config_set_identity(cfg,tmp); if (passwd ) { - auth=linphone_auth_info_new(linphone_address_get_username(parsed_uri),NULL,passwd,NULL,NULL,NULL); + auth=linphone_auth_info_new(linphone_address_get_username(parsed_uri),userid,passwd,NULL,NULL, + linphone_address_get_domain(parsed_uri)); linphone_core_add_auth_info(lc,auth); } linphone_proxy_config_enable_register(cfg,TRUE); diff --git a/coreapi/sipsetup.c b/coreapi/sipsetup.c index a5b846a64..91abf5d62 100644 --- a/coreapi/sipsetup.c +++ b/coreapi/sipsetup.c @@ -146,7 +146,7 @@ int sip_setup_context_account_validated(SipSetupContext *ctx, const char *uri){ return -1; } -int sip_setup_context_login_account(SipSetupContext * ctx, const char *uri, const char *passwd){ +int sip_setup_context_login_account(SipSetupContext * ctx, const char *uri, const char *passwd, const char *userid){ LinphoneAddress *from=linphone_address_new(uri); if (from==NULL) { ms_warning("Fail to parse %s",uri); @@ -156,7 +156,7 @@ int sip_setup_context_login_account(SipSetupContext * ctx, const char *uri, cons strncpy(ctx->username,linphone_address_get_username(from),sizeof(ctx->username)); linphone_address_destroy(from); if (ctx->funcs->login_account) - return ctx->funcs->login_account(ctx,uri,passwd); + return ctx->funcs->login_account(ctx,uri,passwd,userid); return -1; } diff --git a/coreapi/sipsetup.h b/coreapi/sipsetup.h index 2aefbee5c..dad51f13e 100644 --- a/coreapi/sipsetup.h +++ b/coreapi/sipsetup.h @@ -98,7 +98,7 @@ struct _SipSetup{ void (*uninit_instance)(SipSetupContext *ctx); int (*account_exists)(SipSetupContext *ctx, const char *uri); int (*create_account)(SipSetupContext *ctx, const char *uri, const char *passwd, const char *email, int suscribe); - int (*login_account)(SipSetupContext *ctx, const char *uri, const char *passwd); + int (*login_account)(SipSetupContext *ctx, const char *uri, const char *passwd, const char *userid); int (*get_proxy)(SipSetupContext *ctx, const char *domain, char *proxy, size_t sz); int (*get_stun_servers)(SipSetupContext *ctx, char *stun1, char *stun2, size_t size); int (*get_relay)(SipSetupContext *ctx, char *relay, size_t size); @@ -135,7 +135,7 @@ int sip_setup_context_account_exists(SipSetupContext *ctx, const char *uri); int sip_setup_context_account_validated(SipSetupContext *ctx, const char *uri); int sip_setup_context_create_account(SipSetupContext *ctx, const char *uri, const char *passwd, const char *email, int suscribe); int sip_setup_context_get_capabilities(SipSetupContext *ctx); -int sip_setup_context_login_account(SipSetupContext * ctx, const char *uri, const char *passwd); +int sip_setup_context_login_account(SipSetupContext * ctx, const char *uri, const char *passwd, const char *userid); int sip_setup_context_get_proxy(SipSetupContext *ctx, const char *domain, char *proxy, size_t sz); int sip_setup_context_get_stun_servers(SipSetupContext *ctx, char *stun1, char *stun2, size_t size); int sip_setup_context_get_relay(SipSetupContext *ctx, char *relay, size_t size); diff --git a/coreapi/sipwizard.c b/coreapi/sipwizard.c index c81dabf35..8d92de9dc 100644 --- a/coreapi/sipwizard.c +++ b/coreapi/sipwizard.c @@ -197,7 +197,7 @@ static void guess_display_name(LinphoneAddress *from){ ms_free(dn); } -static int sip_wizard_do_login(SipSetupContext * ctx, const char *uri, const char *passwd){ +static int sip_wizard_do_login(SipSetupContext * ctx, const char *uri, const char *passwd, const char *userid){ LinphoneProxyConfig *cfg=sip_setup_context_get_proxy_config(ctx); LinphoneCore *lc=linphone_proxy_config_get_core(cfg); LinphoneAuthInfo *auth; diff --git a/gtk/loginframe.c b/gtk/loginframe.c index bd8a8643f..8e75c4c01 100644 --- a/gtk/loginframe.c +++ b/gtk/loginframe.c @@ -24,8 +24,8 @@ void test_button_clicked_cb(GtkWidget *button); void linphone_gtk_exit_login_frame(void); -static void do_login(SipSetupContext *ssctx, const char *identity, const char * passwd){ - if (sip_setup_context_login_account(ssctx,identity,passwd)==0){ +static void do_login(SipSetupContext *ssctx, const char *identity, const char * passwd, const char *userid){ + if (sip_setup_context_login_account(ssctx,identity,passwd,userid)==0){ } } @@ -44,7 +44,7 @@ static gboolean do_login_noprompt(LinphoneProxyConfig *cfg){ addr=linphone_address_new(linphone_proxy_config_get_identity(cfg)); linphone_address_set_username(addr,username); tmp=linphone_address_as_string (addr); - do_login(ssctx,tmp,NULL); + do_login(ssctx,tmp,NULL,NULL); linphone_address_destroy(addr); linphone_gtk_load_identities(); return FALSE; @@ -78,6 +78,10 @@ void linphone_gtk_show_login_frame(LinphoneProxyConfig *cfg){ gtk_widget_hide(linphone_gtk_get_widget(mw,"disconnect_item")); gtk_widget_hide(linphone_gtk_get_widget(mw,"main_frame")); gtk_widget_show(linphone_gtk_get_widget(mw,"login_frame")); + if (linphone_gtk_get_ui_config_int("login_needs_userid",FALSE)){ + gtk_widget_show(linphone_gtk_get_widget(mw,"userid")); + gtk_widget_show(linphone_gtk_get_widget(mw,"login_userid")); + } gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"options_menu"),FALSE); str=g_strdup_printf(_("Please enter login information for %s"),linphone_proxy_config_get_domain(cfg)); gtk_label_set_text(GTK_LABEL(label),str); @@ -131,6 +135,7 @@ void linphone_gtk_login_frame_connect_clicked(GtkWidget *button){ GtkWidget *mw=gtk_widget_get_toplevel(button); const char *username; const char *password; + const char *userid; char *identity; gboolean autologin; LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)g_object_get_data(G_OBJECT(mw),"login_proxy_config"); @@ -139,18 +144,20 @@ void linphone_gtk_login_frame_connect_clicked(GtkWidget *button){ username=gtk_entry_get_text(GTK_ENTRY(linphone_gtk_get_widget(mw,"login_username"))); password=gtk_entry_get_text(GTK_ENTRY(linphone_gtk_get_widget(mw,"login_password"))); - + userid=gtk_entry_get_text(GTK_ENTRY(linphone_gtk_get_widget(mw,"login_userid"))); + if (username==NULL || username[0]=='\0') return; autologin=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(mw,"automatic_login"))); linphone_gtk_set_ui_config_int("automatic_login",autologin); linphone_gtk_set_ui_config("login_username",username); + linphone_gtk_set_ui_config("login_userid",userid); from=linphone_address_new(linphone_proxy_config_get_identity(cfg)); linphone_address_set_username(from,username); identity=linphone_address_as_string(from); - do_login(ssctx,identity,password); + do_login(ssctx,identity,password,userid); /*we need to refresh the identities since the proxy config may have changed.*/ linphone_gtk_load_identities(); } diff --git a/gtk/main.ui b/gtk/main.ui index 190af22a1..8be5b3555 100644 --- a/gtk/main.ui +++ b/gtk/main.ui @@ -1634,7 +1634,7 @@ True False - 4 + 5 2 @@ -1660,8 +1660,8 @@ Internet connection: - 2 - 3 + 3 + 4 @@ -1713,8 +1713,8 @@ 1 2 - 2 - 3 + 3 + 4 @@ -1729,13 +1729,39 @@ 1 2 - 3 - 4 + 4 + 5 + + + False + UserID + + + 2 + 3 + + + + + True + + False + False + True + True + + + 1 + 2 + 2 + 3 + +