[dovecot-cvs] dovecot/src/lib-mail message-body-search.c,1.2,1.3 message-body-search.h,1.2,1.3 message-parser.c,1.25,1.26 message-parser.h,1.11,1.12 message-send.c,1.11,1.12 message-send.h,1.5,1.6 message-size.c,1.7,1.8 message-size.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-mail
In directory danu:/tmp/cvs-serv6082/lib-mail

Modified Files:
	message-body-search.c message-body-search.h message-parser.c 
	message-parser.h message-send.c message-send.h message-size.c 
	message-size.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: message-body-search.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-body-search.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- message-body-search.c	30 Nov 2002 14:58:23 -0000	1.2
+++ message-body-search.c	6 Dec 2002 01:09:23 -0000	1.3
@@ -2,7 +2,7 @@
 
 #include "lib.h"
 #include "base64.h"
-#include "ibuffer.h"
+#include "istream.h"
 #include "charset-utf8.h"
 #include "rfc822-tokenize.h"
 #include "quoted-printable.h"
@@ -134,7 +134,7 @@
 	}
 }
 
-static int message_search_header(PartSearchContext *ctx, IBuffer *inbuf)
+static int message_search_header(PartSearchContext *ctx, IStream *input)
 {
 	ctx->hdr_search_ctx = message_header_search_init(data_stack_pool,
 							 ctx->body_ctx->key,
@@ -143,7 +143,7 @@
 
 	/* we default to text content-type */
 	ctx->content_type_text = TRUE;
-	message_parse_header(NULL, inbuf, NULL, header_find, ctx);
+	message_parse_header(NULL, input, NULL, header_find, ctx);
 
 	return ctx->found;
 }
@@ -252,7 +252,7 @@
 	return 0;
 }
 
-static int message_search_body(PartSearchContext *ctx, IBuffer *inbuf,
+static int message_search_body(PartSearchContext *ctx, IStream *input,
 			       MessagePart *part)
 {
 	const unsigned char *data, *decoded;
@@ -280,15 +280,15 @@
 	ctx->match_count = 0;
 	ctx->matches = t_malloc(sizeof(size_t) * ctx->body_ctx->key_len);
 
-	i_buffer_skip(inbuf, part->physical_pos +
-		      part->header_size.physical_size - inbuf->v_offset);
+	i_stream_skip(input, part->physical_pos +
+		      part->header_size.physical_size - input->v_offset);
 
-	old_limit = inbuf->v_limit;
-	i_buffer_set_read_limit(inbuf, inbuf->v_offset +
+	old_limit = input->v_limit;
+	i_stream_set_read_limit(input, input->v_offset +
 				part->body_size.physical_size);
 
 	found = FALSE; pos = 0;
-	while (i_buffer_read_data(inbuf, &data, &data_size, pos) > 0) {
+	while (i_stream_read_data(input, &data, &data_size, pos) > 0) {
 		/* limit the size of t_malloc()s */
 		if (data_size > DECODE_BLOCK_SIZE)
 			data_size = DECODE_BLOCK_SIZE;
@@ -318,11 +318,11 @@
 		}
 
 		t_pop();
-		i_buffer_skip(inbuf, data_size);
+		i_stream_skip(input, data_size);
 		pos -= data_size;
 	}
 
-	i_buffer_set_read_limit(inbuf, old_limit);
+	i_stream_set_read_limit(input, old_limit);
 
 	if (ctx->translation != NULL)
 		charset_to_utf8_end(ctx->translation);
@@ -355,7 +355,7 @@
 	return TRUE;
 }
 
-static int message_body_search_ctx(BodySearchContext *ctx, IBuffer *inbuf,
+static int message_body_search_ctx(BodySearchContext *ctx, IStream *input,
 				   MessagePart *part)
 {
 	PartSearchContext part_ctx;
@@ -363,9 +363,9 @@
 
 	found = FALSE;
 	while (part != NULL && !found) {
-		i_assert(inbuf->v_offset <= part->physical_pos);
+		i_assert(input->v_offset <= part->physical_pos);
 
-		i_buffer_skip(inbuf, part->physical_pos - inbuf->v_offset);
+		i_stream_skip(input, part->physical_pos - input->v_offset);
 
 		memset(&part_ctx, 0, sizeof(part_ctx));
 		part_ctx.body_ctx = ctx;
@@ -374,14 +374,14 @@
 
 		t_push();
 
-		if (message_search_header(&part_ctx, inbuf)) {
+		if (message_search_header(&part_ctx, input)) {
 			found = TRUE;
 		} else if (part->children != NULL) {
 			/* multipart/xxx or message/rfc822 */
-			if (message_body_search_ctx(ctx, inbuf, part->children))
+			if (message_body_search_ctx(ctx, input, part->children))
 				found = TRUE;
 		} else {
-			if (message_search_body(&part_ctx, inbuf, part))
+			if (message_search_body(&part_ctx, input, part))
 				found = TRUE;
 		}
 
@@ -394,7 +394,7 @@
 }
 
 int message_body_search(const char *key, const char *charset,
-			int *unknown_charset, IBuffer *inbuf,
+			int *unknown_charset, IStream *input,
 			MessagePart *part, int search_header)
 {
         BodySearchContext ctx;
@@ -403,5 +403,5 @@
 				      search_header))
 		return -1;
 
-	return message_body_search_ctx(&ctx, inbuf, part);
+	return message_body_search_ctx(&ctx, input, part);
 }

Index: message-body-search.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-body-search.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- message-body-search.h	30 Nov 2002 14:58:23 -0000	1.2
+++ message-body-search.h	6 Dec 2002 01:09:23 -0000	1.3
@@ -6,7 +6,7 @@
    is invalid. If charset is NULL, the key isn't assumed to be in any
    specific charset but is compared to message data without any translation. */
 int message_body_search(const char *key, const char *charset,
-			int *unknown_charset, IBuffer *inbuf,
+			int *unknown_charset, IStream *input,
 			MessagePart *part, int search_header);
 
 #endif

Index: message-parser.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-parser.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- message-parser.c	4 Nov 2002 07:11:32 -0000	1.25
+++ message-parser.c	6 Dec 2002 01:09:23 -0000	1.26
@@ -1,7 +1,7 @@
 /* Copyright (C) 2002 Timo Sirainen */
 
 #include "lib.h"
-#include "ibuffer.h"
+#include "istream.h"
 #include "rfc822-tokenize.h"
 #include "message-content-parser.h"
 #include "message-parser.h"
@@ -27,12 +27,12 @@
 	void *context;
 } MessageParseContext;
 
-static MessagePart *message_parse_part(IBuffer *inbuf,
+static MessagePart *message_parse_part(IStream *input,
 				       MessageParseContext *parse_ctx);
-static MessagePart *message_parse_body(IBuffer *inbuf,
+static MessagePart *message_parse_body(IStream *input,
 				       MessageBoundary *boundaries,
 				       MessageSize *body_size);
-static MessagePart *message_skip_boundary(IBuffer *inbuf,
+static MessagePart *message_skip_boundary(IStream *input,
 					  MessageBoundary *boundaries,
 					  MessageSize *boundary_size);
 
@@ -136,7 +136,7 @@
 	}
 }
 
-static MessagePart *message_parse_multipart(IBuffer *inbuf,
+static MessagePart *message_parse_multipart(IStream *input,
 					    MessageParseContext *parse_ctx)
 {
 	MessagePart *parent_part, *next_part, *part;
@@ -157,7 +157,7 @@
 
 	/* skip the data before the first boundary */
 	parent_part = parse_ctx->part;
-	next_part = message_skip_boundary(inbuf, parse_ctx->boundaries,
+	next_part = message_skip_boundary(input, parse_ctx->boundaries,
 					  &parent_part->body_size);
 
 	/* now, parse the parts */
@@ -166,7 +166,7 @@
 		part = message_part_append(parse_ctx->pool, parent_part);
 
                 parse_ctx->part = part;
-		next_part = message_parse_part(inbuf, parse_ctx);
+		next_part = message_parse_part(input, parse_ctx);
 
 		/* update our size */
 		message_size_add_part(&parent_part->body_size, part);
@@ -175,7 +175,7 @@
 			break;
 
 		/* skip the boundary */
-		next_part = message_skip_boundary(inbuf, parse_ctx->boundaries,
+		next_part = message_skip_boundary(input, parse_ctx->boundaries,
 						  &parent_part->body_size);
 	}
 
@@ -185,13 +185,13 @@
 	return next_part;
 }
 
-static MessagePart *message_parse_part(IBuffer *inbuf,
+static MessagePart *message_parse_part(IStream *input,
 				       MessageParseContext *parse_ctx)
 {
 	MessagePart *next_part, *part;
 	uoff_t hdr_size;
 
-	message_parse_header(parse_ctx->part, inbuf,
+	message_parse_header(parse_ctx->part, input,
 			     &parse_ctx->part->header_size,
 			     parse_header_field, parse_ctx);
 
@@ -199,7 +199,7 @@
 	hdr_size = parse_ctx->part->header_size.physical_size;
 
 	if (parse_ctx->last_boundary != NULL)
-		return message_parse_multipart(inbuf, parse_ctx);
+		return message_parse_multipart(input, parse_ctx);
 
 	if (parse_ctx->last_content_type == NULL) {
 		if (parse_ctx->part->parent != NULL &&
@@ -226,7 +226,7 @@
 		part = message_part_append(parse_ctx->pool, parse_ctx->part);
 
 		parse_ctx->part = part;
-		next_part = message_parse_part(inbuf, parse_ctx);
+		next_part = message_parse_part(input, parse_ctx);
 		parse_ctx->part = part->parent;
 
 		/* our body size is the size of header+body in message/rfc822 */
@@ -234,14 +234,14 @@
 	} else {
 		/* normal message, read until the next boundary */
 		part = parse_ctx->part;
-		next_part = message_parse_body(inbuf, parse_ctx->boundaries,
+		next_part = message_parse_body(input, parse_ctx->boundaries,
 					       &part->body_size);
 	}
 
 	return next_part;
 }
 
-MessagePart *message_parse(Pool pool, IBuffer *inbuf,
+MessagePart *message_parse(Pool pool, IStream *input,
 			   MessageHeaderFunc func, void *context)
 {
 	MessagePart *part;
@@ -254,20 +254,20 @@
 	parse_ctx.part = part = p_new(pool, MessagePart, 1);
 
 	t_push();
-	message_parse_part(inbuf, &parse_ctx);
+	message_parse_part(input, &parse_ctx);
 	t_pop();
 	return part;
 }
 
 /* skip over to next line increasing message size */
-static void message_skip_line(IBuffer *inbuf, MessageSize *msg_size)
+static void message_skip_line(IStream *input, MessageSize *msg_size)
 {
 	const unsigned char *msg;
 	size_t i, size, startpos;
 
 	startpos = 0;
 
-	while (i_buffer_read_data(inbuf, &msg, &size, startpos) > 0) {
+	while (i_stream_read_data(input, &msg, &size, startpos) > 0) {
 		for (i = startpos; i < size; i++) {
 			if (msg[i] == '\n') {
 				if (msg_size != NULL) {
@@ -285,7 +285,7 @@
 		}
 
 		/* leave the last character, it may be \r */
-		i_buffer_skip(inbuf, i - 1);
+		i_stream_skip(input, i - 1);
 		startpos = 1;
 
 		if (msg_size != NULL) {
@@ -294,7 +294,7 @@
 		}
 	}
 
-	i_buffer_skip(inbuf, startpos);
+	i_stream_skip(input, startpos);
 
 	if (msg_size != NULL) {
 		msg_size->physical_size += startpos;
@@ -302,7 +302,7 @@
 	}
 }
 
-void message_parse_header(MessagePart *part, IBuffer *inbuf,
+void message_parse_header(MessagePart *part, IStream *input,
 			  MessageSize *hdr_size,
 			  MessageHeaderFunc func, void *context)
 {
@@ -317,12 +317,12 @@
 	missing_cr_count = startpos = line_start = 0;
 	colon_pos = UINT_MAX;
 	for (;;) {
-		ret = i_buffer_read_data(inbuf, &msg, &size, startpos+1);
+		ret = i_stream_read_data(input, &msg, &size, startpos+1);
 		if (ret == -2) {
 			/* overflow, line is too long. just skip it. */
 			i_assert(size > 2);
 
-                        message_skip_line(inbuf, hdr_size);
+                        message_skip_line(input, hdr_size);
 			startpos = line_start = 0;
 			colon_pos = UINT_MAX;
 			continue;
@@ -412,13 +412,13 @@
 			colon_pos -= line_start;
 		if (hdr_size != NULL)
 			hdr_size->physical_size += line_start;
-		i_buffer_skip(inbuf, line_start);
+		i_stream_skip(input, line_start);
 
 		startpos = i-line_start;
 		line_start = 0;
 	}
 
-	i_buffer_skip(inbuf, startpos);
+	i_stream_skip(input, startpos);
 
 	if (hdr_size != NULL) {
 		hdr_size->physical_size += startpos;
@@ -451,7 +451,7 @@
    [\r]\n before the boundary, otherwise leave it right after the known
    boundary so the ending "--" can be checked. */
 static MessageBoundary *
-message_find_boundary(IBuffer *inbuf, MessageBoundary *boundaries,
+message_find_boundary(IStream *input, MessageBoundary *boundaries,
 		      MessageSize *msg_size, int skip_over)
 {
 	MessageBoundary *boundary;
@@ -461,7 +461,7 @@
 	boundary = NULL;
 	missing_cr_count = startpos = line_start = 0;
 
-	while (i_buffer_read_data(inbuf, &msg, &size, startpos) > 0) {
+	while (i_stream_read_data(input, &msg, &size, startpos) > 0) {
 		for (i = startpos; i < size; i++) {
 			if (msg[i] != '\n')
 				continue;
@@ -511,7 +511,7 @@
 			line_start -= i;
 		}
 
-		i_buffer_skip(inbuf, i);
+		i_stream_skip(input, i);
 		msg_size->physical_size += i;
 		msg_size->virtual_size += i;
 
@@ -535,7 +535,7 @@
 		startpos = line_start;
 	}
 
-	i_buffer_skip(inbuf, startpos);
+	i_stream_skip(input, startpos);
 	msg_size->physical_size += startpos;
 	msg_size->virtual_size += startpos + missing_cr_count;
 
@@ -544,17 +544,17 @@
 	return boundary;
 }
 
-static MessagePart *message_parse_body(IBuffer *inbuf,
+static MessagePart *message_parse_body(IStream *input,
 				       MessageBoundary *boundaries,
 				       MessageSize *body_size)
 {
 	MessageBoundary *boundary;
 
 	if (boundaries == NULL) {
-		message_get_body_size(inbuf, body_size, (uoff_t)-1);
+		message_get_body_size(input, body_size, (uoff_t)-1);
 		return NULL;
 	} else {
-		boundary = message_find_boundary(inbuf, boundaries,
+		boundary = message_find_boundary(input, boundaries,
 						 body_size, FALSE);
 		return boundary == NULL ? NULL : boundary->part;
 	}
@@ -562,7 +562,7 @@
 
 /* skip data until next boundary is found. if it's end boundary,
    skip the footer as well. */
-static MessagePart *message_skip_boundary(IBuffer *inbuf,
+static MessagePart *message_skip_boundary(IStream *input,
 					  MessageBoundary *boundaries,
 					  MessageSize *boundary_size)
 {
@@ -571,22 +571,22 @@
 	size_t size;
 	int end_boundary;
 
-	boundary = message_find_boundary(inbuf, boundaries,
+	boundary = message_find_boundary(input, boundaries,
 					 boundary_size, TRUE);
 	if (boundary == NULL)
 		return NULL;
 
 	/* now, see if it's end boundary */
 	end_boundary = FALSE;
-	if (i_buffer_read_data(inbuf, &msg, &size, 1) > 0)
+	if (i_stream_read_data(input, &msg, &size, 1) > 0)
 		end_boundary = msg[0] == '-' && msg[1] == '-';
 
 	/* skip the rest of the line */
-	message_skip_line(inbuf, boundary_size);
+	message_skip_line(input, boundary_size);
 
 	if (end_boundary) {
 		/* skip the footer */
-		return message_parse_body(inbuf, boundaries, boundary_size);
+		return message_parse_body(input, boundaries, boundary_size);
 	}
 
 	return boundary == NULL ? NULL : boundary->part;

Index: message-parser.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-parser.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- message-parser.h	13 Oct 2002 23:49:12 -0000	1.11
+++ message-parser.h	6 Dec 2002 01:09:23 -0000	1.12
@@ -44,15 +44,15 @@
 				  void *context);
 
 /* func is called for each field in message header. */
-MessagePart *message_parse(Pool pool, IBuffer *inbuf,
+MessagePart *message_parse(Pool pool, IStream *input,
 			   MessageHeaderFunc func, void *context);
 
 /* Call func for each field in message header. Fills the hdr_size.
    part can be NULL, just make sure your header function works with it.
    This function doesn't use data stack so your header function may save
-   values to it. When finished, inbuf will point to beginning of message
+   values to it. When finished, input will point to beginning of message
    body. */
-void message_parse_header(MessagePart *part, IBuffer *inbuf,
+void message_parse_header(MessagePart *part, IStream *input,
 			  MessageSize *hdr_size,
 			  MessageHeaderFunc func, void *context);
 

Index: message-send.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-send.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- message-send.c	15 Oct 2002 23:46:42 -0000	1.11
+++ message-send.c	6 Dec 2002 01:09:23 -0000	1.12
@@ -1,12 +1,12 @@
 /* Copyright (C) 2002 Timo Sirainen */
 
 #include "lib.h"
-#include "ibuffer.h"
-#include "obuffer.h"
+#include "istream.h"
+#include "ostream.h"
 #include "message-send.h"
 #include "message-size.h"
 
-int message_send(OBuffer *outbuf, IBuffer *inbuf, MessageSize *msg_size,
+int message_send(OStream *output, IStream *input, MessageSize *msg_size,
 		 uoff_t virtual_skip, uoff_t max_virtual_size)
 {
 	const unsigned char *msg;
@@ -23,21 +23,21 @@
 
 	if (msg_size->physical_size == msg_size->virtual_size) {
 		/* no need to kludge with CRs, we can use sendfile() */
-		i_buffer_skip(inbuf, virtual_skip);
+		i_stream_skip(input, virtual_skip);
 
-		old_limit = inbuf->v_limit;
-		limit = inbuf->v_offset + max_virtual_size;
-		i_buffer_set_read_limit(inbuf, I_MIN(limit, old_limit));
-		ret = o_buffer_send_ibuffer(outbuf, inbuf) > 0;
-		i_buffer_set_read_limit(inbuf, old_limit);
+		old_limit = input->v_limit;
+		limit = input->v_offset + max_virtual_size;
+		i_stream_set_read_limit(input, I_MIN(limit, old_limit));
+		ret = o_stream_send_istream(output, input) > 0;
+		i_stream_set_read_limit(input, old_limit);
 
 		return ret;
 	}
 
-	message_skip_virtual(inbuf, virtual_skip, NULL, &cr_skipped);
+	message_skip_virtual(input, virtual_skip, NULL, &cr_skipped);
 
 	/* go through the message data and insert CRs where needed.  */
-	while (i_buffer_read_data(inbuf, &msg, &size, 0) > 0) {
+	while (i_stream_read_data(input, &msg, &size, 0) > 0) {
 		add_cr = FALSE;
 		for (i = 0; i < size; i++) {
 			if (msg[i] == '\n') {
@@ -60,11 +60,11 @@
 			}
 		}
 
-		if (o_buffer_send(outbuf, msg, i) < 0)
+		if (o_stream_send(output, msg, i) < 0)
 			return FALSE;
 
 		if (add_cr) {
-			if (o_buffer_send(outbuf, "\r", 1) < 0)
+			if (o_stream_send(output, "\r", 1) < 0)
 				return FALSE;
 			cr_skipped = TRUE;
 		} else {
@@ -75,7 +75,7 @@
 		if (max_virtual_size == 0)
 			break;
 
-		i_buffer_skip(inbuf, i);
+		i_stream_skip(input, i);
 	}
 
 	return TRUE;

Index: message-send.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-send.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- message-send.h	15 Oct 2002 23:46:42 -0000	1.5
+++ message-send.h	6 Dec 2002 01:09:23 -0000	1.6
@@ -5,9 +5,9 @@
 
 /* Send message to client inserting CRs if needed. Only max_virtual_size
    bytes if sent (relative to virtual_skip), if you want it unlimited,
-   use (uoff_t)-1. Remember that if inbuf begins with LF, CR is inserted
+   use (uoff_t)-1. Remember that if input begins with LF, CR is inserted
    before it unless virtual_skip = 1. Returns TRUE if successful. */
-int message_send(OBuffer *outbuf, IBuffer *inbuf, MessageSize *msg_size,
+int message_send(OStream *output, IStream *input, MessageSize *msg_size,
 		 uoff_t virtual_skip, uoff_t max_virtual_size);
 
 #endif

Index: message-size.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-size.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- message-size.c	13 Oct 2002 23:49:12 -0000	1.7
+++ message-size.c	6 Dec 2002 01:09:23 -0000	1.8
@@ -1,11 +1,11 @@
 /* Copyright (C) 2002 Timo Sirainen */
 
 #include "lib.h"
-#include "ibuffer.h"
+#include "istream.h"
 #include "message-parser.h"
 #include "message-size.h"
 
-void message_get_header_size(IBuffer *inbuf, MessageSize *hdr)
+void message_get_header_size(IStream *input, MessageSize *hdr)
 {
 	const unsigned char *msg;
 	size_t i, size, startpos, missing_cr_count;
@@ -13,7 +13,7 @@
 	memset(hdr, 0, sizeof(MessageSize));
 
 	missing_cr_count = 0; startpos = 0;
-	while (i_buffer_read_data(inbuf, &msg, &size, startpos) > 0) {
+	while (i_stream_read_data(input, &msg, &size, startpos) > 0) {
 		for (i = startpos; i < size; i++) {
 			if (msg[i] != '\n')
 				continue;
@@ -44,18 +44,18 @@
 
 		/* leave the last two characters, they may be \r\n */
 		startpos = size == 1 ? 1 : 2;
-		i_buffer_skip(inbuf, i - startpos);
+		i_stream_skip(input, i - startpos);
 
 		hdr->physical_size += i - startpos;
 	}
-	i_buffer_skip(inbuf, startpos);
+	i_stream_skip(input, startpos);
 	hdr->physical_size += startpos;
 
 	hdr->virtual_size = hdr->physical_size + missing_cr_count;
 	i_assert(hdr->virtual_size >= hdr->physical_size);
 }
 
-void message_get_body_size(IBuffer *inbuf, MessageSize *body,
+void message_get_body_size(IStream *input, MessageSize *body,
 			   uoff_t max_virtual_size)
 {
 	const unsigned char *msg;
@@ -65,7 +65,7 @@
 
 	missing_cr_count = 0; startpos = 0;
 	while (max_virtual_size != 0 &&
-	       i_buffer_read_data(inbuf, &msg, &size, startpos) > 0) {
+	       i_stream_read_data(input, &msg, &size, startpos) > 0) {
 		for (i = startpos; i < size && max_virtual_size != 0; i++) {
 			if (max_virtual_size > 0)
 				max_virtual_size--;
@@ -91,19 +91,19 @@
 		}
 
 		/* leave the last character, it may be \r */
-		i_buffer_skip(inbuf, i - 1);
+		i_stream_skip(input, i - 1);
 		startpos = 1;
 
 		body->physical_size += i - 1;
 	}
-	i_buffer_skip(inbuf, startpos);
+	i_stream_skip(input, startpos);
 	body->physical_size += startpos;
 
 	body->virtual_size = body->physical_size + missing_cr_count;
 	i_assert(body->virtual_size >= body->physical_size);
 }
 
-void message_skip_virtual(IBuffer *inbuf, uoff_t virtual_skip,
+void message_skip_virtual(IStream *input, uoff_t virtual_skip,
 			  MessageSize *msg_size, int *cr_skipped)
 {
 	const unsigned char *msg;
@@ -114,7 +114,7 @@
 		return;
 
 	startpos = 0;
-	while (i_buffer_read_data(inbuf, &msg, &size, startpos) > 0) {
+	while (i_stream_read_data(input, &msg, &size, startpos) > 0) {
 		for (i = startpos; i < size && virtual_skip > 0; i++) {
 			virtual_skip--;
 
@@ -151,12 +151,12 @@
 		}
 
 		if (i < size) {
-			i_buffer_skip(inbuf, i);
+			i_stream_skip(input, i);
 			break;
 		}
 
 		/* leave the last character, it may be \r */
-		i_buffer_skip(inbuf, i - 1);
+		i_stream_skip(input, i - 1);
 		startpos = 1;
 	}
 }

Index: message-size.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-size.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- message-size.h	13 Oct 2002 23:49:12 -0000	1.4
+++ message-size.h	6 Dec 2002 01:09:23 -0000	1.5
@@ -3,18 +3,18 @@
 
 #include "message-parser.h"
 
-/* Calculate size of message header. Leave the inbuf point to first
+/* Calculate size of message header. Leave the input point to first
    character in body. */
-void message_get_header_size(IBuffer *inbuf, MessageSize *hdr);
+void message_get_header_size(IStream *input, MessageSize *hdr);
 /* Calculate size of message body. Read only max_virtual_size virtual bytes,
    if you want it unlimited, use (uoff_t)-1. */
-void message_get_body_size(IBuffer *inbuf, MessageSize *body,
+void message_get_body_size(IStream *input, MessageSize *body,
 			   uoff_t max_virtual_size);
 
-/* Skip number of virtual bytes from buffer. If first character is \n, and
+/* Skip number of virtual bytes from putfer. If first character is \n, and
    cr_skipped is FALSE, \r must be sent before it. msg_size is updated if
    it's not NULL. */
-void message_skip_virtual(IBuffer *inbuf, uoff_t virtual_skip,
+void message_skip_virtual(IStream *input, uoff_t virtual_skip,
 			  MessageSize *msg_size, int *cr_skipped);
 
 /* Sum contents of src into dest. */




More information about the dovecot-cvs mailing list