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 7C8246DE1758 for ; Wed, 22 Mar 2017 04:23:30 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.005 X-Spam-Level: X-Spam-Status: No, score=-0.005 tagged_above=-999 required=5 tests=[AWL=0.006, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-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 DBAuOt_JLgHX for ; Wed, 22 Mar 2017 04:23:29 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id F40266DE175C for ; Wed, 22 Mar 2017 04:23:20 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.84_2) (envelope-from ) id 1cqeLd-0000hT-C8; Wed, 22 Mar 2017 07:22:37 -0400 Received: (nullmailer pid 12126 invoked by uid 1000); Wed, 22 Mar 2017 11:23:11 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH 2/7] lib: add content type argument to uuencode filter. Date: Wed, 22 Mar 2017 08:23:01 -0300 Message-Id: <20170322112306.12060-3-david@tethera.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170322112306.12060-1-david@tethera.net> References: <20170322112306.12060-1-david@tethera.net> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 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, 22 Mar 2017 11:23:30 -0000 The idea is to support more general types of filtering, based on content type. --- lib/index.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/index.cc b/lib/index.cc index 8c145540..1c04cc3d 100644 --- a/lib/index.cc +++ b/lib/index.cc @@ -56,6 +56,7 @@ typedef struct _NotmuchFilterDiscardUuencodeClass NotmuchFilterDiscardUuencodeCl **/ struct _NotmuchFilterDiscardUuencode { GMimeFilter parent_object; + GMimeContentType *content_type; int state; }; @@ -63,7 +64,7 @@ struct _NotmuchFilterDiscardUuencodeClass { GMimeFilterClass parent_class; }; -static GMimeFilter *notmuch_filter_discard_uuencode_new (void); +static GMimeFilter *notmuch_filter_discard_uuencode_new (GMimeContentType *content); static void notmuch_filter_discard_uuencode_finalize (GObject *object); @@ -102,8 +103,9 @@ notmuch_filter_discard_uuencode_finalize (GObject *object) static GMimeFilter * filter_copy (GMimeFilter *gmime_filter) { - (void) gmime_filter; - return notmuch_filter_discard_uuencode_new (); + NotmuchFilterDiscardUuencode *filter = (NotmuchFilterDiscardUuencode *) gmime_filter; + + return notmuch_filter_discard_uuencode_new (filter->content_type); } static void @@ -196,7 +198,7 @@ filter_reset (GMimeFilter *gmime_filter) * Returns: a new #NotmuchFilterDiscardUuencode filter. **/ static GMimeFilter * -notmuch_filter_discard_uuencode_new (void) +notmuch_filter_discard_uuencode_new (GMimeContentType *content_type) { static GType type = 0; NotmuchFilterDiscardUuencode *filter; @@ -220,6 +222,7 @@ notmuch_filter_discard_uuencode_new (void) filter = (NotmuchFilterDiscardUuencode *) g_object_newv (type, 0, NULL); filter->state = 0; + filter->content_type = content_type; return (GMimeFilter *) filter; } @@ -396,7 +399,7 @@ _index_mime_part (notmuch_message_t *message, g_mime_stream_mem_set_owner (GMIME_STREAM_MEM (stream), FALSE); filter = g_mime_stream_filter_new (stream); - discard_uuencode_filter = notmuch_filter_discard_uuencode_new (); + discard_uuencode_filter = notmuch_filter_discard_uuencode_new (content_type); g_mime_stream_filter_add (GMIME_STREAM_FILTER (filter), discard_uuencode_filter); -- 2.11.0