aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-parser.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2001-11-30 11:09:38 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-11-30 11:09:38 +0800
commitd46cb0fd8d142c6dfa186db76202bb9912fbb7fa (patch)
tree09283efea0e5fd246a897b62fa211e96a858d329 /camel/camel-mime-parser.c
parent1af092ec093994115d64ed30f04d11bb322aba35 (diff)
downloadgsoc2013-evolution-d46cb0fd8d142c6dfa186db76202bb9912fbb7fa.tar.gz
gsoc2013-evolution-d46cb0fd8d142c6dfa186db76202bb9912fbb7fa.tar.zst
gsoc2013-evolution-d46cb0fd8d142c6dfa186db76202bb9912fbb7fa.zip
Completely new implementation of NNTP.
2001-11-30 Not Zed <NotZed@Ximian.com> * 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
Diffstat (limited to 'camel/camel-mime-parser.c')
-rw-r--r--camel/camel-mime-parser.c12
1 files changed, 12 insertions, 0 deletions
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';