--- /dev/null
+Return-Path: <sojkam1@fel.cvut.cz>\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 5786B418C34\r
+ for <notmuch@notmuchmail.org>; Tue, 11 May 2010 05:14:47 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.9\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5\r
+ tests=[BAYES_00=-1.9] autolearn=ham\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 OKjKy5wKx9tu for <notmuch@notmuchmail.org>;\r
+ Tue, 11 May 2010 05:14:34 -0700 (PDT)\r
+Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])\r
+ by olra.theworths.org (Postfix) with ESMTP id E1F174196F2\r
+ for <notmuch@notmuchmail.org>; Tue, 11 May 2010 05:14:33 -0700 (PDT)\r
+Received: from localhost (unknown [192.168.200.4])\r
+ by max.feld.cvut.cz (Postfix) with ESMTP id 87BCF19F3411;\r
+ Tue, 11 May 2010 14:14:32 +0200 (CEST)\r
+X-Virus-Scanned: IMAP AMAVIS\r
+Received: from max.feld.cvut.cz ([192.168.200.1])\r
+ by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new,\r
+ port 10044)\r
+ with ESMTP id mnhg+Tkzpivj; Tue, 11 May 2010 14:14:31 +0200 (CEST)\r
+Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])\r
+ by max.feld.cvut.cz (Postfix) with ESMTP id 3E24119F33FC;\r
+ Tue, 11 May 2010 14:14:31 +0200 (CEST)\r
+Received: from steelpick.2x.cz (k335-30.felk.cvut.cz [147.32.86.30])\r
+ (Authenticated sender: sojkam1)\r
+ by imap.feld.cvut.cz (Postfix) with ESMTPSA id 380CFFA004;\r
+ Tue, 11 May 2010 14:14:31 +0200 (CEST)\r
+Received: from wsh by steelpick.2x.cz with local (Exim 4.71)\r
+ (envelope-from <sojkam1@fel.cvut.cz>)\r
+ id 1OBoM3-0005sq-1a; Tue, 11 May 2010 14:14:31 +0200\r
+From: Michal Sojka <sojkam1@fel.cvut.cz>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/4] lib: Return added message even if it already was in the\r
+ database\r
+Date: Tue, 11 May 2010 14:14:18 +0200\r
+Message-Id: <1273580061-22580-2-git-send-email-sojkam1@fel.cvut.cz>\r
+X-Mailer: git-send-email 1.7.1\r
+In-Reply-To: <1273580061-22580-1-git-send-email-sojkam1@fel.cvut.cz>\r
+References: <1273580061-22580-1-git-send-email-sojkam1@fel.cvut.cz>\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: Tue, 11 May 2010 12:14:47 -0000\r
+\r
+---\r
+ lib/database.cc | 3 ++-\r
+ lib/notmuch.h | 3 ++-\r
+ 2 files changed, 4 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/lib/database.cc b/lib/database.cc\r
+index 6afc8d9..694b7ec 100644\r
+--- a/lib/database.cc\r
++++ b/lib/database.cc\r
+@@ -1613,7 +1613,8 @@ notmuch_database_add_message (notmuch_database_t *notmuch,\r
+ \r
+ DONE:\r
+ if (message) {\r
+- if (ret == NOTMUCH_STATUS_SUCCESS && message_ret)\r
++ if ((ret == NOTMUCH_STATUS_SUCCESS ||\r
++ ret == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) && message_ret)\r
+ *message_ret = message;\r
+ else\r
+ notmuch_message_destroy (message);\r
+diff --git a/lib/notmuch.h b/lib/notmuch.h\r
+index 505ad19..0ba1416 100644\r
+--- a/lib/notmuch.h\r
++++ b/lib/notmuch.h\r
+@@ -238,7 +238,8 @@ notmuch_database_get_directory (notmuch_database_t *database,\r
+ * notmuch database will reference the filename, and will not copy the\r
+ * entire contents of the file.\r
+ *\r
+- * If 'message' is not NULL, then, on successful return '*message'\r
++ * If 'message' is not NULL, then, on successful return\r
++ * (NOTMUCH_STATUS_SUCCESS or NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) '*message'\r
+ * will be initialized to a message object that can be used for things\r
+ * such as adding tags to the just-added message. The user should call\r
+ * notmuch_message_destroy when done with the message. On any failure\r
+-- \r
+1.7.1\r
+\r