From 98d8a508be86158e28aa603bc0d865a55fcab067 Mon Sep 17 00:00:00 2001 From: Rainer M Krug Date: Sat, 8 Dec 2012 13:40:17 +0100 Subject: [PATCH] Re: gmail importer script --- 65/82d517640d8a429c03319943396df34dbe520c | 252 ++++++++++++++++++++++ 1 file changed, 252 insertions(+) create mode 100644 65/82d517640d8a429c03319943396df34dbe520c diff --git a/65/82d517640d8a429c03319943396df34dbe520c b/65/82d517640d8a429c03319943396df34dbe520c new file mode 100644 index 000000000..50f7da728 --- /dev/null +++ b/65/82d517640d8a429c03319943396df34dbe520c @@ -0,0 +1,252 @@ +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 5136B431FB6 + for ; Sat, 8 Dec 2012 04:40:21 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.001 +X-Spam-Level: +X-Spam-Status: No, score=0.001 tagged_above=-999 required=5 + tests=[HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001] + 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 Ni5-M8GuNiKW for ; + Sat, 8 Dec 2012 04:40:20 -0800 (PST) +Received: from moutng.kundenserver.de (moutng.kundenserver.de + [212.227.126.187]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 19E76431FAE + for ; Sat, 8 Dec 2012 04:40:20 -0800 (PST) +Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com + [209.85.217.181]) + by mrelayeu.kundenserver.de (node=mrbap3) with ESMTP (Nemesis) + id 0M731J-1Svvfz2JAj-00xMmv; Sat, 08 Dec 2012 13:40:18 +0100 +Received: by mail-lb0-f181.google.com with SMTP id ge1so1091641lbb.26 + for ; Sat, 08 Dec 2012 04:40:18 -0800 (PST) +MIME-Version: 1.0 +Received: by 10.152.46.161 with SMTP id w1mr8297570lam.27.1354970417805; Sat, + 08 Dec 2012 04:40:17 -0800 (PST) +Received: by 10.112.108.7 with HTTP; Sat, 8 Dec 2012 04:40:17 -0800 (PST) +In-Reply-To: + +References: + + <50c16b03.47e2440a.6038.ffffedce@mx.google.com> <50C1AEA0.9090508@gmail.com> + + <50C1F5C3.6010201@gmail.com> + +Date: Sat, 8 Dec 2012 13:40:17 +0100 +Message-ID: + +Subject: Re: gmail importer script +From: Rainer M Krug +To: "Jason A. Donenfeld" +Content-Type: multipart/alternative; boundary=bcaec55408906f390304d056a254 +X-Provags-ID: V02:K0:LEXdKncTpzqHMJ/7eCW2QQ25Ti8TD7pQFo5Z4NuM8eX + 4jydoQyBG3iZWllTg3tCCQOktsX10VvIXiUFThW/ujt5/tu4k6 + B6SVQb98nByWQEPl+3hwKbEu41BcHNVH9LOabMxeMSkv0U/0B3 + 0xdaUcjgSfSB0cGLxc8NzObs85mnTvwQV+DGX0VMXIco65/Cdx + NpMaoTfHGlrBP680wMqqcCBqHEMT4x0XGsParlMMAO0EPPY6Ht + dXE1lY6cB39WF2kx1OPnCX8TDpfd9wT4UHkHMeHKAVJzCXEsrB + mmlXnNFsJvxxIZDaSlCt1vycjm8zKx96zmKhgweuI07splMyjp + 4DDH0Wm3uVx/uh2QA85oQe+zEshiun6RVatY4UMFL90ArMusDa + T+cj8KFXvvl0WA0jPBwMQZXEDbbYDrwZ5vaQ5aOHhum7vTY/Pp 3M4QA +X-Mailman-Approved-At: Mon, 10 Dec 2012 21:54:39 -0800 +Cc: public-notmuch-gxuj+Tv9EO5zyzON3hdc1g@plane.gmane.org, + notmuch@notmuchmail.org +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +Reply-To: Rainer@krugs.de +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sat, 08 Dec 2012 12:40:21 -0000 + +--bcaec55408906f390304d056a254 +Content-Type: text/plain; charset=ISO-8859-1 + +On 7 December 2012 16:32, Jason A. Donenfeld wrote: + +> +> +> On Fri, Dec 7, 2012 at 2:57 PM, Rainer M Krug wrote: +>> +>> > +>> > +>> > 2) I am downloading with the patched notmuch (to add x-keywords +>> containing the labels) only +>> > the "All Mail" folder - does your script use this information (if +>> present) to tag the emails? +>> > +>> > +>> > What is the patched notmuch? What does that do? +>> +>> Sorry - should have been "patched offlineimap" ( +>> https://github.com/aroig/offlineimap +>> +>> http://thread.gmane.org/gmane.mail.imap.offlineimap.general/5943/focus=5970and +>> http://article.gmane.org/gmane.mail.imap.offlineimap.general/5970 ) +>> +>> It is synching the gmail labels into the x-keywords header as a comma +>> separated list. These could +>> then be used by notmuch to be added to the labels. It also does sync +>> changes from the X-Keywords +>> to gmail (see +>> http://thread.gmane.org/gmane.mail.imap.offlineimap.general/5943/focus=5970for details) +> +> +> I see. +> +> I use the All Mail folder and get the tags using the X-GM-LABELS imap +> extension. I don't muck with the mail headers in the process, fortunately. +> + +I actually prefer this approach, but I think it would be more useful to +leave the syncing of the emails to a different program, and then just +managing the labels / tags with your tool (which is notmuch territory). So +the workflow would be: + +Initial or download (only remote changes): + +1) Download email ("All Mail" folder) with whatever you are using +(offlinemail, ...) +2) call your script to index the downloaded emails (All Mail" folder) with +notmuch and get the labels and set / remove them in notmuch accordingly. + +Upload (only local changes): + +1) upload emails using whatever (offlineimap, ...) +2) upload the changed tags and create the needed new labels (and possibly +delete empty ons?) + +The tricky part will be the synching when changes on both sides were +observed. +The mail sync is implemented in e.g. offlineimap and works reilably. But I +don't know how one could handle tag / label changes on both sides. + +So, implementing the mail sync in this script would, as I see it, kind of +reinventing the wheel. One can leave it in, but I would like to have an +option to leave the synching of the emails to a separate program. + +Cheers, + +Rainer + + + +-- +NEW GERMAN FAX NUMBER!!! + +Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, +UCT), Dipl. Phys. (Germany) + +Centre of Excellence for Invasion Biology +Natural Sciences Building +Office Suite 2039 +Stellenbosch University +Main Campus, Merriman Avenue +Stellenbosch +South Africa + +Cell: +27 - (0)83 9479 042 +Fax: +27 - (0)86 516 2782 +Fax: +49 - (0)321 2125 2244 +email: Rainer@krugs.de + +Skype: RMkrug +Google: R.M.Krug@gmail.com + +--bcaec55408906f390304d056a254 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable + +


On 7 Dece= +mber 2012 16:32, Jason A. Donenfeld <Jason@zx2c4.com> wrote:
+

On Fri, Dec 7, 2012 at= + 2:57 PM, Rainer M Krug <r.m.krug@gmail.com> wrote: + +
+>
+>
+> 2) I am downloading with the patched notmuch (to add x-keywords contai= +ning the labels) only
+> the "All Mail" folder - does your script use this informatio= +n (if present) to tag the emails?
+>
+>
+> What is the patched notmuch? What does that do?
+
+
Sorry - should have been "patched offlineimap" ( https://github.com= +/aroig/offlineimap
+http://thread.gmane.org/gmane.mail.imap.of= +flineimap.general/5943/focus=3D5970 and
+http://article.gmane.org/gmane.mail.imap.offlineimap.g= +eneral/5970 )
+
+It is synching the gmail labels into the x-keywords header as a comma separ= +ated list. These could
+then be used by notmuch to be added to the labels. It also does sync change= +s from the X-Keywords
+to gmail (see http://thread.gmane.org/gman= +e.mail.imap.offlineimap.general/5943/focus=3D5970 for details)
+ +

I see.

I use the All Mai= +l folder and get the tags using the X-GM-LABELS imap extension. I don't= + muck with the mail headers in the process, fortunately.
+

I actually prefer this approach, but I think it would be more usef= +ul to leave the syncing of the emails to a different program, and then just= + managing the labels / tags with your tool (which is notmuch territory). So= + the workflow would be:
+
Initial or download (only remote changes):

1) Download email (&q= +uot;All Mail" folder) with whatever you are using (offlinemail, ...)2) call your script to index the downloaded emails (All Mail" folder= +) with notmuch and get the labels and set / remove them in notmuch accordin= +gly.
+
Upload (only local changes):

1) upload emails using whatever (of= +flineimap, ...)
2) upload the changed tags and create the needed new lab= +els (and possibly delete empty ons?)

