syncing custom IMAP flags
jdc at uwo.ca
Sat Nov 20 17:39:29 GMT 2010
Thanks for the reply!
Nicolas Sebrecht <nicolas.s-dev at laposte.net> writes:
> On Thu, Nov 18, 2010 at 06:08:06PM -0500, Dan Christensen wrote:
>> Dan Christensen <jdc at uwo.ca> writes:
>> [Note added: I don't think the above special case is really a good idea.
> Yes. I'd rather not to have to maintain any specific hard code to a
> particular case like this. The solution has to be much more generic than
>> > Alternatively, could offlineimap handle the IMAP --> IMAP case
>> > separately and simply copy the flags as is?
You didn't respond to this option. I don't know enough about the code
to know whether it is easy to implement, but it would be great if
offlineimap simply transparently handled synchronization of all IMAP
flags without any user customization.
>> > Or, as a third alternative, offlineimap could do what dovecot does,
>> > which is to keep a mapping between custom flags and lower case letters,
>> > and use those letters when storing to the maildir. This last solution
>> > means that *any* custom flags work, both with IMAP --> IMAP and IMAP -->
>> > Maildir. See http://wiki.dovecot.org/MailboxFormat/Maildir
> For the same reason as above, I'd say this is a "please no".
While I cited dovecot's method, this isn't specific to dovecot, so I
don't think this idea is specific to any situation. However, now that I
think about it, it's probably not a great option for other reasons.
>> > A fourth alternative is to apply the patch attached below. It combines
>> > the two flagmap dictionaries into one list which is used for both
>> > directions, and it makes this list a global. The first change means
>> > that there is no chance of the two mappings getting out of sync. The
>> > second change means that flagmap can be monkeypatched by code in
>> > .offlineimap.py, such as:
> Ok, this one looks much more smart.
I think the second option (handle all IMAP-->IMAP flags automatically)
would be the best option, since all users would immediately get this
functionality. But I won't be able to provide a patch for that.
So if you want to apply the patch I sent to implement the fourth
alternative, that would be great.
> We may want to add all the real and tested cases we know in the
> offlineimap.conf file.
The monkeypatching has to be in .offlineimap.py, but it could be
documented in the advanced settings section of offlineimap.conf. I
agree that this would be sufficient. For example:
# If you want to synchronize custom IMAP flags, the table for
# mapping flags between IMAP and Maildir needs to be updated.
# (This needs to be done even for IMAP to IMAP synchronization,
# since internally offlineimap views the local IMAP server as
# a virtual Maildir.)
# For example, to synchronize some flags that Gnus uses, you
# can set
# pythonfile = ~/.offlineimap.py
# and add the following code to .offlineimap.py (without the
# leading "#" on each line):
# import offlineimap.imaputil as IU
# if not hasattr(IU, 'monkeypatchdone'):
# IU.flagmap += [('gnus-expire','E'),
# ('gnus-dormant', 'Q'),
# ('gnus-save', 'V'),
# ('gnus-forward', 'W')]
# IU.monkeypatchdone = True
More information about the OfflineIMAP-project