Bug 114923 - mbox import doesn't seem to respect mail status flags of YAM mbox
Summary: mbox import doesn't seem to respect mail status flags of YAM mbox
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Unmaintained
Component: kmailcvt (show other bugs)
Version: unspecified
Platform: Debian testing FreeBSD
: NOR wishlist
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-23 12:04 UTC by Martin Steigerwald
Modified: 2009-03-19 00:30 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Steigerwald 2005-10-23 12:04:06 UTC
Version:           3 (using KDE KDE 3.4.2)
Installed from:    Debian testing/unstable Packages
OS:                FreeBSD

Hello, I imported two mbox files that were created with YAM (http://www.yam.ch), development version 2005-10-12. 

The mails were imported nicely, but KMailCVT does not seem to honour mail status flags. Most emails in this mbox file are marked as being read, but in the newly created MBOX-? folder in KMail all mails are marked as being unread.

As far as I know YAM uses a standard format for mail status flags. Here is an example:

-----------------------------------------------------
From [... email address ...] Mon Sep 17 09:26:09 2001
Status: RO
X-Status: R
Return-path: [...]
Envelope-to: [...]
Delivery-date: Mon, 17 Sep 2001 11:26:09 +0200
Received: [...]
Received: [...]
Message-ID: [...]
From: [...]
To: [...]
Subject: [...]
Date: Mon, 17 Sep 2001 05:26:09 -0400
MIME-Version: 1.0
X-Mailer: [...]
Content-Type: text/plain;
 charset="iso-8859-1"

[mailtext] 
-----------------------------------------------------

(see Status: and X-Status lines, where Status: should be official standard)

This is with:

martin@deepdance:~ -> kmailcvt --version
Qt: 3.3.5
KDE: 3.4.2
KMailCVT: 3

I like KMailCVT to support these flags. I do not like to have every mail I import marked as being unread. Well I read them, even when in a different email application. ;)

Tell me if you need any further information or if you want someone to test mbox import with mail status flags. I have enough test material at hand ;-).

Regards, Martin
Comment 1 Danny Kukawka 2005-10-23 23:23:31 UTC
could you provide all possible Flags for Status/X-Status used by YAM and the mean of the Flag? Please also send me (direct) a testbox with some messages in all known Flags.
Comment 2 Danny Kukawka 2006-08-29 18:40:24 UTC
SVN commit 578568 by dkukawka:

Added support to read X-Status from mails while import mbox 
and set correct state back to the imported mails in KMail

CCBUG:114923



 M  +18 -10    filter_mbox.cxx  


--- branches/KDE/3.5/kdepim/kmailcvt/filter_mbox.cxx #578567:578568
@@ -77,6 +77,7 @@
                 * get Unicode/UTF-email but KMail can't detect the correct charset.
                 */
                 QCString seperate;
+		QString x_status_flag = "";
 
 		/* check if the first line start with "From " (and not "From: ") and discard the line 
 		 * in this case because some IMAP servers (e.g. Cyrus) don't accept this header line */
@@ -89,14 +90,21 @@
 	                tmp.file()->writeBlock( input, l );
 
                 while ( ! mbox.atEnd() &&  (l = mbox.readLine(input.data(),MAX_LINE)) && ((seperate = input.data()).left(5) != "From ")) {
-                       tmp.file()->writeBlock( input, l );
-                       
-                       // workaround to fix hang if a corrupted mbox contains some 
-                       // binary data, for more see bug #106796
-                       if (mbox.at() == filepos)
-                           mbox.at(mbox.size());
-                       else 
-                           filepos = mbox.at();
+			tmp.file()->writeBlock( input, l );
+
+			if ((seperate = input.data()).left(10) == "X-Status: ") {
+				x_status_flag = seperate;
+				x_status_flag.remove("X-Status: ");
+				x_status_flag = x_status_flag.stripWhiteSpace();
+				// qDebug("x_status_flag: %s", x_status_flag.latin1() );		
+			}
+
+			// workaround to fix hang if a corrupted mbox contains some 
+			// binary data, for more see bug #106796
+			if (mbox.at() == filepos)
+			   mbox.at(mbox.size());
+			else 
+			   filepos = mbox.at();
                 }
                 tmp.close();
                 first_msg = false;
@@ -106,9 +114,9 @@
                 * addMessage_fastImport == new function, faster and no check for duplicates
                 */
                 if(info->removeDupMsg)
-                    addMessage( info, folderName, tmp.name() );
+                    addMessage( info, folderName, tmp.name(), x_status_flag );
                 else
-                    addMessage_fastImport( info, folderName, tmp.name() );
+                    addMessage_fastImport( info, folderName, tmp.name(), x_status_flag );
 
                 tmp.unlink();
                 int currentPercentage = (int) ( ( (float) mbox.at() / filenameInfo.size() ) * 100 );
Comment 3 Danny Kukawka 2006-09-08 12:52:15 UTC
*** Bug has been marked as fixed ***.
Comment 4 Martin Steigerwald 2008-03-28 13:42:16 UTC
I finally got around to test this. Appears to work nicely with YAM 2.5 and KMail 1.9.9! Thanks a lot.