From 9a5762a4de13a23a45ac9b85ff475aaf877cf906 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Wed, 13 Aug 2008 13:00:35 -0400
Subject: [PATCH] #1485242: better handling of situation when message was sent successfully but cannot be saved

---
 program/localization/en_US/messages.inc |    1 +
 program/localization/pl_PL/messages.inc |    3 ++-
 program/steps/mail/sendmail.inc         |   12 +++++++++---
 program/js/app.js                       |    4 ++--
 program/localization/en_GB/messages.inc |    1 +
 5 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index a86f41c..58d1175 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -2206,10 +2206,10 @@
     };
 
 
-  this.sent_successfully = function(msg)
+  this.sent_successfully = function(type, msg)
     {
     this.list_mailbox();
-    this.display_message(msg, 'confirmation', true);
+    this.display_message(msg, type, true);
     }
 
 
diff --git a/program/localization/en_GB/messages.inc b/program/localization/en_GB/messages.inc
index c763d01..8ee5d8e 100644
--- a/program/localization/en_GB/messages.inc
+++ b/program/localization/en_GB/messages.inc
@@ -40,6 +40,7 @@
 $messages['nocontactsfound'] = 'No contacts found';
 $messages['contactnotfound'] = 'The requested contact was not found';
 $messages['sendingfailed'] = 'Failed to send message';
+$messages['errorsavingsent'] = 'An error occured while saving sent message';
 $messages['errorsaving'] = 'An error occured while saving';
 $messages['errormoving'] = 'Could not move the message';
 $messages['errordeleting'] = 'Could not delete the message';
diff --git a/program/localization/en_US/messages.inc b/program/localization/en_US/messages.inc
index d7b3f03..8777bb1 100644
--- a/program/localization/en_US/messages.inc
+++ b/program/localization/en_US/messages.inc
@@ -40,6 +40,7 @@
 $messages['nocontactsfound'] = 'No contacts found';
 $messages['contactnotfound'] = 'The requested contact was not found';
 $messages['sendingfailed'] = 'Failed to send message';
+$messages['errorsavingsent'] = 'An error occured while saving sent message';
 $messages['errorsaving'] = 'An error occured while saving';
 $messages['errormoving'] = 'Could not move the message';
 $messages['errordeleting'] = 'Could not delete the message';
diff --git a/program/localization/pl_PL/messages.inc b/program/localization/pl_PL/messages.inc
index be8d04d..8b52e30 100644
--- a/program/localization/pl_PL/messages.inc
+++ b/program/localization/pl_PL/messages.inc
@@ -45,7 +45,8 @@
 $messages['nocontactsfound'] = 'Nie znaleziono kontaktu!';
 $messages['contactnotfound'] = 'Szukany kontakt nie został odnaleziony';
 $messages['sendingfailed'] = 'Nie udało się wysłać wiadomości!';
-$messages['errorsaving'] = 'Błąd podczas zapisu!';
+$messages['errorsavingsent'] = 'Wystąpił błąd podczas zapisu wysłanej wiadomości!';
+$messages['errorsaving'] = 'Wystąpił błąd podczas zapisu!';
 $messages['errormoving'] = 'Nie można przenieść wybranej wiadomości!';
 $messages['errordeleting'] = 'Nie można usunąć wiadomości!';
 $messages['deletecontactconfirm'] = 'Czy na pewno chcesz usunąć wybrane kontakty?';
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index 090919e..9888c5a 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -377,8 +377,10 @@
     raise_error(array('code' => 800, 'type' => 'imap', 'file' => __FILE__,
                       'message' => "Could not save message in $store_target"), TRUE, FALSE);
     
-    $OUTPUT->show_message('errorsaving', 'error');
-    $OUTPUT->send('iframe');
+    if ($savedraft) {
+      $OUTPUT->show_message('errorsaving', 'error');
+      $OUTPUT->send('iframe');
+      }
     }
 
   if ($olddraftmessageid)
@@ -434,7 +436,11 @@
     }
 
   rcmail_compose_cleanup();
-  $OUTPUT->command('sent_successfully', rcube_label('messagesent'));
+
+  if ($store_folder && !$saved)
+    $OUTPUT->command('sent_successfully', 'error', rcube_label('errorsavingsent'));
+  else
+    $OUTPUT->command('sent_successfully', 'confirmation', rcube_label('messagesent'));
   $OUTPUT->send('iframe');
   }
 

--
Gitblit v1.9.1