Syncing IMAP keywords using xattrs: Modify what where in the codebase?

Erik Quaeghebeur offlineimap at
Fri Jan 4 12:54:01 GMT 2013


I'd like to use notmuch without losing the advantages of IMAP and I make 
extensive use of IMAP keywords[0, Sec.2.3.2 Par.3]. However, offlineimap 
does not sync them, I guess because the Maildir spec[1] gives no 
pointers to how to store arbitrary additional flags.

In 2007, on this list, Florian Friesdorf suggested using extended 

To me, this seems like a good idea. (Is it?)

I tried to look at the offlineimap source to see whether i could (with 
my limited programming skills) modify it to make this work. Trying to 
discover what I needed to do, I bumped into flagsimap2maildir and 
flagsmaildir2imap in

For IMAP->Maildir, my initial idea was to add a companion function

def getimapkws(flagstring):
     flags = set(flagstring[1:-1].split())
     return (flags - imapsysflags)


imapsysflags = set(['\\Seen',

and then use its output to add a user.imap.keywords xattr to the file 
corresponding to the message being dealt with (using pyxattr[2] or 
xattr[3] python modules?). I've not considered keyword modification of 
an already synchronized message yet.

Maildir->IMAP would be similar, in reverse.

Now, I didn't get further than, because I don't have a good 
overview of the codebase (and have a limited experience in programming 
anything but applied math). Therefore: could anybody tell me what would 
need to be modified where in the codebase?



P.S.: Actually, for my personal use case, I'd also consider straying 
from the Maildir spec[1] by omitting the ':info'-part and put the system 
flags in a user.imap.sysflags xattr. I'd have to augment notmuch with 
functionality to read and write the xattrs (using the python bindings?).


More information about the OfflineIMAP-project mailing list