aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap4/camel-imap4-store.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@novell.com>2004-07-28 03:38:51 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-07-28 03:38:51 +0800
commit7fcf69af0f8a9019d5114a4741ff1bbf3aa9a3dc (patch)
treef34c5482994fe0ba6c753b0d8ca96ff0bb68c170 /camel/providers/imap4/camel-imap4-store.c
parentfd83a09d5ced1b3a89dcf122e7ec47d5985de062 (diff)
downloadgsoc2013-evolution-7fcf69af0f8a9019d5114a4741ff1bbf3aa9a3dc.tar
gsoc2013-evolution-7fcf69af0f8a9019d5114a4741ff1bbf3aa9a3dc.tar.gz
gsoc2013-evolution-7fcf69af0f8a9019d5114a4741ff1bbf3aa9a3dc.tar.bz2
gsoc2013-evolution-7fcf69af0f8a9019d5114a4741ff1bbf3aa9a3dc.tar.lz
gsoc2013-evolution-7fcf69af0f8a9019d5114a4741ff1bbf3aa9a3dc.tar.xz
gsoc2013-evolution-7fcf69af0f8a9019d5114a4741ff1bbf3aa9a3dc.tar.zst
gsoc2013-evolution-7fcf69af0f8a9019d5114a4741ff1bbf3aa9a3dc.zip
Changed to be the same prototype as engine_queue().
2004-07-27 Jeffrey Stedfast <fejj@novell.com> * providers/imap4/camel-imap4-engine.c (camel_imap4_engine_prequeue): Changed to be the same prototype as engine_queue(). (engine_prequeue_folder_select): Updated. * providers/imap4/camel-imap4-store.c (connect_to_server): Use engine_prequeue() for STARTTLS in case we are reconnecting and already have a command queue. (imap4_try_authenticate): Use prequeue() here too. (imap4_reconnect): Moved all the connect logic in here. (imap4_connect): just lock and call reconnect(). svn path=/trunk/; revision=26748
Diffstat (limited to 'camel/providers/imap4/camel-imap4-store.c')
-rw-r--r--camel/providers/imap4/camel-imap4-store.c46
1 files changed, 22 insertions, 24 deletions
diff --git a/camel/providers/imap4/camel-imap4-store.c b/camel/providers/imap4/camel-imap4-store.c
index 08f7459614..0d47c3252e 100644
--- a/camel/providers/imap4/camel-imap4-store.c
+++ b/camel/providers/imap4/camel-imap4-store.c
@@ -271,7 +271,7 @@ connect_to_server (CamelIMAP4Engine *engine, struct hostent *host, int ssl_mode,
CamelIMAP4Command *ic;
int id;
- ic = camel_imap4_engine_queue (engine, NULL, "STARTTLS\r\n");
+ ic = camel_imap4_engine_prequeue (engine, NULL, "STARTTLS\r\n");
while ((id = camel_imap4_engine_iterate (engine)) < ic->id && id != -1)
;
@@ -423,12 +423,12 @@ imap4_try_authenticate (CamelIMAP4Engine *engine, gboolean reprompt, const char
mech = g_hash_table_lookup (engine->authtypes, service->url->authmech);
sasl = camel_sasl_new ("imap4", mech->authproto, service);
- ic = camel_imap4_engine_queue (engine, NULL, "AUTHENTICATE %s\r\n", service->url->authmech);
+ ic = camel_imap4_engine_prequeue (engine, NULL, "AUTHENTICATE %s\r\n", service->url->authmech);
ic->plus = sasl_auth;
ic->user_data = sasl;
} else {
- ic = camel_imap4_engine_queue (engine, NULL, "LOGIN %S %S\r\n",
- service->url->user, service->url->passwd);
+ ic = camel_imap4_engine_prequeue (engine, NULL, "LOGIN %S %S\r\n",
+ service->url->user, service->url->passwd);
}
while ((id = camel_imap4_engine_iterate (engine)) < ic->id && id != -1)
@@ -459,35 +459,29 @@ imap4_try_authenticate (CamelIMAP4Engine *engine, gboolean reprompt, const char
}
static gboolean
-imap4_connect (CamelService *service, CamelException *ex)
+imap4_reconnect (CamelIMAP4Engine *engine, CamelException *ex)
{
- CamelIMAP4Store *store = (CamelIMAP4Store *) service;
+ CamelService *service = engine->service;
CamelServiceAuthType *mech;
gboolean reprompt = FALSE;
char *errmsg = NULL;
CamelException lex;
- CAMEL_SERVICE_LOCK (store, connect_lock);
-
- if (!connect_to_server_wrapper (store->engine, ex)) {
- CAMEL_SERVICE_UNLOCK (store, connect_lock);
+ if (!connect_to_server_wrapper (engine, ex))
return FALSE;
- }
-#define CANT_USE_AUTHMECH (!(mech = g_hash_table_lookup (store->engine->authtypes, service->url->authmech)))
+#define CANT_USE_AUTHMECH (!(mech = g_hash_table_lookup (engine->authtypes, service->url->authmech)))
if (service->url->authmech && CANT_USE_AUTHMECH) {
/* Oops. We can't AUTH using the requested mechanism */
camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
_("Cannot authenticate to IMAP server %s using %s"),
service->url->host, service->url->authmech);
- CAMEL_SERVICE_UNLOCK (store, connect_lock);
-
return FALSE;
}
camel_exception_init (&lex);
- while (imap4_try_authenticate (store->engine, reprompt, errmsg, &lex)) {
+ while (imap4_try_authenticate (engine, reprompt, errmsg, &lex)) {
g_free (errmsg);
errmsg = g_strdup (lex.desc);
camel_exception_clear (&lex);
@@ -497,24 +491,28 @@ imap4_connect (CamelService *service, CamelException *ex)
if (camel_exception_is_set (&lex)) {
camel_exception_xfer (ex, &lex);
-
- CAMEL_SERVICE_UNLOCK (store, connect_lock);
-
return FALSE;
}
- if (camel_imap4_engine_namespace (store->engine, ex) == -1) {
- CAMEL_SERVICE_UNLOCK (store, connect_lock);
-
+ if (camel_imap4_engine_namespace (engine, ex) == -1)
return FALSE;
- }
-
- CAMEL_SERVICE_UNLOCK (store, connect_lock);
return TRUE;
}
static gboolean
+imap4_connect (CamelService *service, CamelException *ex)
+{
+ gboolean retval;
+
+ CAMEL_SERVICE_LOCK (service, connect_lock);
+ retval = imap4_reconnect (((CamelIMAP4Store *) service)->engine, ex);
+ CAMEL_SERVICE_UNLOCK (service, connect_lock);
+
+ return retval;
+}
+
+static gboolean
imap4_disconnect (CamelService *service, gboolean clean, CamelException *ex)
{
CamelIMAP4Store *store = (CamelIMAP4Store *) service;