camel-imap4 r10 - trunk/imap4
- From: fejj svn gnome org
- To: svn-commits-list gnome org
- Subject: camel-imap4 r10 - trunk/imap4
- Date: Mon, 12 May 2008 14:36:09 +0100 (BST)
Author: fejj
Date: Mon May 12 13:36:08 2008
New Revision: 10
URL: http://svn.gnome.org/viewvc/camel-imap4?rev=10&view=rev
Log:
2008-05-12 Jeffrey Stedfast <fejj novell com>
* camel-imap4-store.c (connect_to_server): Disconnect the engine
if SSL negotiations fail (there's no other way for the engine to
know that failed).
* camel-imap4-engine.c (camel_imap4_engine_disconnect): New
convenience function.
Modified:
trunk/imap4/ChangeLog
trunk/imap4/camel-imap4-engine.c
trunk/imap4/camel-imap4-engine.h
trunk/imap4/camel-imap4-store.c
Modified: trunk/imap4/camel-imap4-engine.c
==============================================================================
--- trunk/imap4/camel-imap4-engine.c (original)
+++ trunk/imap4/camel-imap4-engine.c Mon May 12 13:36:08 2008
@@ -227,14 +227,33 @@
exception:
+ camel_imap4_engine_disconnect (engine);
+
+ return -1;
+}
+
+
+/**
+ * camel_imap4_engine_disconnect:
+ * @engine: IMAP4 engine
+ *
+ * Closes the engine's connection to the IMAP4 server and sets state
+ * to #CAMEL_IMAP4_ENGINE_DISCONNECTED.
+ **/
+void
+camel_imap4_engine_disconnect (CamelIMAP4Engine *engine)
+{
engine->state = CAMEL_IMAP4_ENGINE_DISCONNECTED;
- camel_object_unref (engine->istream);
- engine->istream = NULL;
- camel_object_unref (engine->ostream);
- engine->ostream = NULL;
+ if (engine->istream) {
+ camel_object_unref (engine->istream);
+ engine->istream = NULL;
+ }
- return -1;
+ if (engine->ostream) {
+ camel_object_unref (engine->ostream);
+ engine->ostream = NULL;
+ }
}
@@ -245,7 +264,7 @@
*
* Forces the IMAP4 engine to query the IMAP4 server for a list of capabilities.
*
- * Returns 0 on success or -1 on fail.
+ * Returns %0 on success or %-1 on fail.
**/
int
camel_imap4_engine_capability (CamelIMAP4Engine *engine, CamelException *ex)
@@ -1540,7 +1559,7 @@
* failure and updates the engine state to DISCONNECTED if the stream
* gets disconencted.
*
- * Returns 0 on success or -1 on fail.
+ * Returns %0 on success or %-1 on fail.
**/
int
camel_imap4_engine_next_token (CamelIMAP4Engine *engine, camel_imap4_token_t *token, CamelException *ex)
Modified: trunk/imap4/camel-imap4-engine.h
==============================================================================
--- trunk/imap4/camel-imap4-engine.h (original)
+++ trunk/imap4/camel-imap4-engine.h Mon May 12 13:36:08 2008
@@ -200,6 +200,8 @@
/* returns 0 on success or -1 on error */
int camel_imap4_engine_take_stream (CamelIMAP4Engine *engine, CamelStream *stream, CamelException *ex);
+void camel_imap4_engine_disconnect (CamelIMAP4Engine *engine);
+
int camel_imap4_engine_capability (CamelIMAP4Engine *engine, CamelException *ex);
int camel_imap4_engine_namespace (CamelIMAP4Engine *engine, CamelException *ex);
Modified: trunk/imap4/camel-imap4-store.c
==============================================================================
--- trunk/imap4/camel-imap4-store.c (original)
+++ trunk/imap4/camel-imap4-store.c Mon May 12 13:36:08 2008
@@ -347,6 +347,7 @@
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Failed to connect to IMAP server %s in secure mode: %s"),
service->url->host, _("TLS negotiations failed"));
+ camel_imap4_engine_disconnect (engine);
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]