[Libpst-commits] r63 - trunk

Joseph Nahmias jello at alioth.debian.org
Tue Dec 12 22:20:28 CET 2006


Author: jello
Date: 2006-12-12 22:20:28 +0100 (Tue, 12 Dec 2006)
New Revision: 63

Modified:
   trunk/readpst.c
Log:
Fix format of "From " separator lines in mbox files.
Patch based on input from Nigel Horne.


Modified: trunk/readpst.c
===================================================================
--- trunk/readpst.c	2006-12-11 03:04:00 UTC (rev 62)
+++ trunk/readpst.c	2006-12-12 21:20:28 UTC (rev 63)
@@ -684,24 +684,27 @@
 	}
 	if (item->email->header != NULL) {
 	  char *soh = NULL;  // real start of headers.
+
 	  // some of the headers we get from the file are not properly defined.
 	  // they can contain some email stuff too. We will cut off the header
 	  // when we see a \n\n or \r\n\r\n
-
 	  removeCR(item->email->header);
-
 	  temp = strstr(item->email->header, "\n\n");
-
-	  if (temp != NULL)
+	  if (temp != NULL) {
 	    DEBUG_MAIN(("main: Found body text in header\n"));
-
-	  temp[1] = '\0'; // skip past first \n
+	    temp[1] = '\0'; // stop after first \n
+    }
 	  
-	  if (mode != MODE_SEPERATE)
+    // Now, write out the header...
+	  soh = skip_header_prologue(item->email->header);
+	  if (mode != MODE_SEPERATE) {
 	    // don't put rubbish in if we are doing seperate
-	    fprintf(f->output, "From \"%s\" %s\n", item->email->outlook_sender_name, c_time);
-	  
-	  soh = skip_header_prologue(item->email->header);
+      if ( strncmp(soh, "X-From_: ", 9) == 0 ) {
+        fputs("From ", f->output);
+        soh += 9;
+      } else
+	      fprintf(f->output, "From \"%s\" %s\n", item->email->outlook_sender_name, c_time);
+    }
 	  fprintf(f->output, "%s", soh);
 
 	} else {




More information about the Libpst-commits mailing list