[dovecot-cvs] dovecot/src/lib-imap imap-bodystructure.c,1.19,1.20 imap-bodystructure.h,1.4,1.5 imap-envelope.c,1.12,1.13 imap-message-cache.c,1.24,1.25 imap-message-cache.h,1.12,1.13 imap-parser.c,1.22,1.23 imap-parser.h,1.4,1.5

cras at procontrol.fi cras at procontrol.fi
Fri Dec 6 03:09:25 EET 2002


Update of /home/cvs/dovecot/src/lib-imap
In directory danu:/tmp/cvs-serv6082/lib-imap

Modified Files:
	imap-bodystructure.c imap-bodystructure.h imap-envelope.c 
	imap-message-cache.c imap-message-cache.h imap-parser.c 
	imap-parser.h 
Log Message:
Renamed IBuffer and OBuffer to IStream and OStream which describes their
functionality better. I tried to keep the variable names and comments also
sensible.



Index: imap-bodystructure.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-imap/imap-bodystructure.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- imap-bodystructure.c	22 Nov 2002 08:37:06 -0000	1.19
+++ imap-bodystructure.c	6 Dec 2002 01:09:22 -0000	1.20
@@ -1,7 +1,7 @@
 /* Copyright (C) 2002 Timo Sirainen */
 
 #include "lib.h"
-#include "ibuffer.h"
+#include "istream.h"
 #include "temp-string.h"
 #include "rfc822-tokenize.h"
 #include "message-parser.h"
@@ -220,20 +220,20 @@
 	t_pop();
 }
 
