+2007-05-14 Murray Cumming <murrayc@murrayc.com>
+
+ * src/maemo/easysetup/modest-easysetup-wizard.c: (create_account):
+ * src/maemo/modest-account-settings-dialog.c:
+ (modest_account_settings_dialog_set_account_name),
+ (save_configuration): For the incoming secure authentication checkbox,
+ use PASSWORD for unchecked, and CRAM-MD5 for checked, after I reread
+ the UI specification. PLAIN does not seem to be supported for most IMAP
+ servers anyway, and I am not sure what it would mean.
+ However, we probably need to discover which of the secure-authentication
+ mechanisms are supported by the server, instead of hard-coding CRAM-MD5.
+ * src/modest-account-mgr-helpers.c:
+ (modest_account_mgr_get_server_account_data):
+
+ * src/modest-tny-account.c:
+ (modest_tny_account_new_from_server_account):
+ Use tny_account_set_mech() to set secure-authentication methods,
+ with some special-casing for IMAP, based on my observations of how
+ evolution behaves.
+
+ * src/modest-account-mgr-helpers.h:
+ * src/modest-account-mgr.c:
+ * src/modest-defs.h: Comment that the URI is only used for local folders.
+
2007-05-11 Murray Cumming <murrayc@murrayc.com>
* src/maemo/modest-main-window.c: (on_account_update): Make the gchar*
protocol_security_incoming = modest_serversecurity_combo_box_get_active_serversecurity (
MODEST_SERVERSECURITY_COMBO_BOX (self->combo_incoming_security));
+ /* The UI spec says:
+ * If secure authentication is unchecked, allow sending username and password also as plain text.
+ * If secure authentication is checked, require one of the secure methods during connection: SSL, TLS, CRAM-MD5 etc.
+ * TODO: Do we need to discover which of these (SSL, TLS, CRAM-MD5) is supported?
+ */
protocol_authentication_incoming = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->checkbox_incoming_auth))
- ? MODEST_PROTOCOL_AUTH_PASSWORD
- : MODEST_PROTOCOL_AUTH_NONE;
+ ? MODEST_PROTOCOL_AUTH_CRAMMD5
+ : MODEST_PROTOCOL_AUTH_PASSWORD;
}
gtk_entry_set_text( GTK_ENTRY (dialog->entry_incomingserver),
incoming_account->hostname ? incoming_account->hostname : "");
+ /* The UI spec says:
+ * If secure authentication is unchecked, allow sending username and password also as plain text.
+ * If secure authentication is checked, require one of the secure methods during connection: SSL, TLS, CRAM-MD5 etc.
+ * TODO: Do we need to discover which of these (SSL, TLS, CRAM-MD5) is supported?
+ */
const ModestProtocol secure_auth = modest_server_account_get_secure_auth(
dialog->account_manager, incoming_account->account_name);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (dialog->checkbox_incoming_auth),
- secure_auth == MODEST_PROTOCOL_AUTH_PASSWORD);
+ secure_auth != MODEST_PROTOCOL_AUTH_PASSWORD);
+ /* Note that MODEST_PROTOCOL_AUTH_PLAIN should probably never be used. */
update_incoming_server_title (dialog, incoming_account->proto);
update_incoming_server_security_choices (dialog, incoming_account->proto);
const gchar* password = gtk_entry_get_text (GTK_ENTRY (dialog->entry_user_password));
modest_server_account_set_password (dialog->account_manager, incoming_account_name, password);
+ /* The UI spec says:
+ * If secure authentication is unchecked, allow sending username and password also as plain text.
+ * If secure authentication is checked, require one of the secure methods during connection: SSL, TLS, CRAM-MD5 etc.
+ * TODO: Do we need to discover which of these (SSL, TLS, CRAM-MD5) is supported?
+ */
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_PROTOCOL_AUTH_CRAMMD5
+ : MODEST_PROTOCOL_AUTH_PASSWORD;
modest_server_account_set_secure_auth (dialog->account_manager, incoming_account_name, protocol_authentication_incoming);
const ModestProtocol protocol_security_incoming = modest_serversecurity_combo_box_get_active_serversecurity (
data->last_updated = modest_account_mgr_get_int (self, name, MODEST_ACCOUNT_LAST_UPDATED,TRUE);
- data->password = modest_account_mgr_get_string (self, name, MODEST_ACCOUNT_PASSWORD, TRUE);
- data->uri = modest_account_mgr_get_string (self, name, MODEST_ACCOUNT_URI,TRUE);
+ data->password = modest_account_mgr_get_string (self, name, MODEST_ACCOUNT_PASSWORD, TRUE);
return data;
}
gchar *account_name;
gchar *hostname;
gchar *username;
- gchar *uri;
+ gchar *uri; /*< Only for mbox and maildir accounts. */
ModestProtocol proto; /*< The store or transport. Not ORed. */
gchar *password;
time_t last_updated;
return TRUE;
}
-
+/** modest_account_mgr_add_server_account_uri:
+ * Only used for mbox and maildir accounts.
+ */
gboolean
modest_account_mgr_add_server_account_uri (ModestAccountMgr * self,
const gchar *name, ModestProtocol proto,
#define MODEST_ACCOUNT_USERNAME_HAS_SUCCEEDED "username_succeeded" /* string */
#define MODEST_ACCOUNT_USE_SIGNATURE "use_signature" /* boolean */
#define MODEST_ACCOUNT_SIGNATURE "signature" /* string */
+
+/* Only used for mbox and maildir accounts: */
#define MODEST_ACCOUNT_URI "uri" /* string */
#define MODEST_ACCOUNT_PROTO "proto" /* string */
#define MODEST_ACCOUNT_OPTION_USE_LSUB "use_lsub" /* Show only subscribed folders */
#define MODEST_ACCOUNT_OPTION_CHECK_ALL "check_all" /* Check for new messages in all folders */
-/* TODO: Find how to specify the authentication method with camel.
- * This is just made up stuff - I have no idea if its even possible via options:
-#define MODEST_ACCOUNT_OPTION_AUTH "auth"
-#define MODEST_ACCOUNT_OPTION_AUTH_PLAIN "PLAIN"
-#define MODEST_ACCOUNT_OPTION_AUTH_PASSWORD "PASSWORD"
-#define MODEST_ACCOUNT_OPTION_AUTH_CRAMMD5 "CRAMMD5"
-*/
+
+/* Posssible values for tny_account_set_mech().
+ * These might be camel-specific.
+ * Really, tinymail should use an enum.
+ * camel_sasl_authtype() seems to list some possible values.
+ */
+
+ /* Note that evolution does not offer this for IMAP: */
+#define MODEST_ACCOUNT_AUTH_PLAIN "PLAIN"
+
+/* IMAP uses NULL instead.
+ * Also, not that Evolution offers "Password" for IMAP, but "Login" for SMTP.*/
+#define MODEST_ACCOUNT_AUTH_PASSWORD "LOGIN"
+#define MODEST_ACCOUNT_AUTH_CRAMMD5 "CRAM-MD5"
+
/**
* modest_tny_account_new_from_server_account:
static TnyAccount*
modest_tny_account_new_from_server_account (ModestAccountMgr *account_mgr,
ModestServerAccountData *account_data)
-{
- TnyAccount *tny_account;
-
+{
g_return_val_if_fail (account_mgr, NULL);
g_return_val_if_fail (account_data, NULL);
return NULL;
}
+ TnyAccount *tny_account = NULL;
+
switch (account_data->proto) {
case MODEST_PROTOCOL_TRANSPORT_SENDMAIL:
case MODEST_PROTOCOL_TRANSPORT_SMTP:
/* Proto */
tny_account_set_proto (tny_account,
modest_protocol_info_get_protocol_name(account_data->proto));
-
+
+
+ /* mbox and maildir accounts use a URI instead of the rest: */
if (account_data->uri)
tny_account_set_url_string (TNY_ACCOUNT(tny_account), account_data->uri);
else {
/* Set camel-specific options: */
- /* To enable security settings: */
+ /* Enable secure connection settings: */
const gchar* option_security = NULL;
switch (account_data->security) {
case MODEST_PROTOCOL_SECURITY_NONE:
option_security);
}
- /* To enable secure-auth settings: */
- /* The UI spec says:
- * # If secure authentication is unchecked, allow sending username and password also as plain text.
- * # If secure authentication is checked, require one of the secure methods during connection: SSL, TLS, CRAM-MD5 etc
- */
- /* TODO: Find how to specify the authentication method with camel.
- * This is just made up stuff - I have no idea if its even possible via options:
- const gchar* option_secure_auth = NULL;
+
+ const gchar* auth_mech_name = NULL;
switch (account_data->secure_auth) {
case MODEST_PROTOCOL_AUTH_NONE:
- option_secure_auth = MODEST_ACCOUNT_OPTION_AUTH "= " MODEST_ACCOUNT_OPTION_AUTH_PLAIN;
+ /* IMAP needs at least a password,
+ * which camel uses if we specify NULL.
+ * This setting should never happen anyway. */
+ if (account_data->proto == MODEST_PROTOCOL_STORE_IMAP)
+ auth_mech_name = NULL;
+ else
+ auth_mech_name = MODEST_ACCOUNT_AUTH_PLAIN;
break;
+
case MODEST_PROTOCOL_AUTH_PASSWORD:
- option_secure_auth = MODEST_ACCOUNT_OPTION_AUTH "= " MODEST_ACCOUNT_OPTION_AUTH_PASSWORD;
+ /* Camel use a password for IMAP if we specify NULL,
+ * but will report an error if we use "Password", "Login" or "Plain". */
+ if (account_data->proto == MODEST_PROTOCOL_STORE_IMAP)
+ auth_mech_name = NULL;
+ else
+ auth_mech_name = MODEST_ACCOUNT_AUTH_PASSWORD;
break;
+
case MODEST_PROTOCOL_AUTH_CRAMMD5:
- option_secure_auth = MODEST_ACCOUNT_OPTION_AUTH "= " MODEST_ACCOUNT_OPTION_AUTH_CRAMMD5;
+ auth_mech_name = MODEST_ACCOUNT_AUTH_CRAMMD5;
+
default:
+ g_warning ("%s: Unhandled secure authentication setting for "
+ "account=%s", __FUNCTION__, account_data->account_name);
break;
}
- if(option_secure_auth) {
- tny_camel_account_add_option (TNY_CAMEL_ACCOUNT (tny_account),
- option_secure_auth);
+ if(auth_mech_name) {
+ tny_account_set_mech (tny_account, auth_mech_name);
}
- */
if (account_data->proto == MODEST_PROTOCOL_TYPE_STORE) {
/* Other connection options. Some options are only valid for IMAP