Commit c639d650 authored by Simon Morlat's avatar Simon Morlat

add user ID to login screen, fix bugs

parent c88c845e
......@@ -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);
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -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;
......
......@@ -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();
}
......@@ -1634,7 +1634,7 @@
<object class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_rows">4</property>
<property name="n_rows">5</property>
<property name="n_columns">2</property>
<child>
<object class="GtkLabel" id="label8">
......@@ -1660,8 +1660,8 @@
<property name="label" translatable="yes">Internet connection:</property>
</object>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
......@@ -1713,8 +1713,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
......@@ -1729,13 +1729,39 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkLabel" id="userid">
<property name="can_focus">False</property>
<property name="label" translatable="yes">UserID</property>
</object>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="login_userid">
<property name="can_focus">True</property>
<property name="invisible_char"></property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
</object>
</child>
</object>
......
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