Re: [Evolution-hackers] Making an email-moving plugin

On Sun, 2016-04-03 at 22:28 +0200, Ángel González wrote:
Where should I begin dealing with it? I have looked at those at the
plugins folder, but none of them seem to do any of the steps I need.

the plugins are sort of an outdated technology in the code, what you
want to do is an EExtension, which are stored in modules/ directory.
You read the CamelFolder and the set of selected messages from an
EMailReader, then you do whatever you want using the CamelFolder API.
In your case of moving the messages between folders you
call camel_folder_transfer_messages_to() or its _sync() variant. You
might want to read the messages first too, to check the headers, which
you can do using camel_folder_get_message().

One of the close changes, regarding message move to other folder, was
done in this [1] commit. You might be interested in the .ui file
changes and in the e-mail-reader.c changes. It is not a module, it's
inside the code, but it shows at least how to easily move messages
between folders and how to get to the list of selected messages.

I do not know which evolution version you target this for, but also
consider using e_shell_view_submit_thread_job(), which helps to run
jobs asynchronously and reports errors to UI, together with a possible
feedback and cancellation capabilities (the used cancallable is a
CamelOperation, through which you can pass the feedback and progress).

With respect of what to extend, one possible type is a MessageList,
though you cannot get directly to the EMailReader from it. You can use
an EMailBrowser type as the extensible target, which is the separate
window showing the message (it also implements the EMailReader
interface), and also EMailPanedView type, which is the one in the Mail
view. You can extend also other types and add your UI elements into the
EMailReader related parts (like shown in [1]), and all of that will be
propagated to all EMailReader descendants/implementations, without you
knowing whom they are at all.

        Hope it helps,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]