Commit 75648946 authored by smorlat's avatar smorlat

Work on assistant.



git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@488 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent 1301aa2f
...@@ -2331,7 +2331,7 @@ void linphone_core_set_waiting_callback(LinphoneCore *lc, LinphoneWaitingCallbac ...@@ -2331,7 +2331,7 @@ void linphone_core_set_waiting_callback(LinphoneCore *lc, LinphoneWaitingCallbac
void linphone_core_start_waiting(LinphoneCore *lc, const char *purpose){ void linphone_core_start_waiting(LinphoneCore *lc, const char *purpose){
if (lc->wait_cb){ if (lc->wait_cb){
lc->wait_ctx=lc->wait_cb(lc,NULL,LinphoneWaitingStart,purpose,0); lc->wait_ctx=lc->wait_cb(lc,lc->wait_ctx,LinphoneWaitingStart,purpose,0);
} }
} }
......
...@@ -340,6 +340,8 @@ LinphoneAccountCreator *linphone_account_creator_new(struct _LinphoneCore *core, ...@@ -340,6 +340,8 @@ LinphoneAccountCreator *linphone_account_creator_new(struct _LinphoneCore *core,
void linphone_account_creator_set_username(LinphoneAccountCreator *obj, const char *username); void linphone_account_creator_set_username(LinphoneAccountCreator *obj, const char *username);
void linphone_account_creator_set_password(LinphoneAccountCreator *obj, const char *password); void linphone_account_creator_set_password(LinphoneAccountCreator *obj, const char *password);
void linphone_account_creator_set_domain(LinphoneAccountCreator *obj, const char *domain); void linphone_account_creator_set_domain(LinphoneAccountCreator *obj, const char *domain);
const char * linphone_account_creator_get_username(LinphoneAccountCreator *obj);
const char * linphone_account_creator_get_domain(LinphoneAccountCreator *obj);
int linphone_account_creator_test_existence(LinphoneAccountCreator *obj); int linphone_account_creator_test_existence(LinphoneAccountCreator *obj);
LinphoneProxyConfig * linphone_account_creator_validate(LinphoneAccountCreator *obj); LinphoneProxyConfig * linphone_account_creator_validate(LinphoneAccountCreator *obj);
void linphone_account_creator_destroy(LinphoneAccountCreator *obj); void linphone_account_creator_destroy(LinphoneAccountCreator *obj);
......
...@@ -235,8 +235,10 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *obj){ ...@@ -235,8 +235,10 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *obj){
if (obj->reg_sendregister){ if (obj->reg_sendregister){
char *ct=NULL; char *ct=NULL;
osip_message_t *msg=NULL; osip_message_t *msg=NULL;
eXosip_lock();
obj->rid=eXosip_register_build_initial_register(id_str,obj->reg_proxy,NULL,obj->expires,&msg); obj->rid=eXosip_register_build_initial_register(id_str,obj->reg_proxy,NULL,obj->expires,&msg);
eXosip_register_send_register(obj->rid,msg); eXosip_register_send_register(obj->rid,msg);
eXosip_unlock();
if (ct!=NULL) osip_free(ct); if (ct!=NULL) osip_free(ct);
} }
} }
...@@ -504,7 +506,7 @@ void linphone_proxy_config_process_authentication_failure(LinphoneCore *lc, eXos ...@@ -504,7 +506,7 @@ void linphone_proxy_config_process_authentication_failure(LinphoneCore *lc, eXos
LinphoneProxyConfig *cfg=linphone_core_get_proxy_config_from_rid(lc, ev->rid); LinphoneProxyConfig *cfg=linphone_core_get_proxy_config_from_rid(lc, ev->rid);
if (cfg){ if (cfg){
cfg->auth_failures++; cfg->auth_failures++;
/*restart a new register */ /*restart a new register so that the user gets a chance to be prompted for a password*/
if (cfg->auth_failures==1){ if (cfg->auth_failures==1){
linphone_proxy_config_register(cfg); linphone_proxy_config_register(cfg);
} }
...@@ -667,6 +669,14 @@ void linphone_account_creator_set_domain(LinphoneAccountCreator *obj, const char ...@@ -667,6 +669,14 @@ void linphone_account_creator_set_domain(LinphoneAccountCreator *obj, const char
set_string(&obj->domain,domain); set_string(&obj->domain,domain);
} }
const char * linphone_account_creator_get_username(LinphoneAccountCreator *obj){
return obj->username;
}
const char * linphone_account_creator_get_domain(LinphoneAccountCreator *obj){
return obj->domain;
}
int linphone_account_creator_test_existence(LinphoneAccountCreator *obj){ int linphone_account_creator_test_existence(LinphoneAccountCreator *obj){
SipSetupContext *ssctx=obj->ssctx; SipSetupContext *ssctx=obj->ssctx;
char *uri=ms_strdup_printf("%s@%s",obj->username,obj->domain); char *uri=ms_strdup_printf("%s@%s",obj->username,obj->domain);
......
...@@ -85,10 +85,10 @@ static void *progress_bar_update(LinphoneCore *lc, void *ctx, LinphoneWaitingSta ...@@ -85,10 +85,10 @@ static void *progress_bar_update(LinphoneCore *lc, void *ctx, LinphoneWaitingSta
} }
static void check_username(GtkWidget *page){ static void check_username(GtkWidget *page){
GtkWidget *progress=g_object_get_data(G_OBJECT(page),"progress"); GtkWidget *progress=(GtkWidget*)g_object_get_data(G_OBJECT(page),"progress");
GtkWidget *label=g_object_get_data(G_OBJECT(page),"label"); GtkWidget *label=(GtkWidget*)g_object_get_data(G_OBJECT(page),"label");
const char *username=g_object_get_data(G_OBJECT(page),"username"); LinphoneAccountCreator *creator=linphone_gtk_assistant_get_creator(gtk_widget_get_toplevel(page));
gchar *text=g_strdup_printf(_("Checking if '%s' is available..."),username); gchar *text=g_strdup_printf(_("Checking if '%s' is available..."),linphone_account_creator_get_username(creator));
LinphoneAccountCreator *c=linphone_gtk_assistant_get_creator(gtk_widget_get_toplevel(page)); LinphoneAccountCreator *c=linphone_gtk_assistant_get_creator(gtk_widget_get_toplevel(page));
int res; int res;
gtk_label_set_text(GTK_LABEL(label),text); gtk_label_set_text(GTK_LABEL(label),text);
...@@ -107,6 +107,27 @@ static void check_username(GtkWidget *page){ ...@@ -107,6 +107,27 @@ static void check_username(GtkWidget *page){
linphone_core_set_waiting_callback(linphone_gtk_get_core(),linphone_gtk_wait,NULL); linphone_core_set_waiting_callback(linphone_gtk_get_core(),linphone_gtk_wait,NULL);
} }
static GtkWidget *create_confirmation_page(){
GtkWidget *vbox=gtk_vbox_new(FALSE,2);
GtkWidget *label=gtk_label_new(NULL);
gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 2);
g_object_set_data(G_OBJECT(vbox),"label",label);
gtk_widget_show_all(vbox);
return vbox;
}
static GtkWidget *create_creation_page(){
GtkWidget *vbox=gtk_vbox_new(FALSE,2);
GtkWidget *label=gtk_label_new(NULL);
GtkWidget *progress=gtk_progress_bar_new();
gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 2);
gtk_box_pack_start (GTK_BOX (vbox), progress, TRUE, TRUE, 2);
g_object_set_data(G_OBJECT(vbox),"label",label);
g_object_set_data(G_OBJECT(vbox),"progress",progress);
gtk_widget_show_all(vbox);
return vbox;
}
static GtkWidget *create_finish_page(){ static GtkWidget *create_finish_page(){
GtkWidget *vbox=gtk_vbox_new(FALSE,2); GtkWidget *vbox=gtk_vbox_new(FALSE,2);
GtkWidget *label=gtk_label_new(_("Thank you. Your account is now configured and ready for use.")); GtkWidget *label=gtk_label_new(_("Thank you. Your account is now configured and ready for use."));
...@@ -135,13 +156,40 @@ static int linphone_gtk_assistant_forward(int curpage, gpointer data){ ...@@ -135,13 +156,40 @@ static int linphone_gtk_assistant_forward(int curpage, gpointer data){
} }
static void linphone_gtk_assistant_apply(GtkWidget *w){ static void linphone_gtk_assistant_apply(GtkWidget *w){
g_message("in apply()"); LinphoneAccountCreator *creator=linphone_gtk_assistant_get_creator(w);
GtkWidget *page=gtk_assistant_get_nth_page(GTK_ASSISTANT(w),gtk_assistant_get_current_page(GTK_ASSISTANT(w)));
GtkWidget *progress=(GtkWidget*)g_object_get_data(G_OBJECT(page),"progress");
LinphoneProxyConfig *res;
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress),_("Please wait..."));
linphone_core_set_waiting_callback(linphone_gtk_get_core(),progress_bar_update,progress);
res=linphone_account_creator_validate(creator);
if (res){
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress),_("Ok !"));
gtk_assistant_set_page_complete(GTK_ASSISTANT(w),page,TRUE);
}else{
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress),_("Communication problem, please try again later."));
}
linphone_core_set_waiting_callback(linphone_gtk_get_core(),linphone_gtk_wait,NULL);
if (res) linphone_core_add_proxy_config(linphone_gtk_get_core(),res);
gtk_assistant_set_page_complete(GTK_ASSISTANT(w),page,TRUE);
} }
static void linphone_gtk_assistant_prepare(GtkWidget *assistant, GtkWidget *page){ static void linphone_gtk_assistant_prepare(GtkWidget *assistant, GtkWidget *page){
int pagenum=gtk_assistant_get_current_page(GTK_ASSISTANT(assistant)); int pagenum=gtk_assistant_get_current_page(GTK_ASSISTANT(assistant));
if (pagenum==3){ if (pagenum==3){
check_username(page); check_username(page);
}else if (pagenum==4){
GtkWidget *label=(GtkWidget*)g_object_get_data(G_OBJECT(page),"label");
LinphoneAccountCreator *creator=linphone_gtk_assistant_get_creator(assistant);
gchar *text=g_strdup_printf("You have choosen '%s' as username.\nDo you confirm the creation of the account ?",linphone_account_creator_get_username(creator));
gtk_label_set_text(GTK_LABEL(label),text);
g_free(text);
}else if (pagenum==5){
GtkWidget *label=(GtkWidget*)g_object_get_data(G_OBJECT(page),"label");
LinphoneAccountCreator *creator=linphone_gtk_assistant_get_creator(assistant);
gchar *text=g_strdup_printf("Account creation in progress for '%s'",linphone_account_creator_get_username(creator));
gtk_label_set_text(GTK_LABEL(label),text);
g_free(text);
} }
} }
...@@ -169,6 +217,8 @@ GtkWidget * linphone_gtk_create_assistant(void){ ...@@ -169,6 +217,8 @@ GtkWidget * linphone_gtk_create_assistant(void){
GtkWidget *p2=create_setup_signin_choice(); GtkWidget *p2=create_setup_signin_choice();
GtkWidget *p3=create_username_chooser(); GtkWidget *p3=create_username_chooser();
GtkWidget *checking=create_username_checking_page(); GtkWidget *checking=create_username_checking_page();
GtkWidget *confirm=create_confirmation_page();
GtkWidget *creation=create_creation_page();
GtkWidget *end=create_finish_page(); GtkWidget *end=create_finish_page();
linphone_gtk_assistant_init(w); linphone_gtk_assistant_init(w);
...@@ -182,12 +232,21 @@ GtkWidget * linphone_gtk_create_assistant(void){ ...@@ -182,12 +232,21 @@ GtkWidget * linphone_gtk_create_assistant(void){
gtk_assistant_set_page_complete(GTK_ASSISTANT(w),p2,TRUE); gtk_assistant_set_page_complete(GTK_ASSISTANT(w),p2,TRUE);
gtk_assistant_append_page(GTK_ASSISTANT(w),p3); gtk_assistant_append_page(GTK_ASSISTANT(w),p3);
gtk_assistant_set_page_type(GTK_ASSISTANT(w),p3,GTK_ASSISTANT_PAGE_CONTENT); gtk_assistant_set_page_type(GTK_ASSISTANT(w),p3,GTK_ASSISTANT_PAGE_CONTENT);
gtk_assistant_set_page_title(GTK_ASSISTANT(w),p3,_("Account setup assistant - enter your information")); gtk_assistant_set_page_title(GTK_ASSISTANT(w),p3,_("Choosing a username"));
gtk_assistant_append_page(GTK_ASSISTANT(w),checking); gtk_assistant_append_page(GTK_ASSISTANT(w),checking);
gtk_assistant_set_page_type(GTK_ASSISTANT(w),checking,GTK_ASSISTANT_PAGE_PROGRESS); gtk_assistant_set_page_type(GTK_ASSISTANT(w),checking,GTK_ASSISTANT_PAGE_PROGRESS);
gtk_assistant_set_page_title(GTK_ASSISTANT(w),checking,_("Account setup assistant - verifying")); gtk_assistant_set_page_title(GTK_ASSISTANT(w),checking,_("Verifying"));
gtk_assistant_append_page(GTK_ASSISTANT(w),confirm);
gtk_assistant_set_page_type(GTK_ASSISTANT(w),confirm,GTK_ASSISTANT_PAGE_CONFIRM);
gtk_assistant_set_page_title(GTK_ASSISTANT(w),confirm,_("Confirmation"));
gtk_assistant_set_page_complete(GTK_ASSISTANT(w),confirm,TRUE);
gtk_assistant_append_page(GTK_ASSISTANT(w),creation);
gtk_assistant_set_page_type(GTK_ASSISTANT(w),creation,GTK_ASSISTANT_PAGE_PROGRESS);
gtk_assistant_set_page_title(GTK_ASSISTANT(w),creation,_("Creating your account"));
gtk_assistant_append_page(GTK_ASSISTANT(w),end); gtk_assistant_append_page(GTK_ASSISTANT(w),end);
gtk_assistant_set_page_type(GTK_ASSISTANT(w),end,GTK_ASSISTANT_PAGE_SUMMARY); gtk_assistant_set_page_type(GTK_ASSISTANT(w),end,GTK_ASSISTANT_PAGE_SUMMARY);
gtk_assistant_set_page_title(GTK_ASSISTANT(w),end,_("Now ready !")); gtk_assistant_set_page_title(GTK_ASSISTANT(w),end,_("Now ready !"));
......
...@@ -39,8 +39,8 @@ if test $GCC = yes && test $wall_werror = yes; then ...@@ -39,8 +39,8 @@ if test $GCC = yes && test $wall_werror = yes; then
fi fi
AC_ARG_WITH(java, AC_ARG_WITH(java,
[ --with-java Sets directory of java home, [default=/usr/lib/jvm/java-1.5.0-sun] ], [ --with-java Sets directory of java home, [default=/usr/lib/jvm/java-6-sun] ],
[ javadir=${withval}],[javadir=/usr/lib/jvm/java-1.5.0-sun/]) [ javadir=${withval}],[javadir=/usr/lib/jvm/java-6-sun/])
AC_SUBST(javadir) AC_SUBST(javadir)
......
JAVA_LIBS=-L$(javadir)/jre/lib/amd64 -L$(javadir)/jre/lib/i386 \ JAVA_LIBS=-L$(javadir)/jre/lib/amd64 -L$(javadir)/jre/lib/i386 \
-L$(javadir)/jre/lib/amd64/server -L$(javadir)/jre/lib/i386/server -ljvm -L$(javadir)/jre/lib/amd64/server -L$(javadir)/jre/lib/i386/server -ljava
JAVA_LDFLAGS=\ JAVA_LDFLAGS=\
-Wl,-rpath,$(javadir)/jre/lib/amd64 -Wl,-rpath,$(javadir)/jre/lib/i386 \ -Wl,-rpath,$(javadir)/jre/lib/amd64 -Wl,-rpath,$(javadir)/jre/lib/i386 \
......
...@@ -67,10 +67,26 @@ static bool_t fonis_check_connected(SipSetupContext *ctx){ ...@@ -67,10 +67,26 @@ static bool_t fonis_check_connected(SipSetupContext *ctx){
return FALSE; return FALSE;
} }
static int fonis_test_account(SipSetupContext *ctx, const char *uri){
int ret;
LinphoneCore *lc=linphone_proxy_config_get_core(sip_setup_context_get_proxy_config(ctx));
if (!fonis_check_connected(ctx)) return -1;
linphone_core_start_waiting(lc,"Checking...");
ret=(p2pproxy_accountmgt_isValidAccount(uri)==P2PPROXY_ACCOUNTMGT_USER_EXIST) ? 1 : 0;
linphone_core_update_progress(lc,NULL,1);
linphone_core_stop_waiting(lc);
return ret;
}
static int fonis_create_account(SipSetupContext *ctx, const char *uri, const char *passwd){ static int fonis_create_account(SipSetupContext *ctx, const char *uri, const char *passwd){
int err; int err;
LinphoneCore *lc=linphone_proxy_config_get_core(sip_setup_context_get_proxy_config(ctx));
if (!fonis_check_connected(ctx)) return -1; if (!fonis_check_connected(ctx)) return -1;
linphone_core_start_waiting(lc,"Creating account...");
err=p2pproxy_accountmgt_createAccount(uri); err=p2pproxy_accountmgt_createAccount(uri);
ms_message("Account creation result for %s: %i",uri,err);
linphone_core_update_progress(lc,NULL,1);
linphone_core_stop_waiting(lc);
if (err<0) return -1; if (err<0) return -1;
return 0; return 0;
} }
...@@ -128,6 +144,7 @@ static SipSetup fonis_sip_setup={ ...@@ -128,6 +144,7 @@ static SipSetup fonis_sip_setup={
SIP_SETUP_CAP_RELAY_PROVIDER|SIP_SETUP_CAP_ACCOUNT_MANAGER, SIP_SETUP_CAP_RELAY_PROVIDER|SIP_SETUP_CAP_ACCOUNT_MANAGER,
.name="fonis", .name="fonis",
.init=fonis_init, .init=fonis_init,
.account_exists=fonis_test_account,
.create_account=fonis_create_account, .create_account=fonis_create_account,
.login_account=fonis_login_account, .login_account=fonis_login_account,
.get_proxy=fonis_get_proxy, .get_proxy=fonis_get_proxy,
......
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