diff --git a/sflphone-client-gnome/src/actions.c b/sflphone-client-gnome/src/actions.c index 37c5ac1c81787708aef68ab4d85f555e2ffe18df..6d08042b7e1c02b5998988db1b180ad0c6530167 100644 --- a/sflphone-client-gnome/src/actions.c +++ b/sflphone-client-gnome/src/actions.c @@ -33,6 +33,7 @@ #include <unistd.h> guint voice_mails; +GHashTable * ip2ip_profile=NULL; void sflphone_notify_voice_mail ( const gchar* accountID , guint count ) @@ -274,6 +275,9 @@ gboolean sflphone_init() // Fetch the configured accounts sflphone_fill_account_list(FALSE); + // Fetch the ip2ip profile + sflphone_fill_ip2ip_profile(); + // Fetch the audio codecs sflphone_fill_codec_list(); @@ -281,6 +285,16 @@ gboolean sflphone_init() } } +void sflphone_fill_ip2ip_profile(void) +{ + ip2ip_profile = (GHashTable *) dbus_get_ip2_ip_details(); +} + +GHashTable * sflphone_get_ip2ip_properties(void) +{ + return ip2ip_profile; +} + void sflphone_hang_up() { diff --git a/sflphone-client-gnome/src/actions.h b/sflphone-client-gnome/src/actions.h index 4c1951d5412a63f7763948dd35ec4a8f04a84b3b..27bf866e19c1bd5a12a304fd865ee8c6e4713651 100644 --- a/sflphone-client-gnome/src/actions.h +++ b/sflphone-client-gnome/src/actions.h @@ -148,6 +148,18 @@ void sflphone_keypad ( guint keyval, gchar * key); */ void sflphone_place_call ( callable_obj_t * c ); +/** + * Fetch the ip2ip profile through dbus and fill + * the internal hash table. + */ +void sflphone_fill_ip2ip_profile(void); + +/** + * @return The internal hash table representing + * the settings for the ip2ip profile. + */ +GHashTable * sflphone_get_ip2ip_properties(void); + /** * Initialize the accounts data structure */ diff --git a/sflphone-client-gnome/src/config/Makefile.am b/sflphone-client-gnome/src/config/Makefile.am index d2a0801af9154651004b25c1b3cdfec0f21e0921..575d2f806ac8ae4a3c576a828a1ba6d75876fbe9 100644 --- a/sflphone-client-gnome/src/config/Makefile.am +++ b/sflphone-client-gnome/src/config/Makefile.am @@ -5,10 +5,12 @@ noinst_LTLIBRARIES = libconfig.la libconfig_la_SOURCES = \ addressbook-config.c \ configwindow.c \ + zrtpadvanceddialog.c \ + ip2ipdialog.c \ accountwindow.c \ hooks-config.c \ audioconf.c \ - utils.c + utils.c libconfig_la_LDFLAGS = @DEPS_LDFLAGS@ diff --git a/sflphone-client-gnome/src/config/accountwindow.c b/sflphone-client-gnome/src/config/accountwindow.c index 4fb204c524f86fa6d4087984b8e23a7e6c84aae2..ffd9c63df8dc3b18d297f3328264564c5abf2879 100644 --- a/sflphone-client-gnome/src/config/accountwindow.c +++ b/sflphone-client-gnome/src/config/accountwindow.c @@ -23,6 +23,7 @@ #include <mainwindow.h> #include <accountlist.h> #include <accountwindow.h> +#include <zrtpadvanceddialog.h> // From version 2.16, gtk provides the functionalities libsexy used to provide #if GTK_CHECK_VERSION(2,16,0) @@ -35,6 +36,7 @@ #include <config.h> #include <gtk/gtk.h> + /** Local variables */ GtkDialog * dialog; GtkWidget * hbox; @@ -53,7 +55,9 @@ GtkListStore * credentialStore; GtkWidget * deleteCredButton; GtkWidget * treeViewCredential; GtkWidget * scrolledWindowCredential; - +GtkWidget * advancedZrtpButton; +GtkWidget * keyExchangeCombo; + // Credentials enum { COLUMN_CREDENTIAL_REALM, @@ -261,10 +265,16 @@ static void fill_treeview_with_credential(GtkListStore * credentialStore, accoun gtk_list_store_append (credentialStore, &iter); /* This is the default, undeletable credential */ - if(g_strcmp0(g_hash_table_lookup(account->properties, ACCOUNT_AUTHENTICATION_USERNAME), "") == 0) { + gchar * authentication_name = g_hash_table_lookup(account->properties, ACCOUNT_AUTHENTICATION_USERNAME); + gchar * realm = g_hash_table_lookup(account->properties, ACCOUNT_REALM); + if (realm == NULL || (g_strcmp0(realm, "") == 0)) { + realm = g_strdup("*"); + } + + if((authentication_name == NULL) || (g_strcmp0(authentication_name, "") == 0)) { DEBUG("DEFAULT"); gtk_list_store_set(credentialStore, &iter, - COLUMN_CREDENTIAL_REALM, g_hash_table_lookup(account->properties, ACCOUNT_REALM), + COLUMN_CREDENTIAL_REALM, realm, COLUMN_CREDENTIAL_USERNAME, gtk_entry_get_text(GTK_ENTRY(entryUsername)), COLUMN_CREDENTIAL_PASSWORD, gtk_entry_get_text(GTK_ENTRY(entryPassword)), COLUMN_CREDENTIAL_DATA, account, @@ -383,10 +393,29 @@ static void editing_started_cb (GtkCellRenderer *cell, GtkCellEditable * editabl gtk_entry_set_visibility(GTK_ENTRY(editable), FALSE); } +static void show_advanced_zrtp_options_cb(GtkWidget *widget UNUSED, gpointer data) +{ + DEBUG("Advanced options for ZRTP"); + show_advanced_zrtp_options((GHashTable *) data); +} + +static void key_exchange_changed_cb(GtkWidget *widget, gpointer data) +{ + DEBUG("Key exchange changed"); + if (g_strcasecmp(gtk_combo_box_get_active_text(GTK_COMBO_BOX(keyExchangeCombo)), (gchar *) "ZRTP") == 0) { + gtk_widget_set_sensitive(GTK_WIDGET(advancedZrtpButton), TRUE); + } else { + gtk_widget_set_sensitive(GTK_WIDGET(advancedZrtpButton), FALSE); + + } +} + + GtkWidget * create_advanced_tab(account_t **a) { GtkWidget * frame; GtkWidget * table; + GtkWidget * label; GtkWidget * ret; GtkWidget * hbox; GtkWidget * editButton; @@ -402,34 +431,50 @@ GtkWidget * create_advanced_tab(account_t **a) gtk_container_set_border_width(GTK_CONTAINER(ret), 10); account_t * currentAccount; - - // Default settings - gchar * curAccountResolveOnce = "FALSE"; - gchar * curAccountExpire = "600"; - currentAccount = *a; - + + gchar * curSRTPEnabled = NULL; + gchar * curKeyExchange = NULL; + gchar * curAccountResolveOnce = NULL; + gchar * curAccountExpire = NULL; + // Load from SIP/IAX/Unknown ? if(currentAccount) { curAccountResolveOnce = g_hash_table_lookup(currentAccount->properties, ACCOUNT_RESOLVE_ONCE); + if (curAccountResolveOnce == NULL) { + curAccountResolveOnce = "FALSE"; + } curAccountExpire = g_hash_table_lookup(currentAccount->properties, ACCOUNT_REGISTRATION_EXPIRE); + if (curAccountExpire == NULL) { + curAccountExpire = "600"; + } + + curKeyExchange = g_hash_table_lookup(currentAccount->properties, ACCOUNT_KEY_EXCHANGE); + if (curKeyExchange == NULL) { + curKeyExchange = "none"; + } + + curSRTPEnabled = g_hash_table_lookup(currentAccount->properties, ACCOUNT_SRTP_ENABLED); + if (curSRTPEnabled == NULL) { + curSRTPEnabled == "FALSE"; + } } gnome_main_section_new_with_table (_("Registration Options"), &frame, &table, 2, 3); gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0); label = gtk_label_new_with_mnemonic (_("Registration _expire")); - gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 0, 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0); + gtk_table_attach_defaults( GTK_TABLE( table ), label, 0, 1, 0, 1); gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); entryExpire = gtk_entry_new(); gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryExpire); gtk_entry_set_text(GTK_ENTRY(entryExpire), curAccountExpire); - gtk_table_attach ( GTK_TABLE( table ), entryExpire, 1, 2, 0, 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0); + gtk_table_attach_defaults( GTK_TABLE( table ), entryExpire, 1, 2, 0, 1); entryResolveNameOnlyOnce = gtk_check_button_new_with_mnemonic(_("_Conform to RFC 3263")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(entryResolveNameOnlyOnce), g_strcasecmp(curAccountResolveOnce,"FALSE") == 0 ? TRUE: FALSE); - gtk_table_attach ( GTK_TABLE( table ), entryResolveNameOnlyOnce, 0, 2, 1, 2, GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0); + gtk_table_attach_defaults( GTK_TABLE( table ), entryResolveNameOnlyOnce, 0, 2, 1, 2); gtk_widget_set_sensitive( GTK_WIDGET( entryResolveNameOnlyOnce ) , TRUE ); gtk_widget_show_all( table ); @@ -440,13 +485,13 @@ GtkWidget * create_advanced_tab(account_t **a) /* Credentials tree view */ gnome_main_section_new_with_table (_("Credential informations"), &frame, &table, 1, 1); gtk_container_set_border_width (GTK_CONTAINER(table), 10); - gtk_table_set_row_spacings (GTK_TABLE(table), 10); + gtk_table_set_row_spacings(GTK_TABLE(table), 10); gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0); scrolledWindowCredential = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledWindowCredential), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledWindowCredential), GTK_SHADOW_IN); - gtk_table_attach (GTK_TABLE(table), scrolledWindowCredential, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_table_attach_defaults (GTK_TABLE(table), scrolledWindowCredential, 0, 1, 0, 1); credentialStore = gtk_list_store_new(COLUMN_CREDENTIAL_COUNT, G_TYPE_STRING, // Realm @@ -500,7 +545,7 @@ GtkWidget * create_advanced_tab(account_t **a) /* Credential Buttons */ hbox = gtk_hbox_new(FALSE, 10); - gtk_table_attach (GTK_TABLE(table), hbox, 0, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_table_attach_defaults(GTK_TABLE(table), hbox, 0, 2, 1, 2); addButton = gtk_button_new_from_stock (GTK_STOCK_ADD); g_signal_connect (addButton, "clicked", G_CALLBACK (add_credential_cb), credentialStore); @@ -509,12 +554,48 @@ GtkWidget * create_advanced_tab(account_t **a) deleteCredButton = gtk_button_new_from_stock (GTK_STOCK_REMOVE); g_signal_connect (deleteCredButton, "clicked", G_CALLBACK (delete_credential_cb), treeViewCredential); gtk_box_pack_start(GTK_BOX(hbox), deleteCredButton, FALSE, FALSE, 0); - + + /* SRTP Section */ + gnome_main_section_new_with_table (_("Security"), &frame, &table, 1, 3); + gtk_container_set_border_width (GTK_CONTAINER(table), 10); + gtk_table_set_row_spacings (GTK_TABLE(table), 10); + gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0); + + label = gtk_label_new_with_mnemonic (_("SRTP key exchange")); + keyExchangeCombo = gtk_combo_box_new_text(); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), keyExchangeCombo); + gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), "ZRTP"); + //gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), "SDES"); + gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), _("Disabled")); + + advancedZrtpButton = gtk_button_new_with_label(_("Advanced options")); + g_signal_connect(G_OBJECT(advancedZrtpButton), "clicked", G_CALLBACK(show_advanced_zrtp_options_cb), currentAccount->properties); + + if (g_strcasecmp(curSRTPEnabled, "FALSE") == 0) + { + gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo), 1); + gtk_widget_set_sensitive(GTK_WIDGET(advancedZrtpButton), FALSE); + } else { + if (strcmp(curKeyExchange, ZRTP) == 0) { + gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo),0); + } else { + gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo), 1); + gtk_widget_set_sensitive(GTK_WIDGET(advancedZrtpButton), FALSE); + } + } + + g_signal_connect (G_OBJECT (GTK_COMBO_BOX(keyExchangeCombo)), "changed", G_CALLBACK (key_exchange_changed_cb), currentAccount); + + gtk_table_attach_defaults( GTK_TABLE(table), label, 0, 1, 0, 1); + gtk_table_attach_defaults (GTK_TABLE(table), keyExchangeCombo, 1, 2, 0, 1); + gtk_table_attach_defaults(GTK_TABLE(table), advancedZrtpButton, 2, 3, 0, 1); + gtk_widget_show_all(ret); + return ret; } -static GPtrArray * getNewCredential(account_t * account) +static GPtrArray * getNewCredential(GHashTable * properties) { GtkTreeIter iter; gboolean valid; @@ -535,9 +616,9 @@ static GPtrArray * getNewCredential(account_t * account) COLUMN_CREDENTIAL_PASSWORD, &password, -1); - g_hash_table_insert(account->properties, g_strdup(ACCOUNT_REALM), realm); - g_hash_table_insert(account->properties, g_strdup(ACCOUNT_AUTHENTICATION_USERNAME), username); - g_hash_table_insert(account->properties, g_strdup(ACCOUNT_PASSWORD), password); + g_hash_table_insert(properties, g_strdup(ACCOUNT_REALM), realm); + g_hash_table_insert(properties, g_strdup(ACCOUNT_AUTHENTICATION_USERNAME), username); + g_hash_table_insert(properties, g_strdup(ACCOUNT_PASSWORD), password); valid = gtk_tree_model_iter_next (GTK_TREE_MODEL(credentialStore), &iter); @@ -597,12 +678,12 @@ show_account_window (account_t * a) tab = create_account_tab(¤tAccount); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Basic"))); gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab); - + /* Advanced */ tab = create_advanced_tab(¤tAccount); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Advanced"))); gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab); - + gtk_notebook_set_current_page( GTK_NOTEBOOK( notebook) , 0); response = gtk_dialog_run (GTK_DIALOG (dialog)); @@ -669,7 +750,14 @@ show_account_window (account_t * a) g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_SIP_STUN_SERVER), (gchar*)""); g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_SIP_STUN_ENABLED), "FALSE"); } - + + gchar* keyExchange = (gchar *)gtk_combo_box_get_active_text(GTK_COMBO_BOX(keyExchangeCombo)); + if (g_strcasecmp(keyExchange, "ZRTP") == 0) { + g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("TRUE")); + } else { + g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("FALSE")); + } + config_window_set_stun_visible(); } @@ -684,7 +772,7 @@ show_account_window (account_t * a) */ dbus_delete_all_credential(currentAccount); - GPtrArray * credential = getNewCredential(a); + GPtrArray * credential = getNewCredential(currentAccount->properties); currentAccount->credential_information = credential; if(currentAccount->credential_information != NULL) { int i; diff --git a/sflphone-client-gnome/src/config/configwindow.c b/sflphone-client-gnome/src/config/configwindow.c index 5255bf10e63f3bf790ffe615d15fe46da6c9f169..8a6af16c07e8aeb4f3bf391486577f0395232d70 100644 --- a/sflphone-client-gnome/src/config/configwindow.c +++ b/sflphone-client-gnome/src/config/configwindow.c @@ -32,6 +32,7 @@ #include <addressbook-config.h> #include <hooks-config.h> #include <utils.h> +#include <ip2ipdialog.h> #include <stdlib.h> #include <stdio.h> @@ -46,6 +47,7 @@ gboolean dialogOpen = FALSE; gboolean ringtoneEnabled = TRUE; GtkListStore *accountStore; + // instead of keeping selected codec as a variable GtkWidget *addButton; GtkWidget *editButton; @@ -94,6 +96,17 @@ config_window_fill_account_list() GtkTreeIter iter; gtk_list_store_clear(accountStore); + + gtk_list_store_append (accountStore, &iter); + + gtk_list_store_set(accountStore, &iter, + COLUMN_ACCOUNT_ALIAS, (gchar *) _("Direct calls account"), + COLUMN_ACCOUNT_TYPE, (gchar *) _("SIP"), // Protocol + COLUMN_ACCOUNT_STATUS, (gchar *) _("Active"), // Status + COLUMN_ACCOUNT_ACTIVE, TRUE, // Enable/Disable + COLUMN_ACCOUNT_DATA, NULL, // Pointer + -1); + unsigned int i; for(i = 0; i < account_list_get_size(); i++) { account_t * a = account_list_get_nth (i); @@ -101,6 +114,8 @@ config_window_fill_account_list() if (a) { gtk_list_store_append (accountStore, &iter); + DEBUG("Filling accounts: Account is enabled :%s\n", g_hash_table_lookup(a->properties, ACCOUNT_ENABLED)); + gtk_list_store_set(accountStore, &iter, COLUMN_ACCOUNT_ALIAS, g_hash_table_lookup(a->properties, ACCOUNT_ALIAS), // Name COLUMN_ACCOUNT_TYPE, g_hash_table_lookup(a->properties, ACCOUNT_TYPE), // Protocol @@ -140,9 +155,26 @@ edit_account(GtkWidget *widget UNUSED, gpointer data UNUSED) if(selectedAccount) { show_account_window(selectedAccount); + } else { + GHashTable * properties = NULL; + properties = sflphone_get_ip2ip_properties(); + if (properties != NULL) { + show_ip2ip_dialog(properties); + } } } +static void edit_ip2ip_profile(GtkWidget * widget UNUSED, gpointer data UNUSED) +{ + DEBUG("Advanced options for ZRTP and ip2ip profile"); + GHashTable * properties = NULL; + properties = sflphone_get_ip2ip_properties(); + if (properties != NULL) { + show_advanced_zrtp_options(properties); + } + show_advanced_zrtp_options((GHashTable *) data); +} + /** * Add an account */ @@ -222,6 +254,17 @@ select_account(GtkTreeSelection *selection, GtkTreeModel *model) GtkTreeIter iter; GValue val; + GtkTreePath *path; + if(gtk_tree_selection_get_selected (selection, NULL, &iter)) { + path = gtk_tree_model_get_path (model, &iter); + if(gtk_tree_path_get_indices (path)[0] == 0) { + gtk_widget_set_sensitive(GTK_WIDGET(editButton), TRUE); + gtk_widget_set_sensitive(GTK_WIDGET(deleteButton), FALSE); + gtk_widget_set_sensitive(GTK_WIDGET(accountMoveUpButton), FALSE); + gtk_widget_set_sensitive(GTK_WIDGET(accountMoveDownButton), FALSE); + } + } + memset (&val, 0, sizeof(val)); if (!gtk_tree_selection_get_selected(selection, &model, &iter)) { @@ -260,25 +303,28 @@ enable_account(GtkCellRendererToggle *rend UNUSED, gchar* path, gpointer data ) treePath = gtk_tree_path_new_from_string(path); model = gtk_tree_view_get_model(GTK_TREE_VIEW(data)); gtk_tree_model_get_iter(model, &iter, treePath); - - // Get pointer on object - gtk_tree_model_get(model, &iter, - COLUMN_ACCOUNT_ACTIVE, &enable, - COLUMN_ACCOUNT_DATA, &acc, - -1); - enable = !enable; - - // Store value - gtk_list_store_set(GTK_LIST_STORE(model), &iter, - COLUMN_ACCOUNT_ACTIVE, enable, - -1); - - gtk_tree_path_free(treePath); - - // Modify account state - g_hash_table_replace( acc->properties , g_strdup(ACCOUNT_ENABLED) , g_strdup((enable == 1)? "TRUE":"FALSE")); - - dbus_send_register( acc->accountID , enable ); + + if (gtk_tree_path_get_indices (treePath)[0] != 0) { + // Get pointer on object + gtk_tree_model_get(model, &iter, + COLUMN_ACCOUNT_ACTIVE, &enable, + COLUMN_ACCOUNT_DATA, &acc, + -1); + enable = !enable; + + DEBUG("Account is %d enabled\n", enable); + // Store value + gtk_list_store_set(GTK_LIST_STORE(model), &iter, + COLUMN_ACCOUNT_ACTIVE, enable, + -1); + + gtk_tree_path_free(treePath); + + // Modify account state + g_hash_table_replace( acc->properties , g_strdup(ACCOUNT_ENABLED) , g_strdup((enable == 1)? "TRUE":"FALSE")); + + dbus_send_register( acc->accountID , enable ); + } } /** @@ -373,9 +419,9 @@ create_accounts_tab(GtkDialog * dialog) { GtkWidget *table; GtkWidget *scrolledWindow; - GtkWidget *treeView; GtkWidget *buttonBox; GtkCellRenderer *renderer; + GtkTreeView * treeView; GtkTreeViewColumn *treeViewColumn; GtkTreeSelection *treeSelection; GtkRequisition requisition; diff --git a/sflphone-client-gnome/src/config/ip2ipdialog.c b/sflphone-client-gnome/src/config/ip2ipdialog.c new file mode 100644 index 0000000000000000000000000000000000000000..b4e0be05bb5231ac378457308c7907e9e4d834c0 --- /dev/null +++ b/sflphone-client-gnome/src/config/ip2ipdialog.c @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2009 Savoir-Faire Linux inc. + * Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <zrtpadvanceddialog.h> +#include <sflphone_const.h> +#include <utils.h> + +#include <gtk/gtk.h> + +static void key_exchange_changed_cb(GtkWidget *widget, gpointer data) +{ + DEBUG("Key exchange changed"); + if (g_strcasecmp(gtk_combo_box_get_active_text(GTK_COMBO_BOX(widget)), (gchar *) "ZRTP") == 0) { + gtk_widget_set_sensitive(GTK_WIDGET(data), TRUE); + } else { + gtk_widget_set_sensitive(GTK_WIDGET(data), FALSE); + + } +} + +static void show_advanced_zrtp_options_cb(GtkWidget *widget UNUSED, gpointer data) +{ + DEBUG("Advanced options for ZRTP"); + show_advanced_zrtp_options((GHashTable *) data); +} + +void show_ip2ip_dialog(GHashTable * properties) +{ + GtkDialog * ip2ipDialog; + + GtkWidget * frame; + GtkWidget * table; + GtkWidget * label; + GtkWidget * enableHelloHash; + GtkWidget * enableSASConfirm; + GtkWidget * enableZrtpNotSuppOther; + GtkWidget * displaySasOnce; + GtkWidget * advancedOptions; + GtkWidget * keyExchangeCombo; + + gchar * curSasConfirm = "TRUE"; + gchar * curHelloEnabled = "TRUE"; + gchar * curZrtpNotSuppOther = "TRUE"; + gchar * curDisplaySasOnce = "FALSE"; + gchar * curSRTPEnabled = "FALSE"; + gchar * curKeyExchange = "0"; + gchar * description; + + if(properties != NULL) { + curSRTPEnabled = g_hash_table_lookup(properties, ACCOUNT_ZRTP_HELLO_HASH); + curKeyExchange = g_hash_table_lookup(properties, ACCOUNT_KEY_EXCHANGE); + curHelloEnabled = g_hash_table_lookup(properties, ACCOUNT_ZRTP_HELLO_HASH); + curSasConfirm = g_hash_table_lookup(properties, ACCOUNT_ZRTP_DISPLAY_SAS); + curZrtpNotSuppOther = g_hash_table_lookup(properties, ACCOUNT_ZRTP_NOT_SUPP_WARNING); + curDisplaySasOnce = g_hash_table_lookup(properties, ACCOUNT_DISPLAY_SAS_ONCE); + } + + ip2ipDialog = GTK_DIALOG(gtk_dialog_new_with_buttons (_("Direct peer to peer calls"), + GTK_WINDOW(get_main_window()), + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_HELP, + GTK_RESPONSE_HELP, + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL, + GTK_STOCK_SAVE, + GTK_RESPONSE_ACCEPT, + NULL)); + gtk_window_set_policy( GTK_WINDOW(ip2ipDialog), FALSE, FALSE, FALSE ); + gtk_dialog_set_has_separator(ip2ipDialog, TRUE); + gtk_container_set_border_width (GTK_CONTAINER(ip2ipDialog), 0); + + GtkWidget * vbox = gtk_vbox_new(FALSE, 10); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); + + gtk_box_pack_start(GTK_BOX(ip2ipDialog->vbox), vbox, FALSE, FALSE, 0); + + description = g_markup_printf_escaped(_("This profile is used when you want to reach a remote peer\nby simply typing sip:remotepeer without having to go throught\nan external server. The settings here defined will also apply\nin case no account could be matched to the incoming or\noutgoing call.")); + label = gtk_label_new(NULL); + gtk_label_set_markup(GTK_LABEL(label), description); + gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_FILL); + gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); + + /* SRTP Section */ + gnome_main_section_new_with_table (_("Security"), &frame, &table, 1, 3); + gtk_container_set_border_width (GTK_CONTAINER(table), 10); + gtk_table_set_row_spacings (GTK_TABLE(table), 10); + gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); + + label = gtk_label_new_with_mnemonic (_("SRTP key exchange")); + keyExchangeCombo = gtk_combo_box_new_text(); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), keyExchangeCombo); + gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), "ZRTP"); + //gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), "SDES"); + gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), _("Disabled")); + + advancedOptions = gtk_button_new_with_label(_("Advanced options")); + g_signal_connect(G_OBJECT(advancedOptions), "clicked", G_CALLBACK(show_advanced_zrtp_options_cb), properties); + + if (g_strcasecmp(curSRTPEnabled, "FALSE") == 0) + { + gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo), 1); + gtk_widget_set_sensitive(GTK_WIDGET(advancedOptions), FALSE); + } else { + if (strcmp(curKeyExchange, ZRTP) == 0) { + gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo),0); + } else { + gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo), 1); + gtk_widget_set_sensitive(GTK_WIDGET(advancedOptions), FALSE); + } + } + + g_signal_connect (G_OBJECT (GTK_COMBO_BOX(keyExchangeCombo)), "changed", G_CALLBACK (key_exchange_changed_cb), advancedOptions); + + gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); + gtk_table_attach_defaults(GTK_TABLE(table), keyExchangeCombo, 1, 2, 0, 1); + gtk_table_attach_defaults(GTK_TABLE(table), advancedOptions, 2, 3, 0, 1); + + gtk_widget_show_all(vbox); + + if(gtk_dialog_run(GTK_DIALOG(ip2ipDialog)) == GTK_RESPONSE_ACCEPT) { + gchar* keyExchange = (gchar *)gtk_combo_box_get_active_text(GTK_COMBO_BOX(keyExchangeCombo)); + if (g_strcasecmp(keyExchange, "ZRTP") == 0) { + g_hash_table_replace(properties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("TRUE")); + } else { + g_hash_table_replace(properties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("FALSE")); + } + } + + gtk_widget_destroy (GTK_WIDGET(ip2ipDialog)); +} diff --git a/sflphone-client-gnome/src/config/ip2ipdialog.h b/sflphone-client-gnome/src/config/ip2ipdialog.h new file mode 100644 index 0000000000000000000000000000000000000000..e1e6de0af71a0755e05d393a06cc15d6fb1426cb --- /dev/null +++ b/sflphone-client-gnome/src/config/ip2ipdialog.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2009 Savoir-Faire Linux inc. + * Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __SFL_IP2IP_DIALOG__ +#define __SFL_IP2IP_DIALOG__ +/** @file zrtpadvanceddialog.h + * @brief Display the advanced options window for zrtp + */ + +#include <glib.h> + +/** + * Display the advanced options window for zrtp + */ + +void show_ip2ip_dialog(GHashTable * properties); + +#endif diff --git a/sflphone-client-gnome/src/config/zrtpadvanceddialog.c b/sflphone-client-gnome/src/config/zrtpadvanceddialog.c new file mode 100644 index 0000000000000000000000000000000000000000..c16fce6ca8c3bc38e7643318c38b5f0d82396ed7 --- /dev/null +++ b/sflphone-client-gnome/src/config/zrtpadvanceddialog.c @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2009 Savoir-Faire Linux inc. + * Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <zrtpadvanceddialog.h> +#include <sflphone_const.h> +#include <utils.h> + +#include <gtk/gtk.h> + +void show_advanced_zrtp_options(GHashTable * properties) +{ + GtkDialog * securityDialog; + + GtkWidget * zrtpFrame; + GtkWidget * tableZrtp; + GtkWidget * enableHelloHash; + GtkWidget * enableSASConfirm; + GtkWidget * enableZrtpNotSuppOther; + GtkWidget * displaySasOnce; + + gchar * curSasConfirm = "TRUE"; + gchar * curHelloEnabled = "TRUE"; + gchar * curZrtpNotSuppOther = "TRUE"; + gchar * curDisplaySasOnce = "FALSE"; + + if(properties != NULL) { + curHelloEnabled = g_hash_table_lookup(properties, ACCOUNT_ZRTP_HELLO_HASH); + curSasConfirm = g_hash_table_lookup(properties, ACCOUNT_ZRTP_DISPLAY_SAS); + curZrtpNotSuppOther = g_hash_table_lookup(properties, ACCOUNT_ZRTP_NOT_SUPP_WARNING); + curDisplaySasOnce = g_hash_table_lookup(properties, ACCOUNT_DISPLAY_SAS_ONCE); + } + + securityDialog = GTK_DIALOG(gtk_dialog_new_with_buttons (_("ZRTP Options"), + GTK_WINDOW(get_main_window()), + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL, + GTK_STOCK_SAVE, + GTK_RESPONSE_ACCEPT, + NULL)); + gtk_window_set_policy( GTK_WINDOW(securityDialog), FALSE, FALSE, FALSE ); + gtk_dialog_set_has_separator(securityDialog, TRUE); + gtk_container_set_border_width (GTK_CONTAINER(securityDialog), 0); + + + tableZrtp = gtk_table_new (4, 2 , FALSE/* homogeneous */); + gtk_table_set_row_spacings( GTK_TABLE(tableZrtp), 10); + gtk_table_set_col_spacings( GTK_TABLE(tableZrtp), 10); + gtk_box_pack_start(GTK_BOX(securityDialog->vbox), tableZrtp, FALSE, FALSE, 0); + gtk_widget_show(tableZrtp); + + enableHelloHash = gtk_check_button_new_with_mnemonic(_("Send Hello Hash in S_DP")); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enableHelloHash), + g_strcasecmp(curHelloEnabled,"TRUE") == 0 ? TRUE: FALSE); + gtk_table_attach ( GTK_TABLE(tableZrtp), enableHelloHash, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_widget_set_sensitive( GTK_WIDGET( enableHelloHash ) , TRUE ); + + enableSASConfirm = gtk_check_button_new_with_mnemonic(_("Ask User to Confirm SAS")); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enableSASConfirm), + g_strcasecmp(curSasConfirm,"TRUE") == 0 ? TRUE: FALSE); + gtk_table_attach ( GTK_TABLE(tableZrtp), enableSASConfirm, 0, 1, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_widget_set_sensitive( GTK_WIDGET( enableSASConfirm ) , TRUE ); + + enableZrtpNotSuppOther = gtk_check_button_new_with_mnemonic(_("_Warn if ZRTP not supported")); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enableZrtpNotSuppOther), + g_strcasecmp(curZrtpNotSuppOther,"TRUE") == 0 ? TRUE: FALSE); + gtk_table_attach ( GTK_TABLE(tableZrtp), enableZrtpNotSuppOther, 0, 1, 4, 5, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_widget_set_sensitive( GTK_WIDGET( enableZrtpNotSuppOther ) , TRUE ); + + displaySasOnce = gtk_check_button_new_with_mnemonic(_("Display SAS once for hold events")); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(displaySasOnce), + g_strcasecmp(curDisplaySasOnce,"TRUE") == 0 ? TRUE: FALSE); + gtk_table_attach ( GTK_TABLE(tableZrtp), displaySasOnce, 0, 1, 5, 6, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_widget_set_sensitive( GTK_WIDGET( displaySasOnce ) , TRUE ); + + gtk_widget_show_all(tableZrtp); + + gtk_container_set_border_width (GTK_CONTAINER(tableZrtp), 10); + + if(gtk_dialog_run(GTK_DIALOG(securityDialog)) == GTK_RESPONSE_ACCEPT) { + g_hash_table_replace(properties, + g_strdup(ACCOUNT_ZRTP_DISPLAY_SAS), + g_strdup(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(enableSASConfirm)) ? "TRUE": "FALSE")); + + g_hash_table_replace(properties, + g_strdup(ACCOUNT_DISPLAY_SAS_ONCE), + g_strdup(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(displaySasOnce)) ? "TRUE": "FALSE")); + + g_hash_table_replace(properties, + g_strdup(ACCOUNT_ZRTP_HELLO_HASH), + g_strdup(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(enableHelloHash)) ? "TRUE": "FALSE")); + + g_hash_table_replace(properties, + g_strdup(ACCOUNT_ZRTP_NOT_SUPP_WARNING), + g_strdup(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(enableZrtpNotSuppOther)) ? "TRUE": "FALSE")); + } + + gtk_widget_destroy (GTK_WIDGET(securityDialog)); +} diff --git a/sflphone-client-gnome/src/config/zrtpadvanceddialog.h b/sflphone-client-gnome/src/config/zrtpadvanceddialog.h new file mode 100644 index 0000000000000000000000000000000000000000..fb84c6e7b74a17218e640f18714b1fea23b32385 --- /dev/null +++ b/sflphone-client-gnome/src/config/zrtpadvanceddialog.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2009 Savoir-Faire Linux inc. + * Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __SFL_ZRTP_ADVANCED_DIALOG__ +#define __SFL_ZRTP_ADVANCED_DIALOG__ +/** @file zrtpadvanceddialog.h + * @brief Display the advanced options window for zrtp + */ + +#include <glib.h> + +/** + * Display the advanced options window for zrtp + */ + +void show_advanced_zrtp_options(GHashTable * properties); + +#endif diff --git a/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml b/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml index 8c2151be386f1fb556b149661fb33d86bdb32cce..2eaea12341bd6a8b727a44effb0106b8de252c16 100644 --- a/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml +++ b/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml @@ -60,6 +60,14 @@ <arg type="as" name="list" direction="out"/> </method> + <method name="getIp2IpDetails"> + <arg type="a{ss}" name="details" direction="out"/> + </method> + + <method name="setIp2IpDetails"> + <arg type="a{ss}" name="details" direction="in"/> + </method> + <method name="sendRegister"> <arg type="s" name="accountID" direction="in"/> <arg type="i" name="expire" direction="in"/> diff --git a/sflphone-client-gnome/src/dbus/dbus.c b/sflphone-client-gnome/src/dbus/dbus.c index a48eecf86dcf2025c79115c82a678cecdad803be..d7306006cd8ad21d13bd80aa58e381d76a1d9666 100644 --- a/sflphone-client-gnome/src/dbus/dbus.c +++ b/sflphone-client-gnome/src/dbus/dbus.c @@ -210,6 +210,7 @@ accounts_changed_cb (DBusGProxy *proxy UNUSED, { DEBUG ("Accounts changed"); sflphone_fill_account_list(TRUE); + sflphone_fill_ip2ip_profile(); config_window_fill_account_list(); // Update the status bar in case something happened @@ -653,6 +654,44 @@ GHashTable* dbus_get_credential(gchar * accountID, int index) } } +GHashTable* dbus_get_ip2_ip_details(void) +{ + GError *error = NULL; + GHashTable * details; + if(!org_sflphone_SFLphone_ConfigurationManager_get_ip2_ip_details( configurationManagerProxy, &details, &error)) + { + if(error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) + { + ERROR ("Caught remote method (get_ip2_ip_details) exception %s: %s", dbus_g_error_get_name(error), error->message); + } + else + { + ERROR("Error while calling get_ip2_ip_details: %s", error->message); + } + g_error_free (error); + return NULL; + } + else{ + return details; + } +} + + void +dbus_set_ip2_ip_details(GHashTable * properties) +{ + GError *error = NULL; + org_sflphone_SFLphone_ConfigurationManager_set_ip2_ip_details ( + configurationManagerProxy, + properties, + &error); + if (error) + { + ERROR ("Failed to call set_ip_2ip_details() on ConfigurationManager: %s", + error->message); + g_error_free (error); + } +} + void dbus_send_register ( gchar* accountID , const guint expire) { diff --git a/sflphone-client-gnome/src/dbus/dbus.h b/sflphone-client-gnome/src/dbus/dbus.h index a8a27791d8dd1916fb0ff4589a295a25c0689999..36158f5fd6ae338e5d90fb6b074aff87f8679eae 100644 --- a/sflphone-client-gnome/src/dbus/dbus.h +++ b/sflphone-client-gnome/src/dbus/dbus.h @@ -151,6 +151,16 @@ void dbus_set_number_of_credential(account_t *a, int number); */ GHashTable* dbus_get_credential(gchar * accountID, int index); +/** + * ConfigurationManager - Get the details for the ip2ip profile + */ +GHashTable * dbus_get_ip2_ip_details(void); + +/** + * ConfigurationManager - Set the details for the ip2ip profile + */ +void dbus_set_ip2_ip_details(GHashTable * properties); + /** * ConfigurationManager - Send registration request * @param accountID The account to register/unregister diff --git a/sflphone-client-gnome/src/sflphone_const.h b/sflphone-client-gnome/src/sflphone_const.h index e0208b8fdd51378bcee6f8327aa7d277c4194f1c..b21851950faedfe63e38969cbbb1914701f4a31e 100644 --- a/sflphone-client-gnome/src/sflphone_const.h +++ b/sflphone-client-gnome/src/sflphone_const.h @@ -45,19 +45,27 @@ #define UNUSED __attribute__((__unused__)) -#define ACCOUNT_TYPE "Account.type" -#define ACCOUNT_ALIAS "Account.alias" -#define ACCOUNT_ENABLED "Account.enable" -#define ACCOUNT_MAILBOX "Account.mailbox" -#define ACCOUNT_RESOLVE_ONCE "Account.resolveOnce" -#define ACCOUNT_REGISTRATION_EXPIRE "Account.expire" -#define ACCOUNT_SIP_STUN_SERVER "STUN.server" -#define ACCOUNT_SIP_STUN_ENABLED "STUN.enable" -#define ACCOUNT_HOSTNAME "hostname" -#define ACCOUNT_USERNAME "username" -#define ACCOUNT_PASSWORD "password" -#define ACCOUNT_AUTHENTICATION_USERNAME "authenticationUsername" -#define ACCOUNT_REALM "realm" +#define ACCOUNT_TYPE "Account.type" +#define ACCOUNT_ALIAS "Account.alias" +#define ACCOUNT_ENABLED "Account.enable" +#define ACCOUNT_MAILBOX "Account.mailbox" +#define ACCOUNT_RESOLVE_ONCE "Account.resolveOnce" +#define ACCOUNT_REGISTRATION_EXPIRE "Account.expire" +#define ACCOUNT_SIP_STUN_SERVER "STUN.server" +#define ACCOUNT_SIP_STUN_ENABLED "STUN.enable" +#define ACCOUNT_HOSTNAME "hostname" +#define ACCOUNT_USERNAME "username" +#define ACCOUNT_PASSWORD "password" +#define ACCOUNT_AUTHENTICATION_USERNAME "authenticationUsername" +#define ACCOUNT_REALM "realm" +#define ACCOUNT_KEY_EXCHANGE "SRTP.keyExchange" +#define ACCOUNT_SRTP_ENABLED "SRTP.enable" +#define ACCOUNT_ZRTP_DISPLAY_SAS "ZRTP.displaySAS" +#define ACCOUNT_ZRTP_NOT_SUPP_WARNING "ZRTP.notSuppWarning" +#define ACCOUNT_ZRTP_HELLO_HASH "ZRTP.helloHashEnable" +#define ACCOUNT_DISPLAY_SAS_ONCE "ZRTP.displaySasOnce" +#define ZRTP "1" +#define SDES_TLS "2" /** * Global logger diff --git a/sflphone-common/src/dbus/configurationmanager.cpp b/sflphone-common/src/dbus/configurationmanager.cpp index d7c6e6a58bfbd7dae168301aa1683a0efc5f3532..0fcaa37f7de72afbc3338a5af476727e2342ba6f 100644 --- a/sflphone-common/src/dbus/configurationmanager.cpp +++ b/sflphone-common/src/dbus/configurationmanager.cpp @@ -128,7 +128,9 @@ ConfigurationManager::getNumberOfCredential (const std::string& accountID) void ConfigurationManager::setNumberOfCredential (const std::string& accountID, const int32_t& number) { - Manager::instance().setConfig (accountID, CONFIG_CREDENTIAL_NUMBER, number); + if (accountID != AccountNULL || !accountID.empty()) { + Manager::instance().setConfig (accountID, CONFIG_CREDENTIAL_NUMBER, number); + } } void diff --git a/sflphone-common/src/main.cpp b/sflphone-common/src/main.cpp index fe01b911cc69c617cad8479a0ae0bbeedb9c5075..5bb1db3f9d08cde9e9f5cfba46e9f59b0ad5060a 100644 --- a/sflphone-common/src/main.cpp +++ b/sflphone-common/src/main.cpp @@ -106,8 +106,6 @@ main (int argc, char **argv) else { fclose (fp); - _debug ("SDLauiobvzsfivbsfivbsuobvsobvasbvfasdkbvkdbvbvksdbvksdbvkzsdbvasdfb: %i\n", atoi (cOldPid)); - if (kill (atoi (cOldPid), 0) == SUCCESS) { fprintf (stderr, "There is already a sflphoned daemon running in the system. Starting Failed.\n"); exit (-1); diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index 6fb3ea479e4654d1ccc641d4e831484649f0af37..e9716358d4ca66494932c97e4a31364db0f01168 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -2412,12 +2412,14 @@ void ManagerImpl::getConfigStringFromFileOrDefaultValue(std::map<std::string, st { std::string setting = getConfigString(section, field); - if (setting == "TRUE") { - details.insert (std::pair<std::string, std::string>(field, "1")); + if (setting == "0") { + details.insert (std::pair<std::string, std::string>(field, "FALSE")); + return; } - if (setting == "FALSE") { - details.insert (std::pair<std::string, std::string>(field, "0")); + if (setting == "1") { + details.insert (std::pair<std::string, std::string>(field, "TRUE")); + return; } if (setting.empty()) { @@ -2547,7 +2549,7 @@ std::map< std::string, std::string > ManagerImpl::getAccountDetails (const Accou } getConfigStringFromFileOrDefaultValue(a, accountID, CONFIG_ACCOUNT_ALIAS); - getConfigStringFromFileOrDefaultValue(a, accountID, CONFIG_ACCOUNT_ENABLE, "0"); + getConfigStringFromFileOrDefaultValue(a, accountID, CONFIG_ACCOUNT_ENABLE, "FALSE"); getConfigStringFromFileOrDefaultValue(a, accountID, CONFIG_ACCOUNT_RESOLVE_ONCE, "FALSE"); getConfigStringFromFileOrDefaultValue(a, accountID, CONFIG_ACCOUNT_TYPE, DEFAULT_ACCOUNT_TYPE); getConfigStringFromFileOrDefaultValue(a, accountID, HOSTNAME); @@ -2561,8 +2563,8 @@ std::map< std::string, std::string > ManagerImpl::getAccountDetails (const Accou RegistrationState state; state = account->getRegistrationState(); a.insert (std::pair<std::string, std::string> ("Status", mapStateNumberToString (state))); - - getConfigStringFromFileOrDefaultValue(a, accountID, SRTP_KEY_EXCHANGE, "0"); + a.insert( std::pair<std::string, std::string>( SRTP_KEY_EXCHANGE, getConfigString(accountID, SRTP_KEY_EXCHANGE) ) ); + getConfigStringFromFileOrDefaultValue(a, accountID, SRTP_ENABLE, "FALSE"); getConfigStringFromFileOrDefaultValue(a, accountID, ZRTP_DISPLAY_SAS, "TRUE"); getConfigStringFromFileOrDefaultValue(a, accountID, ZRTP_DISPLAY_SAS_ONCE, "FALSE");