From: Murray Cumming Date: Tue, 17 Apr 2007 13:34:43 +0000 (+0000) Subject: 2007-04-17 Murray Cumming X-Git-Tag: git_migration_finished~3882 X-Git-Url: http://git.maemo.org/git/?a=commitdiff_plain;ds=sidebyside;h=1fc8fbf2eac83facae2f96b6d84316d747df87ae;p=modest 2007-04-17 Murray Cumming * src/modest-protocol-info.c: * src/modest-protocol-info.h: Added a MODEST_PROTOCOL_AUTH_CRAMMD5 enum value, because it is required by our UI spec. Maybe something in our implementation will use this eventually. * src/maemo/easysetup/modest-easysetup-secureauth-combo-box.c: (easysetup_secureauth_combo_box_fill): Use the CRAM MD5 enum value instead of the previous 0 placeholder. * src/modest-defs.h: Added gconf list pair key names and value strings for the security and secure-auth settings. * src/modest-account-mgr-helpers.h: * src/modest-account-mgr-helpers.c: (modest_server_account_data_get_option_secure_auth), (modest_server_account_set_option_secure_auth), (modest_server_account_data_get_option_security), (modest_server_account_set_option_security): Added this API for getting and setting the security and secure-auth settings. * src/maemo/modest-account-settings-dialog.h: * src/maemo/modest-account-settings-dialog.c: (modest_account_settings_dialog_finalize), (check_data), (on_response): Store the original title as well as the name, to avoid unnececessary warnings about changing titles. (modest_account_settings_dialog_set_account_name): Load the security and secure-auth settings. (save_configuration): Save the security and secure-auth settings. * src/modest-conf.c: (modest_conf_set_list): Get the list after setting it, to show that this is failing sometimes (though reporting success). I fear I may need to debug gconf to fix this. pmo-trunk-r1572 --- diff --git a/ChangeLog2 b/ChangeLog2 index bd04df1..a921a76 100644 --- a/ChangeLog2 +++ b/ChangeLog2 @@ -1,5 +1,35 @@ 2007-04-17 Murray Cumming + * src/modest-protocol-info.c: + * src/modest-protocol-info.h: Added a MODEST_PROTOCOL_AUTH_CRAMMD5 enum value, because it + is required by our UI spec. Maybe something in our implementation will use this eventually. + * src/maemo/easysetup/modest-easysetup-secureauth-combo-box.c: + (easysetup_secureauth_combo_box_fill): Use the CRAM MD5 enum value + instead of the previous 0 placeholder. + + * src/modest-defs.h: Added gconf list pair key names and value strings for the security and + secure-auth settings. + * src/modest-account-mgr-helpers.h: + * src/modest-account-mgr-helpers.c: + (modest_server_account_data_get_option_secure_auth), + (modest_server_account_set_option_secure_auth), + (modest_server_account_data_get_option_security), + (modest_server_account_set_option_security): Added this API for getting and setting the security + and secure-auth settings. + + * src/maemo/modest-account-settings-dialog.h: + * src/maemo/modest-account-settings-dialog.c: + (modest_account_settings_dialog_finalize), (check_data), + (on_response): Store the original title as well as the name, to avoid unnececessary warnings + about changing titles. + (modest_account_settings_dialog_set_account_name): Load the security and secure-auth settings. + (save_configuration): Save the security and secure-auth settings. + + * src/modest-conf.c: (modest_conf_set_list): Get the list after setting it, to show that this + is failing sometimes (though reporting success). I fear I may need to debug gconf to fix this. + +2007-04-17 Murray Cumming + * src/modest-defs.h: * src/modest-account-mgr.c: (modest_account_mgr_add_server_account): diff --git a/src/maemo/easysetup/modest-easysetup-secureauth-combo-box.c b/src/maemo/easysetup/modest-easysetup-secureauth-combo-box.c index 240280a..c900094 100644 --- a/src/maemo/easysetup/modest-easysetup-secureauth-combo-box.c +++ b/src/maemo/easysetup/modest-easysetup-secureauth-combo-box.c @@ -139,9 +139,8 @@ void easysetup_secureauth_combo_box_fill (EasysetupSecureauthComboBox *combobox) gtk_list_store_append (liststore, &iter); gtk_list_store_set (liststore, &iter, MODEL_COL_ID, (gint)MODEST_PROTOCOL_AUTH_PASSWORD, MODEL_COL_NAME, _("mcen_fi_advsetup_smtp_login"), -1); - /* TODO: I can't find a ModestProtocol enum flag for this: */ gtk_list_store_append (liststore, &iter); - gtk_list_store_set (liststore, &iter, MODEL_COL_ID, (gint)0, MODEL_COL_NAME, _("mcen_fi_advsetup_smtp_cram_md5"), -1); + gtk_list_store_set (liststore, &iter, MODEL_COL_ID, (gint)MODEST_PROTOCOL_AUTH_CRAMMD5, MODEL_COL_NAME, _("mcen_fi_advsetup_smtp_cram_md5"), -1); } /** diff --git a/src/maemo/modest-account-settings-dialog.c b/src/maemo/modest-account-settings-dialog.c index 1e37ac5..e487d8a 100644 --- a/src/maemo/modest-account-settings-dialog.c +++ b/src/maemo/modest-account-settings-dialog.c @@ -86,8 +86,11 @@ modest_account_settings_dialog_finalize (GObject *object) { ModestAccountSettingsDialog *self = MODEST_ACCOUNT_SETTINGS_DIALOG (object); - if (self->original_account_name) - g_free (self->original_account_name); + if (self->account_name) + g_free (self->account_name); + + if (self->original_account_title) + g_free (self->original_account_title); if (self->account_manager) g_object_unref (G_OBJECT (self->account_manager)); @@ -573,14 +576,14 @@ static gboolean check_data (ModestAccountSettingsDialog *self) { /* Check that the title is not already in use: */ - const gchar* account_name = gtk_entry_get_text (GTK_ENTRY (self->entry_account_title)); - if ((!account_name) || (strlen(account_name) == 0)) + const gchar* account_title = gtk_entry_get_text (GTK_ENTRY (self->entry_account_title)); + if ((!account_title) || (strlen(account_title) == 0)) return FALSE; /* Should be prevented already anyway. */ - if (strcmp(account_name, self->original_account_name) != 0) { + if (strcmp(account_title, self->original_account_title) != 0) { /* Check the changed title: */ const gboolean name_in_use = modest_account_mgr_account_with_display_name_exists (self->account_manager, - account_name); + account_title); if (name_in_use) { /* Warn the user via a dialog: */ @@ -619,8 +622,6 @@ on_response (GtkDialog *wizard_dialog, ModestAccountSettingsDialog *self = MODEST_ACCOUNT_SETTINGS_DIALOG (wizard_dialog); enable_buttons (self); - /* TODO: Prevent the OK response if the data is invalid. */ - gboolean prevent_response = FALSE; /* Warn about unsaved changes: */ @@ -726,11 +727,12 @@ void modest_account_settings_dialog_set_account_name (ModestAccountSettingsDialo if (!account_name) return; - /* Save the account name so we can refer to it if the user changes it: */ - if (dialog->original_account_name) - g_free (dialog->original_account_name); - dialog->original_account_name = g_strdup (account_name); + /* Save the account name so we can refer to it later: */ + if (dialog->account_name) + g_free (dialog->account_name); + dialog->account_name = g_strdup (account_name); + /* Get the account data for this account name: */ ModestAccountData *account_data = modest_account_mgr_get_account_data (dialog->account_manager, account_name); @@ -738,6 +740,12 @@ void modest_account_settings_dialog_set_account_name (ModestAccountSettingsDialo g_printerr ("modest: failed to get account data for %s\n", account_name); return; } + + /* Save the account title so we can refer to it if the user changes it: */ + if (dialog->original_account_title) + g_free (dialog->original_account_title); + dialog->original_account_title = g_strdup (account_data->display_name); + if (!(account_data->store_account)) { g_printerr ("modest: account has no stores: %s\n", account_name); @@ -771,11 +779,17 @@ void modest_account_settings_dialog_set_account_name (ModestAccountSettingsDialo gtk_entry_set_text( GTK_ENTRY (dialog->entry_incomingserver), incoming_account->hostname ? incoming_account->hostname : ""); - easysetup_serversecurity_combo_box_set_active_serversecurity ( - EASYSETUP_SERVERSECURITY_COMBO_BOX (dialog->combo_incoming_security), incoming_account->proto); + const ModestProtocol secure_auth = modest_server_account_data_get_option_secure_auth(incoming_account); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (dialog->checkbox_incoming_auth), + secure_auth == MODEST_PROTOCOL_AUTH_PASSWORD); + update_incoming_server_title (dialog, incoming_account->proto); update_incoming_server_security_choices (dialog, incoming_account->proto); + const ModestProtocol security = modest_server_account_data_get_option_security (incoming_account); + easysetup_serversecurity_combo_box_set_active_serversecurity ( + EASYSETUP_SERVERSECURITY_COMBO_BOX (dialog->combo_incoming_security), security); + /* TODO: gchar *uri; ModestProtocol proto; @@ -791,36 +805,28 @@ void modest_account_settings_dialog_set_account_name (ModestAccountSettingsDialo gtk_entry_set_text( GTK_ENTRY (dialog->entry_outgoingserver), outgoing_account->hostname ? outgoing_account->hostname : ""); - /* TODO: Dim these if secure authentication is None, as per the UI spec: */ gtk_entry_set_text( GTK_ENTRY (dialog->entry_outgoing_username), outgoing_account->username ? outgoing_account->username : ""); gtk_entry_set_text( GTK_ENTRY (dialog->entry_outgoing_password), outgoing_account->password ? outgoing_account->password : ""); - /* TODO: How do we get the auth setting from the server account struct?: */ - /* This seems to be in ->options, with hard-coded option names. - * This will need new API in ModestAccountMgr. */ + /* Get the secure-auth setting: */ + const ModestProtocol secure_auth = modest_server_account_data_get_option_secure_auth(outgoing_account); easysetup_secureauth_combo_box_set_active_secureauth ( - EASYSETUP_SECUREAUTH_COMBO_BOX (dialog->combo_outgoing_auth), MODEST_PROTOCOL_AUTH_NONE); + EASYSETUP_SECUREAUTH_COMBO_BOX (dialog->combo_outgoing_auth), secure_auth); on_combo_outgoing_auth_changed (GTK_COMBO_BOX (dialog->combo_outgoing_auth), dialog); easysetup_serversecurity_combo_box_fill ( - EASYSETUP_SERVERSECURITY_COMBO_BOX (dialog->combo_outgoing_security), outgoing_account->proto); - - printf("debug: incoming options list=%p\n", incoming_account->options); - printf("debug: outgoing options list=%p\n", outgoing_account->options); - - gchar* debug = modest_server_account_data_get_option_value (incoming_account->options, MODEST_ACCOUNT_OPTION_SSL); - printf("debug: ssl option=X%sX\n", debug); - - gboolean bdebug = modest_server_account_data_get_option_bool (incoming_account->options, MODEST_ACCOUNT_OPTION_USE_LSUB); - printf("debug: ssl option=X%dX\n", bdebug); + EASYSETUP_SERVERSECURITY_COMBO_BOX (dialog->combo_outgoing_security), outgoing_account->proto); + /* Get the security setting: */ + const ModestProtocol security = modest_server_account_data_get_option_security (outgoing_account); + easysetup_serversecurity_combo_box_set_active_serversecurity ( + EASYSETUP_SERVERSECURITY_COMBO_BOX (dialog->combo_outgoing_security), security); /* TODO: set port. */ } - /* TODO: account_data->display_name */ /* account_data->is_enabled, */ /*account_data->is_default, */ @@ -832,9 +838,9 @@ void modest_account_settings_dialog_set_account_name (ModestAccountSettingsDialo static gboolean save_configuration (ModestAccountSettingsDialog *dialog) { - g_assert (dialog->original_account_name); + g_assert (dialog->account_name); - const gchar* account_name = dialog->original_account_name; + const gchar* account_name = dialog->account_name; /* Set the account data from the widgets: */ const gchar* user_name = gtk_entry_get_text (GTK_ENTRY (dialog->entry_user_name)); @@ -848,11 +854,6 @@ save_configuration (ModestAccountSettingsDialog *dialog) MODEST_ACCOUNT_EMAIL, emailaddress, FALSE /* not server account */); if (!test) return FALSE; - - /* TODO: Change name: */ - /* Possibly the account name may never change, but that should be hidden, - * and the display name may change, defaulting to the account name. - */ const gboolean leave_on_server = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->checkbox_leave_messages)); test = modest_account_mgr_set_bool (dialog->account_manager, account_name, @@ -883,15 +884,15 @@ save_configuration (ModestAccountSettingsDialog *dialog) if (!test) return FALSE; - /* TODO: How can we set these in the server account?: - ModestProtocol protocol_authentication_incoming = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->checkbox_incoming_auth)) + const ModestProtocol protocol_authentication_incoming = gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (dialog->checkbox_incoming_auth)) ? MODEST_PROTOCOL_AUTH_PASSWORD : MODEST_PROTOCOL_AUTH_NONE; + modest_server_account_set_option_secure_auth (dialog->account_manager, incoming_account_name, protocol_authentication_incoming); - ModestProtocol protocol_security_incoming = easysetup_serversecurity_combo_box_get_active_serversecurity ( - EASYSETUP_SERVERSECURITY_COMBO_BOX (self->combo_incoming_security)); - - */ + const ModestProtocol protocol_security_incoming = easysetup_serversecurity_combo_box_get_active_serversecurity ( + EASYSETUP_SERVERSECURITY_COMBO_BOX (dialog->combo_incoming_security)); + modest_server_account_set_option_security (dialog->account_manager, incoming_account_name, protocol_security_incoming); g_free (incoming_account_name); @@ -918,13 +919,13 @@ save_configuration (ModestAccountSettingsDialog *dialog) if (!test) return FALSE; - /* TODO: How do we set these in the account data?: - ModestProtocol protocol_security_outgoing = easysetup_serversecurity_combo_box_get_active_serversecurity ( - EASYSETUP_SERVERSECURITY_COMBO_BOX (self->combo_outgoing_security)); + const ModestProtocol protocol_security_outgoing = easysetup_serversecurity_combo_box_get_active_serversecurity ( + EASYSETUP_SERVERSECURITY_COMBO_BOX (dialog->combo_outgoing_security)); + modest_server_account_set_option_security (dialog->account_manager, outgoing_account_name, protocol_security_outgoing); - ModestProtocol protocol_authentication_outgoing = easysetup_secureauth_combo_box_get_active_secureauth ( - EASYSETUP_SECUREAUTH_COMBO_BOX (self->combo_outgoing_auth)); - */ + const ModestProtocol protocol_authentication_outgoing = easysetup_secureauth_combo_box_get_active_secureauth ( + EASYSETUP_SECUREAUTH_COMBO_BOX (dialog->combo_outgoing_auth)); + modest_server_account_set_option_secure_auth (dialog->account_manager, outgoing_account_name, protocol_authentication_outgoing); g_free (outgoing_account_name); diff --git a/src/maemo/modest-account-settings-dialog.h b/src/maemo/modest-account-settings-dialog.h index 5e5912d..6ac8b36 100644 --- a/src/maemo/modest-account-settings-dialog.h +++ b/src/maemo/modest-account-settings-dialog.h @@ -41,7 +41,8 @@ typedef struct { * and to create new accounts: */ ModestAccountMgr *account_manager; - gchar * original_account_name; + gchar * account_name; /* This may not change. It is not user visible. */ + gchar * original_account_title; GtkWidget *page_account_details; GtkWidget *entry_account_title; diff --git a/src/modest-account-mgr-helpers.c b/src/modest-account-mgr-helpers.c index 9cfc252..7533a91 100644 --- a/src/modest-account-mgr-helpers.c +++ b/src/modest-account-mgr-helpers.c @@ -50,7 +50,7 @@ modest_account_mgr_get_enabled (ModestAccountMgr *self, const gchar* name) static gint compare_option_strings_for_name (const gchar* a, const gchar* b) { - printf(" debug: compare_option_strings_for_name():a=%s, b=%s\n", a, b); + /* printf(" debug: compare_option_strings_for_name():a=%s, b=%s\n", a, b); */ const gchar* sep = strchr(a, '='); if (!sep) return -1; @@ -65,7 +65,7 @@ compare_option_strings_for_name (const gchar* a, const gchar* b) memcpy(name, a, len); name[len] = 0; /* Null-termination. */ - printf(" debug: name=%s\n", name); + /* printf(" debug: name=%s\n", name); */ gint result = strcmp (name, b); @@ -118,6 +118,123 @@ modest_server_account_data_get_option_bool (GSList* options_list, const gchar* o return result; } + +ModestProtocol +modest_server_account_data_get_option_secure_auth (ModestServerAccountData *account_data) +{ + ModestProtocol result = MODEST_PROTOCOL_AUTH_NONE; + gchar* value = modest_server_account_data_get_option_value (account_data->options, + MODEST_ACCOUNT_OPTION_SECURE_AUTH); + if (value) { + if (strcmp(value, MODEST_ACCOUNT_OPTION_SECURE_AUTH_VALUE_NONE) == 0) + result = MODEST_PROTOCOL_AUTH_NONE; + else if (strcmp(value, MODEST_ACCOUNT_OPTION_SECURE_AUTH_VALUE_PASSWORD) == 0) + result = MODEST_PROTOCOL_AUTH_PASSWORD; + else if (strcmp(value, MODEST_ACCOUNT_OPTION_SECURE_AUTH_VALUE_CRAMMD5) == 0) + result = MODEST_PROTOCOL_AUTH_CRAMMD5; + + g_free (value); + } + + return result; +} + +void +modest_server_account_set_option_secure_auth (ModestAccountMgr *self, + const gchar* account_name, ModestProtocol secure_auth) +{ + GSList *options_list = modest_account_mgr_get_list (self, account_name, MODEST_ACCOUNT_OPTIONS, + MODEST_CONF_VALUE_STRING, TRUE); + if(options_list) { + /* Remove the item if it exists already: */ + GSList* option = NULL; + do { + option = g_slist_find_custom(options_list, MODEST_ACCOUNT_OPTION_SECURE_AUTH, (GCompareFunc)compare_option_strings_for_name); + if(option) + options_list = g_slist_remove (options_list, option->data); + } while (option); + } + + /* Add the new item to the list: */ + const gchar* str_value = NULL; + if (secure_auth == MODEST_PROTOCOL_AUTH_NONE) + str_value = MODEST_ACCOUNT_OPTION_SECURE_AUTH_VALUE_NONE; + else if (secure_auth == MODEST_PROTOCOL_AUTH_PASSWORD) + str_value = MODEST_ACCOUNT_OPTION_SECURE_AUTH_VALUE_PASSWORD; + else if (secure_auth == MODEST_PROTOCOL_AUTH_CRAMMD5) + str_value = MODEST_ACCOUNT_OPTION_SECURE_AUTH_VALUE_CRAMMD5; + + if (str_value) { + gchar* pair = g_strdup_printf(MODEST_ACCOUNT_OPTION_SECURE_AUTH "=%s", str_value); + options_list = g_slist_append(options_list, pair); + } + + /* Set it in the configuration: */ + modest_account_mgr_set_list (self, account_name, MODEST_ACCOUNT_OPTIONS, options_list, + MODEST_CONF_VALUE_STRING, TRUE); + + /* TODO: Should we free the items too, or just the list? */ + g_slist_free (options_list); +} + +ModestProtocol +modest_server_account_data_get_option_security (ModestServerAccountData *account_data) +{ + ModestProtocol result = MODEST_PROTOCOL_SECURITY_NONE; + gchar* value = modest_server_account_data_get_option_value (account_data->options, + MODEST_ACCOUNT_OPTION_SECURITY); + if (value) { + if (strcmp(value, MODEST_ACCOUNT_OPTION_SECURITY_VALUE_NONE) == 0) + result = MODEST_PROTOCOL_SECURITY_NONE; + else if (strcmp(value, MODEST_ACCOUNT_OPTION_SECURITY_VALUE_NORMAL) == 0) + result = MODEST_PROTOCOL_SECURITY_TLS; + else if (strcmp(value, MODEST_ACCOUNT_OPTION_SECURITY_VALUE_SSL) == 0) + result = MODEST_PROTOCOL_SECURITY_SSL; + + g_free (value); + } + + return result; +} + +void +modest_server_account_set_option_security (ModestAccountMgr *self, + const gchar* account_name, ModestProtocol security) +{ + GSList *options_list = modest_account_mgr_get_list (self, account_name, MODEST_ACCOUNT_OPTIONS, + MODEST_CONF_VALUE_STRING, TRUE); + + if(options_list) { + /* Remove the item if it exists already: */ + GSList* option = NULL; + do { + g_slist_find_custom(options_list, MODEST_ACCOUNT_OPTION_SECURITY, (GCompareFunc)compare_option_strings_for_name); + if(option) + options_list = g_slist_remove (options_list, option->data); + } while(option); + } + + /* Add the new item to the list: */ + const gchar* str_value = NULL; + if (security == MODEST_PROTOCOL_SECURITY_NONE) + str_value = MODEST_ACCOUNT_OPTION_SECURITY_VALUE_NONE; + else if (security == MODEST_PROTOCOL_SECURITY_TLS) + str_value = MODEST_ACCOUNT_OPTION_SECURITY_VALUE_NORMAL; + else if (security == MODEST_PROTOCOL_SECURITY_SSL) + str_value = MODEST_ACCOUNT_OPTION_SECURITY_VALUE_SSL; + + if (str_value) { + gchar* pair = g_strdup_printf(MODEST_ACCOUNT_OPTION_SECURITY "=%s", str_value); + options_list = g_slist_append(options_list, pair); + } + + /* Set it in the configuration: */ + modest_account_mgr_set_list (self, account_name, MODEST_ACCOUNT_OPTIONS, options_list, + MODEST_CONF_VALUE_STRING, TRUE); + + /* TODO: Should we free the items too, or just the list? */ + g_slist_free (options_list); +} gchar* modest_account_mgr_get_server_account_option (ModestAccountMgr *self, diff --git a/src/modest-account-mgr-helpers.h b/src/modest-account-mgr-helpers.h index 1040209..ca4d7c9 100644 --- a/src/modest-account-mgr-helpers.h +++ b/src/modest-account-mgr-helpers.h @@ -137,6 +137,50 @@ gboolean modest_account_mgr_set_enabled (ModestAccountMgr *self, const gchar* na gboolean modest_account_mgr_get_enabled (ModestAccountMgr *self, const gchar* name); /** + * modest_server_account_data_get_option_secure_auth: + * @account_data: a ModestAccountData instance. + * + * Gets the secure authentication method for this server account. + * + * Returns: The secure authentication enum value. + */ +ModestProtocol +modest_server_account_data_get_option_secure_auth (ModestServerAccountData *account_data); + +/** + * modest_server_account_data_get_option_secure_auth: + * @self: a ModestAccountMgr instance + * @secure_auth: The secure authentication enum value. + * + * Gets the secure authentication method for this server account. + */ +void +modest_server_account_set_option_secure_auth (ModestAccountMgr *self, const gchar* account_name, + ModestProtocol secure_auth); + +/** + * modest_server_account_data_get_option_security: + * @account_data: a ModestAccountData instance. + * + * Gets the security method for this server account. + * + * Returns: The security enum value. + */ +ModestProtocol +modest_server_account_data_get_option_security (ModestServerAccountData *account_data); + +/** + * modest_server_account_set_option_security: + * @self: a ModestAccountMgr instance + * @secure_auth: The security enum value. + * + * Gets the security method for this server account. + */ +void +modest_server_account_set_option_security (ModestAccountMgr *self, const gchar* account_name, + ModestProtocol security); + +/** * modest_account_mgr_get_account_option: * @self: a ModestAccountMgr instance * @account_name: the account name to check @@ -144,12 +188,13 @@ gboolean modest_account_mgr_get_enabled (ModestAccountMgr *self, const gchar* na * * Returns: The account option value. This must be freed with g_free(). */ -gchar* modest_account_mgr_get_server_account_option (ModestAccountMgr *self, const gchar* account_name, const gchar* option_name); +gchar* modest_account_mgr_get_server_account_option (ModestAccountMgr *self, + const gchar* account_name, const gchar* option_name); /** * modest_server_account_data_get_option_value: - * @self: a ModestServerAccountData instance - * @account_name: the option name to check + * @options_list: a ModestServerAccountData::options list. + * @option_name: the option name to check * * Returns: The account option value. This must be freed with g_free(). */ @@ -157,8 +202,8 @@ gchar* modest_server_account_data_get_option_value (GSList* options_list, const /** * modest_server_account_data_get_option_bool: - * @self: a ModestServerAccountData instance - * @account_name: the option name to check + * @options_list: a ModestServerAccountData::options list. + * @option_name: the option name to check * * Returns: Whether the account option is present. */ diff --git a/src/modest-conf.c b/src/modest-conf.c index 183ef1b..019b168 100644 --- a/src/modest-conf.c +++ b/src/modest-conf.c @@ -32,6 +32,7 @@ #include #include "modest-conf.h" #include "modest-marshal.h" +#include static void modest_conf_class_init (ModestConfClass *klass); static void modest_conf_init (ModestConf *obj); @@ -319,7 +320,27 @@ modest_conf_set_list (ModestConf* self, const gchar* key, if (*err) return FALSE; - return gconf_client_set_list (priv->gconf_client, key, gconf_type, val, err); + + gboolean result = gconf_client_set_list (priv->gconf_client, key, gconf_type, val, err); + if(*err) { + g_warning("gconf_client_set_list() failed with key=%s. error=%s", key, (*err)->message); + result = FALSE; + } + + /* TODO: Remove this, when we fix the problem: */ + /* This shows that sometimes set_list fails, while saying that it succeeded: */ + if (result) { + const gint debug_list_length_start = g_slist_length(val); + GSList* debug_list = gconf_client_get_list(priv->gconf_client, key, gconf_type, err); + const gint debug_list_length_after = g_slist_length(debug_list); + + if(debug_list_length_start != debug_list_length_after) + g_warning("modest_conf_set_list(): The list length after setting is not the same as the specified list. key=%s", key); + + g_slist_free(debug_list); + } + + return result; } diff --git a/src/modest-defs.h b/src/modest-defs.h index 9da8cd7..bfdcfb4 100644 --- a/src/modest-defs.h +++ b/src/modest-defs.h @@ -110,6 +110,20 @@ #define MODEST_ACCOUNT_AUTH_MECH "auth_mech" /* string */ /* Keys and values used in the text items in the options GSList: */ +#define MODEST_ACCOUNT_OPTION_SECURE_AUTH "secure_auth" +#define MODEST_ACCOUNT_OPTION_SECURE_AUTH_VALUE_NONE "none" +#define MODEST_ACCOUNT_OPTION_SECURE_AUTH_VALUE_PASSWORD "password" +#define MODEST_ACCOUNT_OPTION_SECURE_AUTH_VALUE_CRAMMD5 "cram-md5" + +#define MODEST_ACCOUNT_OPTION_SECURITY "security" +#define MODEST_ACCOUNT_OPTION_SECURITY_VALUE_NONE "none" +#define MODEST_ACCOUNT_OPTION_SECURITY_VALUE_NORMAL "normal" +#define MODEST_ACCOUNT_OPTION_SECURITY_VALUE_SSL "ssl" + + +/* Options keys that correspond directly to camel options. + * These probably should not be written to user configuration, + * because they are specific API implementation details. */ #define MODEST_ACCOUNT_OPTION_SSL "use_ssl" #define MODEST_ACCOUNT_OPTION_SSL_NEVER "never" #define MODEST_ACCOUNT_OPTION_SSL_ALWAYS "always" diff --git a/src/modest-protocol-info.c b/src/modest-protocol-info.c index b9b966d..42584d0 100644 --- a/src/modest-protocol-info.c +++ b/src/modest-protocol-info.c @@ -54,7 +54,8 @@ static const ProtocolInfo ProtocolMap[] = { { MODEST_PROTOCOL_SECURITY_TLS_OP, "tls-op", N_("TLS when possible") }, /* op stands for optional */ { MODEST_PROTOCOL_AUTH_NONE, "none", N_("None") }, - { MODEST_PROTOCOL_AUTH_PASSWORD, "password", N_("Password") } + { MODEST_PROTOCOL_AUTH_PASSWORD, "password", N_("Password") }, + { MODEST_PROTOCOL_AUTH_CRAMMD5, "cram-md5", N_("Cram MD5") } }; const guint PROTOCOL_MAP_SIZE = sizeof(ProtocolMap)/sizeof(ProtocolInfo); diff --git a/src/modest-protocol-info.h b/src/modest-protocol-info.h index de963ba..51e5791 100644 --- a/src/modest-protocol-info.h +++ b/src/modest-protocol-info.h @@ -54,6 +54,7 @@ typedef enum { MODEST_PROTOCOL_AUTH_NONE, MODEST_PROTOCOL_AUTH_PASSWORD, + MODEST_PROTOCOL_AUTH_CRAMMD5, MODEST_PROTOCOL_NUM } ModestProtocol;