The tricky part will be the syn= +ching when changes on both sides were observed.
+The mail sync is implemented in e.g. offlineimap and works reilably. But I = +don't know how one could handle tag / label changes on both sides.
<= +br>So, implementing the mail sync in this script would, as I see it, kind o= +f reinventing the wheel. One can leave it in, but I would like to have an o= +ption to leave the synching of the emails to a separate program.
+
Cheers,

Rainer



--
= +NEW GERMAN FAX NUMBER!!!

Rainer M. Krug, PhD (Conservation Ecology, = +SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre = +of Excellence for Invasion Biology
+Natural Sciences Building
Office Suite 2039
Stellenbosch UniversityMain Campus, Merriman Avenue
Stellenbosch
South Africa

Cell:= +=A0 =A0 =A0 =A0 =A0=A0 +27 - (0)83 9479 042
Fax:=A0 =A0 =A0 =A0 =A0 =A0 = ++27 - (0)86 516 2782
+Fax:=A0 =A0 =A0 =A0 =A0 =A0 +49 - (0)321 2125 2244
email:=A0 =A0 =A0 =A0= + =A0 Rainer@krugs.de

Skype:=A0 =A0 =A0 =A0 =A0 RMkrug
Google:=A0 =A0 =A0 =A0=A0
R.M.Krug@gmail.com= +
+
+
+ +--bcaec55408906f390304d056a254-- -- 2.26.2