From d46cb0fd8d142c6dfa186db76202bb9912fbb7fa Mon Sep 17 00:00:00 2001 From: Not Zed Date: Fri, 30 Nov 2001 03:09:38 +0000 Subject: Completely new implementation of NNTP. 2001-11-30 Not Zed * providers/nntp/camel-nntp-*.c: Completely new implementation of NNTP. Doesn't support subscriptions yet (lists all folders), but should be more reliable (faster?), and has an integrated cache. * camel-exception.c (camel_exception_new): Use e_memchunks for exception blocks. (camel_exception_free): Same. * camel-data-cache.[ch]: New object for managing on-disk caches of anything that can be stored in a camel-stream. * camel-file-utils.c (camel_file_util_mkdir): New function, just a nicer place to put this (than camel-store), should be removed from camel-store. (camel_file_util_safe_filename): New function to url-encode a filename. * camel-mime-parser.c (drop_states): New func to drop the parser state to initial state. (folder_scan_init_with_fd): (folder_scan_init_with_stream): Call above func to reset state if the stream is changed on us so we can change streams to reuse a parser object. svn path=/trunk/; revision=14822 --- camel/camel-mime-parser.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'camel/camel-mime-parser.c') diff --git a/camel/camel-mime-parser.c b/camel/camel-mime-parser.c index a53e0716a7..ea7b75f5ca 100644 --- a/camel/camel-mime-parser.c +++ b/camel/camel-mime-parser.c @@ -1523,6 +1523,16 @@ folder_scan_init(void) return s; } +static void +drop_states(struct _header_scan_state *s) +{ + while (s->parts) { + folder_scan_drop_step(s); + } + s->unstep = 0; + s->state = HSCAN_INITIAL; +} + static int folder_scan_init_with_fd(struct _header_scan_state *s, int fd) { @@ -1530,6 +1540,7 @@ folder_scan_init_with_fd(struct _header_scan_state *s, int fd) len = read(fd, s->inbuf, SCAN_BUF); if (len>=0) { + drop_states(s); s->inend = s->inbuf+len; s->inptr = s->inbuf; s->inend[0] = '\n'; @@ -1555,6 +1566,7 @@ folder_scan_init_with_stream(struct _header_scan_state *s, CamelStream *stream) len = camel_stream_read(stream, s->inbuf, SCAN_BUF); if (len >= 0) { + drop_states(s); s->inend = s->inbuf+len; s->inptr = s->inbuf; s->inend[0] = '\n'; -- cgit