aboutsummaryrefslogtreecommitdiffstats
path: root/camel
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
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')
-rw-r--r--camel/ChangeLog24
-rw-r--r--camel/providers/imap4/camel-imap4-engine.c34
-rw-r--r--camel/providers/imap4/camel-imap4-engine.h3
-rw-r--r--camel/providers/imap4/camel-imap4-store.c46
4 files changed, 67 insertions, 40 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 67ddb0db3d..59a81546ad 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,11 +1,25 @@
+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().
+
2004-07-27 Sivaiah Nallagatla <snallagatla@novell.com>
- * providers/groupwise/camel-groupwise-provider.c
- (camel_provider_module_init) : do not set
- transport object for groupwise provider. We want user to
- use SMTP itself instead of "Novell Groupwise"
+ Fixes #61454
- Fixes #61454
+ * providers/groupwise/camel-groupwise-provider.c
+ (camel_provider_module_init): do not set
+ transport object for groupwise provider. We want user to
+ use SMTP itself instead of "Novell Groupwise"
2004-07-26 Jeffrey Stedfast <fejj@novell.com>
diff --git a/camel/providers/imap4/camel-imap4-engine.c b/camel/providers/imap4/camel-imap4-engine.c
index 40501ae399..ce5f83e38f 100644
--- a/camel/providers/imap4/camel-imap4-engine.c
+++ b/camel/providers/imap4/camel-imap4-engine.c
@@ -1173,8 +1173,7 @@ engine_prequeue_folder_select (CamelIMAP4Engine *engine)
}
/* we need to pre-queue a SELECT */
- ic = camel_imap4_command_new (engine, ic->folder, "SELECT %F\r\n", ic->folder);
- camel_imap4_engine_prequeue (engine, ic);
+ ic = camel_imap4_engine_prequeue (engine, (CamelFolder *) ic->folder, "SELECT %F\r\n", ic->folder);
ic->user_data = engine;
camel_imap4_command_unref (ic);
@@ -1280,7 +1279,7 @@ camel_imap4_engine_iterate (CamelIMAP4Engine *engine)
* @format: command format
* @Varargs: arguments
*
- * Basically the same as #camel_imap4_command_new() except that this
+ * Basically the same as camel_imap4_command_new() except that this
* function also places the command in the engine queue.
*
* Returns the CamelIMAP4Command.
@@ -1291,6 +1290,8 @@ camel_imap4_engine_queue (CamelIMAP4Engine *engine, CamelFolder *folder, const c
CamelIMAP4Command *ic;
va_list args;
+ g_return_val_if_fail (CAMEL_IS_IMAP4_ENGINE (engine), NULL);
+
va_start (args, format);
ic = camel_imap4_command_newv (engine, (CamelIMAP4Folder *) folder, format, args);
va_end (args);
@@ -1306,17 +1307,26 @@ camel_imap4_engine_queue (CamelIMAP4Engine *engine, CamelFolder *folder, const c
/**
* camel_imap4_engine_prequeue:
* @engine: IMAP4 engine
- * @ic: IMAP4 command to pre-queue
+ * @folder: IMAP4 folder that the command will affect (or %NULL if it doesn't matter)
+ * @format: command format
+ * @Varargs: arguments
+ *
+ * Same as camel_imap4_engine_queue() except this places the new
+ * command at the head of the queue.
*
- * Places @ic at the head of the queue of pending IMAP4 commands.
+ * Returns the CamelIMAP4Command.
**/
-void
-camel_imap4_engine_prequeue (CamelIMAP4Engine *engine, CamelIMAP4Command *ic)
+CamelIMAP4Command *
+camel_imap4_engine_prequeue (CamelIMAP4Engine *engine, CamelFolder *folder, const char *format, ...)
{
- g_return_if_fail (CAMEL_IS_IMAP4_ENGINE (engine));
- g_return_if_fail (ic != NULL);
+ CamelIMAP4Command *ic;
+ va_list args;
- camel_imap4_command_ref (ic);
+ g_return_val_if_fail (CAMEL_IS_IMAP4_ENGINE (engine), NULL);
+
+ va_start (args, format);
+ ic = camel_imap4_command_newv (engine, (CamelIMAP4Folder *) folder, format, args);
+ va_end (args);
if (e_dlist_empty (&engine->queue)) {
e_dlist_addtail (&engine->queue, (EDListNode *) ic);
@@ -1340,6 +1350,10 @@ camel_imap4_engine_prequeue (CamelIMAP4Engine *engine, CamelIMAP4Command *ic)
}
}
}
+
+ camel_imap4_command_ref (ic);
+
+ return ic;
}
diff --git a/camel/providers/imap4/camel-imap4-engine.h b/camel/providers/imap4/camel-imap4-engine.h
index 1dda36ac43..2fdc52e145 100644
--- a/camel/providers/imap4/camel-imap4-engine.h
+++ b/camel/providers/imap4/camel-imap4-engine.h
@@ -194,7 +194,8 @@ int camel_imap4_engine_select_folder (CamelIMAP4Engine *engine, CamelFolder *fol
struct _CamelIMAP4Command *camel_imap4_engine_queue (CamelIMAP4Engine *engine, CamelFolder *folder,
const char *format, ...);
-void camel_imap4_engine_prequeue (CamelIMAP4Engine *engine, struct _CamelIMAP4Command *ic);
+struct _CamelIMAP4Command *camel_imap4_engine_prequeue (CamelIMAP4Engine *engine, CamelFolder *folder,
+ const char *format, ...);
void camel_imap4_engine_dequeue (CamelIMAP4Engine *engine, struct _CamelIMAP4Command *ic);
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;