aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers/imap')
-rw-r--r--camel/providers/imap/camel-imap-provider.c37
-rw-r--r--camel/providers/imap/camel-imap-store.c37
2 files changed, 37 insertions, 37 deletions
diff --git a/camel/providers/imap/camel-imap-provider.c b/camel/providers/imap/camel-imap-provider.c
index ea41a2ece8..593231a56e 100644
--- a/camel/providers/imap/camel-imap-provider.c
+++ b/camel/providers/imap/camel-imap-provider.c
@@ -28,6 +28,7 @@
#include "camel-provider.h"
#include "camel-session.h"
#include "camel-url.h"
+#include "camel-sasl.h"
static void add_hash (guint *hash, char *s);
static guint imap_url_hash (gconstpointer key);
@@ -48,9 +49,7 @@ static CamelProvider imap_provider = {
CAMEL_URL_NEED_USER | CAMEL_URL_NEED_HOST |
CAMEL_URL_ALLOW_PATH | CAMEL_URL_ALLOW_AUTH,
- { 0, 0 },
-
- NULL
+ /* ... */
};
#if defined (HAVE_NSS) || defined (HAVE_OPENSSL)
@@ -68,30 +67,38 @@ static CamelProvider simap_provider = {
CAMEL_URL_NEED_USER | CAMEL_URL_NEED_HOST |
CAMEL_URL_ALLOW_PATH | CAMEL_URL_ALLOW_AUTH,
- { 0, 0 },
-
- NULL
+ /* ... */
};
#endif /* HAVE_NSS or HAVE_OPENSSL */
+CamelServiceAuthType camel_imap_password_authtype = {
+ N_("Password"),
+
+ N_("This option will connect to the IMAP server using a "
+ "plaintext password."),
+
+ "",
+ TRUE
+};
+
void
camel_provider_module_init (CamelSession *session)
{
imap_provider.object_types[CAMEL_PROVIDER_STORE] =
camel_imap_store_get_type ();
+ imap_provider.service_cache = g_hash_table_new (imap_url_hash, imap_url_equal);
+ imap_provider.authtypes = g_list_concat (camel_remote_store_authtype_list (),
+ camel_sasl_authtype_list ());
+ imap_provider.authtypes = g_list_prepend (imap_provider.authtypes,
+ &camel_imap_password_authtype);
+
+ camel_session_register_provider (session, &imap_provider);
+
#if defined (HAVE_NSS) || defined (HAVE_OPENSSL)
simap_provider.object_types[CAMEL_PROVIDER_STORE] =
camel_imap_store_get_type ();
-#endif
-
- imap_provider.service_cache = g_hash_table_new (imap_url_hash, imap_url_equal);
-
-#if defined (HAVE_NSS) || defined (HAVE_OPENSSL)
simap_provider.service_cache = g_hash_table_new (imap_url_hash, imap_url_equal);
-#endif
-
- camel_session_register_provider (session, &imap_provider);
-#if defined (HAVE_NSS) || defined (HAVE_OPENSSL)
+ simap_provider.authtypes = g_list_copy (imap_provider.authtypes);
camel_session_register_provider (session, &simap_provider);
#endif
}
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 21eb673945..f5dd7ba089 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -63,7 +63,7 @@ static void construct (CamelService *service, CamelSession *session,
CamelException *ex);
static gboolean imap_connect (CamelService *service, CamelException *ex);
static gboolean imap_disconnect (CamelService *service, gboolean clean, CamelException *ex);
-static GList *query_auth_types (CamelService *service, gboolean connect, CamelException *ex);
+static GList *query_auth_types (CamelService *service, CamelException *ex);
static guint hash_folder_name (gconstpointer key);
static gint compare_folder_name (gconstpointer a, gconstpointer b);
static CamelFolder *get_folder (CamelStore *store, const char *folder_name, guint32 flags, CamelException *ex);
@@ -301,42 +301,35 @@ connect_to_server (CamelService *service, CamelException *ex)
return TRUE;
}
-static CamelServiceAuthType password_authtype = {
- N_("Password"),
-
- N_("This option will connect to the IMAP server using a "
- "plaintext password."),
-
- "",
- TRUE
-};
+extern CamelServiceAuthType camel_imap_password_authtype;
static GList *
-query_auth_types (CamelService *service, gboolean connect, CamelException *ex)
+query_auth_types (CamelService *service, CamelException *ex)
{
CamelImapStore *store = CAMEL_IMAP_STORE (service);
CamelServiceAuthType *authtype;
- GList *types, *sasl_types, *t;
+ GList *types, *sasl_types, *t, *next;
- if (connect && !connect_to_server (service, ex))
+ if (!connect_to_server (service, ex))
return NULL;
- types = CAMEL_SERVICE_CLASS (remote_store_class)->query_auth_types (service, connect, ex);
+ types = CAMEL_SERVICE_CLASS (remote_store_class)->query_auth_types (service, ex);
+ if (camel_exception_is_set (ex))
+ return types;
sasl_types = camel_sasl_authtype_list ();
- if (connect) {
- for (t = types; t; t = t->next) {
- authtype = t->data;
+ for (t = sasl_types; t; t = next) {
+ authtype = t->data;
+ next = t->next;
- if (!g_hash_table_lookup (store->authtypes, authtype->authproto)) {
- g_list_remove_link (types, t);
- g_list_free_1 (t);
- }
+ if (!g_hash_table_lookup (store->authtypes, authtype->authproto)) {
+ sasl_types = g_list_remove_link (sasl_types, t);
+ g_list_free_1 (t);
}
}
types = g_list_concat (types, sasl_types);
- return g_list_prepend (types, &password_authtype);
+ return g_list_prepend (types, &camel_imap_password_authtype);
}
/* call refresh folder directly, bypassing the folder lock */