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