From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 95DC7431FB6 for ; Wed, 1 Dec 2010 12:34:35 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 lb28owIOTD1t for ; Wed, 1 Dec 2010 12:34:35 -0800 (PST) Received: from mail-ew0-f53.google.com (mail-ew0-f53.google.com [209.85.215.53]) by olra.theworths.org (Postfix) with ESMTP id E0DF0431FB5 for ; Wed, 1 Dec 2010 12:34:34 -0800 (PST) Received: by ewy6 with SMTP id 6so4421350ewy.26 for ; Wed, 01 Dec 2010 12:34:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :message-id:x-mailer:mime-version:content-type :content-transfer-encoding; bh=/pWr5I6qt38Oj5a/6oAN4E9lyzXTYFwDUVVW9TFJYao=; b=HJDHFIkNhoMRjOcZhOEN+nIWL4cfw5cu3FbjaGpCfCGCS10MOfG5AHESMnTzPMsO3L GPIabq/0IZJYNsmPzyZNL0TVpxO9gKagnJx8cVZh85ZOp16gZ7C7d3PU9A5WzpvUgoUm M8mwByF3ejnh6Yc0HmX+tGFS7c8dlA6gwYmW4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:x-mailer:mime-version:content-type :content-transfer-encoding; b=L2pGXljERTd5AJ3OOESEYnYSc1zOSyuLc3BRIrsn7gxixSTnFHLgvc1QT5ZiyZnIP4 k7lHJLmn/K4sFNDuqt2YIG5eVER9KSQJgFyuz/QiSRbevYxp4blj9KVW/TFnBMQMsdkb 9jMZdV4BGlVTKcaC5MTV3LdmOgdy/SvHqQTkI= Received: by 10.213.32.203 with SMTP id e11mr2053351ebd.28.1291235673955; Wed, 01 Dec 2010 12:34:33 -0800 (PST) Received: from localhost.localdomain (c80-216-237-236.bredband.comhem.se [80.216.237.236]) by mx.google.com with ESMTPS id x54sm321511eeh.17.2010.12.01.12.34.32 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 01 Dec 2010 12:34:33 -0800 (PST) From: =?UTF-8?q?Joel=20Borggr=C3=A9n-Franck?= To: notmuch@notmuchmail.org Subject: [PATCH] add headers cc: bcc: and to: (as exactto:) to search index Date: Wed, 1 Dec 2010 21:33:55 +0100 Message-Id: <1291235635-16523-1-git-send-email-joel.borggren.franck@gmail.com> X-Mailer: git-send-email 1.7.3.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: Wed, 01 Dec 2010 20:34:35 -0000 From: Joel Borggrén-Franck Add headers cc: bcc: and to: to index. Real header to: is searched as "exactto:foo@bar.baz" and search term "to:" is kept as a union of cc:, bcc: and to: for backward compatibility. Use search term "cc:" resp. "bcc:" to search those headers respectively. --- lib/database.cc | 11 +++++++---- lib/index.cc | 9 +++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/database.cc b/lib/database.cc index 7a00917..68910f3 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -88,9 +88,9 @@ typedef struct { * MESSAGE_ID: The unique ID of the mail mess (see "id" above) * * In addition, terms from the content of the message are added with - * "from", "to", "attachment", and "subject" prefixes for use by the - * user in searching. But the database doesn't really care itself - * about any of these. + * "from", "to", "exactto", "cc", "bbc", "attachment" and "subject" + * prefixes for use by the user in searching. But the database doesn't + * really care itself about any of these. * * The data portion of a mail document is empty. * @@ -204,7 +204,10 @@ static prefix_t PROBABILISTIC_PREFIX[]= { { "from", "XFROM" }, { "to", "XTO" }, { "attachment", "XATTACHMENT" }, - { "subject", "XSUBJECT"} + { "subject", "XSUBJECT"}, + { "exactto", "XEXACTTO"}, + { "cc", "XCC"}, + { "bcc", "XBCC"}, }; int diff --git a/lib/index.cc b/lib/index.cc index 00478f8..d59c255 100644 --- a/lib/index.cc +++ b/lib/index.cc @@ -455,6 +455,15 @@ _notmuch_message_index_file (notmuch_message_t *message, _index_address_list (message, "from", addresses); + addresses = g_mime_message_get_recipients (mime_message, GMIME_RECIPIENT_TYPE_TO); + _index_address_list (message, "exactto", addresses); + + addresses = g_mime_message_get_recipients (mime_message, GMIME_RECIPIENT_TYPE_CC); + _index_address_list (message, "cc", addresses); + + addresses = g_mime_message_get_recipients (mime_message, GMIME_RECIPIENT_TYPE_BCC); + _index_address_list (message, "bcc", addresses); + addresses = g_mime_message_get_all_recipients (mime_message); _index_address_list (message, "to", addresses); -- 1.7.3.2