[#2623] Load local interface in account configuration dialog

This commit is contained in:
Alexandre Savard
2010-01-04 14:19:34 -05:00
parent db2b154978
commit ef7f067d93
5 changed files with 26 additions and 5 deletions

View File

@ -757,6 +757,7 @@ GtkWidget * create_advanced_tab(account_t **a)
gchar * use_tls;
gchar * published_address;
gchar * published_port;
gchar * local_interface;
gchar * local_address;
gchar * local_port;
gchar * stun_enable;
@ -772,6 +773,9 @@ GtkWidget * create_advanced_tab(account_t **a)
published_sameas_local = g_hash_table_lookup(currentAccount->properties, PUBLISHED_SAMEAS_LOCAL);
local_interface = g_hash_table_lookup(currentAccount->properties, LOCAL_INTERFACE);
local_port = g_hash_table_lookup(currentAccount->properties, LOCAL_PORT);
local_address = g_hash_table_lookup(currentAccount->properties, LOCAL_ADDRESS);
@ -849,7 +853,7 @@ GtkWidget * create_advanced_tab(account_t **a)
gtk_list_store_set(ipInterfaceListStore, &iter, 0, *iface, -1 );
// set the current local address
if (!iface_found && (g_strcmp0(*iface, local_address) == 0)) {
if (!iface_found && (g_strcmp0(*iface, local_interface) == 0)) {
DEBUG("Setting active local address combo box");
current_local_address_iter = iter;
iface_found = TRUE;
@ -1114,6 +1118,10 @@ show_account_window (account_t * a)
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_INTERFACE),
g_strdup((gchar *)gtk_combo_box_get_active_text(GTK_COMBO_BOX(localAddressCombo))));
g_hash_table_replace(currentAccount->properties,
g_strdup(LOCAL_PORT),
g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(localPortSpinBox))));
@ -1137,6 +1145,7 @@ show_account_window (account_t * a)
g_strdup(PUBLISHED_PORT),
g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(localPortSpinBox))));
g_hash_table_replace(currentAccount->properties,
g_strdup(PUBLISHED_ADDRESS),
g_strdup((gchar *)gtk_combo_box_get_active_text(GTK_COMBO_BOX(localAddressCombo))));

View File

@ -165,7 +165,7 @@ static void use_sip_tls_cb(GtkWidget *widget, gpointer data)
static void ip2ip_local_address_changed_cb(GtkWidget *widget, gpointer data)
{
DEBUG("ip2ip_local_address_changed_cb\n");
g_hash_table_replace(directIpCallsProperties, g_strdup(LOCAL_ADDRESS), g_strdup((gchar *)gtk_combo_box_get_active_text(GTK_COMBO_BOX(widget))));
g_hash_table_replace(directIpCallsProperties, g_strdup(LOCAL_INTERFACE), g_strdup((gchar *)gtk_combo_box_get_active_text(GTK_COMBO_BOX(widget))));
}
static void ip2ip_local_port_changed_cb(GtkWidget *widget, gpointer data)
@ -199,6 +199,7 @@ GtkWidget* create_direct_ip_calls_tab()
gchar * curKeyExchange = "0";
gchar * description;
gchar * local_interface;
gchar * local_address;
gchar * local_port;
@ -207,8 +208,10 @@ GtkWidget* create_direct_ip_calls_tab()
if(directIpCallsProperties != NULL) {
DEBUG("got a directIpCallsProperties");
local_interface = g_hash_table_lookup(directIpCallsProperties, LOCAL_INTERFACE);
local_address = g_hash_table_lookup(directIpCallsProperties, LOCAL_ADDRESS);
local_port = g_hash_table_lookup(directIpCallsProperties, LOCAL_PORT);
DEBUG(" local interface = %s", local_interface);
DEBUG(" local address = %s", local_address);
DEBUG(" local port = %s", local_port);
curSRTPEnabled = g_hash_table_lookup(directIpCallsProperties, ACCOUNT_SRTP_ENABLED);
@ -264,7 +267,7 @@ GtkWidget* create_direct_ip_calls_tab()
gtk_list_store_append(ipInterfaceListStore, &iter );
gtk_list_store_set(ipInterfaceListStore, &iter, 0, *iface, -1 );
if (!iface_found && (g_strcmp0(*iface, local_address) == 0)) {
if (!iface_found && (g_strcmp0(*iface, local_interface) == 0)) {
DEBUG("Setting active local address combo box");
current_local_address_iter = iter;
iface_found = TRUE;
@ -292,7 +295,7 @@ GtkWidget* create_direct_ip_calls_tab()
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(localAddressCombo), &current_local_address_iter);
g_signal_connect (G_OBJECT(GTK_COMBO_BOX(localAddressCombo)), "changed", G_CALLBACK (ip2ip_local_address_changed_cb), localAddressCombo);
g_hash_table_replace(directIpCallsProperties, g_strdup(LOCAL_ADDRESS), g_strdup((gchar *)gtk_combo_box_get_active_text(GTK_COMBO_BOX(localAddressCombo))));
g_hash_table_replace(directIpCallsProperties, g_strdup(LOCAL_INTERFACE), g_strdup((gchar *)gtk_combo_box_get_active_text(GTK_COMBO_BOX(localAddressCombo))));
/**

View File

@ -88,6 +88,7 @@
#define TLS_NEGOTIATION_TIMEOUT_SEC "TLS.negotiationTimeoutSec"
#define TLS_NEGOTIATION_TIMEOUT_MSEC "TLS.negotiationTimemoutMsec"
#define LOCAL_INTERFACE "Account.localInterface"
#define PUBLISHED_SAMEAS_LOCAL "Account.publishedSameAsLocal"
#define LOCAL_PORT "Account.localPort"
#define LOCAL_ADDRESS "Account.localAddress"

View File

@ -77,6 +77,7 @@ ConfigurationManager::getIp2IpDetails (void)
ip2ipAccountDetails.insert (std::pair<std::string, std::string> (ZRTP_NOT_SUPP_WARNING, Manager::instance().getConfigString (IP2IP_PROFILE, ZRTP_NOT_SUPP_WARNING)));
ip2ipAccountDetails.insert (std::pair<std::string, std::string> (ZRTP_DISPLAY_SAS_ONCE, Manager::instance().getConfigString (IP2IP_PROFILE, ZRTP_DISPLAY_SAS_ONCE)));
ip2ipAccountDetails.insert (std::pair<std::string, std::string> (LOCAL_INTERFACE, Manager::instance().getConfigString(IP2IP_PROFILE, LOCAL_INTERFACE)));
ip2ipAccountDetails.insert (std::pair<std::string, std::string> (LOCAL_ADDRESS, Manager::instance().getConfigString (IP2IP_PROFILE, LOCAL_ADDRESS)));
ip2ipAccountDetails.insert (std::pair<std::string, std::string> (LOCAL_PORT, Manager::instance().getConfigString (IP2IP_PROFILE, LOCAL_PORT)));
@ -94,6 +95,12 @@ ConfigurationManager::setIp2IpDetails (const std::map< std::string, std::string
std::map<std::string, std::string> map_cpy = details;
std::map<std::string, std::string>::iterator it;
it = map_cpy.find (LOCAL_INTERFACE);
if (it != details.end()) {
Manager::instance().setConfig (IP2IP_PROFILE, LOCAL_INTERFACE, it->second);
}
it = map_cpy.find (LOCAL_ADDRESS);
if (it != details.end()) {

View File

@ -3536,6 +3536,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> (LOCAL_INTERFACE, getConfigString (accountID, LOCAL_INTERFACE)));
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)));