Revision: 7310
          http://mahogany.svn.sourceforge.net/mahogany/?rev=7310&view=rev
Author:   vadz
Date:     2007-08-04 07:15:56 -0700 (Sat, 04 Aug 2007)

Log Message:
-----------
abort sending the message if any of its attachments couldn't be processed

Modified Paths:
--------------
    trunk/M/src/gui/wxComposeView.cpp

Modified: trunk/M/src/gui/wxComposeView.cpp
===================================================================
--- trunk/M/src/gui/wxComposeView.cpp   2007-08-04 14:11:29 UTC (rev 7309)
+++ trunk/M/src/gui/wxComposeView.cpp   2007-08-04 14:15:56 UTC (rev 7310)
@@ -4282,6 +4282,13 @@
 
    wxFontEncoding encodingMsg = m_encoding;
 
+   // if we find a part which we can't process (probably because it's an
+   // attachment and the corresponding file doesn't exist or can't be read) we
+   // still continue with building the message as we want to give the user the
+   // errors about all such problematic parts instead of giving the error about
+   // the first one, then, after he retries after correcting the problem, about
+   // the second one and so forth
+   bool allPartsOk = true;
    for ( EditorContentPart *part = m_editor->GetFirstPart();
          part;
          part = m_editor->GetNextPart() )
@@ -4380,6 +4387,8 @@
 
          case EditorContentPart::Type_File:
             {
+               bool partOk = false;
+
                String filename = part->GetFileName();
                wxFile file;
                if ( file.Open(filename) )
@@ -4427,6 +4436,8 @@
                             &dlist,
                             &plist
                           );
+
+                     partOk = true;
                   }
                   else if ( flags & Interactive )
                   {
@@ -4441,6 +4452,9 @@
                   wxLogError(_("Cannot open file '%s' included in "
                                "this message!"), filename.c_str());
                }
+
+               if ( !partOk )
+                  allPartsOk = false;
             }
             break;
 
@@ -4488,6 +4502,13 @@
       part->DecRef();
    }
 
+   if ( !allPartsOk )
+   {
+      // we shouldn't send the message without some attachments, abort
+      return NULL;
+   }
+
+
    // setup the headers
    // -----------------
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to