Revision: 7186
          http://svn.sourceforge.net/mahogany/?rev=7186&view=rev
Author:   vadz
Date:     2006-12-25 07:53:48 -0800 (Mon, 25 Dec 2006)

Log Message:
-----------
added partsToOmit parameter to CreateFromMsg() to allow stripping some MIME 
parts

Modified Paths:
--------------
    trunk/M/include/SendMessage.h
    trunk/M/include/SendMessageCC.h
    trunk/M/src/mail/SendMessageCC.cpp

Modified: trunk/M/include/SendMessage.h
===================================================================
--- trunk/M/include/SendMessage.h       2006-12-25 15:51:29 UTC (rev 7185)
+++ trunk/M/include/SendMessage.h       2006-12-25 15:53:48 UTC (rev 7186)
@@ -89,12 +89,17 @@
 
       @param profile pointer to the profile to use (must be non NULL)
       @param message the original message (can't be NULL)
+      @param protocol which protocol to use for sending
       @param frame the parent window for dialogs, may be NULL
+      @param partsToOmit if non NULL, contains the indices of the MIME parts of
+                         the message (consistent with Message::GetMimePart()
+                         interpretation) to not copy to the new one
     */
    static SendMessage *CreateFromMsg(Profile *profile,
                                      const Message *message,
                                      Protocol protocol = Prot_Default,
-                                     wxFrame *frame = NULL);
+                                     wxFrame *frame = NULL,
+                                     const wxArrayInt *partsToOmit = NULL);
 
    //@}
 

Modified: trunk/M/include/SendMessageCC.h
===================================================================
--- trunk/M/include/SendMessageCC.h     2006-12-25 15:51:29 UTC (rev 7185)
+++ trunk/M/include/SendMessageCC.h     2006-12-25 15:53:48 UTC (rev 7186)
@@ -118,8 +118,7 @@
    SendMessageCC(Profile *profile,
                  Protocol protocol,
                  wxFrame *frame,
-                 const Message *message = NULL,
-                 bool resend = false);
+                 const Message *message = NULL);
 
    /// init the fields for a new message
    void InitNew();
@@ -128,7 +127,7 @@
    void InitResent(const Message *message);
 
    /// init the header and contents from an existing message
-   void InitFromMsg(const Message *message);
+   void InitFromMsg(const Message *message, const wxArrayInt *partsToOmit);
 
    /// common part of InitNew() and InitFromMsg()
    void InitBody();

Modified: trunk/M/src/mail/SendMessageCC.cpp
===================================================================
--- trunk/M/src/mail/SendMessageCC.cpp  2006-12-25 15:51:29 UTC (rev 7185)
+++ trunk/M/src/mail/SendMessageCC.cpp  2006-12-25 15:53:48 UTC (rev 7186)
@@ -217,7 +217,12 @@
                           const Message *message,
                           wxFrame *frame)
 {
-   return new SendMessageCC(profile, Prot_Default, frame, message, true);
+   CHECK( message, NULL, _T("no Message in SendMessage::CreateResent()") );
+
+   SendMessageCC *msg = new SendMessageCC(profile, Prot_Default, frame, 
message);
+   if ( msg )
+      msg->InitResent(message);
+   return msg;
 }
 
 /* static */
@@ -225,11 +230,15 @@
 SendMessage::CreateFromMsg(Profile *profile,
                            const Message *message,
                            Protocol protocol,
-                           wxFrame *frame)
+                           wxFrame *frame,
+                           const wxArrayInt *partsToOmit)
 {
    CHECK( message, NULL, _T("no Message in SendMessage::CreateFromMsg()") );
 
-   return new SendMessageCC(profile, protocol, frame, message, false);
+   SendMessageCC *msg = new SendMessageCC(profile, protocol, frame, message);
+   if ( msg )
+      msg->InitFromMsg(message, partsToOmit);
+   return msg;
 }
 
 SendMessage::~SendMessage()
@@ -243,8 +252,7 @@
 SendMessageCC::SendMessageCC(Profile *profile,
                              Protocol protocol,
                              wxFrame *frame,
-                             const Message *message,
-                             bool resend)
+                             const Message *message)
 {
    m_frame = frame;
    m_encHeaders = wxFONTENCODING_SYSTEM;
@@ -363,18 +371,10 @@
    if ( READ_CONFIG(profile,MP_USEOUTGOINGFOLDER) )
       m_FccList.push_back(new 
String(READ_CONFIG_TEXT(profile,MP_OUTGOINGFOLDER)));
 
-   // finally, special init for resent messages
-   // -----------------------------------------
-
-   if ( message )
+   // initialize the message body, unless it's going to be done by our caller
+   // for resent/cloned messages
+   if ( !message )
    {
-      if ( resend )
-         InitResent(message);
-      else
-         InitFromMsg(message);
-   }
-   else
-   {
       InitNew();
    }
 }
@@ -492,7 +492,7 @@
 }
 
 void
-SendMessageCC::InitFromMsg(const Message *message)
+SendMessageCC::InitFromMsg(const Message *message, const wxArrayInt 
*partsToOmit)
 {
    // the headers must be already encoded in the existing message, don't encode
    // them twice
@@ -569,6 +569,9 @@
    const int count = message->CountParts();
    for(int i = 0; i < count; i++)
    {
+      if ( partsToOmit && partsToOmit->Index(i) != wxNOT_FOUND )
+         continue;
+
       unsigned long len;
       const void *data = message->GetPartContent(i, &len);
       String dispType;


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

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to