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



lets try this again, but this time without Ctrl-K'ing out the goto
label. *sigh* today is not my day.

Jeff

On Thu, 2003-08-14 at 15:01, Jeffrey Stedfast wrote:
> *sigh* got sidetracked and forgot the whole point of this patch which
> was to append to local Sent if appending to remote Sent failed.
> 
> Here's a new patch.
> 
> Jeff
> 
> On Thu, 2003-08-14 at 12:04, Jeffrey Stedfast wrote:
> > 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
? 45597.patch
? diff
? idate
? idate.c
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.2761.2.12
diff -u -r1.2761.2.12 ChangeLog
--- ChangeLog	14 Aug 2003 16:59:20 -0000	1.2761.2.12
+++ ChangeLog	14 Aug 2003 19:02:31 -0000
@@ -1,3 +1,12 @@
+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. Also, if we fail to
+	append to the account Sent folder, try again with the local Sent
+	folder. Fixes bug #46512.
+
 2003-08-13  Suresh Chandrasekharan <suresh chandrasekharan sun com>
 
 	* e-searching-tokenizer.c (searcher_next_token): Fix for 45818 ( i18n
@@ -35,9 +44,9 @@
 
 2003-08-01  Yuedong Du  <yuedong du sun com>
 
-	* message-browser.c: (on_key_press): close mail message window
+	* message-browser.c (on_key_press): close mail message window
 	using 'ESC' key, fix bug #47087
-                                                                                
+
 2003-07-29  Dan Winship  <danw ximian com>
 
 	* mail-display.c (pixbuf_for_mime_type): Gone
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 19:02:56 -0000
@@ -460,6 +460,8 @@
 	char *sent_folder_uri = NULL;
 	const char *resent_from;
 	CamelFolder *folder;
+	GString *err = NULL;
+	ExceptionId id = 0;
 	XEvolution *xev;
 	int i;
 	
@@ -538,52 +540,72 @@
 	info = camel_message_info_new ();
 	info->flags = CAMEL_MESSAGE_SEEN;
 	
+	if (sent_folder_uri) {
+		folder = mail_tool_uri_to_folder (sent_folder_uri, 0, ex);
+		camel_exception_clear (ex);
+		g_free (sent_folder_uri);
+	}
+	
+	if (!folder) {
+		camel_object_ref (sent_folder);
+		folder = sent_folder;
+	}
+	
 	if (driver) {
 		camel_filter_driver_filter_message (driver, message, info,
 						    NULL, NULL, NULL, "", ex);
 		
 		if (camel_exception_is_set (ex)) {
-			ExceptionId id;
-			
+			/* save this error */
 			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;
+			err = g_string_new (camel_exception_get_description (ex));
+			camel_exception_clear (ex);
 		}
 	}
 	
-	if (sent_folder_uri) {
-		folder = mail_tool_uri_to_folder (sent_folder_uri, 0, NULL);
-		g_free (sent_folder_uri);
-		if (!folder) {
-			/* FIXME */
+ retry_append:
+	camel_folder_append_message (folder, message, info, NULL, ex);
+	if (camel_exception_is_set (ex)) {
+		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);
+		
+		if (folder != sent_folder) {
 			camel_object_ref (sent_folder);
+			camel_object_unref (folder);
 			folder = sent_folder;
+			goto retry_append;
 		}
-	} else {
-		camel_object_ref (sent_folder);
-		folder = sent_folder;
 	}
 	
-	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);
-			camel_exception_setv (ex, id, "%s\n%s", camel_exception_get_description (ex),
-					      _("However, the message was successfully sent."));
+	camel_folder_sync (folder, FALSE, ex);
+	if (camel_exception_is_set (ex)) {
+		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_folder_sync (folder, FALSE, NULL);
-		camel_object_unref (folder);
+		camel_exception_clear (ex);
 	}
 	
+	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]