Commit 660bb518 authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

Apply patch to create custom SIP account from our own server

parent 90edabd1
...@@ -2,7 +2,7 @@ Source: sflphone ...@@ -2,7 +2,7 @@ Source: sflphone
Maintainer: SavoirFaireLinux Inc <yun.liu@savoirfairelinux.com> Maintainer: SavoirFaireLinux Inc <yun.liu@savoirfairelinux.com>
Section: gnome Section: gnome
Priority: optional Priority: optional
Build-Depends: debhelper (>= 5) Build-Depends: debhelper (>= 5), autoconf, automake, libpulse-dev, libsamplerate0-dev, libcommoncpp2-dev, libccrtp-dev, dbus-c++-1-dev, libcppunit-dev, libgsm1-dev, libspeex-dev, sflphone-iax2-dev, libtool, libgtk2.0-dev, libsexy-dev, libdbus-1-dev, libdbus-glib-1-dev, libnotify-dev
Standards-Version: 3.7.3 Standards-Version: 3.7.3
Package: sflphone Package: sflphone
......
...@@ -2,7 +2,7 @@ Source: sflphone ...@@ -2,7 +2,7 @@ Source: sflphone
Maintainer: SavoirFaireLinux Inc <yun.liu@savoirfairelinux.com> Maintainer: SavoirFaireLinux Inc <yun.liu@savoirfairelinux.com>
Section: gnome Section: gnome
Priority: optional Priority: optional
Build-Depends: debhelper (>= 5) Build-Depends: debhelper (>= 5), autoconf, automake, libpulse-dev, libsamplerate0-dev, libcommoncpp2-dev, libccrtp-dev, dbus-c++-1-dev, libcppunit-dev, libgsm1-dev, libspeex-dev, sflphone-iax2-dev, libtool, libgtk2.0-dev, libsexy-dev, libdbus-1-dev, libdbus-glib-1-dev, libnotify-dev
Standards-Version: 3.8.0 Standards-Version: 3.8.0
Package: sflphone Package: sflphone
......
...@@ -2,7 +2,7 @@ Source: sflphone ...@@ -2,7 +2,7 @@ Source: sflphone
Maintainer: SavoirFaireLinux Inc <yun.liu@savoirfairelinux.com> Maintainer: SavoirFaireLinux Inc <yun.liu@savoirfairelinux.com>
Section: gnome Section: gnome
Priority: optional Priority: optional
Build-Depends: debhelper (>= 5) Build-Depends: debhelper (>= 5), autoconf, automake, libpulse-dev, libsamplerate0-dev, libcommoncpp2-dev, libccrtp-dev, dbus-c++-1-dev, libcppunit-dev, libgsm1-dev, libspeex-dev, sflphone-iax2-dev, libtool, libgtk2.0-dev, libsexy-dev, libdbus-1-dev, libdbus-glib-1-dev, libnotify-dev
Standards-Version: 3.7.3 Standards-Version: 3.7.3
Package: sflphone Package: sflphone
......
...@@ -33,11 +33,12 @@ sflphone_gtk_SOURCES = \ ...@@ -33,11 +33,12 @@ sflphone_gtk_SOURCES = \
sliders.c \ sliders.c \
$(STATUSICON_SOURCE) \ $(STATUSICON_SOURCE) \
codeclist.c \ codeclist.c \
timestamp.c timestamp.c \
reqaccount.c
noinst_HEADERS = actions.h dbus.h sflnotify.h mainwindow.h calllist.h dialpad.h audioconf.h codeclist.h assistant.h\ noinst_HEADERS = actions.h dbus.h sflnotify.h mainwindow.h calllist.h dialpad.h audioconf.h codeclist.h assistant.h \
callmanager-glue.h errors.h sflphone_const.h configurationmanager-glue.h instance-glue.h menus.h calltab.h calltree.h configwindow.h \ callmanager-glue.h errors.h sflphone_const.h configurationmanager-glue.h instance-glue.h menus.h calltab.h calltree.h configwindow.h \
accountlist.h accountwindow.h marshaller.h sliders.h $(STATUSICON_HEADER) timestamp.h historyfilter.c accountlist.h accountwindow.h marshaller.h sliders.h $(STATUSICON_HEADER) timestamp.h historyfilter.c reqaccount.h
EXTRA_DIST = marshaller.list EXTRA_DIST = marshaller.list
sflphone_gtk_LDADD = $(DEPS_LIBS) $(NOTIFY_LIBS) $(SEXY_LIBS) sflphone_gtk_LDADD = $(DEPS_LIBS) $(NOTIFY_LIBS) $(SEXY_LIBS)
......
...@@ -18,13 +18,18 @@ ...@@ -18,13 +18,18 @@
*/ */
#include <assistant.h> #include <assistant.h>
#include "reqaccount.h"
#include <libsexy/sexy-icon-entry.h> #include <libsexy/sexy-icon-entry.h>
#if GTK_CHECK_VERSION(2,10,0) #if GTK_CHECK_VERSION(2,10,0)
#define SFLPHONE_ORG_SERVER "sip.sflphone.org"
#define SFLPHONE_ORG_ALIAS "sflphone.org"
struct _wizard *wiz; struct _wizard *wiz;
static int account_type; static int account_type;
static int use_sflphone_org = 1;
account_t* current; account_t* current;
/** /**
...@@ -48,6 +53,12 @@ set_account_type( GtkWidget* widget , gpointer data UNUSED ) ...@@ -48,6 +53,12 @@ set_account_type( GtkWidget* widget , gpointer data UNUSED )
} }
} }
void set_sflphone_org( GtkWidget* widget , gpointer data UNUSED ) {
use_sflphone_org = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) && 1;
}
/** /**
* Callback when the close button of the dialog is clicked * Callback when the close button of the dialog is clicked
* Action : close the assistant widget and get back to sflphone main window * Action : close the assistant widget and get back to sflphone main window
...@@ -140,6 +151,7 @@ if(!wiz){ ...@@ -140,6 +151,7 @@ if(!wiz){
gtk_assistant_set_forward_page_func( GTK_ASSISTANT( wiz->assistant ), (GtkAssistantPageFunc) forward_page_func , NULL , NULL ); gtk_assistant_set_forward_page_func( GTK_ASSISTANT( wiz->assistant ), (GtkAssistantPageFunc) forward_page_func , NULL , NULL );
build_intro(); build_intro();
build_sfl_or_account();
build_select_account(); build_select_account();
build_sip_account_configuration(); build_sip_account_configuration();
build_nat_settings(); build_nat_settings();
...@@ -153,7 +165,7 @@ if(!wiz){ ...@@ -153,7 +165,7 @@ if(!wiz){
gtk_widget_show_all(wiz->assistant); gtk_widget_show_all(wiz->assistant);
gtk_assistant_update_buttons_state(GTK_ASSISTANT(wiz->assistant)); gtk_assistant_update_buttons_state(GTK_ASSISTANT(wiz->assistant));
} }
} }
GtkWidget* GtkWidget*
...@@ -191,6 +203,23 @@ build_select_account() ...@@ -191,6 +203,23 @@ build_select_account()
} }
GtkWidget* build_sfl_or_account()
{
GtkWidget* sfl;
GtkWidget* cus;
wiz->sflphone_org = create_vbox( GTK_ASSISTANT_PAGE_CONTENT , _("Account") , _("Choose SFLphone an account or a custom one"));
sfl = gtk_radio_button_new_with_label(NULL, "sflphone.org account");
gtk_box_pack_start( GTK_BOX(wiz->sflphone_org) , sfl , TRUE, TRUE, 0);
cus = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(sfl), "Custom SIP or IAX2 account");
gtk_box_pack_start( GTK_BOX(wiz->sflphone_org) , cus , TRUE, TRUE, 0);
g_signal_connect(G_OBJECT( sfl ) , "clicked" , G_CALLBACK( set_sflphone_org ) , NULL );
return wiz->sflphone_org;
}
GtkWidget* GtkWidget*
build_sip_account_configuration( void ) build_sip_account_configuration( void )
{ {
...@@ -369,27 +398,73 @@ build_registration_error() ...@@ -369,27 +398,73 @@ build_registration_error()
} }
static gint void set_sip_infos_sentivite(gboolean b) {
forward_page_func( gint current_page , gpointer data UNUSED) gtk_widget_set_sensitive(GTK_WIDGET(wiz->sip_alias), b);
{ gtk_widget_set_sensitive(GTK_WIDGET(wiz->sip_server), b);
gtk_widget_set_sensitive(GTK_WIDGET(wiz->sip_username), b);
gtk_widget_set_sensitive(GTK_WIDGET(wiz->sip_password), b);
}
void prefill_sip(void) {
if (use_sflphone_org == 1) {
rest_account ra = get_rest_account(SFLPHONE_ORG_SERVER);
if (ra.success) {
set_sip_infos_sentivite(FALSE);
gtk_entry_set_text (GTK_ENTRY(wiz->sip_alias), SFLPHONE_ORG_ALIAS);
gtk_entry_set_text (GTK_ENTRY(wiz->sip_server), SFLPHONE_ORG_SERVER);
gtk_entry_set_text (GTK_ENTRY(wiz->sip_username), ra.user);
gtk_entry_set_text (GTK_ENTRY(wiz->sip_password), ra.passwd);
}
}
}
#define PAGE_INTRO 0
#define PAGE_SFL 1
#define PAGE_TYPE 2
#define PAGE_SIP 3
#define PAGE_STUN 4
#define PAGE_IAX 5
#define PAGE_REG_ERR 6
#define PAGE_SUMMARY 8
static gint
forward_page_func( gint current_page , gpointer data UNUSED) {
switch( current_page ){ switch( current_page ){
case 0: case PAGE_INTRO:
return 1; return PAGE_SFL;
case 1:
if( account_type == _SIP ) case PAGE_SFL:
return 2; if (use_sflphone_org) {
return 4; prefill_sip();
case 2: account_type = _SIP;
return 3; return PAGE_SIP;
case 3: }
return 6; return PAGE_TYPE;
case 4:
return 6; case PAGE_TYPE:
default: if( account_type == _SIP ) {
return -1; set_sip_infos_sentivite(TRUE);
return PAGE_SIP;
}
return PAGE_IAX;
case PAGE_SIP:
return PAGE_STUN;
case PAGE_STUN:
return PAGE_SUMMARY;
case PAGE_IAX:
return PAGE_SUMMARY;
default:
return -1;
} }
} }
static GtkWidget* static GtkWidget*
create_vbox(GtkAssistantPageType type, const gchar *title, const gchar *section) create_vbox(GtkAssistantPageType type, const gchar *title, const gchar *section)
{ {
......
...@@ -180,10 +180,11 @@ error_alert(DBusGProxy *proxy UNUSED, ...@@ -180,10 +180,11 @@ error_alert(DBusGProxy *proxy UNUSED,
static void nameOwnerChanged(DBusGProxy *proxy, char *name, char *old_owner, char *new_owner, gpointer data ) static void nameOwnerChanged(DBusGProxy *proxy, char *name, char *old_owner, char *new_owner, gpointer data )
{ {
#if 0
g_print("******************************************************************\n"); g_print("******************************************************************\n");
g_print("Owner name of the service %s changed from %s to %s\n", name, old_owner, new_owner); g_print("Owner name of the service %s changed from %s to %s\n", name, old_owner, new_owner);
g_print("******************************************************************\n"); g_print("******************************************************************\n");
#endif
if (strcmp(name, "org.sflphone.SFLphone")!=0) return; if (strcmp(name, "org.sflphone.SFLphone")!=0) return;
......
Supports Markdown
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