I finally got around to working on it and over the last two days have gotten two-way gmail syncing with labels working.<div><br></div><div>The list of caveats is much longer than the list of details:</div><div><br></div><div>
1) only tested with 100 messages, which is hard coded</div><div>2) doesn't update UIDs of messages on disk, though it mostly avoids situations where that would be an issue</div><div>3) Can only do a full, scan every file sync, but it assumes that message content is immutable so only adds new messages</div>
<div>4) Doesn't support syncing new/deleted messages from notmuch -> gmail (not sure this is worth the trouble)</div><div>5) Quoting issues, i'm sure.</div><div><br></div><div><br></div><div>The basic approach is to get the difference between a the last sync and the current notmuch state, sync the diff of labels to gmail, than we request UID, X-GM-MSGID, Message-ID, and X-GM-LABELS from gmail for every message, if it lacks a message-id we build a notmuch-sha1- one, hopefully that approach won't change, we then write new messages to disk by using the filename GMID=...,UID=.... to store that information, and then sync the labels (with a mapping for special labels like sent, etc), then we look for messages that have changed in gmail but not changed locally, and sync their labels.</div>
<div><br></div><div>I'm sure it won't work for you, but you might try it. :)</div><div><br></div><div>source is at <a href="http://alexbl.net/~alexbl/imapsync.py">http://alexbl.net/~alexbl/imapsync.py</a></div><div>
<br></div><div>p.s. I also ran into an issue with the notmuch python bindings where I had to wrap every c_void_p in POINTER() or it would segfault for any method that tried to use a pointer. Also the sed command that tries to build notmuch.sym doesn't work on freebsd, i changed it to work, but i'm pretty sure it won't work on linux anymore. :) I wonder if using ctags might actually work for that.</div>
<div><br></div><div>alex</div>