[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE_3_2_BRANCH: kdepim/kmail
From:       Marc Mutz <Marc.Mutz () uni-bielefeld ! de>
Date:       2004-02-09 17:34:09
Message-ID: 20040209173409.7B7CC9144 () office ! kde ! org
[Download RAW message or body]

CVS commit by mutz: 

>From aegypten_branch: Fix saving of mp/signed parts inside mp/mixed.


  M +27 -3     kmcommands.cpp   1.99.2.3


--- kdepim/kmail/kmcommands.cpp  #1.99.2.2:1.99.2.3
@@ -1875,8 +1875,32 @@ void KMSaveAttachmentsCommand::saveItem(
       {
         QDataStream ds( &file );
-        if( (bSaveEncrypted || !bEncryptedParts) && bSaveWithSig ) {
-          QByteArray cstr = node->msgPart().bodyDecodedBinary();
+        if( bSaveEncrypted || !bEncryptedParts) {
+          partNode *dataNode = node;
+          if( !bSaveWithSig ) {
+            if( DwMime::kTypeMultipart == node->type() &&
+                DwMime::kSubtypeSigned == node->subType() ){
+              // carefully look for the part that is *not* the signature part:
+              if( node->findType( DwMime::kTypeApplication,
+                                  DwMime::kSubtypePgpSignature,
+                                  TRUE, false ) ){
+                dataNode = node->findTypeNot( DwMime::kTypeApplication,
+                                              DwMime::kSubtypePgpSignature,
+                                              TRUE, false );
+              }else if( node->findType( DwMime::kTypeApplication,
+                                        DwMime::kSubtypePkcs7Mime,
+                                  TRUE, false ) ){
+                dataNode = node->findTypeNot( DwMime::kTypeApplication,
+                                              DwMime::kSubtypePkcs7Mime,
+                                              TRUE, false );
+              }else{
+                dataNode = node->findTypeNot( DwMime::kTypeMultipart,
+                                              DwMime::kSubtypeUnknown,
+                                              TRUE, false );
+              }
+            }
+          }
+          QByteArray cstr = dataNode->msgPart().bodyDecodedBinary();
           size_t size = cstr.size();
-          if ( node->msgPart().type() == DwMime::kTypeText ) {
+          if ( dataNode->msgPart().type() == DwMime::kTypeText ) {
             // convert CRLF to LF before writing text attachments to disk
             size = KMFolder::crlf2lf( cstr.data(), size );


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic