+2007-06-05 Johannes Schmid,,, <jhs@idefix>
+
+ reviewed by: <delete if not using a buddy>
+
+ * src/maemo/easysetup/modest-easysetup-wizard.c:
+ (get_serverport_incoming), (on_before_next), (create_account):
+ * src/maemo/modest-account-settings-dialog.c:
+ (modest_account_settings_dialog_set_account_name):
+ * src/maemo/modest-maemo-utils.c:
+ (on_camel_account_get_supported_secure_authentication_status),
+ (on_camel_account_get_supported_secure_authentication),
+ (on_secure_auth_cancel),
+ (modest_maemo_utils_get_supported_secure_authentication_methods):
+
* please check the svn log instead
+2007-06-05 Johannes Schmid <johannes.schmid@openismus.com>
+
+ * src/maemo/easysetup/modest-easysetup-wizard.c:
+ (get_serverport_incoming), (on_before_next), (create_account):
+ * src/maemo/modest-account-settings-dialog.c:
+ (modest_account_settings_dialog_set_account_name):
+ * src/maemo/modest-maemo-utils.c:
+ (on_camel_account_get_supported_secure_authentication_status),
+ (on_camel_account_get_supported_secure_authentication),
+ (on_secure_auth_cancel),
+ (modest_maemo_utils_get_supported_secure_authentication_methods):
+
+ Implemented security authentication for settings and easysetup.
+
2007-06-05 Murray Cumming <murrayc@murrayc.com>
* src/maemo/modest-main-window.c: (create_details_widget):
static void on_combo_servertype_changed(GtkComboBox *combobox, gpointer user_data);
+static gint get_serverport_incoming(ModestPresetsServerType servertype_incoming,
+ ModestPresetsSecurity security_incoming)
+{
+ int serverport_incoming = 0;
+ /* We don't check for SMTP here as that is impossible for an incoming server. */
+ if (servertype_incoming == MODEST_PRESETS_SERVER_TYPE_IMAP) {
+ serverport_incoming =
+ (security_incoming & MODEST_PRESETS_SECURITY_SECURE_INCOMING_ALTERNATE_PORT) ? 993 : 143;
+ } else if (servertype_incoming == MODEST_PRESETS_SERVER_TYPE_POP) {
+ serverport_incoming =
+ (security_incoming & MODEST_PRESETS_SECURITY_SECURE_INCOMING_ALTERNATE_PORT) ? 995 : 110;
+ }
+ return serverport_incoming;
+}
+
static void
invoke_enable_buttons_vfunc (ModestEasysetupWizardDialog *wizard_dialog)
{
/* Check if the server support secure authentication */
if (gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (account_wizard->checkbox_incoming_auth))) {
-#if 0
const ModestTransportStoreProtocol protocol =
easysetup_servertype_combo_box_get_active_servertype (
EASYSETUP_SERVERTYPE_COMBO_BOX (account_wizard->combo_incoming_servertype));
const gchar* hostname = gtk_entry_get_text(GTK_ENTRY(account_wizard->entry_incomingserver));
- /* FIXME: Get correct port */
-
- int port_num = 22;
+ const ModestConnectionProtocol protocol_security_incoming =
+ modest_serversecurity_combo_box_get_active_serversecurity (
+ MODEST_SERVERSECURITY_COMBO_BOX (
+ account_wizard->combo_incoming_security));
+ int port_num = get_serverport_incoming(protocol, protocol_security_incoming);
GList *list_auth_methods =
modest_maemo_utils_get_supported_secure_authentication_methods (
protocol,
- hostname, port_num, GTK_WINDOW (dialog));
+ hostname, port_num, GTK_WINDOW (account_wizard));
if (list_auth_methods) {
/* TODO: Select the correct method */
g_list_free (list_auth_methods);
gtk_widget_destroy(error_dialog);
return FALSE;
}
-#endif
}
}
TRUE /* incoming */);
g_warning ("security incoming: %x", security_incoming);
-
+
/* We don't check for SMTP here as that is impossible for an incoming server. */
if (servertype_incoming == MODEST_PRESETS_SERVER_TYPE_IMAP) {
protocol_incoming = MODEST_PROTOCOL_STORE_IMAP;
- serverport_incoming =
- (security_incoming & MODEST_PRESETS_SECURITY_SECURE_INCOMING_ALTERNATE_PORT) ? 993 : 143;
} else if (servertype_incoming == MODEST_PRESETS_SERVER_TYPE_POP) {
- protocol_incoming = MODEST_PROTOCOL_STORE_POP;
- serverport_incoming =
- (security_incoming & MODEST_PRESETS_SECURITY_SECURE_INCOMING_ALTERNATE_PORT) ? 995 : 110;
+ protocol_incoming = MODEST_PROTOCOL_STORE_POP;
}
-
+ serverport_incoming = get_serverport_incoming(servertype_incoming, security_incoming);
+
if (security_incoming & MODEST_PRESETS_SECURITY_SECURE_INCOMING)
protocol_security_incoming = MODEST_PROTOCOL_CONNECTION_SSL; /* TODO: Is this what we want? */
* 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?
*/
+ /* Is AUTH_PASSWORD a secure method? We accept AUTH_PASSWORD while
+ saving so we should accept it here, too */
const ModestAuthProtocol 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),
typedef struct
{
gboolean finished;
+ gboolean cancel;
GList *result;
- GtkWidget* banner;
+ GtkWidget* dialog;
+ GtkWidget* progress;
} ModestGetSupportedAuthInfo;
-#if 0
static void on_camel_account_get_supported_secure_authentication_status (
GObject *self, TnyStatus *status, gpointer user_data)
{
-
- printf ("DEBUG: %s.\n", __FUNCTION__);
- ModestGetSupportedAuthInfo* info = (ModestGetSupportedAuthInfo*) user_data;
- GDK_THREADS_ENTER();
- hildon_banner_set_fraction(HILDON_BANNER(info->banner), tny_status_get_fraction(status));
- GDK_THREADS_LEAVE();
+ /*ModestGetSupportedAuthInfo* info = (ModestGetSupportedAuthInfo*) user_data;*/
}
static void
TnyList *auth_types, GError **err,
gpointer user_data)
{
- printf ("DEBUG: %s.\n", __FUNCTION__);
ModestGetSupportedAuthInfo *info = (ModestGetSupportedAuthInfo*)user_data;
g_return_if_fail (info);
printf("DEBUG: finished\n");
info->finished = TRUE; /* We are blocking, waiting for this. */
}
-#endif
+
+static void on_secure_auth_cancel(GtkWidget* dialog, int response, gpointer user_data)
+{
+ ModestGetSupportedAuthInfo *info = (ModestGetSupportedAuthInfo*)user_data;
+ g_return_if_fail(info);
+ /* We are blocking */
+ info->result = NULL;
+ info->cancel = TRUE;
+}
GList* modest_maemo_utils_get_supported_secure_authentication_methods (ModestTransportStoreProtocol proto,
const gchar* hostname, gint port, GtkWindow *parent_window)
{
- return NULL;
-/* FIXME: Activate when changes are merged into tinymail */
-#if 0
g_return_val_if_fail (proto != MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN, NULL);
/*
ModestGetSupportedAuthInfo *info = g_slice_new (ModestGetSupportedAuthInfo);
info->finished = FALSE;
info->result = NULL;
- GtkWidget* progressbar = gtk_progress_bar_new();
- info->banner = hildon_banner_show_progress (GTK_WIDGET(parent_window),
- GTK_PROGRESS_BAR(progressbar),
- _("Checking for supported authentification types"));
- gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progressbar));
+ info->progress = gtk_progress_bar_new();
+ info->dialog = gtk_dialog_new_with_buttons(_("Checking for supported authentication types"),
+ parent_window, GTK_DIALOG_MODAL,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_REJECT,
+ NULL);
+
+ g_signal_connect(G_OBJECT(info->dialog), "response", G_CALLBACK(on_secure_auth_cancel), info);
+ gtk_container_add(GTK_CONTAINER(GTK_DIALOG(info->dialog)->vbox), info->progress);
+ gtk_widget_show(info->progress);
+ gtk_widget_show(info->dialog);
+ gtk_progress_bar_pulse(GTK_PROGRESS_BAR(info->progress));
printf ("DEBUG: %s: STARTING.\n", __FUNCTION__);
tny_camel_account_get_supported_secure_authentication (
/* Block until the callback has been called,
* driving the main context, so that the (idle handler) callback can be
* called, and so that our dialog is clickable: */
- while (!(info->finished)) {
+ while (!(info->finished) && (!info->cancel)) {
gtk_main_iteration_do(FALSE);
}
- gtk_widget_destroy(info->banner);
+ gtk_widget_destroy(info->dialog);
GList *result = info->result;
g_slice_free (ModestGetSupportedAuthInfo, info);
info = NULL;
return result;
-#endif
}