--- /dev/null
+Return-Path: <mpn@google.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 087DA431FB6\r
+ for <notmuch@notmuchmail.org>; Fri, 7 Dec 2012 03:48:25 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.8\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.8 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id WMkcaTl46IHA for <notmuch@notmuchmail.org>;\r
+ Fri, 7 Dec 2012 03:48:24 -0800 (PST)\r
+Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com\r
+ [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 4C337431FAE\r
+ for <notmuch@notmuchmail.org>; Fri, 7 Dec 2012 03:48:24 -0800 (PST)\r
+Received: by mail-bk0-f53.google.com with SMTP id j5so188863bkw.26\r
+ for <notmuch@notmuchmail.org>; Fri, 07 Dec 2012 03:48:23 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\r
+ s=20120113;\r
+ h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+ bh=NzI9aK/KYKB1NlqriSJcHSbR5nzLIsJFCIKM2oRKf4g=;\r
+ b=ZDAFzgxliMawO/sPhwTS7raRbPpI75xG5mdD5K4qjUDFu9T28rPJijKFVq7KFiQ56L\r
+ TARFGr2anKLPmFa7KB078QyaA96D/Hsp7haxR3QBB5fI09MlCghSJxdTPZYvv49GkUZb\r
+ wVA6jrY4ryFN3OUytknjNuAOCs9cQJQSY5U4mQrSWQMtC3l4VkfO1g47ViJtO080ckl9\r
+ 2ct8WSg2JQ/dZb8Kr2KUBtRNiWn1sDjIOc7rVcqwRKAqpub+sOmXnhPC21DVXy4QwNVJ\r
+ 19WqVexNL/scYMQVRiMUQ/JO0rpPFj80bsZuXu78EvcvawJkDSGQA4HTxNeE417bpXjL wcpA==\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=google.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references\r
+ :x-gm-message-state;\r
+ bh=NzI9aK/KYKB1NlqriSJcHSbR5nzLIsJFCIKM2oRKf4g=;\r
+ b=mdBqpsetbf78k4aWCHRIrY5KqXQIgXRiL3MS5/YvHO0Ue8T00fAGAWcM0JSWg2UFsx\r
+ 6+VhZXR83D6G/0WXDUXH39QWmbx8lzdycRX6BuWBln9p2FB6fvD9e7IoNi6v/pLpMIPk\r
+ +eHDlYpClgDtDVUlGwOBs2EKqUCFySqdXXs2JF9DclXoGIFYrDI7NiQWly7G8tP8gFYp\r
+ 1A4ItTKQ6PnGa6DmMBfFX+GLG+ja+bUKgpwBlLHk3LYmZBEznNwnpQWv1Si7PKboZPNj\r
+ GCGUZIV6HuP1VNMahL7/bZqvnxl7vZYdd7nvt9cE2cMcpLtz9U1QJWLJuL43+1mp2U3Y\r
+ Vm7A==\r
+Received: by 10.204.15.203 with SMTP id l11mr1761334bka.74.1354880902897;\r
+ Fri, 07 Dec 2012 03:48:22 -0800 (PST)\r
+Received: from mpn-glaptop.corp.google.com\r
+ ([2620:0:105f:5:cdae:35d2:d623:7b7a])\r
+ by mx.google.com with ESMTPS id u3sm8767560bkw.9.2012.12.07.03.48.21\r
+ (version=SSLv3 cipher=OTHER); Fri, 07 Dec 2012 03:48:22 -0800 (PST)\r
+From: Michal Nazarewicz <mpn@google.com>\r
+To: Jason@zx2c4.com\r
+Subject: [PATCH] Minor style changes.\r
+Date: Fri, 7 Dec 2012 12:48:13 +0100\r
+Message-Id:\r
+ <84e52691df739ca60507787173b41663caaf99ed.1354880726.git.mina86@mina86.com>\r
+X-Mailer: git-send-email 1.7.7.3\r
+In-Reply-To:\r
+ <CAHmME9om0twqigr0L2pwXtbj4ceBVVFz0HqxkwFfB-AnusP2VQ@mail.gmail.com>\r
+References:\r
+ <CAHmME9om0twqigr0L2pwXtbj4ceBVVFz0HqxkwFfB-AnusP2VQ@mail.gmail.com>\r
+X-Gm-Message-State: ALoCoQmfaFsXPmIwlGU2C3TRFh1BSDOFhv1RbRtWroGfuvR3SiG0wtYSUurGMqaOLMjMWHPbfU53xhb53AzOkrrH3scfwYRMy8o+DVuvNA4K4ZaUyiJQav8ThCAGH8kroJMz+Mtz+25kfYV10KgE+6VAM8uX5WmCh7QaUF8+Fuj8cunC2A3D79Cge7aA4k8vvFey4k8mjw05\r
+Cc: notmuch@notmuchmail.org\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 07 Dec 2012 11:48:25 -0000\r
+\r
+From: Michal Nazarewicz <mina86@mina86.com>\r
+\r
+---\r
+ gmail-notmuch.py | 29 +++++++++--------------------\r
+ 1 files changed, 9 insertions(+), 20 deletions(-)\r
+\r
+On Fri, Dec 07 2012, Jason A. Donenfeld wrote:\r
+> I wrote a script that imports emails and tags from gmail. It's\r
+> resumable and appears to be working reasonably well. I could use some\r
+> experienced eyes looking at it, as my first exposure to notmuch was\r
+> just a few hours ago.\r
+\r
+Didn't really use it, but I still have some suggested code changes: ;)\r
+\r
+diff --git a/gmail-notmuch.py b/gmail-notmuch.py\r
+index 04a60dc..ef7fa85 100755\r
+--- a/gmail-notmuch.py\r
++++ b/gmail-notmuch.py\r
+@@ -43,7 +43,7 @@ def main():\r
+ (options, args) = parser.parse_args()\r
+ if options.username == None or options.password == None:\r
+ parser.error("Username and password are required.")\r
+- if not options.username.lower().endswith("@gmail.com") and not options.username.lower().endswith("@googlemail.com"):\r
++ if options.username.find("@") == -1:\r
+ options.username += "@gmail.com"\r
+ if len(args) == 0:\r
+ parser.error("Maildir location is required.")\r
+@@ -60,7 +60,7 @@ def main():\r
+ print("Nothing to do!")\r
+ logout(imap)\r
+ sys.exit(0)\r
+- \r
++\r
+ download_new_messages(imap, new_messages, destination_dir)\r
+ \r
+ logout(imap)\r
+@@ -84,9 +84,8 @@ def discover_new_messages(imap, old_messages):\r
+ for response in data:\r
+ imap_seq = response[0:response.find(" ")]\r
+ gmail_id = response[response.rfind(" ") + 1:len(response) - 1]\r
+- if gmail_id in old_messages:\r
+- continue\r
+- new_messages.append((gmail_id, imap_seq))\r
++ if gmail_id not in old_messages:\r
++ new_messages.append((gmail_id, imap_seq))\r
+ return new_messages\r
+ \r
+ def download_new_messages(imap, messages, destination):\r
+@@ -112,7 +111,7 @@ def download_new_messages(imap, messages, destination):\r
+ typ, data = imap.fetch(str(imap_seq), "(FLAGS X-GM-LABELS)")\r
+ if typ != "OK":\r
+ sys.exit("Failed to download labels gmail-%d/imap-%d" % (gmail_id, imap_seq))\r
+- \r
++\r
+ labels = label_parser.search(data[0]).groups()\r
+ labels = filter_labels(shlex.split(labels[0], False, True) + labels[1].split(" "))\r
+ \r
+@@ -149,22 +148,12 @@ def filter_labels(labels):\r
+ "\\Important": None, # I realize this is controversial, but I hate the priority inbox.\r
+ "Junk": "spam",\r
+ "NonJunk": None }\r
+- ret = set()\r
+- for label in labels:\r
+- if label in translation:\r
+- if translation[label] is None:\r
+- continue\r
+- ret.add(translation[label])\r
+- else:\r
+- ret.add(label)\r
+- if "!read!" in ret:\r
+- ret.remove("!read!")\r
+- else:\r
++ ret = set(translation.get(label, label) for label in labels)\r
++ if not ret.pop("!read!", None):\r
+ ret.add("unread")\r
+- if "" in ret:\r
+- ret.remove("")\r
++ ret.pop(None, None)\r
++ ret.pop("", None)\r
+ return ret\r
+- \r
+ \r
+ def logout(imap):\r
+ imap.close()\r
+-- \r
+1.7.7.3\r
+\r