From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 1250E6DE0C6B for ; Wed, 13 Sep 2017 12:13:52 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" X-Spam-Flag: NO X-Spam-Score: 0.039 X-Spam-Level: X-Spam-Status: No, score=0.039 tagged_above=-999 required=5 tests=[AWL=0.059, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2Y-NkON2KIaU for ; Wed, 13 Sep 2017 12:13:51 -0700 (PDT) Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by arlo.cworth.org (Postfix) with ESMTPS id BA97B6DE0BAC for ; Wed, 13 Sep 2017 12:13:46 -0700 (PDT) Received: by mail-lf0-f68.google.com with SMTP id y15so549890lfd.0 for ; Wed, 13 Sep 2017 12:13:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nikula-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=qhyvPopSZn85zjKiTNUAeulqg1t8Muz0GzwvnykdfBw=; b=wgKYGW5N0z9hB4RIGUTjAI3Ynvizl6tMPl5XOdylnUiN5eKfAjEcdR9HqxNf7X+8Gw p+BeKrUDvI9BiGRq0OJTuf/kV3R1wfEr8IVjyL9YkgjRh+1qbK2PUXv+IegXS9eU+58Q VA2ZxyHJMHwFQR6psDQq3pxznYsCfeH36WlvaWWdLCeAgsGR8Ftr10ePvQnj4QpbrR3+ zyup9cTw9r6OtaZHN67i4sNGQSxKnEBRQQH6/UxkcKo8+BZgs/fxOvr45LoVC14QTVbg lWJ+W3Iq+DTyC1J6T5pbr30ihQyDEpUUQzO0+s8LzTAf8Dbe5hG41fttQI1LLzzhSBLG /Ntg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=qhyvPopSZn85zjKiTNUAeulqg1t8Muz0GzwvnykdfBw=; b=DpVgHeo8HBBmnlbvhLtOPfiKcLsCjCdrXFOagbGcuTI2NEQ+MbaBafYvxx5q/3sqPp 2mwaZOia1Rz12OXe4QnYdhMlDcXK/f9zks/lgF0SOR89uouOjk1F0JjcTPe9IZar1LI3 IIS6/xO3o7c3+x6ssIUzftqRosq/6mmNPp1blluROhGzU+rNANI5VA5lLY6Vkgv3YZMM 0wxAolrLP1K8BPbNwmTC9nlkcPUlXGs8WAMgtt4IJThFpyT1Xpa+MAL3RReBIWr37a5L izJU2xIkHtphu4w2sp9O5OGn0AGVm91ZT/veyDuxcJNfqB1cwF313xr4GxvndcwnATF1 ENCQ== X-Gm-Message-State: AHPjjUh3q8vlDJj0+NVSbrRA8otcq31k0sS21TDuARuds9On+/2+mG8+ 6Jfoa52J9dES1jkHYD+oEA== X-Google-Smtp-Source: AOwi7QDnPO7U91YlojpZRJCka0m0YiTEVYt6nXnRqxTnkb4VjXfz1bxstO3j7CaV6fYb6nhwpPdzSQ== X-Received: by 10.25.235.90 with SMTP id j87mr7822155lfh.249.1505330024915; Wed, 13 Sep 2017 12:13:44 -0700 (PDT) Received: from localhost (mobile-access-5d6a60-234.dhcp.inet.fi. [93.106.96.234]) by smtp.gmail.com with ESMTPSA id 67sm2311545ljq.63.2017.09.13.12.13.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Sep 2017 12:13:44 -0700 (PDT) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [PATCH 2/2] lib: index the content type of signature parts Date: Wed, 13 Sep 2017 22:13:35 +0300 Message-Id: <0229fcd10a3384982ec9c9ec03165e6e29a87b4d.1505329740.git.jani@nikula.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 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, 13 Sep 2017 19:13:52 -0000 It's useful (*) to be able to easily find messages with certain types of signatures. Having the mimetype: prefix searches fail for some content types is also genuinely surprising (*). Index the content type of signature parts. While at it, switch to the gmime convenience constants for content and signature part indexes. *) At least for developers of email software! --- lib/index.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/index.cc b/lib/index.cc index 64bc92a5b56d..0beaae62f048 100644 --- a/lib/index.cc +++ b/lib/index.cc @@ -398,12 +398,15 @@ _index_mime_part (notmuch_message_t *message, for (i = 0; i < g_mime_multipart_get_count (multipart); i++) { if (GMIME_IS_MULTIPART_SIGNED (multipart)) { - /* Don't index the signature. */ - if (i == 1) + /* Don't index the signature, but index its content type. */ + if (i == GMIME_MULTIPART_SIGNED_SIGNATURE) { + _index_content_type (message, + g_mime_multipart_get_part (multipart, i)); continue; - if (i > 1) + } else if (i != GMIME_MULTIPART_SIGNED_CONTENT) { _notmuch_database_log (_notmuch_message_database (message), - "Warning: Unexpected extra parts of multipart/signed. Indexing anyway.\n"); + "Warning: Unexpected extra parts of multipart/signed. Indexing anyway.\n"); + } } if (GMIME_IS_MULTIPART_ENCRYPTED (multipart)) { /* Don't index encrypted parts. */ -- 2.11.0