[Kde-pim] Re: Questions about KMail D-Bus interface

Florian Lindner mailinglists at xgm.de
Tue Jan 25 20:56:01 GMT 2011


Am Dienstag 25 Januar 2011, 00:16:58 schrieb Thomas McGuire:
> Hi,

Hi!

> On Sunday 23 January 2011 10:12:23 Florian Lindner wrote:
> > I'm planning to use a filter to pipe mail to an external program. This
> > script should do actions like creating a folder, setting its attributes
> > and do the final delivery for this e-mail. For controlling kmail I intend
> > to use the d-bus interface.
> > 
> > Regarding that interface and its behavior I have some questions:
> > 
> > - Is there a documentation around?
> 
> No, there is only the source, kmkernel.h/kmkernel.cpp.
> 
> > - Is dbusAddMessage the right place to deliver a message?
> 
> dbusAddMessage is only used to add messages to a folder, which is what the
> mail import tool, KMailCVT uses. Real sending needs something else. I know
> that KOrganizer sends emails, so there is probably a dbus function in
> KMKernel. Also there is the command line program ksendemail, also in the
> KDEPIM package.

I don't want to send an email, just deliver it/put it into to a kmail folder. 
I seems to work with dbusAddMessage. 

> > - How can I abort further processing with kmail? The script should say: I
> > have taken of this message, don't worry. Writing nothing back at stdout
> > does not seem to work.
> 
> Ah, you mean your script is executed as part of a filter? 

Yes, just like bogofilter use to be.

> Maybe add an
> additional header to the mail, then add an additional filter step in KMail
> that aborts processing when it finds that header.

Ok, that sounds good.

> One a side note, most if not all of the dbus interface doesn't exist
> anymore in KMail 2, because there, you don't need KMail running for these
> tasks, you can simply use Akonadi. I guess in this case you need to write
> a small C++ wrapper for adding or sending a mail, and then use that
> wrapper application in a script.

Akonadi won't be offering an d-bus interface?


I am having another problem. As I have mentioned my script is called from a 
filter rule and gets the mail piped. It seems that kmail blocks while the 
script is running. My script dispatches the d-bus call that waits for an 
answer, which never comes... Kmail and my script are waiting for each other to 
finish.
I tried to work around that by dispatching the d-bus called from another 
script which is executed in a seperate process. It works fine when in debug 
mode (kmail active, but mail is piped from the command line) but when called 
from kmail filter the dispatcher process is not called for some reason 
unexplained.

Scripting language is python.

Thanks & Regards,

Florian
_______________________________________________
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