Followup on Lemonade: CONDSTORE in camel & camel-lite?

I’ll guide people to how they can help Evolution (and therefore also tinymail) get support for at least certain interesting Lemonade IMAP protocol features. You can all start looking at me to do it for you, but as my todo list just keeps growing and growing, you’ll be looking for a longer time than that it would take you implementing it yourself.

I’ll explain the CONDSTORE capability. CONDSTORE is interesting because the thing that does change about summary of messages are the flags. For example the \Recent and the \Seen flag of your E-mails, change. The CONDSTORE capability makes it possible to quickly synchronize these flags with what you have been storing locally (without having to retrieve all of them one by one again).

In Camel’s camel-imap-folder.c there’s a not-very-difficult implementation for this, called imap_rescan. And in Camel’s camel-imap-store.c you’ll find a static global table called “capabilities”. Simply adding the “CONDSTORE” capability there and putting an if (store->capabilities & IMAP_CAPABILITY_CONDSTORE) { /* your new code */ } else { /* original camel code */ } at that location, would probably be sufficient to actually implement it.

imap_rescan (CamelFolder *folder, int exists, CamelException *ex)

The existing implementation uses a trick to avoid calling the hashtable lookup that I mentioned yesterday. But for a few lookups (only the changed ones since last sync) it’s probably better to simply utilize camel_folder_summary_uid to get the CamelMessageInfo instance for a specific uid. Now use camel_message_info_set_flags on that instance and feed it the new flags which you just received from the server. You even already have the helper functions that turn strings like “\Seen” and “\Recent” into the correct bitfield flags.

If you need to add “(CONDSTORE)” to the “SELECT”-IMAP command: The “SELECT” command is implemented in camel_imap_command (a quick search in the code for “SELECT %F” will do wonders). Just make sure that you only add it in case you have IMAP_CAPABILITY_CONDSTORE in the store->capabilities flags.

So why am I whining about this? Because well, honestly .. not much people are working on this type of things. Yet this is something that both our desktop and mobile devices desperately need.

I decided to link to Camel’s SVN this time because I’m pretty certain that the Evolution Mailer maintainer would accept a good patch that adds support for the CONDSTORE capability. If you are more into experimenting with things that are rather unlikely to go in Evolution’s Camel soon, you can of course join me on experimenting with it in camel-lite. This isn’t a pure isolated fork. I’m trying to extract useful deltas out of those experiments and pushing them upstream. Which takes time on a per-patch basis, of course.

I’m willing to dedicate my entire FOSDEM-time to co-developing Lemonade IMAP support with interested people. I mean, we have developer rooms over there, right? Why not? We can even continue at night if you are not afraid of spending the night coding. Somebody?

In the end, it’s really about “just doing it”.