-static void part_parse_headers(MessagePart *part, IBuffer *inbuf,
+static void part_parse_headers(MessagePart *part, IStream *input,
 			       uoff_t start_offset, Pool pool)
 {
 	while (part != NULL) {
 		/* note that we want to parse the header of all
 		   the message parts, multiparts too. */
-		i_assert(part->physical_pos >= inbuf->v_offset - start_offset);
-		i_buffer_skip(inbuf, part->physical_pos -
-			      (inbuf->v_offset - start_offset));
+		i_assert(part->physical_pos >= input->v_offset - start_offset);
+		i_stream_skip(input, part->physical_pos -
+			      (input->v_offset - start_offset));
 
-		message_parse_header(part, inbuf, NULL, parse_header, pool);
+		message_parse_header(part, input, NULL, parse_header, pool);
 
 		if (part->children != NULL) {
-			part_parse_headers(part->children, inbuf,
+			part_parse_headers(part->children, input,
 					   start_offset, pool);
 		}
 
@@ -426,15 +426,15 @@
 }
 
 const char *imap_part_get_bodystructure(Pool pool, MessagePart **part,
-					IBuffer *inbuf, int extended)
+					IStream *input, int extended)
 {
 	uoff_t start_offset;
 
 	if (*part == NULL)
-		*part = message_parse(pool, inbuf, parse_header, pool);
+		*part = message_parse(pool, input, parse_header, pool);
 	else {
-		start_offset = inbuf->v_offset;
-		part_parse_headers(*part, inbuf, start_offset, pool);
+		start_offset = input->v_offset;
+		part_parse_headers(*part, input, start_offset, pool);
 	}
 
 	return part_get_bodystructure(*part, extended);
@@ -584,7 +584,7 @@
 
 const char *imap_body_parse_from_bodystructure(const char *bodystructure)
 {
-	IBuffer *inbuf;
+	IStream *input;
 	ImapParser *parser;
 	ImapArg *args;
 	TempString *str;
@@ -595,10 +595,10 @@
 	len = strlen(bodystructure);
 	str = t_string_new(len);
 
-	inbuf = i_buffer_create_from_data(data_stack_pool, bodystructure, len);
-	(void)i_buffer_read(inbuf);
+	input = i_stream_create_from_data(data_stack_pool, bodystructure, len);
+	(void)i_stream_read(input);
 
-	parser = imap_parser_create(inbuf, NULL, 0);
+	parser = imap_parser_create(input, NULL, 0);
 	ret = imap_parser_read_args(parser, 0, IMAP_PARSE_FLAG_NO_UNESCAPE,
 				    &args);
 
@@ -611,6 +611,6 @@
 		i_error("Error parsing IMAP bodystructure: %s", bodystructure);
 
 	imap_parser_destroy(parser);
-	i_buffer_unref(inbuf);
+	i_stream_unref(input);
 	return value;
 }

Index: imap-bodystructure.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-imap/imap-bodystructure.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- imap-bodystructure.h	16 Oct 2002 22:54:18 -0000	1.4
+++ imap-bodystructure.h	6 Dec 2002 01:09:22 -0000	1.5
@@ -4,7 +4,7 @@
 /* If *part is non-NULL, it's used as base for building the body structure.
    Otherwise it's set to the root MessagePart and parsed. */
 const char *imap_part_get_bodystructure(Pool pool, MessagePart **part,
-					IBuffer *inbuf, int extended);
+					IStream *input, int extended);
 
 /* Return BODY part from BODYSTRUCTURE */
 const char *imap_body_parse_from_bodystructure(const char *bodystructure);

Index: imap-envelope.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-imap/imap-envelope.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- imap-envelope.c	6 Nov 2002 07:45:08 -0000	1.12
+++ imap-envelope.c	6 Dec 2002 01:09:22 -0000	1.13
@@ -1,7 +1,7 @@
 /* Copyright (C) 2002 Timo Sirainen */
 
 #include "lib.h"
-#include "ibuffer.h"
+#include "istream.h"
 #include "temp-string.h"
 #include "rfc822-address.h"
 #include "imap-parser.h"
@@ -236,7 +236,7 @@
 
 const char *imap_envelope_parse(const char *envelope, ImapEnvelopeField field)
 {
-	IBuffer *inbuf;
+	IStream *input;
 	ImapParser *parser;
 	ImapArg *args;
 	const char *value;
@@ -244,11 +244,11 @@
 
 	i_assert(field < IMAP_ENVELOPE_FIELDS);
 
-	inbuf = i_buffer_create_from_data(data_stack_pool, envelope,
+	input = i_stream_create_from_data(data_stack_pool, envelope,
 					  strlen(envelope));
-	parser = imap_parser_create(inbuf, NULL, 0);
+	parser = imap_parser_create(input, NULL, 0);
 
-	(void)i_buffer_read(inbuf);
+	(void)i_stream_read(input);
 	ret = imap_parser_read_args(parser, field+1, 0, &args);
 	if (ret > (int)field) {
 		value = imap_envelope_parse_arg(&args[field], field, envelope);
@@ -258,6 +258,6 @@
 	}
 
 	imap_parser_destroy(parser);
-	i_buffer_unref(inbuf);
+	i_stream_unref(input);
 	return value;
 }

Index: imap-message-cache.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-imap/imap-message-cache.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- imap-message-cache.c	3 Nov 2002 08:39:43 -0000	1.24
+++ imap-message-cache.c	6 Dec 2002 01:09:22 -0000	1.25
@@ -1,7 +1,7 @@
 /* Copyright (C) 2002 Timo Sirainen */
 
 #include "lib.h"
-#include "ibuffer.h"
+#include "istream.h"
 #include "temp-string.h"
 #include "mmap-util.h"
 #include "message-parser.h"
@@ -50,7 +50,7 @@
 	int messages_count;
 
 	CachedMessage *open_msg;
-	IBuffer *open_inbuf;
+	IStream *open_stream;
 
 	void *context;
 };
@@ -161,23 +161,24 @@
 	}
 }
 
