Commit a614e0cc authored by Tristan Matthews's avatar Tristan Matthews

* 9490: gnome: safer, clearer string equality testing

parent 53d51ead
......@@ -45,7 +45,7 @@ static guint account_list_get_position(account_t *account)
for (guint i = 0; i < size; i++) {
account_t *tmp = account_list_get_nth(i);
if (utf8_case_cmp(tmp->accountID, account->accountID) == 0)
if (utf8_case_equal(tmp->accountID, account->accountID))
return i;
}
......@@ -265,7 +265,7 @@ gboolean current_account_has_mailbox(void)
if (current) {
gchar * account_mailbox = account_lookup(current, ACCOUNT_MAILBOX);
if (account_mailbox && utf8_case_cmp(account_mailbox, "") != 0)
if (account_mailbox && !utf8_case_equal(account_mailbox, ""))
return TRUE;
}
......@@ -297,7 +297,7 @@ gboolean current_account_has_new_message(void)
gboolean account_is_IP2IP(const account_t *account)
{
g_assert(account);
return utf8_case_cmp(account->accountID, IP2IP_PROFILE) == 0;
return utf8_case_equal(account->accountID, IP2IP_PROFILE);
}
static gboolean is_type(const account_t *account, const gchar *type)
......@@ -343,6 +343,11 @@ void account_replace(account_t *account, const gchar *key, const gchar *value)
g_hash_table_replace(account->properties, g_strdup(key), g_strdup(value));
}
void account_insert(account_t *account, const gchar *key, const gchar *value)
{
g_hash_table_insert(account->properties, g_strdup(key), g_strdup(value));
}
gpointer account_lookup(const account_t *account, gconstpointer key)
{
g_assert(account->properties);
......
......@@ -192,6 +192,7 @@ account_t *create_default_account();
void initialize_credential_information(account_t *account);
void account_replace(account_t *account, const gchar *key, const gchar *value);
void account_insert(account_t *account, const gchar *key, const gchar *value);
gpointer account_lookup(const account_t *account, gconstpointer key);
#endif
......@@ -103,7 +103,7 @@ sflphone_notify_voice_mail(const gchar* accountID , guint count)
static gboolean is_direct_call(callable_obj_t * c)
{
if (utf8_case_cmp(c->_accountID, "empty") == 0) {
if (utf8_case_equal(c->_accountID, "empty")) {
if (!g_str_has_prefix(c->_peer_number, "sip:")) {
gchar * new_number = g_strconcat("sip:", c->_peer_number, NULL);
g_free(c->_peer_number);
......@@ -819,7 +819,7 @@ static int place_registered_call(callable_obj_t * c)
}
gpointer status = g_hash_table_lookup(current->properties, "Status");
if (status && utf8_case_cmp(status, "REGISTERED") == 0) {
if (utf8_case_equal(status, "REGISTERED")) {
/* The call is made with the current account */
// free memory for previous account id and get a new one
g_free(c->_accountID);
......
......@@ -147,15 +147,15 @@ callable_obj_t *create_new_call_from_details(const gchar *call_id, GHashTable *d
const gchar * const display_name = g_hash_table_lookup(details, "DISPLAY_NAME");
const gchar * const state_str = g_hash_table_lookup(details, "CALL_STATE");
if (utf8_case_cmp(state_str, "CURRENT") == 0)
if (utf8_case_equal(state_str, "CURRENT"))
state = CALL_STATE_CURRENT;
else if (utf8_case_cmp(state_str, "RINGING") == 0)
else if (utf8_case_equal(state_str, "RINGING"))
state = CALL_STATE_RINGING;
else if (utf8_case_cmp(state_str, "INCOMING") == 0)
else if (utf8_case_equal(state_str, "INCOMING"))
state = CALL_STATE_INCOMING;
else if (utf8_case_cmp(state_str, "HOLD") == 0)
else if (utf8_case_equal(state_str, "HOLD"))
state = CALL_STATE_HOLD;
else if (utf8_case_cmp(state_str, "BUSY") == 0)
else if (utf8_case_equal(state_str, "BUSY"))
state = CALL_STATE_BUSY;
else
state = CALL_STATE_FAILURE;
......
......@@ -81,17 +81,17 @@ conference_obj_t *create_new_conference_from_details(const gchar *conf_id, GHash
gchar *state_str = g_hash_table_lookup(details, "CONF_STATE");
if (utf8_case_cmp(state_str, "ACTIVE_ATTACHED") == 0)
if (utf8_case_equal(state_str, "ACTIVE_ATTACHED"))
new_conf->_state = CONFERENCE_STATE_ACTIVE_ATTACHED;
else if (utf8_case_cmp(state_str, "ACTIVE_ATTACHED_REC") == 0)
else if (utf8_case_equal(state_str, "ACTIVE_ATTACHED_REC"))
new_conf->_state = CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD;
else if (utf8_case_cmp(state_str, "ACTIVE_DETACHED") == 0)
else if (utf8_case_equal(state_str, "ACTIVE_DETACHED"))
new_conf->_state = CONFERENCE_STATE_ACTIVE_DETACHED;
else if (utf8_case_cmp(state_str, "ACTIVE_DETACHED_REC") == 0)
else if (utf8_case_equal(state_str, "ACTIVE_DETACHED_REC"))
new_conf->_state = CONFERENCE_STATE_ACTIVE_DETACHED_RECORD;
else if (utf8_case_cmp(state_str, "HOLD") == 0)
else if (utf8_case_equal(state_str, "HOLD"))
new_conf->_state = CONFERENCE_STATE_HOLD;
else if (utf8_case_cmp(state_str, "HOLD_REC") == 0)
else if (utf8_case_equal(state_str, "HOLD_REC"))
new_conf->_state = CONFERENCE_STATE_HOLD_RECORD;
return new_conf;
......
......@@ -131,7 +131,7 @@ void change_protocol_cb()
// Only if tabs are not NULL
if (security_tab && advanced_tab) {
if (utf8_case_cmp(protocol, "IAX") == 0) {
if (utf8_case_equal(protocol, "IAX")) {
gtk_widget_hide(security_tab);
gtk_widget_hide(advanced_tab);
} else {
......@@ -433,8 +433,8 @@ cell_edited_cb(GtkCellRendererText *renderer, gchar *path_desc, gchar *text,
gint column = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(renderer), "column"));
DEBUG("path desc in cell_edited_cb: %s\n", text);
if ((utf8_case_cmp(path_desc, "0") == 0) &&
utf8_case_cmp(text, gtk_entry_get_text(GTK_ENTRY(entry_username))) != 0)
if ((utf8_case_equal(path_desc, "0")) &&
!utf8_case_equal(text, gtk_entry_get_text(GTK_ENTRY(entry_username))))
g_signal_handlers_disconnect_by_func(G_OBJECT(entry_username),
G_CALLBACK(update_credential_cb),
NULL);
......@@ -453,7 +453,7 @@ editing_started_cb(GtkCellRenderer *cell UNUSED, GtkCellEditable * editable,
DEBUG("path desc in editing_started_cb: %s\n", path);
// If we are dealing the first row
if (utf8_case_cmp(path, "0") == 0)
if (utf8_case_equal(path, "0"))
gtk_entry_set_text(GTK_ENTRY(editable), gtk_entry_get_text(GTK_ENTRY(entry_password)));
}
......@@ -462,7 +462,7 @@ static void show_advanced_zrtp_options_cb(GtkWidget *widget UNUSED, gpointer dat
account_t *account = (account_t *) data;
gchar *proto = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(key_exchange_combo));
if (utf8_case_cmp(proto, "ZRTP") == 0)
if (utf8_case_equal(proto, "ZRTP"))
show_advanced_zrtp_options(account);
else
show_advanced_sdes_options(account);
......@@ -485,8 +485,8 @@ key_exchange_changed_cb(GtkWidget *widget UNUSED, gpointer data UNUSED)
DEBUG("Key exchange changed %s", active_text);
gboolean sensitive = FALSE;
sensitive |= utf8_case_cmp(active_text, "SDES") == 0;
sensitive |= utf8_case_cmp(active_text, "ZRTP") == 0;
sensitive |= utf8_case_equal(active_text, "SDES");
sensitive |= utf8_case_equal(active_text, "ZRTP");
g_free(active_text);
gtk_widget_set_sensitive(zrtp_button, sensitive);
}
......@@ -922,11 +922,10 @@ GtkWidget* create_published_address(const account_t *account)
// Get the user configuration
if (account) {
use_tls = g_hash_table_lookup(account->properties, TLS_ENABLE);
published_sameas_local = g_hash_table_lookup(account->properties, PUBLISHED_SAMEAS_LOCAL);
if (utf8_case_cmp(published_sameas_local, "true") == 0) {
if (utf8_case_equal(published_sameas_local, "true")) {
published_address = dbus_get_address_from_interface_name(g_hash_table_lookup(account->properties, LOCAL_INTERFACE));
published_port = g_hash_table_lookup(account->properties, LOCAL_PORT);
} else {
......@@ -947,8 +946,8 @@ GtkWidget* create_published_address(const account_t *account)
gtk_table_attach_defaults(GTK_TABLE(table), use_stun_check_box, 0, 1, 0, 1);
g_signal_connect(use_stun_check_box, "toggled", G_CALLBACK(use_stun_cb), NULL);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(use_stun_check_box),
utf8_case_cmp(stun_enable, "true") == 0);
gtk_widget_set_sensitive(use_stun_check_box, utf8_case_cmp(use_tls, "true") != 0);
utf8_case_equal(stun_enable, "true"));
gtk_widget_set_sensitive(use_stun_check_box, !utf8_case_equal(use_tls, "true"));
stun_server_label = gtk_label_new_with_mnemonic(_("STUN server URL"));
gtk_table_attach_defaults(GTK_TABLE(table), stun_server_label, 0, 1, 1, 2);
......@@ -964,7 +963,7 @@ GtkWidget* create_published_address(const account_t *account)
published_addr_radio_button = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(same_as_local_radio_button), _("Set published address and port:"));
gtk_table_attach_defaults(GTK_TABLE(table), published_addr_radio_button, 0, 2, 4, 5);
if (utf8_case_cmp(published_sameas_local, "true") == 0) {
if (utf8_case_equal(published_sameas_local, "true")) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(same_as_local_radio_button), TRUE);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(published_addr_radio_button), FALSE);
} else {
......@@ -1063,7 +1062,7 @@ create_audiocodecs_configuration(const account_t *account)
overrtp = gtk_radio_button_new_with_label(NULL, _("RTP"));
const gchar * const dtmf_type = g_hash_table_lookup(account->properties, ACCOUNT_DTMF_TYPE);
const gboolean dtmf_are_rtp = !utf8_case_cmp(dtmf_type, OVERRTP);
const gboolean dtmf_are_rtp = utf8_case_equal(dtmf_type, OVERRTP);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(overrtp), dtmf_are_rtp);
gtk_table_attach(GTK_TABLE(table), overrtp, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
......@@ -1199,10 +1198,10 @@ static void update_account_from_basic_tab(account_t *account)
gchar* key_exchange = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(key_exchange_combo));
if (utf8_case_cmp(key_exchange, "ZRTP") == 0) {
if (utf8_case_equal(key_exchange, "ZRTP")) {
account_replace(account, ACCOUNT_SRTP_ENABLED, "true");
account_replace(account, ACCOUNT_KEY_EXCHANGE, ZRTP);
} else if (utf8_case_cmp(key_exchange, "SDES") == 0) {
} else if (utf8_case_equal(key_exchange, "SDES")) {
account_replace(account, ACCOUNT_SRTP_ENABLED, "true");
account_replace(account, ACCOUNT_KEY_EXCHANGE, SDES);
} else {
......@@ -1316,7 +1315,7 @@ void show_account_window(account_t *account)
update_account_from_basic_tab(account);
/** @todo Verify if it's the best condition to check */
if (utf8_case_cmp(account->accountID, "new") == 0)
if (utf8_case_equal(account->accountID, "new"))
dbus_add_account(account);
else
dbus_set_account_details(account);
......
......@@ -104,7 +104,7 @@ static void account_store_fill(GtkTreeIter *iter, account_t *a)
g_hash_table_lookup(a->properties, ACCOUNT_ALIAS),
COLUMN_ACCOUNT_TYPE, type,
COLUMN_ACCOUNT_STATUS, account_state_name(a->state),
COLUMN_ACCOUNT_ACTIVE, !utf8_case_cmp(enabled, "true"),
COLUMN_ACCOUNT_ACTIVE, utf8_case_equal(enabled, "true"),
COLUMN_ACCOUNT_DATA, a, -1);
}
......@@ -208,7 +208,7 @@ enable_account_cb(GtkCellRendererToggle *rend UNUSED, gchar* path,
gpointer data)
{
// The IP2IP profile can't be disabled
if (utf8_case_cmp(path, "0") == 0)
if (utf8_case_equal(path, "0"))
return;
// Get pointer on object
......@@ -259,7 +259,7 @@ account_move(gboolean move_up, gpointer data)
// The first real account in the list can't move up because of the IP2IP account
// It can still move down though
if (utf8_case_cmp(path, "1") == 0 && move_up)
if (utf8_case_equal(path, "1") && move_up)
return;
GtkTreePath *tree_path = gtk_tree_path_new_from_string(path);
......
......@@ -444,14 +444,14 @@ addressbook_display(AddressBook_Config *settings, const gchar *field)
{
gboolean display;
if (utf8_case_cmp(field, ADDRESSBOOK_DISPLAY_CONTACT_PHOTO) == 0)
display = (settings->display_contact_photo == 1) ? TRUE : FALSE;
else if (utf8_case_cmp(field, ADDRESSBOOK_DISPLAY_PHONE_BUSINESS) == 0)
display = (settings->search_phone_business == 1) ? TRUE : FALSE;
else if (utf8_case_cmp(field, ADDRESSBOOK_DISPLAY_PHONE_HOME) == 0)
display = (settings->search_phone_home == 1) ? TRUE : FALSE;
else if (utf8_case_cmp(field, ADDRESSBOOK_DISPLAY_PHONE_MOBILE) == 0)
display = (settings->search_phone_mobile == 1) ? TRUE : FALSE;
if (utf8_case_equal(field, ADDRESSBOOK_DISPLAY_CONTACT_PHOTO))
display = settings->display_contact_photo == 1;
else if (utf8_case_equal(field, ADDRESSBOOK_DISPLAY_PHONE_BUSINESS))
display = settings->search_phone_business == 1;
else if (utf8_case_equal(field, ADDRESSBOOK_DISPLAY_PHONE_HOME))
display = settings->search_phone_home == 1;
else if (utf8_case_equal(field, ADDRESSBOOK_DISPLAY_PHONE_MOBILE))
display = settings->search_phone_mobile == 1;
else
display = FALSE;
......
......@@ -145,26 +145,25 @@ static void sip_apply_callback(void)
}
if (account_type == _SIP) {
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_ALIAS), g_strdup((gchar *) gtk_entry_get_text(GTK_ENTRY(wiz->sip_alias))));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_ENABLED), g_strdup("true"));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_MAILBOX), g_strdup((gchar *) gtk_entry_get_text(GTK_ENTRY(wiz->sip_voicemail))));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_TYPE), g_strdup("SIP"));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_HOSTNAME), g_strdup((gchar *) gtk_entry_get_text(GTK_ENTRY(wiz->sip_server))));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_PASSWORD), g_strdup((gchar *) gtk_entry_get_text(GTK_ENTRY(wiz->sip_password))));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_USERNAME), g_strdup((gchar *) gtk_entry_get_text(GTK_ENTRY(wiz->sip_username))));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_SIP_STUN_ENABLED), g_strdup((gchar *)(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wiz->enable)) ? "true":"false")));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_SIP_STUN_SERVER), g_strdup((gchar *) gtk_entry_get_text(GTK_ENTRY(wiz->addr))));
account_insert(current, ACCOUNT_ALIAS, gtk_entry_get_text(GTK_ENTRY(wiz->sip_alias)));
account_insert(current, ACCOUNT_ENABLED, "true");
account_insert(current, ACCOUNT_MAILBOX, gtk_entry_get_text(GTK_ENTRY(wiz->sip_voicemail)));
account_insert(current, ACCOUNT_TYPE, "SIP");
account_insert(current, ACCOUNT_HOSTNAME, gtk_entry_get_text(GTK_ENTRY(wiz->sip_server)));
account_insert(current, ACCOUNT_PASSWORD, gtk_entry_get_text(GTK_ENTRY(wiz->sip_password)));
account_insert(current, ACCOUNT_USERNAME, gtk_entry_get_text(GTK_ENTRY(wiz->sip_username)));
account_insert(current, ACCOUNT_SIP_STUN_ENABLED, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wiz->enable)) ? "true" : "false");
account_insert(current, ACCOUNT_SIP_STUN_SERVER, gtk_entry_get_text(GTK_ENTRY(wiz->addr)));
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wiz->zrtp_enable)) == TRUE) {
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup((gchar *) "true"));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_KEY_EXCHANGE), g_strdup((gchar *) ZRTP));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_ZRTP_DISPLAY_SAS), g_strdup((gchar *) "true"));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_ZRTP_NOT_SUPP_WARNING), g_strdup((gchar *) "true"));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_ZRTP_HELLO_HASH), g_strdup((gchar *) "true"));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_DISPLAY_SAS_ONCE), g_strdup((gchar *) "false"));
account_insert(current, ACCOUNT_SRTP_ENABLED, "true");
account_insert(current, ACCOUNT_KEY_EXCHANGE, ZRTP);
account_insert(current, ACCOUNT_ZRTP_DISPLAY_SAS, "true");
account_insert(current, ACCOUNT_ZRTP_NOT_SUPP_WARNING, "true");
account_insert(current, ACCOUNT_ZRTP_HELLO_HASH, "true");
account_insert(current, ACCOUNT_DISPLAY_SAS_ONCE, "false");
}
// Add default interface info
gchar ** iface_list = NULL;
iface_list = (gchar**) dbus_get_all_ip_interface_by_name();
......@@ -174,9 +173,8 @@ static void sip_apply_callback(void)
iface = iface_list;
DEBUG("Selected interface %s", *iface);
g_hash_table_insert(current->properties, g_strdup(LOCAL_INTERFACE), g_strdup((gchar *) *iface));
g_hash_table_insert(current->properties, g_strdup(PUBLISHED_ADDRESS), g_strdup((gchar *) *iface));
account_insert(current, LOCAL_INTERFACE, *iface);
account_insert(current, PUBLISHED_ADDRESS, *iface);
dbus_add_account(current);
getMessageSummary(gtk_entry_get_text(GTK_ENTRY(wiz->sip_alias)),
......@@ -196,20 +194,19 @@ static void sip_apply_callback(void)
static void iax_apply_callback(void)
{
if (account_type == _IAX) {
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_ALIAS), g_strdup((gchar *) gtk_entry_get_text(GTK_ENTRY(wiz->iax_alias))));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_ENABLED), g_strdup("true"));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_MAILBOX), g_strdup((gchar *) gtk_entry_get_text(GTK_ENTRY(wiz->iax_voicemail))));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_TYPE), g_strdup("IAX"));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_USERNAME), g_strdup((gchar *) gtk_entry_get_text(GTK_ENTRY(wiz->iax_username))));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_HOSTNAME), g_strdup((gchar *) gtk_entry_get_text(GTK_ENTRY(wiz->iax_server))));
g_hash_table_insert(current->properties, g_strdup(ACCOUNT_PASSWORD), g_strdup((gchar *) gtk_entry_get_text(GTK_ENTRY(wiz->iax_password))));
account_insert(current, ACCOUNT_ALIAS, gtk_entry_get_text(GTK_ENTRY(wiz->iax_alias)));
account_insert(current, ACCOUNT_ENABLED, "true");
account_insert(current, ACCOUNT_MAILBOX, gtk_entry_get_text(GTK_ENTRY(wiz->iax_voicemail)));
account_insert(current, ACCOUNT_TYPE, "IAX");
account_insert(current, ACCOUNT_USERNAME, gtk_entry_get_text(GTK_ENTRY(wiz->iax_username)));
account_insert(current, ACCOUNT_HOSTNAME, gtk_entry_get_text(GTK_ENTRY(wiz->iax_server)));
account_insert(current, ACCOUNT_PASSWORD, gtk_entry_get_text(GTK_ENTRY(wiz->iax_password)));
dbus_add_account(current);
getMessageSummary(gtk_entry_get_text(GTK_ENTRY(wiz->iax_alias)),
gtk_entry_get_text(GTK_ENTRY(wiz->iax_server)),
gtk_entry_get_text(GTK_ENTRY(wiz->iax_username)),
FALSE
) ;
FALSE);
gtk_label_set_text(GTK_LABEL(wiz->label_summary), message);
}
......@@ -228,17 +225,13 @@ void build_wizard(void)
return ;
wiz = (struct _wizard*) g_malloc(sizeof(struct _wizard));
current = g_new0(account_t, 1);
current->properties = NULL;
current->properties = dbus_get_account_details(NULL);
current = create_default_account();
if (current->properties == NULL) {
DEBUG("Failed to get default values. Creating from scratch");
current->properties = g_hash_table_new(NULL, g_str_equal);
}
current->accountID = g_strdup("new");
wiz->assistant = gtk_assistant_new();
gtk_window_set_title(GTK_WINDOW(wiz->assistant), _("SFLphone account creation wizard"));
......
......@@ -273,7 +273,7 @@ select_active_input_audio_device()
void
update_device_widget(gchar *pluginName)
{
if (utf8_case_cmp(pluginName, "default") == 0) {
if (utf8_case_equal(pluginName, "default")) {
gtk_widget_set_sensitive(output, FALSE);
gtk_widget_set_sensitive(input, FALSE);
gtk_widget_set_sensitive(ringtone, FALSE);
......@@ -316,7 +316,7 @@ select_active_output_audio_plugin()
do {
gtk_tree_model_get(model, &iter, 0, &pluginname, -1);
if (utf8_case_cmp(tmp, pluginname) == 0) {
if (utf8_case_equal(tmp, pluginname)) {
// Set current iteration the active one
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(plugin), &iter);
return;
......@@ -423,11 +423,11 @@ codec_active_toggled(GtkCellRendererToggle *renderer UNUSED, gchar *path, gpoint
codec_t* codec;
if ((utf8_case_cmp(name,"speex") == 0) && (utf8_case_cmp(srate,"8 kHz") == 0))
if (utf8_case_equal(name,"speex") && utf8_case_equal(srate,"8 kHz"))
codec = codec_list_get_by_payload((gconstpointer) 110, acc->codecs);
else if ((utf8_case_cmp(name,"speex") ==0) && (utf8_case_cmp(srate,"16 kHz") ==0))
else if (utf8_case_equal(name,"speex") && utf8_case_equal(srate,"16 kHz"))
codec = codec_list_get_by_payload((gconstpointer) 111, acc->codecs);
else if ((utf8_case_cmp(name,"speex") ==0) && (utf8_case_cmp(srate,"32 kHz") ==0))
else if (utf8_case_equal(name,"speex") && utf8_case_equal(srate, "32 kHz"))
codec = codec_list_get_by_payload((gconstpointer) 112, acc->codecs);
else
codec = codec_list_get_by_name((gconstpointer) name, acc->codecs);
......
......@@ -157,7 +157,7 @@ GtkWidget* create_hooks_settings()
gtk_table_attach(GTK_TABLE(table), info_bar, 0, 2, 0, 1, GTK_FILL | GTK_EXPAND, GTK_SHRINK, 10, 10);
widg = gtk_check_button_new_with_mnemonic(_("Trigger on specific _SIP header"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widg), (utf8_case_cmp(_urlhook_config->sip_enabled, "true") ==0) ?TRUE:FALSE);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widg), utf8_case_equal(_urlhook_config->sip_enabled, "true"));
g_signal_connect(G_OBJECT(widg) , "clicked" , G_CALLBACK(sip_enabled_cb), NULL);
gtk_table_attach(GTK_TABLE(table), widg, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
......@@ -166,7 +166,7 @@ GtkWidget* create_hooks_settings()
gtk_table_attach(GTK_TABLE(table), field, 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
widg = gtk_check_button_new_with_mnemonic(_("Trigger on _IAX2 URL"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widg), (utf8_case_cmp(_urlhook_config->iax2_enabled, "true") ==0) ?TRUE:FALSE);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widg), utf8_case_equal(_urlhook_config->iax2_enabled, "true"));
g_signal_connect(G_OBJECT(widg) , "clicked" , G_CALLBACK(iax2_enabled_cb), NULL);
gtk_table_attach(GTK_TABLE(table), widg, 0, 2, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
......@@ -183,7 +183,7 @@ GtkWidget* create_hooks_settings()
gtk_widget_show(frame);
widg = gtk_check_button_new_with_mnemonic(_("_Prefix dialed numbers with"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widg), (utf8_case_cmp(_urlhook_config->phone_number_enabled, "true") ==0) ?TRUE:FALSE);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widg), utf8_case_equal(_urlhook_config->phone_number_enabled, "true"));
g_signal_connect(G_OBJECT(widg) , "clicked" , G_CALLBACK(phone_number_enabled_cb), NULL);
gtk_table_attach(GTK_TABLE(table), widg, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
......
......@@ -258,19 +258,19 @@ void show_advanced_tls_options(account_t *account)
GtkWidget * verifyCertificateServer;
verifyCertificateServer = gtk_check_button_new_with_mnemonic(_("Verify incoming certificates, as a server"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(verifyCertificateServer),
utf8_case_cmp(verify_server,"true") == 0);
utf8_case_equal(verify_server, "true"));
gtk_table_attach(GTK_TABLE(table), verifyCertificateServer, 0, 1, 11, 12, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
GtkWidget * verifyCertificateClient;
verifyCertificateClient = gtk_check_button_new_with_mnemonic(_("Verify certificates from answer, as a client"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(verifyCertificateClient),
utf8_case_cmp(verify_client,"true") == 0);
utf8_case_equal(verify_client, "true"));
gtk_table_attach(GTK_TABLE(table), verifyCertificateClient, 0, 1, 12, 13, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
GtkWidget * requireCertificate;
requireCertificate = gtk_check_button_new_with_mnemonic(_("Require certificate for incoming tls connections"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(requireCertificate),
utf8_case_cmp(require_client_certificate,"true") == 0);
utf8_case_equal(require_client_certificate,"true"));
gtk_table_attach(GTK_TABLE(table), requireCertificate, 0, 1, 13, 14, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show_all(ret);
......
......@@ -44,10 +44,10 @@ void show_advanced_zrtp_options(account_t *account)
gboolean curDisplaySasOnce = FALSE;
if (account != NULL) {
curHelloEnabled = !utf8_case_cmp(account_lookup(account, ACCOUNT_ZRTP_HELLO_HASH), "true");
curSasConfirm = !utf8_case_cmp(account_lookup(account, ACCOUNT_ZRTP_DISPLAY_SAS), "true");
curZrtpNotSuppOther = !utf8_case_cmp(account_lookup(account, ACCOUNT_ZRTP_NOT_SUPP_WARNING), "true");
curDisplaySasOnce = !utf8_case_cmp(account_lookup(account, ACCOUNT_DISPLAY_SAS_ONCE), "true");
curHelloEnabled = utf8_case_equal(account_lookup(account, ACCOUNT_ZRTP_HELLO_HASH), "true");
curSasConfirm = utf8_case_equal(account_lookup(account, ACCOUNT_ZRTP_DISPLAY_SAS), "true");
curZrtpNotSuppOther = utf8_case_equal(account_lookup(account, ACCOUNT_ZRTP_NOT_SUPP_WARNING), "true");
curDisplaySasOnce = utf8_case_equal(account_lookup(account, ACCOUNT_DISPLAY_SAS_ONCE), "true");
}
GtkDialog *securityDialog = GTK_DIALOG(gtk_dialog_new_with_buttons(_("ZRTP Options"),
......@@ -114,7 +114,7 @@ void show_advanced_sdes_options(account_t *account)
gboolean rtpFallback = FALSE;
if (account != NULL)
rtpFallback = !utf8_case_cmp(account_lookup(account, ACCOUNT_SRTP_RTP_FALLBACK), "true");
rtpFallback = utf8_case_equal(account_lookup(account, ACCOUNT_SRTP_RTP_FALLBACK), "true");
GtkDialog *securityDialog = GTK_DIALOG(gtk_dialog_new_with_buttons(_("SDES Options"),
GTK_WINDOW(get_main_window()),
......
......@@ -98,9 +98,9 @@ calltab_create_searchbar(calltab_t* tab)
{
g_assert(tab);
if (utf8_case_cmp(tab->_name, HISTORY) == 0)
if (utf8_case_equal(tab->_name, HISTORY))
tab->searchbar = history_searchbar_new();
else if (utf8_case_cmp(tab->_name, CONTACTS) == 0)
else if (utf8_case_equal(tab->_name, CONTACTS))
tab->searchbar = contacts_searchbar_new();
else
ERROR("Current calls tab does not need a searchbar\n");
......
......@@ -292,7 +292,7 @@ row_single_click(GtkTreeView *tree_view UNUSED, void * data UNUSED)
case SRTP_STATE_ZRTP_SAS_UNCONFIRMED:
selectedCall->_srtp_state = SRTP_STATE_ZRTP_SAS_CONFIRMED;
if (utf8_case_cmp(displaySasOnce, "true") == 0)
if (utf8_case_equal(displaySasOnce, "true"))
selectedCall->_zrtp_confirmed = TRUE;
dbus_confirm_sas(selectedCall);
......@@ -595,26 +595,21 @@ calltree_update_call_recursive(calltab_t* tab, callable_obj_t * c, GtkTreeIter *
gchar* srtp_enabled = NULL;
gboolean display_sas = TRUE;
account_t* account_details=NULL;
account_t* account = NULL;
int nbChild = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), parent);
if (c) {
account_details = account_list_get_by_id(c->_accountID);
if (account_details != NULL) {
srtp_enabled = g_hash_table_lookup(account_details->properties, ACCOUNT_SRTP_ENABLED);
account = account_list_get_by_id(c->_accountID);
if (utf8_case_cmp(g_hash_table_lookup(account_details->properties, ACCOUNT_ZRTP_DISPLAY_SAS),"false") == 0)
display_sas = FALSE;
if (account != NULL) {
srtp_enabled = account_lookup(account, ACCOUNT_SRTP_ENABLED);
display_sas = utf8_case_equal(account_lookup(account, ACCOUNT_ZRTP_DISPLAY_SAS), "true");
} else {
GHashTable * properties = sflphone_get_ip2ip_properties();
if (properties != NULL) {
srtp_enabled = g_hash_table_lookup(properties, ACCOUNT_SRTP_ENABLED);
if (utf8_case_cmp(g_hash_table_lookup(properties, ACCOUNT_ZRTP_DISPLAY_SAS),"false") == 0)
display_sas = FALSE;
display_sas = utf8_case_equal(g_hash_table_lookup(properties, ACCOUNT_ZRTP_DISPLAY_SAS), "true");
}
}
}
......@@ -699,12 +694,12 @@ calltree_update_call_recursive(calltab_t* tab, callable_obj_t * c, GtkTreeIter *
pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/lock_certified.svg", NULL);
break;
case SRTP_STATE_UNLOCKED:
if (utf8_case_cmp(srtp_enabled,"true") == 0)
if (utf8_case_equal(srtp_enabled, "true"))
pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/lock_off.svg", NULL);
break;
default:
WARN("Update calltree srtp state #%d- Should not happen!", c->_srtp_state);
if (utf8_case_cmp(srtp_enabled, "true") == 0)
if (utf8_case_equal(srtp_enabled, "true"))
pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/lock_off.svg", NULL);
}
......@@ -812,7 +807,7 @@ void calltree_add_call(calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent)
WARN("Update calltree add - Should not happen!");
}
if (srtp_enabled && utf8_case_cmp(srtp_enabled, "true") == 0)
if (srtp_enabled && utf8_case_equal(srtp_enabled, "true"))
pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/secure_off.svg", NULL);
} else if (tab == contacts_tab)
......@@ -973,7 +968,7 @@ void calltree_add_conference_to_current_calls(conference_obj_t* conf)
else
srtp_enabled = g_hash_table_lookup(account_details->properties, ACCOUNT_SRTP_ENABLED);
if (utf8_case_cmp(srtp_enabled, "true") == 0) {
if (utf8_case_equal(srtp_enabled, "true")) {
DEBUG("Calltree: SRTP enabled for participant %s", call_id);
conf->_conf_srtp_enabled = TRUE;
break;