Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 064F4431FBC for ; Tue, 15 Dec 2009 04:05:21 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FwFkJsREy+U1 for ; Tue, 15 Dec 2009 04:05:20 -0800 (PST) Received: from pivot.cs.unb.ca (pivot.cs.unb.ca [131.202.240.57]) by olra.theworths.org (Postfix) with ESMTP id 06D1B431FAE for ; Tue, 15 Dec 2009 04:05:19 -0800 (PST) Received: from fctnnbsc30w-142167182194.pppoe-dynamic.high-speed.nb.bellaliant.net ([142.167.182.194] helo=localhost) by pivot.cs.unb.ca with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1NKW9W-0007dl-O2 for notmuch@notmuchmail.org; Tue, 15 Dec 2009 08:05:19 -0400 Received: from bremner by localhost with local (Exim 4.69) (envelope-from ) id 1NKW9R-0006Pg-CJ for notmuch@notmuchmail.org; Tue, 15 Dec 2009 08:05:13 -0400 From: David Bremner To: notmuch@notmuchmail.org Date: Tue, 15 Dec 2009 08:05:13 -0400 Message-ID: <87pr6gcuiu.fsf@pivot.cs.unb.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Sender-Verified: bremner@pivot.cs.unb.ca Subject: [notmuch] notmuch and imap [musing, no code :)] X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Dec 2009 12:05:21 -0000 Recent discussions on IRC (I forget with whom, sorry), brought me back to thinking about syncing notmuch with imap. In addition to the flags \Seen, \Answered, \Draft, \Deleted, and \Flagged, imap servers can optionally support user defined keywords (i.e. tags). At least courier and dovecot do. These keywords are imap "atoms", which, without tracing though the BNF [1] completely look like they can can have (ascii) alphanumeric, and punctuation other than brackets, quotes and "%", "*". So the mapping is relatively nice between notmuch tags and imap keywords. One idea I had was to extend some imap syncing program to sync to notmuch. mbsync (confusingly also named isync) is a C based one. It is indeed relatively easy to add a new backend; I made a new "notmuch" driver for mbsync in an hour or so that is actually just a maildir driver. I am a little discouraged by some of mbsync code (there are lots of places with a buffer hard-coded to size 16, with a comment to change that later when keyword support is added), but in principle, I think this could work. A more fundamental issue is that mbsync, like most similar programs uses an index file to keep track of the sync state, and it seems somehow wrong (or at least fragile) to keep a second database with essentially the same information in it. To write a custom sync program would require some imap code; this is somewhere between trivial and not; mbsync's imap driver is about 1900 lines of C. There is the uw c-client library; I remember some security issues but that was more than a decade ago. There are some newer libraries like tinymail and libetpan, but they seem to have a whole bunch of stuff not needed for notmuch. d [1]: http://www.faqs.org/rfcs/rfc3501.html