aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog9
-rw-r--r--mail/mail-ops.c84
2 files changed, 63 insertions, 30 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index b3dd16eedd..a4969527e6 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -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-18 Jeffrey Stedfast <fejj@ximian.com>
* mail-session.c (main_get_filter_driver): Removed the
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index ecd56c60ed..fcfcdaba9f 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -459,7 +459,8 @@ mail_send_message (CamelMimeMessage *message, const char *destination,
char *transport_url = NULL;
char *sent_folder_uri = NULL;
const char *resent_from;
- CamelFolder *folder;
+ CamelFolder *folder = NULL;
+ GString *err = NULL;
XEvolution *xev;
int i;
@@ -538,52 +539,75 @@ mail_send_message (CamelMimeMessage *message, const char *destination,
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;
-
- 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 (camel_exception_get_id (ex) == CAMEL_EXCEPTION_USER_CANCEL)
+ goto exit;
- camel_message_info_free (info);
- g_free (sent_folder_uri);
-
- return;
+ /* save this error */
+ err = g_string_new ("");
+ g_string_append_printf (err, _("Failed to apply outgoing filters: %s"),
+ camel_exception_get_description (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_exception_clear (ex);
+ camel_folder_append_message (folder, message, info, NULL, ex);
+ if (camel_exception_is_set (ex)) {
+ if (camel_exception_get_id (ex) == CAMEL_EXCEPTION_USER_CANCEL)
+ goto exit;
+
+ if (err == NULL)
+ err = g_string_new ("");
+ else
+ g_string_append (err, "\n\n");
+
+ if (folder != sent_folder) {
+ const char *name;
+
+ camel_object_get (folder, NULL, CAMEL_OBJECT_DESCRIPTION, (char **) &name, 0);
+ g_string_append_printf (err, _("Failed to append to %s: %s\n"
+ "Appending to local `Sent' folder instead."),
+ name, camel_exception_get_description (ex));
camel_object_ref (sent_folder);
+ camel_object_unref (folder);
folder = sent_folder;
+
+ goto retry_append;
+ } else {
+ g_string_append_printf (err, _("Failed to append to local `Sent' folder: %s"),
+ camel_exception_get_description (ex));
}
- } 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, NULL);
- camel_object_unref (folder);
+ if (err != NULL) {
+ /* set the culmulative exception report */
+ camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, err->str);
}
+
+ exit:
+ camel_folder_sync (folder, FALSE, NULL);
camel_message_info_free (info);
+ camel_object_unref (folder);
+
+ if (err != NULL)
+ g_string_free (err, TRUE);
}
/* ********************************************************************** */