-static int imap_msgcache_get_inbuf(ImapMessageCache *cache, uoff_t offset)
+static int imap_msgcache_get_stream(ImapMessageCache *cache, uoff_t offset)
 {
-	if (cache->open_inbuf == NULL)
-		cache->open_inbuf = cache->iface->open_mail(cache->context);
-	else if (offset < cache->open_inbuf->v_offset) {
+	if (cache->open_stream == NULL)
+		cache->open_stream = cache->iface->open_mail(cache->context);
+	else if (offset < cache->open_stream->v_offset) {
 		/* need to rewind */
-		cache->open_inbuf =
-			cache->iface->inbuf_rewind(cache->open_inbuf,
-						   cache->context);
+		cache->open_stream =
+			cache->iface->stream_rewind(cache->open_stream,
+						    cache->context);
 	}
 
-	if (cache->open_inbuf == NULL)
+	if (cache->open_stream == NULL)
 		return FALSE;
 
-	i_assert(offset >= cache->open_inbuf->v_offset);
+	i_assert(offset >= cache->open_stream->v_offset);
 
-	i_buffer_skip(cache->open_inbuf, offset - cache->open_inbuf->v_offset);
+	i_stream_skip(cache->open_stream,
+		      offset - cache->open_stream->v_offset);
 	return TRUE;
 }
 
@@ -206,12 +207,12 @@
 	    msg->cached_bodystructure == NULL) {
 		value = cache->iface->get_cached_field(IMAP_CACHE_BODYSTRUCTURE,
 						       cache->context);
-		if (value == NULL && imap_msgcache_get_inbuf(cache, 0)) {
+		if (value == NULL && imap_msgcache_get_stream(cache, 0)) {
 			msg_get_part(cache);
 
 			value = imap_part_get_bodystructure(msg->pool,
 							    &msg->part,
-							    cache->open_inbuf,
+							    cache->open_stream,
 							    TRUE);
 		}
 
@@ -222,7 +223,7 @@
 	if ((fields & IMAP_CACHE_BODY) && msg->cached_body == NULL) {
 		value = cache->iface->get_cached_field(IMAP_CACHE_BODY,
 						       cache->context);
-		if (value == NULL && cache->open_inbuf != NULL) {
+		if (value == NULL && cache->open_stream != NULL) {
 			/* we can generate it from cached BODYSTRUCTURE.
 			   do it only if the file isn't open already, since
 			   this takes more CPU than parsing message headers. */
@@ -234,12 +235,12 @@
 			}
 		}
 
-		if (value == NULL && imap_msgcache_get_inbuf(cache, 0)) {
+		if (value == NULL && imap_msgcache_get_stream(cache, 0)) {
 			msg_get_part(cache);
 
 			value = imap_part_get_bodystructure(msg->pool,
 							    &msg->part,
-							    cache->open_inbuf,
+							    cache->open_stream,
 							    FALSE);
 		}
 
@@ -252,7 +253,7 @@
 						       cache->context);
 		if (value == NULL) {
 			if (msg->envelope == NULL &&
-			    imap_msgcache_get_inbuf(cache, 0)) {
+			    imap_msgcache_get_stream(cache, 0)) {
 				/* envelope isn't parsed yet, do it. header
 				   size is calculated anyway so save it */
 				if (msg->hdr_size == NULL) {
@@ -260,7 +261,7 @@
 							      MessageSize, 1);
 				}
 
-				message_parse_header(NULL, cache->open_inbuf,
+				message_parse_header(NULL, cache->open_stream,
 						     msg->hdr_size,
 						     parse_envelope_header,
 						     msg);
@@ -290,7 +291,7 @@
 	if (fields & IMAP_CACHE_MESSAGE_PART) {
 		msg_get_part(cache);
 
-		if (msg->part == NULL && imap_msgcache_get_inbuf(cache, 0)) {
+		if (msg->part == NULL && imap_msgcache_get_stream(cache, 0)) {
 			/* we need to parse the message */
 			MessageHeaderFunc func;
 
@@ -303,7 +304,7 @@
 				func = NULL;
 			}
 
-			msg->part = message_parse(msg->pool, cache->open_inbuf,
+			msg->part = message_parse(msg->pool, cache->open_stream,
 						  func, msg);
 		} else {
 			failed = TRUE;
@@ -336,8 +337,8 @@
 			}
 		} else {
 			/* need to do some light parsing */
-			if (imap_msgcache_get_inbuf(cache, 0)) {
-				message_get_header_size(cache->open_inbuf,
+			if (imap_msgcache_get_stream(cache, 0)) {
+				message_get_header_size(cache->open_stream,
 							msg->hdr_size);
 			} else {
 				failed = TRUE;
@@ -358,7 +359,7 @@
 	if (fields & IMAP_CACHE_MESSAGE_OPEN) {
 		/* this isn't needed for anything else than pre-opening the
 		   mail and seeing if it fails. */
-		failed = !imap_msgcache_get_inbuf(cache, 0);
+		failed = !imap_msgcache_get_stream(cache, 0);
 	}
 
 	if ((fields & IMAP_CACHE_INTERNALDATE) &&
@@ -410,9 +411,9 @@
 
 void imap_msgcache_close(ImapMessageCache *cache)
 {
-	if (cache->open_inbuf != NULL) {
-		i_buffer_unref(cache->open_inbuf);
-		cache->open_inbuf = NULL;
+	if (cache->open_stream != NULL) {
+		i_stream_unref(cache->open_stream);
+		cache->open_stream = NULL;
 	}
 
 	cache->open_msg = NULL;
@@ -467,7 +468,7 @@
 	return cache->open_msg->internal_date;
 }
 
-int imap_msgcache_get_rfc822(ImapMessageCache *cache, IBuffer **inbuf,
+int imap_msgcache_get_rfc822(ImapMessageCache *cache, IStream **stream,
 			     MessageSize *hdr_size, MessageSize *body_size)
 {
 	CachedMessage *msg;
@@ -476,14 +477,14 @@
 	i_assert(cache->open_msg != NULL);
 
 	msg = cache->open_msg;
-	if (inbuf != NULL) {
+	if (stream != NULL) {
 		if (msg->hdr_size == NULL)
 			cache_fields(cache, IMAP_CACHE_MESSAGE_HDR_SIZE);
 		offset = hdr_size != NULL ? 0 :
 			msg->hdr_size->physical_size;
-		if (!imap_msgcache_get_inbuf(cache, offset))
+		if (!imap_msgcache_get_stream(cache, offset))
 			return FALSE;
-                *inbuf = cache->open_inbuf;
+                *stream = cache->open_stream;
 	}
 
 	if (body_size != NULL) {
@@ -505,7 +506,7 @@
 	return TRUE;
 }
 
-static void get_partial_size(IBuffer *inbuf,
+static void get_partial_size(IStream *stream,
 			     uoff_t virtual_skip, uoff_t max_virtual_size,
 			     MessageSize *partial, MessageSize *dest,
 			     int *cr_skipped)
@@ -514,12 +515,12 @@
 	if (partial->virtual_size > virtual_skip)
 		memset(partial, 0, sizeof(MessageSize));
 	else {
-		i_buffer_skip(inbuf, partial->physical_size);
+		i_stream_skip(stream, partial->physical_size);
 		virtual_skip -= partial->virtual_size;
 	}
 
-	message_skip_virtual(inbuf, virtual_skip, partial, cr_skipped);
-	message_get_body_size(inbuf, dest, max_virtual_size);
+	message_skip_virtual(stream, virtual_skip, partial, cr_skipped);
+	message_get_body_size(stream, dest, max_virtual_size);
 
 	if (*cr_skipped) {
 		dest->virtual_size--;
@@ -531,7 +532,7 @@
 				     uoff_t virtual_skip,
 				     uoff_t max_virtual_size,
 				     int get_header, MessageSize *size,
-                                     IBuffer **inbuf, int *cr_skipped)
+                                     IStream **stream, int *cr_skipped)
 {
 	CachedMessage *msg;
 	uoff_t physical_skip, full_size;
@@ -540,7 +541,7 @@
 	i_assert(cache->open_msg != NULL);
 
 	memset(size, 0, sizeof(MessageSize));
-	*inbuf = NULL;
+	*stream = NULL;
 	*cr_skipped = FALSE;
 
 	msg = cache->open_msg;
@@ -575,7 +576,7 @@
 	if (size_got) {
 		physical_skip = get_header ? 0 : msg->hdr_size->physical_size;
 	} else {
-		if (!imap_msgcache_get_inbuf(cache, 0))
+		if (!imap_msgcache_get_stream(cache, 0))
 			return FALSE;
 
 		if (msg->partial_size == NULL)
@@ -583,7 +584,7 @@
 		if (!get_header)
 			virtual_skip += msg->hdr_size->virtual_size;
 
-		get_partial_size(cache->open_inbuf, virtual_skip,
+		get_partial_size(cache->open_stream, virtual_skip,
 				 max_virtual_size, msg->partial_size, size,
 				 cr_skipped);
 
@@ -591,20 +592,20 @@
 	}
 
 	/* seek to wanted position */
-	if (!imap_msgcache_get_inbuf(cache, physical_skip))
+	if (!imap_msgcache_get_stream(cache, physical_skip))
 		return FALSE;
 
-        *inbuf = cache->open_inbuf;
+        *stream = cache->open_stream;
 	return TRUE;
 }
 
-int imap_msgcache_get_data(ImapMessageCache *cache, IBuffer **inbuf)
+int imap_msgcache_get_data(ImapMessageCache *cache, IStream **stream)
 {
 	i_assert(cache->open_msg != NULL);
 
-	if (!imap_msgcache_get_inbuf(cache, 0))
+	if (!imap_msgcache_get_stream(cache, 0))
 		return FALSE;
 
-        *inbuf = cache->open_inbuf;
+        *stream = cache->open_stream;
 	return TRUE;
 }

Index: imap-message-cache.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-imap/imap-message-cache.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- imap-message-cache.h	27 Oct 2002 19:49:13 -0000	1.12
+++ imap-message-cache.h	6 Dec 2002 01:09:22 -0000	1.13
@@ -26,10 +26,10 @@
 
 typedef struct {
 	/* Open mail for reading. */
-	IBuffer *(*open_mail)(void *context);
-	/* Rewind input buffer to beginning, possibly closing the old buffer
+	IStream *(*open_mail)(void *context);
+	/* Rewind stream to beginning, possibly closing the old stream
 	   if it can't directly be rewinded. */
-	IBuffer *(*inbuf_rewind)(IBuffer *inbuf, void *context);
+	IStream *(*stream_rewind)(IStream *stream, void *context);
 
 	/* Returns field if it's already cached, or NULL. */
 	const char *(*get_cached_field)(ImapCacheField field, void *context);
@@ -56,7 +56,7 @@
 		       uoff_t vp_header_size, uoff_t vp_body_size,
 		       uoff_t full_virtual_size, void *context);
 
-/* Close the IOBuffer for opened message. */
+/* Close the IOStream for opened message. */
 void imap_msgcache_close(ImapMessageCache *cache);
 
 /* Returns the field from cache, or NULL if it's not cached. */
@@ -71,23 +71,23 @@
 /* Returns the internal date of message, or (time_t)-1 if failed. */
 time_t imap_msgcache_get_internal_date(ImapMessageCache *cache);
 
-/* Returns TRUE if successful. If inbuf is not NULL, it's set to point to
+/* Returns TRUE if successful. If stream is not NULL, it's set to point to
    beginning of message, or to beginning of message body if hdr_size is NULL. */
-int imap_msgcache_get_rfc822(ImapMessageCache *cache, IBuffer **inbuf,
+int imap_msgcache_get_rfc822(ImapMessageCache *cache, IStream **stream,
 			     MessageSize *hdr_size, MessageSize *body_size);
 
-/* Returns TRUE if successful. *inbuf is set to point to the first non-skipped
+/* Returns TRUE if successful. *stream is set to point to the first non-skipped
    character. size is set to specify the actual message size in
    virtual_skip..max_virtual_size range. cr_skipped is set to TRUE if first
-   character in inbuf is LF, and we should NOT treat it as CR+LF. */
+   character in stream is LF, and we should NOT treat it as CR+LF. */
 int imap_msgcache_get_rfc822_partial(ImapMessageCache *cache,
 				     uoff_t virtual_skip,
 				     uoff_t max_virtual_size,
 				     int get_header, MessageSize *size,
-				     IBuffer **inbuf, int *cr_skipped);
+				     IStream **stream, int *cr_skipped);
 
-/* Returns TRUE if successful. *inbuf is set to point to beginning of
+/* Returns TRUE if successful. *stream is set to point to beginning of
    message. */
-int imap_msgcache_get_data(ImapMessageCache *cache, IBuffer **inbuf);
+int imap_msgcache_get_data(ImapMessageCache *cache, IStream **stream);
 
 #endif

Index: imap-parser.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-imap/imap-parser.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- imap-parser.c	1 Dec 2002 18:00:03 -0000	1.22
+++ imap-parser.c	6 Dec 2002 01:09:22 -0000	1.23
@@ -1,8 +1,8 @@
 /* Copyright (C) 2002 Timo Sirainen */
 
 #include "lib.h"
-#include "ibuffer.h"
-#include "obuffer.h"
+#include "istream.h"
+#include "ostream.h"
 #include "imap-parser.h"
 
 #define is_linebreak(c) \
@@ -21,8 +21,8 @@
 struct _ImapParser {
 	/* permanent */
 	Pool pool;
-	IBuffer *inbuf;
-	OBuffer *outbuf;
+	IStream *input;
+	OStream *output;
 	size_t max_literal_size;
         ImapParserFlags flags;
 
@@ -58,15 +58,15 @@
 		parser->list_arg->data.list = parser->cur_list;
 }
 
-ImapParser *imap_parser_create(IBuffer *inbuf, OBuffer *outbuf,
+ImapParser *imap_parser_create(IStream *input, OStream *output,
 			       size_t max_literal_size)
 {
 	ImapParser *parser;
 
 	parser = i_new(ImapParser, 1);
         parser->pool = pool_create("IMAP parser", 8192, FALSE);
-	parser->inbuf = inbuf;
-	parser->outbuf = outbuf;
+	parser->input = input;
+	parser->output = output;
 	parser->max_literal_size = max_literal_size;
 
 	imap_args_realloc(parser, LIST_ALLOC_SIZE);
@@ -112,7 +112,7 @@
 			break;
 	}
 
-        i_buffer_skip(parser->inbuf, i);
+        i_stream_skip(parser->input, i);
 	parser->cur_pos = 0;
 
 	*data += i;
@@ -311,9 +311,9 @@
 			return FALSE;
 		}
 
-		if (parser->outbuf != NULL) {
-			o_buffer_send(parser->outbuf, "+ OK\r\n", 6);
-			o_buffer_flush(parser->outbuf);
+		if (parser->output != NULL) {
+			o_stream_send(parser->output, "+ OK\r\n", 6);
+			o_stream_flush(parser->output);
 		}
 	}
 
@@ -332,7 +332,7 @@
 	/* expecting digits + "}" */
 	for (i = parser->cur_pos; i < data_size; i++) {
 		if (data[i] == '}') {
-			i_buffer_skip(parser->inbuf, i+1);
+			i_stream_skip(parser->input, i+1);
 			return imap_parser_literal_end(parser);
 		}
 
@@ -365,7 +365,7 @@
 
 		if (*data == '\r') {
 			data++; data_size--;
-			i_buffer_skip(parser->inbuf, 1);
+			i_stream_skip(parser->input, 1);
 
 			if (data_size == 0)
 				return FALSE;
@@ -377,7 +377,7 @@
 		}
 
 		data++; data_size--;
-		i_buffer_skip(parser->inbuf, 1);
+		i_stream_skip(parser->input, 1);
 		parser->literal_skip_crlf = FALSE;
 
 		i_assert(parser->cur_pos == 0);
@@ -407,7 +407,7 @@
 	const char *data;
 	size_t data_size;
 
-	data = (const char *) i_buffer_get_data(parser->inbuf, &data_size);
+	data = (const char *) i_stream_get_data(parser->input, &data_size);
 	if (data_size == 0)
 		return FALSE;
 
@@ -468,9 +468,9 @@
 		if (!imap_parser_read_literal(parser, data, data_size))
 			return FALSE;
 
-		/* pass through to parsing data. since inbuf->skip was
+		/* pass through to parsing data. since input->skip was
 		   modified, we need to get the data start position again. */
-		data = (const char *) i_buffer_get_data(parser->inbuf,
+		data = (const char *) i_stream_get_data(parser->input,
 							&data_size);
 
 		/* fall through */
@@ -534,8 +534,7 @@
 	const char *data;
 	size_t i, data_size;
 
-	/* get the beginning of data in input buffer */
-	data = (const char *) i_buffer_get_data(parser->inbuf, &data_size);
+	data = (const char *) i_stream_get_data(parser->input, &data_size);
 
 	for (i = 0; i < data_size; i++) {
 		if (data[i] == ' ' || data[i] == '\r' || data[i] == '\n')
@@ -543,7 +542,7 @@
 	}
 
 	if (i < data_size) {
-		i_buffer_skip(parser->inbuf, i + (data[i] == ' ' ? 1 : 0));
+		i_stream_skip(parser->input, i + (data[i] == ' ' ? 1 : 0));
 		return p_strndup(parser->pool, data, i);
 	} else {
 		return NULL;
@@ -555,8 +554,7 @@
 	const char *data;
 	size_t i, data_size;
 
-	/* get the beginning of data in input buffer */
-	data = (const char *) i_buffer_get_data(parser->inbuf, &data_size);
+	data = (const char *) i_stream_get_data(parser->input, &data_size);
 
 	for (i = 0; i < data_size; i++) {
 		if (data[i] == '\r' || data[i] == '\n')
@@ -564,7 +562,7 @@
 	}
 
 	if (i < data_size) {
-		i_buffer_skip(parser->inbuf, i);
+		i_stream_skip(parser->input, i);
 		return p_strndup(parser->pool, data, i);
 	} else {
 		return NULL;

Index: imap-parser.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-imap/imap-parser.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- imap-parser.h	16 Oct 2002 22:50:21 -0000	1.4
+++ imap-parser.h	6 Dec 2002 01:09:22 -0000	1.5
@@ -41,18 +41,18 @@
 	ImapArg args[1]; /* variable size */
 };
 
-/* Create new IMAP argument parser. The max. size of inbuf limits the
+/* Create new IMAP argument parser. The max. size of input limits the
    maximum size of each argument. max_literal_size also limits sizes of
    literals which we even try to handle if FLAG_LITERAL_SIZE is not set.
-   outbuf is used for sending command continuation requests for literals. */
-ImapParser *imap_parser_create(IBuffer *inbuf, OBuffer *outbuf,
+   output is used for sending command continuation requests for literals. */
+ImapParser *imap_parser_create(IStream *input, OStream *output,
 			       size_t max_literal_size);
 void imap_parser_destroy(ImapParser *parser);
 
 /* Reset the parser to initial state. */
 void imap_parser_reset(ImapParser *parser);
 
-/* Read a number of arguments. This function doesn't call i_buffer_read(), you
+/* Read a number of arguments. This function doesn't call i_stream_read(), you
    need to do that. Returns number of arguments read (may be less than count
    in case of EOL), -2 if more data is needed or -1 if error occured.
 




More information about the dovecot-cvs mailing list