diff --git a/sflphone-client-gnome/src/config/accountconfigdialog.c b/sflphone-client-gnome/src/config/accountconfigdialog.c index 2766d13cfb1b6f53e017c6efc0ad532069d87598..7467d38fae3f6f50803742b2141d1c00402edada 100644 --- a/sflphone-client-gnome/src/config/accountconfigdialog.c +++ b/sflphone-client-gnome/src/config/accountconfigdialog.c @@ -667,7 +667,8 @@ GtkWidget * create_advanced_tab(account_t **a) gchar * local_address; gchar * local_port; gchar * stun_enable; - gchar * stun_server; + gchar * stun_server; + gchar * published_sameas_local; // Load from SIP/IAX/Unknown ? if(currentAccount) { @@ -681,8 +682,10 @@ GtkWidget * create_advanced_tab(account_t **a) published_port = g_hash_table_lookup(currentAccount->properties, PUBLISHED_PORT); stun_enable = g_hash_table_lookup(currentAccount->properties, ACCOUNT_SIP_STUN_ENABLED); stun_server = g_hash_table_lookup(currentAccount->properties, ACCOUNT_SIP_STUN_SERVER); + published_sameas_local = g_hash_table_lookup(currentAccount->properties, PUBLISHED_SAMEAS_LOCAL); + DEBUG("-------- Advanced parameters from config"); - DEBUG("resolve_once %s, account_expire %s, use_tls %s, published_address %s, published_port %s, local_address %s, local_port %s, stun_enable %s, stun_server %s\n", resolve_once, account_expire, use_tls, published_address, published_port, local_address, local_port, stun_enable, stun_server); + DEBUG("resolve_once %s, account_expire %s, use_tls %s, published_address %s, published_port %s, local_address %s, local_port %s, stun_enable %s, stun_server %s, published_sameas_local %s\n", resolve_once, account_expire, use_tls, published_address, published_port, local_address, local_port, stun_enable, stun_server, published_sameas_local); } gnome_main_section_new_with_table (_("Registration"), &frame, &table, 2, 3); @@ -791,16 +794,18 @@ GtkWidget * create_advanced_tab(account_t **a) gtk_entry_set_text(GTK_ENTRY(stunServerEntry), stun_server); gtk_table_attach_defaults(GTK_TABLE(table), stunServerEntry, 1, 2, 1, 2); - // label = gtk_label_new_with_mnemonic (_("Set published address and port:")); - // gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 2, 2, 3); - // gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5); - sameAsLocalRadioButton = gtk_radio_button_new_with_mnemonic_from_widget(NULL, _("Same as local parameters")); gtk_table_attach_defaults(GTK_TABLE(table), sameAsLocalRadioButton, 0, 2, 3, 4); publishedAddrRadioButton = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(sameAsLocalRadioButton), _("Set published address and port:")); gtk_table_attach_defaults(GTK_TABLE(table), publishedAddrRadioButton, 0, 2, 4, 5); - + + if(g_strcasecmp(published_sameas_local, "true") == 0) { + gtk_toggle_button_set_active (GTK_WIDGET(sameAsLocalRadioButton), TRUE); + } else { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(publishedAddrRadioButton), TRUE); + } + gtk_widget_show_all(ret); publishedAddressLabel = gtk_label_new_with_mnemonic (_("Published address")); @@ -825,24 +830,16 @@ GtkWidget * create_advanced_tab(account_t **a) // widgets need to be instanciated before that. g_signal_connect(useStunCheckBox, "toggled", G_CALLBACK(use_stun_cb), useStunCheckBox); g_signal_connect(sameAsLocalRadioButton, "toggled", G_CALLBACK(same_as_local_cb), sameAsLocalRadioButton); - g_signal_connect(publishedAddrRadioButton, "toggled", G_CALLBACK(set_published_addr_manually_cb), publishedAddrRadioButton); - /* - if (g_strcasecmp(stun_enable,"true") == 0) { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(useStunRadioButton), TRUE); - } else if ((g_strcasecmp(published_address, local_address) == 0) - && (g_strcasecmp(published_port, local_port) == 0)) { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(sameAsLocalRadioButton), TRUE); - } else { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(publishedAddrRadioButton), TRUE); - } - */ + g_signal_connect(publishedAddrRadioButton, "toggled", G_CALLBACK(set_published_addr_manually_cb), publishedAddrRadioButton); +/* if ((g_strcasecmp(published_address, local_address) == 0) && (g_strcasecmp(published_port, local_port) == 0)) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(sameAsLocalRadioButton), TRUE); } else { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(publishedAddrRadioButton), TRUE); } +*/ return ret; } @@ -1002,6 +999,8 @@ show_account_window (account_t * a) g_hash_table_replace(currentAccount->properties, g_strdup(TLS_ENABLE), g_strdup(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(useSipTlsCheckBox)) ? "true":"false")); + g_hash_table_replace(currentAccount->properties, g_strdup(PUBLISHED_SAMEAS_LOCAL), g_strdup(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(sameAsLocalRadioButton)) ? "true":"false")); + g_hash_table_replace(currentAccount->properties, g_strdup(LOCAL_PORT), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(localPortSpinBox)))); diff --git a/sflphone-client-gnome/src/sflphone_const.h b/sflphone-client-gnome/src/sflphone_const.h index f12ed3f30c69bcabe02b79f0cc663f5d99f698b6..1e55bef1c8faa943e710fa41c9090b0b8a464fcb 100644 --- a/sflphone-client-gnome/src/sflphone_const.h +++ b/sflphone-client-gnome/src/sflphone_const.h @@ -84,6 +84,7 @@ #define TLS_NEGOTIATION_TIMEOUT_SEC "TLS.negotiationTimeoutSec" #define TLS_NEGOTIATION_TIMEOUT_MSEC "TLS.negotiationTimemoutMsec" +#define PUBLISHED_SAMEAS_LOCAL "Account.publishedSameAsLocal" #define LOCAL_PORT "Account.localPort" #define LOCAL_ADDRESS "Account.localAddress" #define PUBLISHED_PORT "Account.publishedPort" diff --git a/sflphone-common/src/account.h b/sflphone-common/src/account.h index 324ec2d0d6c51b573fae076c77b1adcb2e5278cf..3d6c36b8b2275bac68a0dc4c0f2ef64417bcb588 100644 --- a/sflphone-common/src/account.h +++ b/sflphone-common/src/account.h @@ -70,6 +70,7 @@ typedef enum RegistrationState { #define REALM "realm" #define DEFAULT_REALM "*" +#define PUBLISHED_SAMEAS_LOCAL "Account.publishedSameAsLocal" #define LOCAL_PORT "Account.localPort" #define LOCAL_ADDRESS "Account.localAddress" #define PUBLISHED_PORT "Account.publishedPort" diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index 8f97e00fd3c015008992a669d523890825f6114f..98ee2d94516f5bf4b82c00f2ca1186085c066f0c 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -3487,6 +3487,7 @@ std::map< std::string, std::string > ManagerImpl::getAccountDetails (const Accou a.insert (std::pair<std::string, std::string> (AUTHENTICATION_USERNAME, getConfigString (accountID, AUTHENTICATION_USERNAME))); a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_MAILBOX, getConfigString (accountID, CONFIG_ACCOUNT_MAILBOX))); a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_REGISTRATION_EXPIRE, getConfigString (accountID, CONFIG_ACCOUNT_REGISTRATION_EXPIRE))); + a.insert (std::pair<std::string, std::string> (PUBLISHED_SAMEAS_LOCAL, getConfigString (accountID, PUBLISHED_SAMEAS_LOCAL))); a.insert (std::pair<std::string, std::string> (LOCAL_ADDRESS, getConfigString (accountID, LOCAL_ADDRESS))); a.insert (std::pair<std::string, std::string> (PUBLISHED_ADDRESS, getConfigString (accountID, PUBLISHED_ADDRESS))); a.insert (std::pair<std::string, std::string> (LOCAL_PORT, getConfigString (accountID, LOCAL_PORT))); @@ -3719,6 +3720,7 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma std::string hostname; std::string displayName; + std::string publishedSameasLocal; std::string localAddress; std::string publishedAddress; std::string localPort; @@ -3754,6 +3756,10 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma displayName = iter->second; } + if ( (iter = map_cpy.find (PUBLISHED_SAMEAS_LOCAL)) != map_cpy.end()) { + publishedSameasLocal = iter->second; + } + if ( (iter = map_cpy.find (LOCAL_ADDRESS)) != map_cpy.end()) { localAddress = iter->second; } @@ -3880,6 +3886,7 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma setConfig (accountID, HOSTNAME, hostname); + setConfig (accountID, PUBLISHED_SAMEAS_LOCAL, publishedSameasLocal); setConfig (accountID, LOCAL_ADDRESS, localAddress); setConfig (accountID, PUBLISHED_ADDRESS, publishedAddress); setConfig (accountID, LOCAL_PORT, localPort);