Revision: 7495
          http://mahogany.svn.sourceforge.net/mahogany/?rev=7495&view=rev
Author:   vadz
Date:     2008-07-26 18:48:42 +0000 (Sat, 26 Jul 2008)

Log Message:
-----------
show the headers from the body of the embedded message/rfc822 part instead of 
headers which are part of the top-level message itself and present no interest 
(re-fix for bug 932)

Modified Paths:
--------------
    trunk/M/src/classes/MessageView.cpp

Modified: trunk/M/src/classes/MessageView.cpp
===================================================================
--- trunk/M/src/classes/MessageView.cpp 2008-07-26 18:15:23 UTC (rev 7494)
+++ trunk/M/src/classes/MessageView.cpp 2008-07-26 18:48:42 UTC (rev 7495)
@@ -2030,7 +2030,7 @@
 void MessageView::ShowEmbeddedMessageSeparator()
 {
    if ( m_ProfileValues.decorateEmbedded )
-      ShowTextLine(wxString(80, '_'));
+      ShowTextLine("\r\n" + wxString(80, '_'));
 }
 
 void MessageView::ShowEmbeddedMessageStart(const MimePart& part)
@@ -2040,22 +2040,29 @@
    if ( !m_ProfileValues.showEmbeddedHeaders )
       return;
 
-   const MimePart * const nested = part.GetNested();
-   if ( nested )
+   const wxArrayString
+      displayHeaders = strutil_restore_array(GetHeaderNamesToDisplay());
+   if ( !displayHeaders.empty() )
    {
-      const wxArrayString
-         displayHeaders = strutil_restore_array(GetHeaderNamesToDisplay());
-      if ( !displayHeaders.empty() )
-      {
-         m_viewer->StartHeaders();
+      m_viewer->StartHeaders();
 
-         ViewableInfoFromHeaders vi;
-         ShowMatchingHeaders(nested->GetHeaders(), displayHeaders, &vi);
+      // we need to get the headers of the embedded message, which are not the
+      // headers of MESSAGE/RFC822 part (they're basically limited to just
+      // "Content-Type: message/rfc822") nor the headers of the nested part
+      unsigned long len = 0;
+      const char * const hdrStart = (const char *)part.GetRawContent(&len);
 
-         ShowInfoFromHeaders(vi);
+      // headers are separated from the body by a blank line
+      const char * const hdrEnd = strstr(hdrStart, "\r\n\r\n");
+      if ( hdrEnd )
+         len = hdrEnd - hdrStart + 2; // leave "\r\n" terminating last header
 
-         m_viewer->EndHeaders();
-      }
+      ViewableInfoFromHeaders vi;
+      ShowMatchingHeaders(String(hdrStart, len), displayHeaders, &vi);
+
+      ShowInfoFromHeaders(vi);
+
+      m_viewer->EndHeaders();
    }
 }
 


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 the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to