[Kde-pim] Messages without body

Ingo Klöcker kloecker at kde.org
Thu Jul 29 20:50:21 BST 2010


On Thursday 29 July 2010, Kevin Krammer wrote:
> Hi all,
> 
> while writing unit tests for item fetching from the MixedMaildir
> store, I've discovered inconsistencies between MBox and Maildir
> regarding messages without body.
> 
> The test data I am testing against has been created with KMail1, its
> the same four messages for both MBox and Maildir.
> I created all of them by sending new messages from one account to
> another,
> 
> For one of them I did not type anything into the main content area of
> the composer.

It seems KMail1 still adds an empty line as body (so it is not possible 
to create a message without body with KMail1). As test I created a 
message without body and a message with a single line of text (but no 
newline). I saved both messages as drafts (the drafts folder is mbox). 
After saving the message without body as draft the drafts mbox ended 
with two empty lines (i.e. in total with three '\n'). After saving the 
message with the single-line body as draft the drafts mbox ended with 
the single-line (i.e. with a single '\n').

Now it gets tricky. If the last message in an mbox file does already end 
with an empty line (which is true for the message without body) then 
KMail1 does not add an extra empty line when appending the next message 
to the mbox file. OTOH, if the last message in an mbox file does not end 
with an empty line then KMail1 does (of course) add an extra empty line 
before appending the next message to the mbox file.

IMO this is a bug in KMail1.


> When reading this message from Maildir, i.e. reading the raw data
> into a bytearray and setting it on a KMime::Message using
> setContent(), the code that checks for the body part (copied from
> the serializer plugin) detects a body [1].
> 
> However, reading the same message from MBox does not.
> (Message::body().isEmpty() == true)
> 
> When looking at the file, the difference seems to be that the Maildir
> file ends in two empty lines, while the MBox file's entry only has
> one (followed by the empty line which separates from the next
> entry).
> 
> I can of course check conditionally in the unittest, i.e. check
> whether the lower level API would have a body and only then QVERIFY
> that the item has one.
> 
> But I first wanted to make sure it is not either a bug in libmaildir,
> libmbox or KMime. [2]

AFAICS there is no bug anywhere in libmaildir, libmbox or KMime. But 
there is the above mentioned inconsistency in KMail1's writing to mbox 
files and there is KMail1's inability to create messages without body 
(even if they later appear to be messages without body when reading them 
from an mbox file due to the former issue).


Regards,
Ingo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20100729/a6b923da/attachment.sig>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-pim mailing list