From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id C9CE9429E25 for ; Wed, 17 Aug 2011 19:31:40 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.798 X-Spam-Level: X-Spam-Status: No, score=-0.798 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled 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 z2bwfvW4lLIK for ; Wed, 17 Aug 2011 19:31:39 -0700 (PDT) Received: from mail-vx0-f181.google.com (mail-vx0-f181.google.com [209.85.220.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id AC3E9431FD0 for ; Wed, 17 Aug 2011 19:31:39 -0700 (PDT) Received: by vxi39 with SMTP id 39so1632046vxi.26 for ; Wed, 17 Aug 2011 19:31:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=KBGtQDXIUEK/AM6d7uD2ppyh0hIm6o+r38rtTWRu9v8=; b=ORhfECtkQdifPEuqh/rAAKvUrjanUbteKJnEDXvLBEiBkuVvhVXmHlGnG2Oj0OOtcn rKscX4dEkcK9Bd8LvVTH1uwXQ1kR+OqNB1xAYGJ++qhD6UJEUuPmjEZdhmQBW7CW3NNa +R/lyh3b89GgEt94GJPIM+wZRTyZmPpYiDRM4= MIME-Version: 1.0 Received: by 10.52.22.237 with SMTP id h13mr175282vdf.228.1313634696303; Wed, 17 Aug 2011 19:31:36 -0700 (PDT) Received: by 10.52.188.4 with HTTP; Wed, 17 Aug 2011 19:31:36 -0700 (PDT) Date: Wed, 17 Aug 2011 19:31:36 -0700 Message-ID: Subject: gmail syncing sort of working From: Alex Botero-Lowry To: notmuch@notmuchmail.org Content-Type: multipart/alternative; boundary=20cf3079b6ee70134e04aabe6909 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 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: Thu, 18 Aug 2011 02:31:41 -0000 --20cf3079b6ee70134e04aabe6909 Content-Type: text/plain; charset=ISO-8859-1 I finally got around to working on it and over the last two days have gotten two-way gmail syncing with labels working. The list of caveats is much longer than the list of details: 1) only tested with 100 messages, which is hard coded 2) doesn't update UIDs of messages on disk, though it mostly avoids situations where that would be an issue 3) Can only do a full, scan every file sync, but it assumes that message content is immutable so only adds new messages 4) Doesn't support syncing new/deleted messages from notmuch -> gmail (not sure this is worth the trouble) 5) Quoting issues, i'm sure. 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. I'm sure it won't work for you, but you might try it. :) source is at http://alexbl.net/~alexbl/imapsync.py 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. alex --20cf3079b6ee70134e04aabe6909 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I finally got around to working on it and over the last two days have gotte= n two-way gmail syncing with labels working.

The list of= caveats is much longer than the list of details:

1) only tested with 100 messages, which is hard coded
2) doesn= 9;t update UIDs of messages on disk, though it mostly avoids situations whe= re that would be an issue
3) Can only do a full, scan every file = sync, but it assumes that message content is immutable so only adds new mes= sages
4) Doesn't support syncing new/deleted messages from notmuch ->= gmail (not sure this is worth the trouble)
5) Quoting issues, i&= #39;m sure.


The basic approach is t= o 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=3D...,UID=3D...= . to store that information, and then sync the labels (with a mapping for s= pecial labels like sent, etc), then we look for messages that have changed = in gmail but not changed locally, and sync their labels.

I'm sure it won't work for you, but you might t= ry it. :)


p.s. I also ran into an issue with the notmuch python bindin= gs 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.

alex
--20cf3079b6ee70134e04aabe6909--