evolution-data-server r10102 - trunk/camel/providers/imap



Author: mcrha
Date: Thu Feb 26 11:56:32 2009
New Revision: 10102
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=10102&view=rev

Log:
2009-02-26  Milan Crha  <mcrha redhat com>

	** Fix for bug #573240

	* camel-imap-store.c: (camel_imap_store_readline):
	* camel-imap-command.c: (imap_command_start),
	(camel_imap_command_continuation), (imap_read_untagged):
	Do not disconnect on user canceled.



Modified:
   trunk/camel/providers/imap/ChangeLog
   trunk/camel/providers/imap/camel-imap-command.c
   trunk/camel/providers/imap/camel-imap-store.c

Modified: trunk/camel/providers/imap/camel-imap-command.c
==============================================================================
--- trunk/camel/providers/imap/camel-imap-command.c	(original)
+++ trunk/camel/providers/imap/camel-imap-command.c	Thu Feb 26 11:56:32 2009
@@ -232,8 +232,9 @@
 		else
 			camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
 					     g_strerror (errno));
-		
-		camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
+
+		if (g_str_has_prefix (cmd, "LOGIN"))
+			camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
 		return FALSE;
 	}
 	
@@ -275,13 +276,14 @@
 
 	if (camel_stream_write (store->ostream, cmd, cmdlen) == -1 ||
 	    camel_stream_write (store->ostream, "\r\n", 2) == -1) {
-		if (errno == EINTR)
+		if (errno == EINTR) {
 			camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,
 					     _("Operation cancelled"));
-		else
+		} else {
 			camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
 					     g_strerror (errno));
-		camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
+			camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
+		}
 		CAMEL_SERVICE_REC_UNLOCK (store, connect_lock);
 		return NULL;
 	}
@@ -489,13 +491,15 @@
 		
 		do {
 			if ((n = camel_stream_read (store->istream, str->str + nread + 1, length - nread)) == -1) {
-				if (errno == EINTR)
+				if (errno == EINTR) {
 					camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,
 							     _("Operation cancelled"));
-				else
+				} else {
 					camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
 							     g_strerror (errno));
-				camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
+					camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
+				}
+
 				g_string_free (str, TRUE);
 				goto lose;
 			}

Modified: trunk/camel/providers/imap/camel-imap-store.c
==============================================================================
--- trunk/camel/providers/imap/camel-imap-store.c	(original)
+++ trunk/camel/providers/imap/camel-imap-store.c	Thu Feb 26 11:56:32 2009
@@ -3033,14 +3033,16 @@
 	}
 
 	if (nread <= 0) {
-		if (errno == EINTR)
+		if (errno == EINTR) {
 			camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL, _("Operation cancelled"));
-		else
+		} else {
 			camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
 					      _("Server unexpectedly disconnected: %s"),
 					      g_strerror (errno));
 		
-		camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
+			camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
+		}
+
 		g_byte_array_free (ba, TRUE);
 		return -1;
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]