Re: [PATCH 11/11] lib: add recipients to database
authorMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 31 Aug 2012 21:34:12 +0000 (23:34 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:49:16 +0000 (09:49 -0800)
7c/90ee686fdcc8a64b1a81d6024965c51487def6 [new file with mode: 0644]

diff --git a/7c/90ee686fdcc8a64b1a81d6024965c51487def6 b/7c/90ee686fdcc8a64b1a81d6024965c51487def6
new file mode 100644 (file)
index 0000000..8084d17
--- /dev/null
@@ -0,0 +1,158 @@
+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 C4E4D431FBC\r
+       for <notmuch@notmuchmail.org>; Fri, 31 Aug 2012 14:34:16 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_MED=-2.3] 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 cVj+nMGOD6vq for <notmuch@notmuchmail.org>;\r
+       Fri, 31 Aug 2012 14:34:15 -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 9280B431FAF\r
+       for <notmuch@notmuchmail.org>; Fri, 31 Aug 2012 14:34:15 -0700 (PDT)\r
+Received: from localhost (unknown [192.168.200.4])\r
+       by max.feld.cvut.cz (Postfix) with ESMTP id D1E1F3CFE71;\r
+       Fri, 31 Aug 2012 23:34:14 +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 ER31UVcwZvdE; Fri, 31 Aug 2012 23:34:13 +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 29B4E19F3302;\r
+       Fri, 31 Aug 2012 23:34:13 +0200 (CEST)\r
+Received: from steelpick.2x.cz (unknown [213.29.198.144])\r
+       (Authenticated sender: sojkam1)\r
+       by imap.feld.cvut.cz (Postfix) with ESMTPSA id 0F805660904;\r
+       Fri, 31 Aug 2012 23:34:13 +0200 (CEST)\r
+Received: from wsh by steelpick.2x.cz with local (Exim 4.80)\r
+       (envelope-from <sojkam1@fel.cvut.cz>)\r
+       id 1T7Yqy-0002da-KQ; Fri, 31 Aug 2012 23:34:12 +0200\r
+From: Michal Sojka <sojkam1@fel.cvut.cz>\r
+To: Jameson Graef Rollins <jrollins@finestructure.net>,\r
+       Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: Re: [PATCH 11/11] lib: add recipients to database\r
+In-Reply-To: <1345427570-26518-12-git-send-email-jrollins@finestructure.net>\r
+References: <1345427570-26518-1-git-send-email-jrollins@finestructure.net>\r
+       <1345427570-26518-2-git-send-email-jrollins@finestructure.net>\r
+       <1345427570-26518-3-git-send-email-jrollins@finestructure.net>\r
+       <1345427570-26518-4-git-send-email-jrollins@finestructure.net>\r
+       <1345427570-26518-5-git-send-email-jrollins@finestructure.net>\r
+       <1345427570-26518-6-git-send-email-jrollins@finestructure.net>\r
+       <1345427570-26518-7-git-send-email-jrollins@finestructure.net>\r
+       <1345427570-26518-8-git-send-email-jrollins@finestructure.net>\r
+       <1345427570-26518-9-git-send-email-jrollins@finestructure.net>\r
+       <1345427570-26518-10-git-send-email-jrollins@finestructure.net>\r
+       <1345427570-26518-11-git-send-email-jrollins@finestructure.net>\r
+       <1345427570-26518-12-git-send-email-jrollins@finestructure.net>\r
+User-Agent: Notmuch/0.14+3~g608c52f (http://notmuchmail.org) Emacs/24.1.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Fri, 31 Aug 2012 23:34:12 +0200\r
+Message-ID: <873932oiej.fsf@steelpick.2x.cz>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\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, 31 Aug 2012 21:34:16 -0000\r
+\r
+On Mon, Aug 20 2012, Jameson Graef Rollins wrote:\r
+> This adds just the "to" recipients, but probably "cc"s should be\r
+> included as well.\r
+> ---\r
+>  lib/database.cc       |    2 +-\r
+>  lib/message.cc        |    4 ++++\r
+>  lib/notmuch-private.h |    2 ++\r
+>  3 files changed, 7 insertions(+), 1 deletion(-)\r
+>\r
+> diff --git a/lib/database.cc b/lib/database.cc\r
+> index 761dc1a..4c1d578 100644\r
+> --- a/lib/database.cc\r
+> +++ b/lib/database.cc\r
+> @@ -1814,7 +1814,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch,\r
+>              goto DONE;\r
+>  \r
+>          date = notmuch_message_file_get_header (message_file, "date");\r
+> -        _notmuch_message_set_header_values (message, date, from, subject);\r
+> +        _notmuch_message_set_header_values (message, date, from, to, subject);\r
+>  \r
+>          _notmuch_message_index_file (message, filename);\r
+>      } else {\r
+> diff --git a/lib/message.cc b/lib/message.cc\r
+> index fa28073..cc5c8a0 100644\r
+> --- a/lib/message.cc\r
+> +++ b/lib/message.cc\r
+> @@ -420,6 +420,8 @@ notmuch_message_get_header (notmuch_message_t *message, const char *header)\r
+>       * available */\r
+>      if (strcasecmp (header, "from") == 0)\r
+>      value = message->doc.get_value (NOTMUCH_VALUE_FROM);\r
+> +    if (strcasecmp (header, "to") == 0)\r
+> +    value = message->doc.get_value (NOTMUCH_VALUE_TO);\r
+>      else if (strcasecmp (header, "subject") == 0)\r
+>      value = message->doc.get_value (NOTMUCH_VALUE_SUBJECT);\r
+>      else if (strcasecmp (header, "message-id") == 0)\r
+> @@ -830,6 +832,7 @@ void\r
+>  _notmuch_message_set_header_values (notmuch_message_t *message,\r
+>                                  const char *date,\r
+>                                  const char *from,\r
+> +                                const char *to,\r
+>                                  const char *subject)\r
+>  {\r
+>      time_t time_value;\r
+> @@ -844,6 +847,7 @@ _notmuch_message_set_header_values (notmuch_message_t *message,\r
+>      message->doc.add_value (NOTMUCH_VALUE_TIMESTAMP,\r
+>                          Xapian::sortable_serialise (time_value));\r
+>      message->doc.add_value (NOTMUCH_VALUE_FROM, from);\r
+> +    message->doc.add_value (NOTMUCH_VALUE_TO, to);\r
+>      message->doc.add_value (NOTMUCH_VALUE_SUBJECT, subject);\r
+>  }\r
+>  \r
+> diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h\r
+> index 32d1523..f56c580 100644\r
+> --- a/lib/notmuch-private.h\r
+> +++ b/lib/notmuch-private.h\r
+> @@ -95,6 +95,7 @@ typedef enum {\r
+>      NOTMUCH_VALUE_TIMESTAMP = 0,\r
+>      NOTMUCH_VALUE_MESSAGE_ID,\r
+>      NOTMUCH_VALUE_FROM,\r
+> +    NOTMUCH_VALUE_TO,\r
+\r
+It would be definitely useful to add other headers to the database (and\r
+make them searchable). As far as I remember this is on the todo list for\r
+ages. I'm only not sure that the approach of adding every possible\r
+header manually (like in this patch) is a good approach. Emails can\r
+contain arbitrary headers so there would be always some header missing.\r
+I'm not that much familiar with Xapian to figure out how to implement\r
+this.\r
+\r
+Otherwise this series looks quite well. I'm only not sure whether to\r
+merge it now or after changing the storage of headers in the database.\r
+\r
+Probably, if emacs interface is also extended to use this feature as\r
+part of saved searches or hello-section in a way that I can see the list\r
+of drafts on one click from hello screen. I'd vote for merging this now.\r
+\r
+However, I've just looked how does my drafts folder (messages saved with\r
+C-x C-s) looks like and one problem I see there is that draft messages\r
+do not have message ids. Do you have an idea how to implement drafts in\r
+emacs UI?\r
+\r
+Thanks,\r
+-Michal\r
+\r