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



Author: mcrha
Date: Mon Jul 28 07:19:39 2008
New Revision: 9203
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9203&view=rev

Log:
2008-07-28  Milan Crha  <mcrha redhat com>

	** Fix for bug #349870

	* camel-imap-folder.c: (do_append), (imap_append_online):
	* camel-imap-command.c: (imap_command_start),
	(camel_imap_command_continuation): Do not hide errors, rather
	report them to the caller as expected.



Modified:
   trunk/camel/providers/imap/ChangeLog
   trunk/camel/providers/imap/camel-imap-command.c
   trunk/camel/providers/imap/camel-imap-folder.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	Mon Jul 28 07:19:39 2008
@@ -178,10 +178,17 @@
 		    const char *cmd, CamelException *ex)
 {
 	ssize_t nwritten;
-	
-	g_return_val_if_fail(store->ostream!=NULL, FALSE);
-	g_return_val_if_fail(store->istream!=NULL, FALSE);
-	
+
+	if (!store->ostream) {
+		camel_exception_set (ex, CAMEL_EXCEPTION_STORE_INVALID, _("No output stream"));
+		return FALSE;
+	}
+
+	if (!store->istream) {
+		camel_exception_set (ex, CAMEL_EXCEPTION_STORE_INVALID, _("No input stream"));
+		return FALSE;
+	}
+
 	/* Check for current folder */
 	if (folder && folder != store->current_folder) {
 		CamelImapResponse *response;
@@ -256,9 +263,16 @@
 	if (!camel_imap_store_connected (store, ex))
 		return NULL;
 
-	g_return_val_if_fail(store->ostream!=NULL, NULL);
-	g_return_val_if_fail(store->istream!=NULL, NULL);
-	
+	if (!store->ostream) {
+		camel_exception_set (ex, CAMEL_EXCEPTION_STORE_INVALID, _("No output stream"));
+		return FALSE;
+	}
+
+	if (!store->istream) {
+		camel_exception_set (ex, CAMEL_EXCEPTION_STORE_INVALID, _("No input stream"));
+		return FALSE;
+	}
+
 	if (camel_stream_write (store->ostream, cmd, cmdlen) == -1 ||
 	    camel_stream_write (store->ostream, "\r\n", 2) == -1) {
 		if (errno == EINTR)

Modified: trunk/camel/providers/imap/camel-imap-folder.c
==============================================================================
--- trunk/camel/providers/imap/camel-imap-folder.c	(original)
+++ trunk/camel/providers/imap/camel-imap-folder.c	Mon Jul 28 07:19:39 2008
@@ -1661,6 +1661,9 @@
 	}
 
 	if (*response->status != '+') {
+		if (!camel_exception_is_set (ex))
+			camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Unexpected response status '%s' after APPEND command"), response->status);
+
 		camel_imap_response_free (store, response);
 		g_byte_array_free (ba, TRUE);
 		return NULL;
@@ -1672,8 +1675,12 @@
 
 	/* free it only after message is sent. This may cause more FETCHes. */
 	camel_imap_response_free (store, response);
-	if (!response2)
+	if (!response2) {
+		if (!camel_exception_is_set (ex))
+			camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("No response on continuation after APPEND command"));
+
 		return response2;
+	}
 	
 	if (store->capabilities & IMAP_CAPABILITY_UIDPLUS) {
 		*uid = camel_strstrcase (response2->status, "[APPENDUID ");
@@ -1705,8 +1712,11 @@
 
 	count = camel_folder_summary_count (folder->summary);
 	response = do_append (folder, message, info, &uid, ex);
-	if (!response)
+	if (!response) {
+		if (!camel_exception_is_set (ex))
+			camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("Unknown error occurred during APPEND command!"));
 		return;
+	}
 	
 	if (uid) {
 		/* Cache first, since freeing response may trigger a



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