[dovecot-cvs] dovecot/src/lib-storage/index index-copy.c,1.22,1.23 index-fetch-section.c,1.20,1.21 index-fetch.c,1.34,1.35 index-fetch.h,1.11,1.12 index-msgcache.c,1.12,1.13 index-save.c,1.21,1.22 index-search.c,1.47,1.48 index-sort.c,1.1,1.2 index-sort.h,1.1,1.2 Message-Id: <20021206010925.BEA062399B@danu.procontrol.fi>

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


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

Modified Files:
	index-copy.c index-fetch-section.c index-fetch.c index-fetch.h 
	index-msgcache.c index-save.c index-search.c index-sort.c 
	index-sort.h index-storage.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: index-copy.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-copy.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- index-copy.c	25 Nov 2002 19:02:50 -0000	1.22
+++ index-copy.c	6 Dec 2002 01:09:23 -0000	1.23
@@ -1,7 +1,7 @@
 /* Copyright (C) 2002 Timo Sirainen */
 
 #include "lib.h"
-#include "ibuffer.h"
+#include "istream.h"
 #include "mail-custom-flags.h"
 #include "index-storage.h"
 #include "index-messageset.h"
@@ -20,12 +20,12 @@
 {
 	CopyContext *ctx = context;
 	IndexMailbox *dest_ibox = NULL;
-	IBuffer *inbuf;
+	IStream *input;
 	time_t internal_date;
 	int failed, deleted;
 
-	inbuf = index->open_mail(index, rec, &internal_date, &deleted);
-	if (inbuf == NULL)
+	input = index->open_mail(index, rec, &internal_date, &deleted);
+	if (input == NULL)
 		return FALSE;
 
 	if (ctx->copy_inside_mailbox) {
@@ -37,12 +37,12 @@
 	/* save it in destination mailbox */
 	failed = !ctx->dest->save(ctx->dest, rec->msg_flags,
 				  ctx->custom_flags, internal_date, 0,
-				  inbuf, inbuf->v_limit);
+				  input, input->v_limit);
 
 	if (ctx->copy_inside_mailbox)
 		dest_ibox->delay_save_unlocking = FALSE;
 
-	i_buffer_unref(inbuf);
+	i_stream_unref(input);
 	return !failed;
 }
 

Index: index-fetch-section.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-fetch-section.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- index-fetch-section.c	17 Nov 2002 13:33:43 -0000	1.20
+++ index-fetch-section.c	6 Dec 2002 01:09:23 -0000	1.21
@@ -2,8 +2,8 @@
 
 #include "lib.h"
 #include "temp-string.h"
-#include "ibuffer.h"
-#include "obuffer.h"
+#include "istream.h"
+#include "ostream.h"
 #include "rfc822-tokenize.h"
 #include "message-send.h"
 #include "index-storage.h"
@@ -43,13 +43,13 @@
 		      FetchContext *ctx, const char *prefix, int fetch_header)
 {
 	MessageSize size;
-	IBuffer *inbuf;
+	IStream *input;
 	const char *str;
 	int cr_skipped;
 
 	if (!imap_msgcache_get_rfc822_partial(ctx->cache, sect->skip,
 					      sect->max_size, fetch_header,
-					      &size, &inbuf, &cr_skipped)) {
+					      &size, &input, &cr_skipped)) {
 		i_error("Couldn't get BODY[] for UID %u (index %s)",
 			rec->uid, ctx->index->filepath);
 		return FALSE;
@@ -57,13 +57,13 @@
 
 	str = t_strdup_printf("%s {%"PRIuUOFF_T"}\r\n",
 			      prefix, size.virtual_size);
-	if (o_buffer_send(ctx->outbuf, str, strlen(str)) < 0)
+	if (o_stream_send(ctx->output, str, strlen(str)) < 0)
 		return FALSE;
 
 	if (cr_skipped)
 		size.virtual_size++;
 
-	return message_send(ctx->outbuf, inbuf, &size,
+	return message_send(ctx->output, input, &size,
 			    cr_skipped ? 1 : 0, sect->max_size);
 }
 
@@ -139,7 +139,7 @@
 
 typedef struct {
 	TempString *dest;
-	OBuffer *outbuf;
+	OStream *output;
 	uoff_t dest_size;
 
 	uoff_t skip, max_size;
@@ -170,8 +170,8 @@
 		t_string_append_n(ctx->dest, str, size);
 	ctx->dest_size += size;
 
-	if (ctx->outbuf != NULL) {
-		if (o_buffer_send(ctx->outbuf, str, size) < 0)
+	if (ctx->output != NULL) {
+		if (o_stream_send(ctx->output, str, size) < 0)
 			return FALSE;
 	}
 	return ctx->dest_size < ctx->max_size;
@@ -220,7 +220,7 @@
 	(void)fetch_header_append(ctx, "\r\n", 2);
 }
 
-static int fetch_header_fields(IBuffer *inbuf, const char *section,
+static int fetch_header_fields(IStream *input, const char *section,
 			       FetchHeaderFieldContext *ctx)
 {
 	if (strncasecmp(section, "HEADER.FIELDS ", 14) == 0) {
@@ -238,7 +238,7 @@
 	}
 
 	ctx->dest_size = 0;
-	message_parse_header(NULL, inbuf, NULL, fetch_header_field, ctx);
+	message_parse_header(NULL, input, NULL, fetch_header_field, ctx);
 
 	i_assert(ctx->dest_size <= ctx->max_size);
 	i_assert(ctx->dest == NULL || ctx->dest->len == ctx->dest_size);
@@ -246,7 +246,7 @@
 }
 
 /* fetch wanted headers from given data */
-static int fetch_header_from(IBuffer *inbuf, OBuffer *outbuf,
+static int fetch_header_from(IStream *input, OStream *output,
 			     const char *prefix, MessageSize *size,
 			     const char *section, MailFetchBodyData *sect)
 {
@@ -261,61 +261,61 @@
 		/* all headers */
 		str = t_strdup_printf("%s {%"PRIuUOFF_T"}\r\n",
 				      prefix, size->virtual_size);
-		if (o_buffer_send(outbuf, str, strlen(str)) < 0)
+		if (o_stream_send(output, str, strlen(str)) < 0)
 			return FALSE;
-		return message_send(outbuf, inbuf, size,
+		return message_send(output, input, size,
 				    sect->skip, sect->max_size);
 	}
 
 	/* partial headers - copy the wanted fields into memory, inserting
 	   missing CRs on the way. If the header is too large, calculate 
-	   the size first and then send the data directly to output buffer. */
+	   the size first and then send the data directly to output stream. */
 
 	memset(&ctx, 0, sizeof(ctx));
 	ctx.skip = sect->skip;
 	ctx.max_size = sect->max_size;
 
 	failed = FALSE;
-	start_offset = inbuf->v_offset;
+	start_offset = input->v_offset;
 
 	t_push();
 
 	/* first pass, we need at least the size */
 	if (size->virtual_size > MAX_HEADER_BUFFER_SIZE &&
 	    sect->max_size > MAX_HEADER_BUFFER_SIZE) {
-		if (!fetch_header_fields(inbuf, section, &ctx))
+		if (!fetch_header_fields(input, section, &ctx))
 			failed = TRUE;
 
 		i_assert(ctx.dest_size <= size->virtual_size);
 	} else {
 		ctx.dest = t_string_new(size->virtual_size < 4096 ?
 					size->virtual_size : 4096);
-		if (!fetch_header_fields(inbuf, section, &ctx))
+		if (!fetch_header_fields(input, section, &ctx))
 			failed = TRUE;
 	}
 
 	if (!failed) {
 		str = t_strdup_printf("%s {%"PRIuUOFF_T"}\r\n",
 				      prefix, ctx.dest_size);
-		if (o_buffer_send(outbuf, str, strlen(str)) < 0)
+		if (o_stream_send(output, str, strlen(str)) < 0)
 			failed = TRUE;
 	}
 
 	if (!failed) {
 		if (ctx.dest == NULL) {
-			/* second pass, write the data to output buffer */
+			/* second pass, write the data to output stream */
 			uoff_t first_size = ctx.dest_size;
 
-			ctx.outbuf = outbuf;
-			i_buffer_seek(inbuf, start_offset);
+			ctx.output = output;
+			i_stream_seek(input, start_offset);
 
 			if (!failed &&
-			    !fetch_header_fields(inbuf, section, &ctx))
+			    !fetch_header_fields(input, section, &ctx))
 				failed = TRUE;
 
 			i_assert(first_size == ctx.dest_size);
 		} else {
-			if (o_buffer_send(outbuf, ctx.dest->str,
+			if (o_stream_send(output, ctx.dest->str,
 					  ctx.dest->len) < 0)
 				failed = TRUE;
 		}
@@ -330,12 +330,12 @@
 			const char *prefix)
 {
 	MessageSize hdr_size;
-	IBuffer *inbuf;
+	IStream *input;
 
-	if (!imap_msgcache_get_rfc822(ctx->cache, &inbuf, &hdr_size, NULL))
+	if (!imap_msgcache_get_rfc822(ctx->cache, &input, &hdr_size, NULL))
 		return FALSE;
 
-	return fetch_header_from(inbuf, ctx->outbuf, prefix, &hdr_size,
+	return fetch_header_from(input, ctx->output, prefix, &hdr_size,
 				 sect->section, sect);
 }
 
@@ -389,25 +389,25 @@
 static int fetch_part_body(MessagePart *part, MailFetchBodyData *sect,
 			   FetchContext *ctx, const char *prefix)
 {
-	IBuffer *inbuf;
+	IStream *input;
 	const char *str;
 	uoff_t skip_pos;
 
-	if (!imap_msgcache_get_data(ctx->cache, &inbuf))
+	if (!imap_msgcache_get_data(ctx->cache, &input))
 		return FALSE;
 
 	/* jump to beginning of wanted data */
 	skip_pos = part->physical_pos + part->header_size.physical_size;
-	i_buffer_skip(inbuf, skip_pos);
+	i_stream_skip(input, skip_pos);
 
 	str = t_strdup_printf("%s {%"PRIuUOFF_T"}\r\n",
 			      prefix, part->body_size.virtual_size);
-	if (o_buffer_send(ctx->outbuf, str, strlen(str)) < 0)
+	if (o_stream_send(ctx->output, str, strlen(str)) < 0)
 		return FALSE;
 
 	/* FIXME: potential performance problem with big messages:
 	   FETCH BODY[1]<100000..1024>, hopefully no clients do this */
-	return message_send(ctx->outbuf, inbuf, &part->body_size,
+	return message_send(ctx->output, input, &part->body_size,
 			    sect->skip, sect->max_size);
 }
 
@@ -416,13 +416,13 @@
 			     MailFetchBodyData *sect, FetchContext *ctx,
 			     const char *prefix)
 {
-	IBuffer *inbuf;
+	IStream *input;
 
-	if (!imap_msgcache_get_data(ctx->cache, &inbuf))
+	if (!imap_msgcache_get_data(ctx->cache, &input))
 		return FALSE;
 
-	i_buffer_skip(inbuf, part->physical_pos);
-	return fetch_header_from(inbuf, ctx->outbuf, prefix, &part->header_size,
+	i_stream_skip(input, part->physical_pos);
+	return fetch_header_from(input, ctx->output, prefix, &part->header_size,
 				 section, sect);
 }
 

Index: index-fetch.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-fetch.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- index-fetch.c	25 Nov 2002 19:02:50 -0000	1.34
+++ index-fetch.c	6 Dec 2002 01:09:23 -0000	1.35
@@ -1,7 +1,7 @@
 /* Copyright (C) 2002 Timo Sirainen */
 
 #include "lib.h"
-#include "obuffer.h"
+#include "ostream.h"
 #include "temp-string.h"
 #include "mail-custom-flags.h"
 #include "index-storage.h"
@@ -119,10 +119,10 @@
 static int index_fetch_send_rfc822(MailIndexRecord *rec, FetchContext *ctx)
 {
 	MessageSize hdr_size, body_size;
-	IBuffer *inbuf;
+	IStream *input;
 	const char *str;
 
-	if (!imap_msgcache_get_rfc822(ctx->cache, &inbuf,
+	if (!imap_msgcache_get_rfc822(ctx->cache, &input,
 				      &hdr_size, &body_size)) {
 		mail_storage_set_critical(ctx->storage,
 			"Couldn't get RFC822 for UID %u (index %s)",
@@ -135,22 +135,22 @@
 	if (ctx->first) {
 		str++; ctx->first = FALSE;
 	}
-	if (o_buffer_send(ctx->outbuf, str, strlen(str)) < 0)
+	if (o_stream_send(ctx->output, str, strlen(str)) < 0)
 		return FALSE;
 
 	body_size.physical_size += hdr_size.physical_size;
 	body_size.virtual_size += hdr_size.virtual_size;
-	return message_send(ctx->outbuf, inbuf, &body_size, 0, (uoff_t)-1);
+	return message_send(ctx->output, input, &body_size, 0, (uoff_t)-1);
 }
 
 static int index_fetch_send_rfc822_header(MailIndexRecord *rec,
 					  FetchContext *ctx)
 {
 	MessageSize hdr_size;
-	IBuffer *inbuf;
+	IStream *input;
 	const char *str;
 
-	if (!imap_msgcache_get_rfc822(ctx->cache, &inbuf, &hdr_size, NULL)) {
+	if (!imap_msgcache_get_rfc822(ctx->cache, &input, &hdr_size, NULL)) {
 		mail_storage_set_critical(ctx->storage,
 			"Couldn't get RFC822.HEADER for UID %u (index %s)",
 			rec->uid, ctx->index->filepath);
@@ -162,19 +162,19 @@
 	if (ctx->first) {
 		str++; ctx->first = FALSE;
 	}
-	if (o_buffer_send(ctx->outbuf, str, strlen(str)) < 0)
+	if (o_stream_send(ctx->output, str, strlen(str)) < 0)
 		return FALSE;
 
-	return message_send(ctx->outbuf, inbuf, &hdr_size, 0, (uoff_t)-1);
+	return message_send(ctx->output, input, &hdr_size, 0, (uoff_t)-1);
 }
 
 static int index_fetch_send_rfc822_text(MailIndexRecord *rec, FetchContext *ctx)
 {
 	MessageSize body_size;
-	IBuffer *inbuf;
+	IStream *input;
 	const char *str;
 
-	if (!imap_msgcache_get_rfc822(ctx->cache, &inbuf, NULL, &body_size)) {
+	if (!imap_msgcache_get_rfc822(ctx->cache, &input, NULL, &body_size)) {
 		mail_storage_set_critical(ctx->storage,
 			"Couldn't get RFC822.TEXT for UID %u (index %s)",
 			rec->uid, ctx->index->filepath);
@@ -186,10 +186,10 @@
 	if (ctx->first) {
 		str++; ctx->first = FALSE;
 	}
-	if (o_buffer_send(ctx->outbuf, str, strlen(str)) < 0)
+	if (o_stream_send(ctx->output, str, strlen(str)) < 0)
 		return FALSE;
 
-	return message_send(ctx->outbuf, inbuf, &body_size, 0, (uoff_t)-1);
+	return message_send(ctx->output, input, &body_size, 0, (uoff_t)-1);
 }
 
 static ImapCacheField index_get_cache(MailFetchData *fetch_data)
@@ -303,7 +303,7 @@
 			if (!ctx->first)
 				ctx->str->len--;
 
-			if (o_buffer_send(ctx->outbuf, ctx->str->str,
+			if (o_stream_send(ctx->output, ctx->str->str,
 					  ctx->str->len) < 0)
 				break;
 		}
@@ -331,7 +331,7 @@
 	} while (0);
 
 	if (data_written) {
-		if (o_buffer_send(ctx->outbuf, ")\r\n", 3) < 0)
+		if (o_stream_send(ctx->output, ")\r\n", 3) < 0)
 			failed = TRUE;
 	}
 
@@ -340,7 +340,7 @@
 }
 
 int index_storage_fetch(Mailbox *box, MailFetchData *fetch_data,
-			OBuffer *outbuf, int *all_found)
+			OStream *output, int *all_found)
 {
 	IndexMailbox *ibox = (IndexMailbox *) box;
 	FetchContext ctx;
@@ -391,7 +391,7 @@
         ctx.custom_flags_count = MAIL_CUSTOM_FLAGS_COUNT;
 
 	ctx.fetch_data = fetch_data;
-	ctx.outbuf = outbuf;
+	ctx.output = output;
 
 	ret = index_messageset_foreach(ibox, fetch_data->messageset,
 				       fetch_data->uidset,

Index: index-fetch.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-fetch.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- index-fetch.h	20 Oct 2002 00:17:21 -0000	1.11
+++ index-fetch.h	6 Dec 2002 01:09:23 -0000	1.12
@@ -11,7 +11,7 @@
 	unsigned int custom_flags_count;
 
 	MailFetchData *fetch_data;
-	OBuffer *outbuf;
+	OStream *output;
 	TempString *str;
 	int update_seen, failed;
 	int first;

Index: index-msgcache.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-msgcache.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- index-msgcache.c	28 Oct 2002 04:33:00 -0000	1.12
+++ index-msgcache.c	6 Dec 2002 01:09:23 -0000	1.13
@@ -1,7 +1,7 @@
 /* Copyright (C) 2002 Timo Sirainen */
 
 #include "lib.h"
-#include "ibuffer.h"
+#include "istream.h"
 #include "imap-date.h"
 #include "imap-message-cache.h"
 #include "message-part-serialize.h"
@@ -71,7 +71,7 @@
 				  full_virtual_size, ctx);
 }
 
-static IBuffer *index_msgcache_open_mail(void *context)
+static IStream *index_msgcache_open_mail(void *context)
 {
 	IndexMsgcacheContext *ctx = context;
 	int deleted;
@@ -80,11 +80,11 @@
 				     &ctx->internal_date, &deleted);
 }
 
-static IBuffer *index_msgcache_inbuf_rewind(IBuffer *inbuf,
-					    void *context __attr_unused__)
+static IStream *index_msgcache_stream_rewind(IStream *input,
+					     void *context __attr_unused__)
 {
-	i_buffer_seek(inbuf, 0);
-	return inbuf;
+	i_stream_seek(input, 0);
+	return input;
 }
 
 static const char *index_msgcache_get_cached_field(ImapCacheField field,
@@ -169,7 +169,7 @@
 
 ImapMessageCacheIface index_msgcache_iface = {
 	index_msgcache_open_mail,
-	index_msgcache_inbuf_rewind,
+	index_msgcache_stream_rewind,
 	index_msgcache_get_cached_field,
 	index_msgcache_get_cached_parts,
 	index_msgcache_get_internal_date

Index: index-save.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-save.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- index-save.c	5 Dec 2002 18:06:27 -0000	1.21
+++ index-save.c	6 Dec 2002 01:09:23 -0000	1.22
@@ -1,15 +1,15 @@
 /* Copyright (C) 2002 Timo Sirainen */
 
 #include "lib.h"
-#include "ibuffer.h"
-#include "obuffer.h"
+#include "istream.h"
+#include "ostream.h"
 #include "write-full.h"
 #include "index-storage.h"
 
 #include <stdlib.h>
 #include <unistd.h>
 
-static int write_with_crlf(OBuffer *outbuf, const unsigned char *data,
+static int write_with_crlf(OStream *output, const unsigned char *data,
 			   size_t size)
 {
 	size_t i, start;
@@ -20,9 +20,9 @@
 	for (i = 0; i < size; i++) {
 		if (data[i] == '\n' && (i == 0 || data[i-1] != '\r')) {
 			/* missing CR */
-			if (o_buffer_send(outbuf, data + start, i - start) < 0)
+			if (o_stream_send(output, data + start, i - start) < 0)
 				return -1;
-			if (o_buffer_send(outbuf, "\r", 1) < 0)
+			if (o_stream_send(output, "\r", 1) < 0)
 				return -1;
 
 			/* \n is written next time */
@@ -34,13 +34,13 @@
 	if (data[size-1] == '\r')
 		size--;
 
-	if (o_buffer_send(outbuf, data + start, size - start) < 0)
+	if (o_stream_send(output, data + start, size - start) < 0)
 		return -1;
 
 	return size;
 }
 
-static int write_with_lf(OBuffer *outbuf, const unsigned char *data,
+static int write_with_lf(OStream *output, const unsigned char *data,
 			 size_t size)
 {
 	size_t i, start;
@@ -51,7 +51,7 @@
 	for (i = 0; i < size; i++) {
 		if (data[i] == '\n' && i > 0 && data[i-1] == '\r') {
 			/* \r\n - skip \r */
-			if (o_buffer_send(outbuf, data + start,
+			if (o_stream_send(output, data + start,
 					   i - start - 1) < 0)
 				return -1;
 
@@ -64,16 +64,16 @@
 	if (data[size-1] == '\r')
 		size--;
 
-	if (o_buffer_send(outbuf, data + start, size - start) < 0)
+	if (o_stream_send(output, data + start, size - start) < 0)
 		return -1;
 
 	return size;
 }
 
 int index_storage_save(MailStorage *storage, const char *path,
-		       IBuffer *inbuf, OBuffer *outbuf, uoff_t data_size)
+		       IStream *input, OStream *output, uoff_t data_size)
 {
-	int (*write_func)(OBuffer *, const unsigned char *, size_t);
+	int (*write_func)(OStream *, const unsigned char *, size_t);
 	const unsigned char *data;
 	size_t size;
 	ssize_t ret;
@@ -83,9 +83,9 @@
 
 	failed = FALSE;
 	while (data_size > 0) {
-		ret = i_buffer_read(inbuf);
+		ret = i_stream_read(input);
 		if (ret < 0) {
-			errno = inbuf->buf_errno;
+			errno = input->stream_errno;
 			if (errno == 0) {
 				mail_storage_set_error(storage,
 					"Client disconnected");
@@ -99,14 +99,14 @@
 			return FALSE;
 		}
 
-		data = i_buffer_get_data(inbuf, &size);
+		data = i_stream_get_data(input, &size);
 		if (size > data_size)
 			size = (size_t)data_size;
 
 		if (!failed) {
-			ret = write_func(outbuf, data, size);
+			ret = write_func(output, data, size);
 			if (ret < 0) {
-				errno = outbuf->buf_errno;
+				errno = output->stream_errno;
 				if (errno == ENOSPC) {
 					mail_storage_set_error(storage,
 						"Not enough disk space");
@@ -122,7 +122,7 @@
 		}
 
 		data_size -= size;
-		i_buffer_skip(inbuf, size);
+		i_stream_skip(input, size);
 	}
 
 	return !failed;

Index: index-search.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-search.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- index-search.c	4 Dec 2002 18:28:38 -0000	1.47
+++ index-search.c	6 Dec 2002 01:09:23 -0000	1.48
@@ -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 "mmap-util.h"
 #include "rfc822-tokenize.h"
 #include "rfc822-date.h"
@@ -50,7 +50,7 @@
 
 typedef struct {
         SearchIndexContext *index_ctx;
-	IBuffer *inbuf;
+	IStream *input;
 	MessagePart *part;
 } SearchBodyContext;
 
@@ -533,10 +533,10 @@
 		return;
 
 	if (arg->type == SEARCH_TEXT || arg->type == SEARCH_BODY) {
-		i_buffer_seek(ctx->inbuf, 0);
+		i_stream_seek(ctx->input, 0);
 		ret = message_body_search(arg->value.str,
 					  ctx->index_ctx->charset,
-					  &unknown_charset, ctx->inbuf,
+					  &unknown_charset, ctx->input,
 					  ctx->part, arg->type == SEARCH_TEXT);
 
 		if (ret < 0) {
@@ -550,7 +550,7 @@
 
 static int search_arg_match_text(MailSearchArg *args, SearchIndexContext *ctx)
 {
-	IBuffer *inbuf;
+	IStream *input;
 	int have_headers, have_body, have_text;
 
 	/* first check what we need to use */
@@ -561,7 +561,7 @@
 	if (have_headers || have_text) {
 		SearchHeaderContext hdr_ctx;
 
-		if (!imap_msgcache_get_data(search_open_cache(ctx), &inbuf))
+		if (!imap_msgcache_get_data(search_open_cache(ctx), &input))
 			return FALSE;
 
 		memset(&hdr_ctx, 0, sizeof(hdr_ctx));
@@ -569,10 +569,10 @@
 		hdr_ctx.custom_header = TRUE;
 		hdr_ctx.args = args;
 
-		message_parse_header(NULL, inbuf, NULL,
+		message_parse_header(NULL, input, NULL,
 				     search_header, &hdr_ctx);
 	} else {
-		if (!imap_msgcache_get_rfc822(search_open_cache(ctx), &inbuf,
+		if (!imap_msgcache_get_rfc822(search_open_cache(ctx), &input,
 					      NULL, NULL))
 			return FALSE;
 	}
@@ -582,7 +582,7 @@
 
 		memset(&body_ctx, 0, sizeof(body_ctx));
 		body_ctx.index_ctx = ctx;
-		body_ctx.inbuf = inbuf;
+		body_ctx.input = input;
 		body_ctx.part = imap_msgcache_get_parts(search_open_cache(ctx));
 
 		mail_search_args_foreach(args, search_body, &body_ctx);
@@ -757,7 +757,7 @@
 
 static int search_messages(IndexMailbox *ibox, const char *charset,
 			   MailSearchArg *args, MailSortContext *sort_ctx,
-			   OBuffer *outbuf, int uid_result)
+			   OStream *output, int uid_result)
 {
 	SearchIndexContext ctx;
 	MailIndexRecord *rec;
@@ -831,7 +831,7 @@
 					len = i_snprintf(num, sizeof(num),
 							 " %u", uid_result ?
 							 rec->uid : client_seq);
-					o_buffer_send(outbuf, num, len);
+					o_stream_send(output, num, len);
 				} else {
 					mail_sort_input(sort_ctx, rec->uid);
 				}
@@ -850,7 +850,7 @@
 }
 
 int index_storage_search(Mailbox *box, const char *charset, MailSearchArg *args,
-			 MailSortType *sorting, OBuffer *outbuf, int uid_result)
+			 MailSortType *sorting, OStream *output, int uid_result)
 {
 	IndexMailbox *ibox = (IndexMailbox *) box;
 	MailSortContext *sort_ctx;
@@ -862,23 +862,23 @@
 
 	if (sorting == NULL) {
 		sort_ctx = NULL;
-		o_buffer_send(outbuf, "* SEARCH", 8);
+		o_stream_send(output, "* SEARCH", 8);
 	} else {
 		memset(&index_sort_ctx, 0, sizeof(index_sort_ctx));
 		index_sort_ctx.ibox = ibox;
-		index_sort_ctx.outbuf = outbuf;
+		index_sort_ctx.output = output;
 
 		sort_ctx = mail_sort_init(sort_unsorted, sorting,
 					  index_sort_funcs, &index_sort_ctx);
-		o_buffer_send(outbuf, "* SORT", 6);
+		o_stream_send(output, "* SORT", 6);
 	}
 
 	failed = !search_messages(ibox, charset, args, sort_ctx,
-				  outbuf, uid_result);
+				  output, uid_result);
 	if (sort_ctx != NULL)
 		mail_sort_deinit(sort_ctx);
 
-	o_buffer_send(outbuf, "\r\n", 2);
+	o_stream_send(output, "\r\n", 2);
 
 	if (!index_storage_lock(ibox, MAIL_LOCK_UNLOCK))
 		return FALSE;

Index: index-sort.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-sort.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- index-sort.c	4 Dec 2002 18:28:38 -0000	1.1
+++ index-sort.c	6 Dec 2002 01:09:23 -0000	1.2
@@ -1,7 +1,7 @@
 /* Copyright (C) 2002 Timo Sirainen */
 
 #include "lib.h"
-#include "obuffer.h"
+#include "ostream.h"
 #include "rfc822-date.h"
 #include "imap-envelope.h"
 #include "imap-message-cache.h"
@@ -124,7 +124,7 @@
 
 	for (i = 0; i < count; i++) {
 		len = i_snprintf(num, sizeof(num), " %u", data[i]);
-		o_buffer_send(ctx->outbuf, num, len);
+		o_stream_send(ctx->output, num, len);
 	}
 }
 

Index: index-sort.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-sort.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- index-sort.h	4 Dec 2002 18:28:38 -0000	1.1
+++ index-sort.h	6 Dec 2002 01:09:23 -0000	1.2
@@ -6,7 +6,7 @@
 
 typedef struct {
 	IndexMailbox *ibox;
-	OBuffer *outbuf;
+	OStream *output;
 
 	unsigned int last_uid;
 	MailIndexRecord *rec;

Index: index-storage.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-storage.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- index-storage.h	4 Dec 2002 18:28:38 -0000	1.24
+++ index-storage.h	6 Dec 2002 01:09:23 -0000	1.25
@@ -59,7 +59,7 @@
 		       unsigned int seq, int notify);
 
 int index_storage_save(MailStorage *storage, const char *path,
-		       IBuffer *inbuf, OBuffer *outbuf, uoff_t data_size);
+		       IStream *input, OStream *output, uoff_t data_size);
 
 int index_msgcache_open(ImapMessageCache *cache, MailIndex *index,
 			MailIndexRecord *rec, ImapCacheField fields);
@@ -82,9 +82,9 @@
 			       ModifyType modify_type, int notify,
 			       int *all_found);
 int index_storage_fetch(Mailbox *box, MailFetchData *fetch_data,
-			OBuffer *outbuf, int *all_found);
+			OStream *output, int *all_found);
 int index_storage_search(Mailbox *box, const char *charset, MailSearchArg *args,
-			 MailSortType *sorting, OBuffer *outbuf,
+			 MailSortType *sorting, OStream *output,
 			 int uid_result);
 
 #endif




More information about the dovecot-cvs mailing list