[Kde-pim] Design Review: KMime::ContentStrategy

Stephen Kelly steveire at gmail.com
Sat Oct 25 17:43:32 BST 2008


Hi,

While looking into support for inline images in kmail (rfc2557,
multipart/related), I saw a lot of comments since 2001 that kmail would be
ported to kmime 'soon'. Instead of learning to use mimelib to create
multipart/related messages, I've been looking into using kmime instead.

As part of that I've been thinking about some convenience classes for client
applications to use kmime (Armed again with my design patterns book). The
result is in svn here:

http://websvn.kde.org/trunk/playground/pim/kmimecontentstrategy 

It requires a quick and dirty work-in-progress patch to kdepimlibs/kmime.

The idea is to allow chaining of strategies for building a mime message.
Different parts can be added to the message with a EncryptionStrategy,
and/or a SigningStrategy, CompressionStrategy etc. There are examples in
mailclient.cpp. Attachments, Related and Alternatives are also handled with
strategies. It should make kmails code for composing messages much simpler.

I haven't yet looked into how the encryption and signing jobs currently in
kmail work. I imagine they do their work in worker threads. I think this
design also allows for all that. I also haven't looked into writing the
CompressionStrategy yet.

The KMime patch adds a class for Content-Location headers, which doesn't
work. Anyone know why? 

The dirty part of it is this it adds a replaceContent method to the Content
class. I know it doesn't handle most headers that it would need to, but I
just wanted to test my new classes. A better name for it might be
setContent(Content*). The reason for it is that the way I designed
ContentStrategy doesn't really fit with content->addContent which has the
side effect of making content multipart/mixed. 


Any thoughts or better ideas?


Steve.


_______________________________________________
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