[evolution-patches] fix for bug #46512 (mailer doesn't force messages out of Outbox)



http://bugzilla.ximian.com/show_bug.cgi?id=46512

keeps a tab on all exceptions after the send (if send fails, we abort
immediately, but otherwise keep going even after encountering
exceptions).

at the end, we set an exception that contains all the exceptions
encountered.

Jeff

-- 
Jeffrey Stedfast
Evolution Hacker - Ximian, Inc.
fejj ximian com  - www.ximian.com
? 46512.patch
? ExceptionId
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.2761.2.11
diff -u -r1.2761.2.11 ChangeLog
--- ChangeLog	5 Aug 2003 21:38:19 -0000	1.2761.2.11
+++ ChangeLog	14 Aug 2003 15:59:26 -0000
@@ -1,3 +1,11 @@
+2003-08-14  Jeffrey Stedfast  <fejj ximian com>
+
+	* mail-ops.c (mail_send_message): Don't abort at the first failure
+	after sending (filtering, appending to Sent, syncing). Instead,
+	keep a running tab of exceptions and then set a culmulative
+	exception at the end to report to our caller. Should address bug
+	#46512.
+
 2003-08-05  Not Zed  <NotZed Ximian com>
 
 	** See bug #47224.  Hook onto clicked rather than button_pressed,
Index: mail-ops.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-ops.c,v
retrieving revision 1.392.4.1
diff -u -r1.392.4.1 mail-ops.c
--- mail-ops.c	1 Aug 2003 18:39:01 -0000	1.392.4.1
+++ mail-ops.c	14 Aug 2003 15:59:27 -0000
@@ -459,7 +459,9 @@
 	char *transport_url = NULL;
 	char *sent_folder_uri = NULL;
 	const char *resent_from;
-	CamelFolder *folder;
+	CamelFolder *folder = NULL;
+	GString *err = NULL;
+	ExceptionId id = 0;
 	XEvolution *xev;
 	int i;
 	
@@ -538,29 +540,11 @@
 	info = camel_message_info_new ();
 	info->flags = CAMEL_MESSAGE_SEEN;
 	
-	if (driver) {
-		camel_filter_driver_filter_message (driver, message, info,
-						    NULL, NULL, NULL, "", ex);
-		
-		if (camel_exception_is_set (ex)) {
-			ExceptionId id;
-			
-			id = camel_exception_get_id (ex);
-			camel_exception_setv (ex, id, "%s\n%s", camel_exception_get_description (ex),
-					      _("However, the message was successfully sent."));
-			
-			camel_message_info_free (info);
-			g_free (sent_folder_uri);
-			
-			return;
-		}
-	}
-	
 	if (sent_folder_uri) {
-		folder = mail_tool_uri_to_folder (sent_folder_uri, 0, NULL);
+		folder = mail_tool_uri_to_folder (sent_folder_uri, 0, ex);
+		camel_exception_clear (ex);
 		g_free (sent_folder_uri);
 		if (!folder) {
-			/* FIXME */
 			camel_object_ref (sent_folder);
 			folder = sent_folder;
 		}
@@ -569,21 +553,55 @@
 		folder = sent_folder;
 	}
 	
+	if (driver) {
+		camel_filter_driver_filter_message (driver, message, info,
+						    NULL, NULL, NULL, "", ex);
+		
+		if (camel_exception_is_set (ex)) {
+			/* save this error */
+			id = camel_exception_get_id (ex);
+			err = g_string_new (camel_exception_get_description (ex));
+			camel_exception_clear (ex);
+		}
+	}
+	
 	if (folder) {
 		camel_folder_append_message (folder, message, info, NULL, ex);
 		if (camel_exception_is_set (ex)) {
-			ExceptionId id;
+			id = camel_exception_get_id (ex);
+			if (err != NULL) {
+				g_string_append (err, "\n\n");
+				g_string_append (err, camel_exception_get_description (ex));
+			} else {
+				err = g_string_new (camel_exception_get_description (ex));
+			}
 			
+			camel_exception_clear (ex);
+		}
+		
+		camel_folder_sync (folder, FALSE, ex);
+		if (camel_exception_is_set (ex)) {
 			id = camel_exception_get_id (ex);
-			camel_exception_setv (ex, id, "%s\n%s", camel_exception_get_description (ex),
-					      _("However, the message was successfully sent."));
+			if (err != NULL) {
+				g_string_append (err, "\n\n");
+				g_string_append (err, camel_exception_get_description (ex));
+			} else {
+				err = g_string_new (camel_exception_get_description (ex));
+			}
+			
+			camel_exception_clear (ex);
 		}
 		
-		camel_folder_sync (folder, FALSE, NULL);
 		camel_object_unref (folder);
 	}
 	
 	camel_message_info_free (info);
+	
+	if (err != NULL) {
+		/* set the culmulative exception report */
+		camel_exception_set (ex, id, err->str);
+		g_string_free (err, TRUE);
+	}
 }
 
 /* ********************************************************************** */


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