[PATCH] Make flags a set rather than a list
jdc at uwo.ca
Tue Aug 16 16:39:00 BST 2011
Vincent Beffara <vbeffara at ens-lyon.fr> writes:
> Hi Sebastian,
> 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.
The hack I use just monkeypatches the flagmap in .offlineimap.py:
import offlineimap.imaputil as IU
if not hasattr(IU, 'monkeypatchdone'):
IU.flagmap += [('gnus-expire','E'),
IU.monkeypatchdone = True
I think this will still work, right?
> 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.
I agree that in the IMAP to IMAP case, it is odd that the flags
are converted twice, resulting in no conversion, so the flagmap
isn't really needed. It would be better if the flagmap wasn't
used at all in this case, so it wouldn't need to be monkeypatched
to handle more general flags.
More information about the OfflineIMAP-project