From: David Bremner <david@tethera.net>
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 [thread overview]
Message-ID: <20170322112306.12060-3-david@tethera.net> (raw)
In-Reply-To: <20170322112306.12060-1-david@tethera.net>
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
next prev parent reply other threads:[~2017-03-22 11:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-22 11:22 Drop HTML tags when indexing David Bremner
2017-03-22 11:23 ` [PATCH 1/7] test: add known broken test for indexing html David Bremner
2017-04-20 10:05 ` David Bremner
2017-07-16 12:44 ` David Bremner
2017-03-22 11:23 ` David Bremner [this message]
2017-03-22 11:23 ` [PATCH 3/7] lib/index: Add another layer of indirection in filtering David Bremner
2017-03-22 11:23 ` [PATCH 4/7] lib/index: separate state table definition from scanner David Bremner
2017-03-22 11:23 ` [PATCH 5/7] lib/index: generalize filter name David Bremner
2017-03-22 11:23 ` [PATCH 6/7] lib/index.cc: generalize filter state machine David Bremner
2017-03-22 11:23 ` [PATCH 7/7] lib/index: add simple html filter David Bremner
2017-03-22 13:20 ` Drop HTML tags when indexing Daniel Lublin (quite)
2017-03-25 12:59 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170322112306.12060-3-david@tethera.net \
--to=david@tethera.net \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).