diff options
author | Not Zed <NotZed@Ximian.com> | 2001-03-14 15:06:54 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2001-03-14 15:06:54 +0800 |
commit | 0e9c0268a8ae99b88d7b98539181c0e938e5cb53 (patch) | |
tree | 448e5a9d7b6797e4a396c942a8370c5db2a99540 | |
parent | 83b4aa2b1d586cd9014394343b303d71e31ad3b8 (diff) | |
download | gsoc2013-evolution-0e9c0268a8ae99b88d7b98539181c0e938e5cb53.tar gsoc2013-evolution-0e9c0268a8ae99b88d7b98539181c0e938e5cb53.tar.gz gsoc2013-evolution-0e9c0268a8ae99b88d7b98539181c0e938e5cb53.tar.bz2 gsoc2013-evolution-0e9c0268a8ae99b88d7b98539181c0e938e5cb53.tar.lz gsoc2013-evolution-0e9c0268a8ae99b88d7b98539181c0e938e5cb53.tar.xz gsoc2013-evolution-0e9c0268a8ae99b88d7b98539181c0e938e5cb53.tar.zst gsoc2013-evolution-0e9c0268a8ae99b88d7b98539181c0e938e5cb53.zip |
re-constify inbuf, to remove a warning.
2001-03-14 Not Zed <NotZed@Ximian.com>
* camel-mime-filter-charset.c (filter, complete): re-constify
inbuf, to remove a warning.
* camel-mime-parser.c (folder_scan_step): When we're out of data,
run the filter_complete. For some reason the logic that was there
was never being run, always try it now, i think it was to work
around a buggy filter, rather than fix it the right way.
* camel-folder-summary.c (summary_build_content_info): If indexing
html parts, use the html filter to convert it to some indexable
format.
(summary_build_content_info): Reset the filters before adding them
back to the stream, if they get re-used in a given instance
(likely).
* Makefile.am (libcamelinclude_HEADERS): Added
camel-mime-filter-html.[ch].
(INCLUDES): Added xml clags
2001-03-05 Not Zed <NotZed@Ximian.com>
* camel-folder-search.c (camel_folder_search_class_init): Setup a
new function, "uid" which matches uids.
(search_uid): Implement the "match uid" command.
svn path=/trunk/; revision=8705
-rw-r--r-- | camel/ChangeLog | 29 | ||||
-rw-r--r-- | camel/Makefile.am | 3 | ||||
-rw-r--r-- | camel/camel-folder-search.c | 38 | ||||
-rw-r--r-- | camel/camel-folder-search.h | 4 | ||||
-rw-r--r-- | camel/camel-folder-summary.c | 18 | ||||
-rw-r--r-- | camel/camel-mime-filter-charset.c | 4 | ||||
-rw-r--r-- | camel/camel-mime-filter-html.c | 322 | ||||
-rw-r--r-- | camel/camel-mime-filter-html.h | 46 | ||||
-rw-r--r-- | camel/camel-mime-parser.c | 11 | ||||
-rw-r--r-- | camel/camel-private.h | 9 |
10 files changed, 468 insertions, 16 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index c807431ae7..9aaa348288 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,4 +1,31 @@ -2001-03-14 Jeffrey Stedfast <fejj@ximian.com> +2001-03-14 Not Zed <NotZed@Ximian.com> + + * camel-mime-filter-charset.c (filter, complete): re-constify + inbuf, to remove a warning. + + * camel-mime-parser.c (folder_scan_step): When we're out of data, + run the filter_complete. For some reason the logic that was there + was never being run, always try it now, i think it was to work + around a buggy filter, rather than fix it the right way. + + * camel-folder-summary.c (summary_build_content_info): If indexing + html parts, use the html filter to convert it to some indexable + format. + (summary_build_content_info): Reset the filters before adding them + back to the stream, if they get re-used in a given instance + (likely). + + * Makefile.am (libcamelinclude_HEADERS): Added + camel-mime-filter-html.[ch]. + (INCLUDES): Added xml clags + +2001-03-05 Not Zed <NotZed@Ximian.com> + + * camel-folder-search.c (camel_folder_search_class_init): Setup a + new function, "uid" which matches uids. + (search_uid): Implement the "match uid" command. + +2001-03-13 Jeffrey Stedfast <fejj@ximian.com> * camel-mime-utils.c: Check for a new type of mailing list header. diff --git a/camel/Makefile.am b/camel/Makefile.am index 857b8df246..d054ae1538 100644 --- a/camel/Makefile.am +++ b/camel/Makefile.am @@ -11,6 +11,7 @@ INCLUDES = -I.. -I$(srcdir)/.. -I$(includedir) \ -I$(top_srcdir)/intl \ -I$(top_srcdir)/e-util \ $(GLIB_CFLAGS) \ + $(GNOME_XML_CFLAGS) \ $(UNICODE_CFLAGS) \ $(KRB4_CFLAGS) \ -DCAMEL_PROVIDERDIR=\""$(providerdir)"\" \ @@ -35,6 +36,7 @@ libcamel_la_SOURCES = \ camel-mime-filter-charset.c \ camel-mime-filter-crlf.c \ camel-mime-filter-from.c \ + camel-mime-filter-html.c \ camel-mime-filter-index.c \ camel-mime-filter-linewrap.c \ camel-mime-filter-save.c \ @@ -103,6 +105,7 @@ libcamelinclude_HEADERS = \ camel-mime-filter-charset.h \ camel-mime-filter-crlf.h \ camel-mime-filter-from.h \ + camel-mime-filter-html.h \ camel-mime-filter-index.h \ camel-mime-filter-linewrap.h \ camel-mime-filter-save.h \ diff --git a/camel/camel-folder-search.c b/camel/camel-folder-search.c index aec5627875..7afb148b0d 100644 --- a/camel/camel-folder-search.c +++ b/camel/camel-folder-search.c @@ -64,6 +64,7 @@ static ESExpResult *search_system_flag(struct _ESExp *f, int argc, struct _ESExp static ESExpResult *search_get_sent_date(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s); static ESExpResult *search_get_received_date(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s); static ESExpResult *search_get_current_date(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s); +static ESExpResult *search_uid(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s); static ESExpResult *search_dummy(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search); @@ -91,6 +92,7 @@ camel_folder_search_class_init (CamelFolderSearchClass *klass) klass->get_sent_date = search_get_sent_date; klass->get_received_date = search_get_received_date; klass->get_current_date = search_get_current_date; + klass->uid = search_uid; } static void @@ -188,6 +190,7 @@ struct { { "get-sent-date", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, get_sent_date), 1 }, { "get-received-date", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, get_received_date), 1 }, { "get-current-date", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, get_current_date), 1 }, + { "uid", CAMEL_STRUCT_OFFSET(CamelFolderSearchClass, uid), 1 }, }; void @@ -851,3 +854,38 @@ search_get_current_date(struct _ESExp *f, int argc, struct _ESExpResult **argv, r->value.number = time (NULL); return r; } + +static ESExpResult * +search_uid(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search) +{ + ESExpResult *r; + int i; + + r(printf("executing uid\n")); + + /* are we inside a match-all? */ + if (search->current) { + int truth = FALSE; + const char *uid = camel_message_info_uid(search->current); + + /* performs an OR of all words */ + for (i=0;i<argc && !truth;i++) { + if (argv[i]->type == ESEXP_RES_STRING + && !strcmp(uid, argv[i]->value.string)) { + truth = TRUE; + break; + } + } + r = e_sexp_result_new(f, ESEXP_RES_BOOL); + r->value.bool = truth; + } else { + r = e_sexp_result_new(f, ESEXP_RES_ARRAY_PTR); + r->value.ptrarray = g_ptr_array_new(); + for (i=0;i<argc;i++) { + if (argv[i]->type == ESEXP_RES_STRING) + g_ptr_array_add(r->value.ptrarray, argv[i]->value.string); + } + } + + return r; +} diff --git a/camel/camel-folder-search.h b/camel/camel-folder-search.h index e085ddf188..2dd195569e 100644 --- a/camel/camel-folder-search.h +++ b/camel/camel-folder-search.h @@ -103,8 +103,8 @@ struct _CamelFolderSearchClass { /* (get-current-date) Retrieve 'now' as a time_t */ ESExpResult * (*get_current_date)(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s); - /* (mlist-matches "mlist" ...) True if one of the mailing list matches */ - ESExpResult * (*mlist_matches)(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s); + /* (uid "uid" ...) True if the uid is in the list */ + ESExpResult * (*uid)(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s); }; guint camel_folder_search_get_type (void); diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c index 4e9e9e9d1b..9aaa61e50c 100644 --- a/camel/camel-folder-summary.c +++ b/camel/camel-folder-summary.c @@ -36,6 +36,7 @@ #include <camel/camel-mime-filter-charset.h> #include <camel/camel-mime-filter-save.h> #include <camel/camel-mime-filter-basic.h> +#include <camel/camel-mime-filter-html.h> #include <camel/camel-mime-message.h> #include <camel/camel-stream-mem.h> @@ -2053,7 +2054,7 @@ summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, Cam CamelMessageContentInfo *info = NULL; struct _header_content_type *ct; int body; - int enc_id = -1, chr_id = -1, idx_id = -1; + int enc_id = -1, chr_id = -1, html_id = -1, idx_id = -1; struct _CamelFolderSummaryPrivate *p = _PRIVATE(s); CamelMimeFilterCharset *mfc; CamelMessageContentInfo *part; @@ -2087,11 +2088,15 @@ summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, Cam d(printf(" decoding base64\n")); if (p->filter_64 == NULL) p->filter_64 = camel_mime_filter_basic_new_type(CAMEL_MIME_FILTER_BASIC_BASE64_DEC); + else + camel_mime_filter_reset((CamelMimeFilter *)p->filter_64); enc_id = camel_mime_parser_filter_add(mp, (CamelMimeFilter *)p->filter_64); } else if (!strcasecmp(encoding, "quoted-printable")) { d(printf(" decoding quoted-printable\n")); if (p->filter_qp == NULL) p->filter_qp = camel_mime_filter_basic_new_type(CAMEL_MIME_FILTER_BASIC_QP_DEC); + else + camel_mime_filter_reset((CamelMimeFilter *)p->filter_qp); enc_id = camel_mime_parser_filter_add(mp, (CamelMimeFilter *)p->filter_qp); } else { d(printf(" ignoring encoding %s\n", encoding)); @@ -2109,6 +2114,8 @@ summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, Cam mfc = camel_mime_filter_charset_new_convert(charset, "UTF-8"); if (mfc) g_hash_table_insert(p->filter_charset, g_strdup(charset), mfc); + } else { + camel_mime_filter_reset((CamelMimeFilter *)mfc); } if (mfc) { chr_id = camel_mime_parser_filter_add(mp, (CamelMimeFilter *)mfc); @@ -2117,6 +2124,14 @@ summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, Cam } } + if (header_content_type_is(ct, "text", "html")) { + if (p->filter_html == NULL) + p->filter_html = camel_mime_filter_html_new(); + else + camel_mime_filter_reset((CamelMimeFilter *)p->filter_html); + html_id = camel_mime_parser_filter_add(mp, (CamelMimeFilter *)p->filter_html); + } + /* and this filter actually does the indexing */ idx_id = camel_mime_parser_filter_add(mp, (CamelMimeFilter *)p->filter_index); } @@ -2126,6 +2141,7 @@ summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, Cam /* and remove the filters */ camel_mime_parser_filter_remove(mp, enc_id); camel_mime_parser_filter_remove(mp, chr_id); + camel_mime_parser_filter_remove(mp, html_id); camel_mime_parser_filter_remove(mp, idx_id); break; case HSCAN_MULTIPART: diff --git a/camel/camel-mime-filter-charset.c b/camel/camel-mime-filter-charset.c index a45a318367..6c1f668713 100644 --- a/camel/camel-mime-filter-charset.c +++ b/camel/camel-mime-filter-charset.c @@ -85,7 +85,7 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, { CamelMimeFilterCharset *f = (CamelMimeFilterCharset *)mf; int converted; - char *inbuf; + const char *inbuf; char *outbuf; int inlen, outlen; @@ -151,7 +151,7 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s { CamelMimeFilterCharset *f = (CamelMimeFilterCharset *)mf; int converted; - char *inbuf; + const char *inbuf; char *outbuf; int inlen, outlen; diff --git a/camel/camel-mime-filter-html.c b/camel/camel-mime-filter-html.c new file mode 100644 index 0000000000..06d0ef252b --- /dev/null +++ b/camel/camel-mime-filter-html.c @@ -0,0 +1,322 @@ +/* + * Copyright (C) 2001 Ximian Inc. + * + * Authors: Michael Zucchi <notzed@helixcode.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "camel-mime-filter-html.h" + +#include <stdio.h> +#include <string.h> +#include <stdarg.h> + + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> +#include <stdlib.h> + +#include "xmlmemory.h" +#include "HTMLparser.h" +#include "HTMLtree.h" + +#define d(x) + +static void camel_mime_filter_html_class_init (CamelMimeFilterHTMLClass *klass); +static void camel_mime_filter_html_init (CamelObject *o); +static void camel_mime_filter_html_finalize (CamelObject *o); + +static CamelMimeFilterClass *camel_mime_filter_html_parent; + +struct _CamelMimeFilterHTMLPrivate { + htmlParserCtxtPtr ctxt; +}; + +/* ********************************************************************** */ + +/* HTML parser */ + +#define ARRAY_LEN(x) (sizeof(x)/sizeof((x)[0])) + +static struct { + char *element; + char *remap; +} map_start[] = { + { "p", "\n\n" }, + { "br", "\n" }, + { "h1", "\n" }, { "h2", "\n" }, { "h3", "\n" }, { "h4", "\n" }, { "h5", "\n" }, { "h6", "\n" }, +}; + + +static struct { + char *element; + char *remap; +} map_end[] = { + { "h1", "\n" }, { "h2", "\n" }, { "h3", "\n" }, { "h4", "\n" }, { "h5", "\n" }, { "h6", "\n" }, +}; + +static void +characters(void *ctx, const xmlChar *ch, int len) +{ + CamelMimeFilter *mf = ctx; + + memcpy(mf->outptr, ch, len); + mf->outptr+= len; +} + +#if 0 +/* we probably dont want to index comments */ +static void +comment(void *ctx, const xmlChar *value) +{ + CamelMimeFilter *mf = ctx; + + mf->outptr += sprintf(mf->outptr, " %s \n", value); +} +#endif + +/* we map element starts to stuff sometimes, so we can properly break up + words and lines. + This is very dumb, and needs to be smarter: e.g. + <b>F</b>\nooBar should -> "FooBar" +*/ +static void +startElement(void *ctx, const xmlChar *name, const xmlChar **atts) +{ + int i; + CamelMimeFilter *mf = ctx; + + /* we grab all "content" from "meta" tags, and dump it in the output, + it might be useful for searching with. This should probably be pickier */ + if (!strcasecmp(name, "meta")) { + if (atts) { + for (i=0;atts[i];i+=2) { + if (!strcmp(atts[i], "content")) + mf->outptr += sprintf(mf->outptr, " %s \n", atts[i+1]); + } + } + return; + } + + /* FIXME: use a hashtable */ + for (i=0;i<ARRAY_LEN(map_start);i++) { + if (!strcasecmp(map_start[i].element, name)) { + characters(ctx, map_start[i].remap, strlen(map_start[i].remap)); + break; + } + } +} + +static void +endElement(void *ctx, const xmlChar *name) +{ + int i; + + /* FIXME: use a hashtable */ + for (i=0;i<ARRAY_LEN(map_end);i++) { + if (!strcasecmp(map_end[i].element, name)) { + characters(ctx, map_end[i].remap, strlen(map_end[i].remap)); + break; + } + } +} + +/* dum de dum, well we can print out some crap for now */ +static void +warning(void *ctx, const char *msg, ...) +{ + va_list args; + + va_start(args, msg); + fprintf(stdout, "SAX.warning: "); + vfprintf(stdout, msg, args); + va_end(args); +} + +static void +error(void *ctx, const char *msg, ...) +{ + va_list args; + + va_start(args, msg); + fprintf(stdout, "SAX.error: "); + vfprintf(stdout, msg, args); + va_end(args); +} + +static void +fatalError(void *ctx, const char *msg, ...) +{ + va_list args; + + va_start(args, msg); + fprintf(stdout, "SAX.fatalError: "); + vfprintf(stdout, msg, args); + va_end(args); +} + +static xmlSAXHandler indexSAXHandler = { + NULL, /* internalSubset */ + NULL, /*isStandalone,*/ + NULL, /*hasInternalSubset,*/ + NULL, /*hasExternalSubset,*/ + NULL, /*resolveEntity,*/ + NULL, /*getEntity,*/ + NULL, /*entityDecl,*/ + NULL, /*notationDecl,*/ + NULL, /*attributeDecl,*/ + NULL, /*elementDecl,*/ + NULL, /*unparsedEntityDecl,*/ + NULL, /*setDocumentLocator,*/ + NULL, /*startDocument,*/ + NULL, /*endDocument,*/ + startElement, + endElement, + NULL, /*reference,*/ + characters, + NULL, /*ignorableWhitespace,*/ + NULL, /*processingInstruction,*/ + NULL, /*comment,*/ + warning, + error, + fatalError, + NULL, /*getParameterEntity,*/ +}; + + +/* ********************************************************************** */ + + +CamelType +camel_mime_filter_html_get_type (void) +{ + static CamelType type = CAMEL_INVALID_TYPE; + + if (type == CAMEL_INVALID_TYPE) { + type = camel_type_register (camel_mime_filter_get_type (), "CamelMimeFilterHTML", + sizeof (CamelMimeFilterHTML), + sizeof (CamelMimeFilterHTMLClass), + (CamelObjectClassInitFunc) camel_mime_filter_html_class_init, + NULL, + (CamelObjectInitFunc) camel_mime_filter_html_init, + (CamelObjectFinalizeFunc) camel_mime_filter_html_finalize); + } + + return type; +} + +static void +camel_mime_filter_html_finalize(CamelObject *o) +{ + CamelMimeFilterHTML *f = (CamelMimeFilterHTML *)o; + + if (f->priv->ctxt) + htmlFreeParserCtxt(f->priv->ctxt); +} + +static void +camel_mime_filter_html_init (CamelObject *o) +{ + CamelMimeFilterHTML *f = (CamelMimeFilterHTML *)o; + + f->priv = g_malloc0(sizeof(*f->priv)); +} + +static void +complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, size_t *outlenptr, size_t *outprespace) +{ + CamelMimeFilterHTML *f = (CamelMimeFilterHTML *)mf; + + camel_mime_filter_set_size(mf, len*2+256, FALSE); + mf->outptr = mf->outbuf; + + d(printf("converting html end:\n%.*s\n", (int)len, in)); + + if (f->priv->ctxt == NULL) { + f->priv->ctxt = htmlCreatePushParserCtxt(&indexSAXHandler, f, in, len, "", 0); + len = 0; + } + + htmlParseChunk(f->priv->ctxt, in, len, 1); + + *out = mf->outbuf; + *outlenptr = mf->outptr - mf->outbuf; + *outprespace = mf->outbuf - mf->outreal; + + d(printf("converted html end:\n%.*s\n", (int)*outlenptr, *out)); +} + +static void +filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, size_t *outlenptr, size_t *outprespace) +{ + CamelMimeFilterHTML *f = (CamelMimeFilterHTML *)mf; + + camel_mime_filter_set_size(mf, len*2+16, FALSE); + mf->outptr = mf->outbuf; + + d(printf("converting html:\n%.*s\n", (int)len, in)); + + if (f->priv->ctxt == NULL) + f->priv->ctxt = htmlCreatePushParserCtxt(&indexSAXHandler, f, in, len, "", 0); + else + htmlParseChunk(f->priv->ctxt, in, len, 0); + + *out = mf->outbuf; + *outlenptr = mf->outptr - mf->outbuf; + *outprespace = mf->outbuf - mf->outreal; + + d(printf("converted html:\n%.*s\n", (int)*outlenptr, *out)); +} + +static void +reset(CamelMimeFilter *mf) +{ + CamelMimeFilterHTML *f = (CamelMimeFilterHTML *)mf; + + if (f->priv->ctxt != NULL) { + htmlFreeParserCtxt(f->priv->ctxt); + f->priv->ctxt = NULL; + } +} + +static void +camel_mime_filter_html_class_init (CamelMimeFilterHTMLClass *klass) +{ + CamelMimeFilterClass *filter_class = (CamelMimeFilterClass *) klass; + + camel_mime_filter_html_parent = CAMEL_MIME_FILTER_CLASS (camel_type_get_global_classfuncs (camel_mime_filter_get_type ())); + + filter_class->reset = reset; + filter_class->filter = filter; + filter_class->complete = complete; +} + +/** + * camel_mime_filter_html_new: + * + * Create a new CamelMimeFilterHTML object. + * + * Return value: A new CamelMimeFilterHTML widget. + **/ +CamelMimeFilterHTML * +camel_mime_filter_html_new (void) +{ + CamelMimeFilterHTML *new = CAMEL_MIME_FILTER_HTML ( camel_object_new (camel_mime_filter_html_get_type ())); + return new; +} + diff --git a/camel/camel-mime-filter-html.h b/camel/camel-mime-filter-html.h new file mode 100644 index 0000000000..3bac437f63 --- /dev/null +++ b/camel/camel-mime-filter-html.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2001 Ximian Inc. + * + * Authors: Michael Zucchi <notzed@helixcode.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _CAMEL_MIME_FILTER_HTML_H +#define _CAMEL_MIME_FILTER_HTML_H + +#include <camel/camel-mime-filter.h> + +#define CAMEL_MIME_FILTER_HTML(obj) CAMEL_CHECK_CAST (obj, camel_mime_filter_html_get_type (), CamelMimeFilterHTML) +#define CAMEL_MIME_FILTER_HTML_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_mime_filter_html_get_type (), CamelMimeFilterHTMLClass) +#define CAMEL_IS_MIME_FILTER_HTML(obj) CAMEL_CHECK_TYPE (obj, camel_mime_filter_html_get_type ()) + +typedef struct _CamelMimeFilterHTMLClass CamelMimeFilterHTMLClass; +typedef struct _CamelMimeFilterHTML CamelMimeFilterHTML; + +struct _CamelMimeFilterHTML { + CamelMimeFilter parent; + + struct _CamelMimeFilterHTMLPrivate *priv; +}; + +struct _CamelMimeFilterHTMLClass { + CamelMimeFilterClass parent_class; +}; + +guint camel_mime_filter_html_get_type (void); +CamelMimeFilterHTML *camel_mime_filter_html_new (void); + +#endif /* ! _CAMEL_MIME_FILTER_HTML_H */ diff --git a/camel/camel-mime-parser.c b/camel/camel-mime-parser.c index b9fc3d2ebb..d08beffca7 100644 --- a/camel/camel-mime-parser.c +++ b/camel/camel-mime-parser.c @@ -1719,13 +1719,12 @@ tail_recurse: } while (hb == h && *datalength > 0); /* check for any filter completion data */ - if (*datalength > 0) { - while (f) { - camel_mime_filter_complete(f->filter, *databuffer, *datalength, presize, - databuffer, datalength, &presize); - f = f->next; - } + while (f) { + camel_mime_filter_complete(f->filter, *databuffer, *datalength, presize, + databuffer, datalength, &presize); + f = f->next; } + if (*datalength > 0) return; diff --git a/camel/camel-private.h b/camel/camel-private.h index 9be3a24209..33dc9da163 100644 --- a/camel/camel-private.h +++ b/camel/camel-private.h @@ -120,10 +120,11 @@ struct _CamelRemoteStorePrivate { struct _CamelFolderSummaryPrivate { GHashTable *filter_charset; /* CamelMimeFilterCharset's indexed by source charset */ - CamelMimeFilterIndex *filter_index; - CamelMimeFilterBasic *filter_64; - CamelMimeFilterBasic *filter_qp; - CamelMimeFilterSave *filter_save; + struct _CamelMimeFilterIndex *filter_index; + struct _CamelMimeFilterBasic *filter_64; + struct _CamelMimeFilterBasic *filter_qp; + struct _CamelMimeFilterSave *filter_save; + struct _CamelMimeFilterHTML *filter_html; struct ibex *index; |