diff options
author | Not Zed <NotZed@HelixCode.com> | 2000-09-28 19:31:29 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2000-09-28 19:31:29 +0800 |
commit | e71de4c02186efe577412709346154df96e35054 (patch) | |
tree | 125ad7e9d02cf42bf8acebefed08c39b8df675e5 /camel/camel-mime-parser.c | |
parent | 18579aa7e01b4d313d2cf05f355aa4698b99cf7d (diff) | |
download | gsoc2013-evolution-e71de4c02186efe577412709346154df96e35054.tar gsoc2013-evolution-e71de4c02186efe577412709346154df96e35054.tar.gz gsoc2013-evolution-e71de4c02186efe577412709346154df96e35054.tar.bz2 gsoc2013-evolution-e71de4c02186efe577412709346154df96e35054.tar.lz gsoc2013-evolution-e71de4c02186efe577412709346154df96e35054.tar.xz gsoc2013-evolution-e71de4c02186efe577412709346154df96e35054.tar.zst gsoc2013-evolution-e71de4c02186efe577412709346154df96e35054.zip |
New function to fold headers.
2000-09-28 Not Zed <NotZed@HelixCode.com>
* camel-mime-utils.c (header_fold): New function to fold headers.
2000-09-27 Not Zed <NotZed@HelixCode.com>
* camel-mime-parser.c (folder_scan_header): If we had an empty
header, then it must be end of the headers too.
(folder_scan_init): No we dont need to init the outbuf with a nul
terminator.
* camel-folder-summary.c (camel_folder_summary_set_uid): New
function to reset the uid to a higher value.
* providers/mbox/camel-mbox-summary.c (camel_mbox_summary_sync):
"something failed (yo!)" what sort of crap is this? Fixed all the
indenting again, what wanker keeps running stuff through indent?
(message_info_new): Check the uid we loaded off the disk, if it
existed already, assign a new one. If it didn't then make sure
the nextuid is higher.
* camel-charset-map.c: New file, used to build a large unicode
decoding mapping table, and use it to determine what is the
lowest charset a given word can be encoded with. Uses tables from
libunicode's source.
* camel-internet-address.c (internet_encode): Use
header_phrase_encode to properly encode the fullname, as required.
refixed indenting. Who keeps doing that?
(camel_internet_address_find_address): Changed fatal return/warnings
into assertions.
* camel-mime-utils.c (header_raw_append_parse): Check : explicitly
(removed from is_fieldname() macro).
(camel_mime_special_table): Changed to short, so we can represent
more bit types.
(quoted_encode): Take a mask of the safe chars for this encoding.
(header_address_decode): Removed a #warning that makes no sense
anymore.
(header_decode_date): Fixed the 'broken date' parser code, if it
ever decoded it it just threw away the result.
(header_encode_string): Use better charset matching for encoding
strings as well.
2000-08-31 Not Zed <NotZed@HelixCode.com>
* providers/mh/camel-mh-summary.c (camel_mh_summary_sync): Save
the index if we do a sync.
(camel_mh_summary_check): Save the index here too. Probably.
svn path=/trunk/; revision=5615
Diffstat (limited to 'camel/camel-mime-parser.c')
-rw-r--r-- | camel/camel-mime-parser.c | 50 |
1 files changed, 35 insertions, 15 deletions
diff --git a/camel/camel-mime-parser.c b/camel/camel-mime-parser.c index 0926748504..08b9868912 100644 --- a/camel/camel-mime-parser.c +++ b/camel/camel-mime-parser.c @@ -42,10 +42,10 @@ #include "camel-stream.h" #include "camel-seekable-stream.h" -#define r(x) -#define h(x) -#define c(x) -#define d(x) +#define r(x) +#define h(x) +#define c(x) +#define d(x) /*#define PURIFY*/ @@ -282,7 +282,6 @@ static void header_append_mempool(struct _header_scan_state *s, struct _header_s static void camel_mime_parser_class_init (CamelMimeParserClass *klass); static void camel_mime_parser_init (CamelMimeParser *obj); -#if d(!)0 static char *states[] = { "HSCAN_INITIAL", "HSCAN_FROM", /* got 'From' line */ @@ -301,8 +300,6 @@ static char *states[] = { "HSCAN_MULTIPART_END", "HSCAN_MESSAGE_END", }; -#endif - static CamelObjectClass *camel_mime_parser_parent; @@ -986,8 +983,6 @@ header_append_mempool(struct _header_scan_state *s, struct _header_scan_stack *h struct _header_raw *l, *n; char *content; - d(printf("Header: %s: %s\n", name, value)); - content = strchr(header, ':'); if (content) { register int len; @@ -1125,14 +1120,21 @@ retry: s->midline = FALSE; } + h(printf("midline = %s\n", s->midline?"TRUE":"FALSE")); h(printf("outbuf[0] = %02x '%c' oubuf[1] = %02x '%c'\n", s->outbuf[0], isprint(s->outbuf[0])?s->outbuf[0]:'.', s->outbuf[1], isprint(s->outbuf[1])?s->outbuf[1]:'.')); + h(printf("inptr[0] = %02x '%c' inptr[1] = %02x '%c'\n", + inptr[0], isprint(inptr[0])?inptr[0]:'.', + inptr[1], isprint(inptr[1])?inptr[1]:'.')); if (!s->midline && !(inptr[0] == ' ' || inptr[0] == '\t')) { - if (s->outbuf[0] == '\n' + h(printf("ok, checking\n")); + if (s->outbuf == s->outptr + || s->outbuf[0] == '\n' || (s->outbuf[0] == '\r' && s->outbuf[1]=='\n')) { + h(printf("header done?\n")); goto header_done; } @@ -1141,7 +1143,7 @@ retry: s->outptr--; s->outptr[0] = 0; - d(printf("header %.10s at %d\n", s->outbuf, s->header_start)); + d(printf("header '%.10s' at %d\n", s->outbuf, s->header_start)); header_raw_append_parse(&h->headers, s->outbuf, s->header_start); @@ -1218,7 +1220,7 @@ folder_scan_content(struct _header_scan_state *s, int *lastone, char **data, int struct _header_scan_stack *part, *overpart = s->parts; int already_packed = FALSE; - /*printf("scanning content\n");*/ + c(printf("scanning content\n")); /* FIXME: this info should be cached ? */ part = s->parts; @@ -1368,7 +1370,6 @@ folder_scan_init(void) s->stream = NULL; s->outbuf = g_malloc(1024); - s->outbuf[0] = '\0'; s->outptr = s->outbuf; s->outend = s->outbuf+1024; @@ -1719,7 +1720,8 @@ int main(int argc, char **argv) perror("Cannot open mailbox"); exit(1); } - s = folder_scan_init(fd); + s = folder_scan_init(); + folder_scan_init_with_fd(s, fd); s->scan_from = FALSE; #if 0 h = g_malloc0(sizeof(*h)); @@ -1734,7 +1736,9 @@ int main(int argc, char **argv) if (s->parts->content_type && (charset = header_content_type_param(s->parts->content_type, "charset"))) { if (strcasecmp(charset, "us-ascii")) { +#if 0 folder_push_filter_charset(s, "UTF-8", charset); +#endif } else { charset = NULL; } @@ -1742,39 +1746,55 @@ int main(int argc, char **argv) charset = NULL; } - encoding = header_raw_find(&s->parts->headers, "Content-transfer-encoding"); + encoding = header_raw_find(&s->parts->headers, "Content-transfer-encoding", 0); printf("encoding = '%s'\n", encoding); if (encoding && !strncasecmp(encoding, " base64", 7)) { printf("adding base64 filter\n"); attachname = g_strdup_printf("attach.%d.%d", i, attach++); +#if 0 folder_push_filter_save(s, attachname); +#endif g_free(attachname); +#if 0 folder_push_filter_mime(s, 0); +#endif } if (encoding && !strncasecmp(encoding, " quoted-printable", 17)) { printf("adding quoted-printable filter\n"); attachname = g_strdup_printf("attach.%d.%d", i, attach++); +#if 0 folder_push_filter_save(s, attachname); +#endif g_free(attachname); +#if 0 folder_push_filter_mime(s, 1); +#endif } break; case HSCAN_BODY: + printf("got body %d '%.*s'\n", len, len, data); break; case HSCAN_BODY_END: + printf("end body %d '%.*s'\n", len, len, data); if (encoding && !strncasecmp(encoding, " base64", 7)) { printf("removing filters\n"); +#if 0 folder_filter_pull(s); folder_filter_pull(s); +#endif } if (encoding && !strncasecmp(encoding, " quoted-printable", 17)) { printf("removing filters\n"); +#if 0 folder_filter_pull(s); folder_filter_pull(s); +#endif } if (charset) { +#if 0 folder_filter_pull(s); +#endif charset = NULL; } encoding = NULL; |