[PATCH] Make flags a set rather than a list

Sebastian Spaeth Sebastian at SSpaeth.de
Wed Aug 17 11:31:56 BST 2011

On Tue, 16 Aug 2011 12:58:14 +0200, Vincent Beffara <vbeffara at ens-lyon.fr> wrote:
> Just one quick question. There are these two methods,
> SS> def flagsimap2maildir(flagstring):
> SS> def flagsmaildir2imap(maildirflaglist):
> mapping from a list to a string representation, using a flagmap. To get
> compatibility with Gnus, there is a hack somewhere on the web replacing
> these two functions with essentially identical copies using a different
> flag map. Your patch will break that hack.
> But that's ok. I'm not complaining about that, I can adapt it ...

Hi Vincent. Rather than patching OfflineImap, why don't we integrate the
GNUs compatability work upstream? I have not seen such a different flag
map, but compatability with other systems sounds good to me.

> As you are going down that road, I seem to remember (no time to check
> right now) that the flags are stored in the status file as exactly that
> string. Any plan to store the set() of flags instead (it should be
> picklable) ? Then these two functions would never be used in the
> IMAP<->IMAP case, which feels a bit simpler.

You are right that we use these to store flags as a single-character list
in the status file. While it would be more useful to directly pickle the
set, *I* don't feel the need to modify the working plain text status
cache, breaking compatability with older versions. Rather, I would like
to store the flag values directly in the newer sqlite status cache,
which I believe is what the majority should be using.

We will still be needing those functions in any case, as they are used
to store the flags in the Maildir file names of emails. (and I have no
idea, if and how we should be encoding additional flags there, yet)
> If not (or in parallel), would it be easy to make the flagmap
> configurable (to add something like ('gnus-expirable', 'E') to it) ? Or
> would it make sense to even add 'E' in the source by default, it
> shouldn't hurt anyone ?

As I said, feel free to propose changes to the upstream flag
list. Personally, I think we could be using a user-configurable mapping,
that allows us to map single characters to IMAP flags, e.g. people might
want to use 
IMAPFLAG_to_MaildirFlag = Junk, J, gnus-expirable, E, TODO, A,...
(as long as the single characters don't collide with the standard flags)
or whatever system we can come up with.

But these changes are unrelated to the proposed patch :).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/offlineimap-project/attachments/20110817/42c5088b/attachment-0001.sig>

More information about the OfflineIMAP-project mailing list