[Kde-pim] mulitpart/alternative & mixed libkmime question.

Volker Krause vkrause at kde.org
Fri Feb 16 10:17:02 GMT 2007


On Thursday, February 15, 2007 11:57:33 PM Ingo Klöcker wrote:
> On Thursday 15 February 2007 23:31, Tom Albers wrote:
> > Hi,
> >
> > I'm trying to *compose* a message with three parts, one plain, one
> > html and one attachment. The plain and html are alternatives to each
> > other and the attachment should be visible for either version...
> >
> > Scenario 1:
> > Create Content A, fill it with plain content
> > Create Content B, fill it with html content
> > Add Content B to A. A will get converted to Mixed, with proper A and
> > B multiparts. Change the Mixed to Alternative.
> > Create Content C, fill it with attachment.
> > Add C to A. libkmime sees it's already a multipart and adds C as
> > third part to the message. Problem: C is not an alternative to A or
> > B. A & B should be in a seperate multipart part and that should be
> > together with C a mixed multipart.
> >
> > Scenario 2:
> > Create Content A. Dont fill it.
> > Create Content B. Fill it with plain.
> > Create Content C. Fill it with html.
> > Add Content C to B. B is converted to Mixed, with proper A and B
> > multiparts. Change the Mixed to Alternative.
> > Add Content B to A. A is converted to Mixed, there will be an extra
> > invalid/invalid part in the message. Create Content C, fill it with
> > attachment,
> > Add C to A, A proper part is added.
> > Problem: There is an invalid/invalid part added to the message. The
> > rest of the message is ok. If i grep that part and delete it from the
> > message, i loose the whole Alternative part. But that is a separate
> > bug.
> >
> > Is anyone able to tell me if either scenario is the right one?
>
> Both scenarios are awkward and obviously broken. IMO the right way
> (which KMime doesn't seem to provide or else you'd use it) is:
> Create Content A, fill it with plain content
> Create Content B, fill it with html content
> Create BodyPart::MultiPart::Alternative and add A and B
> Create Content C, fill it with the attachment
> Create BodyPart::MultiPart::Mixed and add the multipart/alternative and
> C.
>
> Apparently, the complete subtree starting with BodyPart described in
> CLASSTREE.bodyparts seems to be missing from KMime. :-(

Indeed, nothing of this is actually implemented.

From a quick look at the code, a small change to Content::addContent() should 
help: If it is of type mulitpart even without having sub-contents currently, 
it should not convert itself into a sub-content and create a new multipart 
node, but just skip to appending the sub-content.

That should make it possible to get close to Ingo's scenario if you replace 
BodyPart::Mulitpart::... with Content and set its type accordingly.

regards
Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20070216/e8996150/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