mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-20 04:28:10 +00:00
Work on assistant.
git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@488 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
This commit is contained in:
parent
1301aa2f7e
commit
75648946a4
7 changed files with 100 additions and 12 deletions
|
|
@ -2331,7 +2331,7 @@ void linphone_core_set_waiting_callback(LinphoneCore *lc, LinphoneWaitingCallbac
|
|||
|
||||
void linphone_core_start_waiting(LinphoneCore *lc, const char *purpose){
|
||||
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,
|
|||
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_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);
|
||||
LinphoneProxyConfig * linphone_account_creator_validate(LinphoneAccountCreator *obj);
|
||||
void linphone_account_creator_destroy(LinphoneAccountCreator *obj);
|
||||
|
|
|
|||
|
|
@ -235,8 +235,10 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *obj){
|
|||
if (obj->reg_sendregister){
|
||||
char *ct=NULL;
|
||||
osip_message_t *msg=NULL;
|
||||
eXosip_lock();
|
||||
obj->rid=eXosip_register_build_initial_register(id_str,obj->reg_proxy,NULL,obj->expires,&msg);
|
||||
eXosip_register_send_register(obj->rid,msg);
|
||||
eXosip_unlock();
|
||||
if (ct!=NULL) osip_free(ct);
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
if (cfg){
|
||||
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){
|
||||
linphone_proxy_config_register(cfg);
|
||||
}
|
||||
|
|
@ -667,6 +669,14 @@ void linphone_account_creator_set_domain(LinphoneAccountCreator *obj, const char
|
|||
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){
|
||||
SipSetupContext *ssctx=obj->ssctx;
|
||||
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
|
|||
}
|
||||
|
||||
static void check_username(GtkWidget *page){
|
||||
GtkWidget *progress=g_object_get_data(G_OBJECT(page),"progress");
|
||||
GtkWidget *label=g_object_get_data(G_OBJECT(page),"label");
|
||||
const char *username=g_object_get_data(G_OBJECT(page),"username");
|
||||
gchar *text=g_strdup_printf(_("Checking if '%s' is available..."),username);
|
||||
GtkWidget *progress=(GtkWidget*)g_object_get_data(G_OBJECT(page),"progress");
|
||||
GtkWidget *label=(GtkWidget*)g_object_get_data(G_OBJECT(page),"label");
|
||||
LinphoneAccountCreator *creator=linphone_gtk_assistant_get_creator(gtk_widget_get_toplevel(page));
|
||||
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));
|
||||
int res;
|
||||
gtk_label_set_text(GTK_LABEL(label),text);
|
||||
|
|
@ -107,6 +107,27 @@ static void check_username(GtkWidget *page){
|
|||
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(){
|
||||
GtkWidget *vbox=gtk_vbox_new(FALSE,2);
|
||||
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){
|
|||
}
|
||||
|
||||
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){
|
||||
int pagenum=gtk_assistant_get_current_page(GTK_ASSISTANT(assistant));
|
||||
if (pagenum==3){
|
||||
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){
|
|||
GtkWidget *p2=create_setup_signin_choice();
|
||||
GtkWidget *p3=create_username_chooser();
|
||||
GtkWidget *checking=create_username_checking_page();
|
||||
GtkWidget *confirm=create_confirmation_page();
|
||||
GtkWidget *creation=create_creation_page();
|
||||
GtkWidget *end=create_finish_page();
|
||||
|
||||
linphone_gtk_assistant_init(w);
|
||||
|
|
@ -182,12 +232,21 @@ GtkWidget * linphone_gtk_create_assistant(void){
|
|||
gtk_assistant_set_page_complete(GTK_ASSISTANT(w),p2,TRUE);
|
||||
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_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_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_set_page_type(GTK_ASSISTANT(w),end,GTK_ASSISTANT_PAGE_SUMMARY);
|
||||
gtk_assistant_set_page_title(GTK_ASSISTANT(w),end,_("Now ready !"));
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ if test $GCC = yes && test $wall_werror = yes; then
|
|||
fi
|
||||
|
||||
AC_ARG_WITH(java,
|
||||
[ --with-java Sets directory of java home, [default=/usr/lib/jvm/java-1.5.0-sun] ],
|
||||
[ javadir=${withval}],[javadir=/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-6-sun/])
|
||||
|
||||
AC_SUBST(javadir)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
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=\
|
||||
-Wl,-rpath,$(javadir)/jre/lib/amd64 -Wl,-rpath,$(javadir)/jre/lib/i386 \
|
||||
|
|
|
|||
|
|
@ -67,10 +67,26 @@ static bool_t fonis_check_connected(SipSetupContext *ctx){
|
|||
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){
|
||||
int err;
|
||||
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,"Creating account...");
|
||||
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;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -128,6 +144,7 @@ static SipSetup fonis_sip_setup={
|
|||
SIP_SETUP_CAP_RELAY_PROVIDER|SIP_SETUP_CAP_ACCOUNT_MANAGER,
|
||||
.name="fonis",
|
||||
.init=fonis_init,
|
||||
.account_exists=fonis_test_account,
|
||||
.create_account=fonis_create_account,
|
||||
.login_account=fonis_login_account,
|
||||
.get_proxy=fonis_get_proxy,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue