email/imap4mtm/imapsession/src/cimapbodystructurebuilder.cpp
changeset 40 224522e33db9
parent 0 72b543305e3a
--- a/email/imap4mtm/imapsession/src/cimapbodystructurebuilder.cpp	Tue Jun 29 23:42:47 2010 +0530
+++ b/email/imap4mtm/imapsession/src/cimapbodystructurebuilder.cpp	Tue Jul 06 22:50:16 2010 +0530
@@ -216,8 +216,16 @@
 				// Found a "MESSAGE/RFC822" body structure.
 				// This contains an embedded bodystructure, so parse up to the structure,
 				// and then allow the loop to parse the embedded structure.
-				ParseBodyTypeMessageRfc822L();
-				parseStep = EParseNewBodyStructure;
+				TRAPD(err, ParseBodyTypeMessageRfc822L());
+				if(err == KErrImapCorrupt)
+				    {
+				parseStep =EParseRemainderMessageRfc822;
+				    }
+				else
+				    {
+                    parseStep = EParseNewBodyStructure;
+				    }
+				
 				}
 				break;
 			case EParseRemainderMessageRfc822:
@@ -520,13 +528,13 @@
 	{
 	// body-fields SP SP body SP body-fld-lines
 	ParseBodyFieldsL();
-	
-	// envelope
-	ParseEnvelopeL();
-	
-	// Expect a body substructure next.
-	// Position iAtomWalker at the opening bracket, ready for ParseBodyStructureTypeL
-	iAtomWalker->WalkAcrossL(ETrue);
+    TRAPD(err, ParseEnvelopeL());
+   
+    // Expect a body substructure next.
+    // Position iAtomWalker at the opening bracket, ready for ParseBodyStructureTypeL
+    iAtomWalker->WalkAcrossL(ETrue);
+    if(err == KErrImapCorrupt)
+        CImapCommand::CorruptDataL(iLogId);
 	}
 
 /**