[dovecot-cvs] dovecot/src/lib-mail message-address.c,NONE,1.1 message-address.h,NONE,1.1 message-date.c,NONE,1.1 message-date.h,NONE,1.1 message-tokenize.c,NONE,1.1 message-tokenize.h,NONE,1.1 Makefile.am,1.6,1.7 message-body-search.c,1.8,1.9 Message-Id: <20030105130956.8F2DA23997@danu.procontrol.fi>

cras at procontrol.fi cras at procontrol.fi
Sun Jan 5 15:09:56 EET 2003


Update of /home/cvs/dovecot/src/lib-mail
In directory danu:/tmp/cvs-serv25916/src/lib-mail

Modified Files:
	Makefile.am message-body-search.c message-body-search.h 
	message-content-parser.c message-header-decode.c 
	message-header-search.c message-header-search.h 
	message-parser.c message-parser.h message-part-serialize.c 
	message-part-serialize.h message-send.c message-send.h 
	message-size.c message-size.h quoted-printable.c 
	quoted-printable.h 
Added Files:
	message-address.c message-address.h message-date.c 
	message-date.h message-tokenize.c message-tokenize.h 
Removed Files:
	rfc822-address.c rfc822-address.h rfc822-date.c rfc822-date.h 
	rfc822-tokenize.c rfc822-tokenize.h 
Log Message:
Naming style changes, finally got tired of most of the typedefs. Also the
previous enum -> macro change reverted so that we don't use the highest bit
anymore, that's incompatible with old indexes so they will be rebuilt.



--- NEW FILE: message-address.c ---
/* Copyright (C) 2002 Timo Sirainen */

#include "lib.h"
#include "str.h"
#include "message-tokenize.h"
#include "message-address.h"

static struct message_address *
new_address(pool_t pool, struct message_address ***next_addr)
{
	struct message_address *addr;

	addr = p_new(pool, struct message_address, 1);

	**next_addr = addr;
	*next_addr = &addr->next;

	return addr;
}

struct message_address *
message_address_parse(pool_t pool, const unsigned char *data, size_t size)
{
	static const enum message_token stop_tokens_init[] =
		{ ',', '@', '<', ':', TOKEN_LAST };
	static const enum message_token stop_tokens_group[] =
		{ ',', '@', '<', ';', TOKEN_LAST };
	static const enum message_token stop_tokens_domain[] =
		{ ',', '<', TOKEN_LAST };
	static const enum message_token stop_tokens_domain_group[] =
		{ ',', '<', ';', TOKEN_LAST };
	static const enum message_token stop_tokens_post_addr[] =
		{ ',', TOKEN_LAST };
	static const enum message_token stop_tokens_post_addr_group[] =
		{ ',', ';', TOKEN_LAST };
	static const enum message_token stop_tokens_addr_route[] =
		{ ':', '>', TOKEN_LAST };
	static const enum message_token stop_tokens_addr_mailbox[] =
		{ '@', '>', TOKEN_LAST };
	static const enum message_token stop_tokens_addr_domain[] =
		{ '>', TOKEN_LAST };

	struct message_address *first_addr, **next_addr, *addr;
	struct message_tokenizer *tok;
	const enum message_token *stop_tokens;
	enum message_token token;
	string_t *mailbox, *domain, *route, *name, *comment, *next_phrase;
	size_t len;
	int ingroup, stop;

	if (size == 0)
		return NULL;

	first_addr = NULL;
	next_addr = &first_addr;

	/* 1) name <@route:mailbox at domain>, ...
	   2) mailbox at domain (name), ...
	   3) group: name <box at domain>, box2 at domain2 (name2), ... ;, ...

	   ENVELOPE wants groups to be stored like (NIL, NIL, group, NIL),
	   ..., (NIL, NIL, NIL, NIL)
	*/
	tok = message_tokenize_init(data, size, NULL, NULL);
	message_tokenize_skip_comments(tok, FALSE);

	t_push();
	mailbox = t_str_new(128);
	domain = t_str_new(256);
	route = t_str_new(128);
	name = t_str_new(256);
	comment = t_str_new(256);

	ingroup = FALSE; len = 0;
	stop_tokens = stop_tokens_init;

	next_phrase = mailbox; stop = FALSE;
	while (!stop) {
		if (next_phrase == name && str_len(name) > 0) {
			/* continuing previously started name,
			   separate it from us with space */
			str_append_c(name, ' ');
			len = str_len(name);
		} else {
			len = 0;
		}
		message_tokenize_get_string(tok, next_phrase, comment,
					    stop_tokens);

		if (next_phrase == name && len > 0 && len == str_len(name)) {
			/* nothing appeneded, remove the space */
			str_truncate(name, len-1);
		}

		token = message_tokenize_get(tok);
		switch (token) {
		case TOKEN_LAST:
		case ',':
		case ';':
			/* end of address */
			if (str_len(mailbox) > 0 || str_len(domain) > 0 ||
			    str_len(route) > 0 || str_len(name) > 0) {
				addr = new_address(pool, &next_addr);
				addr->mailbox = p_strdup(pool, str_c(mailbox));
				addr->domain = str_len(domain) == 0 ? NULL :
					p_strdup(pool, str_c(domain));
				addr->route = str_len(route) == 0 ? NULL :
					p_strdup(pool, str_c(route));
				addr->name = next_phrase == name ?
					p_strdup(pool, str_c(name)) :
					p_strdup(pool, str_c(comment));
			}

			if (ingroup && token == ';') {
				/* end of group - add end of group marker */
				ingroup = FALSE;
				(void)new_address(pool, &next_addr);
			}

			if (token == TOKEN_LAST) {
				stop = TRUE;
				break;
			}

			stop_tokens = ingroup ? stop_tokens_group :
				stop_tokens_init;

			str_truncate(mailbox, 0);
			str_truncate(domain, 0);
			str_truncate(route, 0);
			str_truncate(name, 0);
			str_truncate(comment, 0);

			next_phrase = mailbox;
			break;
		case '@':
			/* domain part comes next */
			next_phrase = domain;
			stop_tokens = ingroup ? stop_tokens_domain_group :
				stop_tokens_domain;
			break;
		case '<':
			/* route-addr */

			/* mailbox/domain name so far has actually
			   been the real name */
			str_append_str(name, mailbox);
			str_truncate(mailbox, 0);

			if (str_len(domain) > 0) {
                                str_append_c(name, '@');
				str_append_str(name, domain);
				str_truncate(domain, 0);
			}

			/* mailbox */
			message_tokenize_get_string(tok, mailbox, NULL,
						    stop_tokens_addr_mailbox);

			if (message_tokenize_get(tok) == '@' &&
			    str_len(mailbox) == 0) {
				/* route is given */
				message_tokenize_get_string(tok,
					route, NULL, stop_tokens_addr_route);

				if (message_tokenize_get(tok) == ':') {
					/* mailbox comes next */
					message_tokenize_get_string(tok,
						mailbox, NULL,
						stop_tokens_addr_mailbox);
				}
			}

			if (message_tokenize_get(tok) == '@') {
				/* domain */
				message_tokenize_get_string(tok,
					domain, NULL, stop_tokens_addr_domain);
			}

			token = message_tokenize_get(tok);
			i_assert(token == '>' || token == TOKEN_LAST);

			next_phrase = name;
			stop_tokens = ingroup ? stop_tokens_post_addr_group :
				stop_tokens_post_addr;
			break;
		case ':':
			/* beginning of group */
			addr = new_address(pool, &next_addr);
			addr->name = p_strdup(pool, str_c(mailbox));

			str_truncate(mailbox, 0);
			str_truncate(comment, 0);

			ingroup = TRUE;
			stop_tokens = stop_tokens_group;
			break;
		default:
			i_unreached();
			break;
		}
	}

	if (ingroup)
		(void)new_address(pool, &next_addr);

	t_pop();
	message_tokenize_deinit(tok);

	return first_addr;
}


--- NEW FILE: message-address.h ---
#ifndef __MESSAGE_ADDRESS_H
#define __MESSAGE_ADDRESS_H

struct message_address {
	struct message_address *next;

	const char *name, *route, *mailbox, *domain;
};

struct message_address *
message_address_parse(pool_t pool, const unsigned char *data, size_t size);

#endif

--- NEW FILE: message-date.c ---
/* Copyright (C) 2002 Timo Sirainen */

#include "lib.h"
#include "utc-offset.h"
#include "utc-mktime.h"
#include "message-tokenize.h"
#include "message-date.h"

#include <ctype.h>

static const char *month_names[] = {
	"Jan", "Feb", "Mar", "Apr", "May", "Jun",
	"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};

static const char *weekday_names[] = {
	"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
};

static int parse_timezone(const unsigned char *str, size_t len)
{
	int offset;
	char chr;

	if (len == 5 && (*str == '+' || *str == '-')) {
		/* numeric offset */
		if (!i_isdigit(str[1]) || !i_isdigit(str[2]) ||
		    !i_isdigit(str[3]) || !i_isdigit(str[4]))
			return FALSE;

		offset = (str[1]-'0') * 1000 + (str[2]-'0') * 100 +
			(str[3]-'0') * 10 + (str[4]-'0');
		return *str == '+' ? offset : -offset;
	}

	if (len == 1) {
		/* military zone - handle them the correct way, not as
		   RFC822 says. RFC2822 though suggests that they'd be
		   considered as unspecified.. */
		chr = i_toupper(*str);
		if (chr < 'J')
			return (*str-'A'+1) * 60;
		if (chr == 'J')
			return 0;
		if (chr <= 'M')
			return (*str-'A') * 60;
		if (chr < 'Z')
			return ('M'-*str) * 60;
		return 0;
	}

	if (len == 2 && i_toupper(str[0]) == 'U' && i_toupper(str[1]) == 'T') {
		/* UT - Universal Time */
		return 0;
	}

	if (len == 3) {
		/* GMT | [ECMP][DS]T */
		if (str[2] != 'T')
			return 0;

		switch (i_toupper(*str)) {
		case 'E':
			offset = -5 * 60;
			break;
		case 'C':
			offset = -6 * 60;
			break;
		case 'M':
			offset = -7 * 60;
			break;
		case 'P':
			offset = -8 * 60;
			break;
		default:
			/* GMT and others */
			return 0;
		}

		if (i_toupper(str[1]) == 'D')
			return offset + 60;
		if (i_toupper(str[1]) == 'S')
			return offset;
	}

	return 0;
}

static enum message_token next_token(struct message_tokenizer *ctx,
				     const unsigned char **value,
				     size_t *value_len)
{
	enum message_token token;

	token = message_tokenize_next(ctx);
	if (token == 'A')
		*value = message_tokenize_get_value(ctx, value_len);
	return token;
}

static int mail_date_parse_tokens(struct message_tokenizer *ctx, time_t *time,
				  int *timezone_offset)
{
	struct tm tm;
	enum message_token token;
	const unsigned char *value;
	size_t i, len;

	/* [weekday_name "," ] dd month_name [yy]yy hh:mi[:ss] timezone */
	memset(&tm, 0, sizeof(tm));

	/* skip the optional weekday */
	token = next_token(ctx, &value, &len);
	if (token == 'A' && len == 3) {
		token = next_token(ctx, &value, &len);
		if (token != ',')
			return FALSE;

		token = next_token(ctx, &value, &len);
	}

	/* dd */
	if (token != 'A' || len > 2 || !i_isdigit(value[0]))
		return FALSE;

	tm.tm_mday = value[0]-'0';
	if (len == 2) {
		if (!i_isdigit(value[1]))
			return FALSE;
		tm.tm_mday = (tm.tm_mday * 10) + (value[1]-'0');
	}

	/* month name */
	token = next_token(ctx, &value, &len);
	if (token != 'A' || len != 3)
		return FALSE;

	for (i = 0; i < 12; i++) {
		if (memcasecmp(month_names[i], value, 3) == 0) {
			tm.tm_mon = i;
			break;
		}
	}
	if (i == 12)
		return FALSE;

	/* [yy]yy */
	token = next_token(ctx, &value, &len);
	if (token != 'A' || (len != 2 && len != 4))
		return FALSE;

	for (i = 0; i < len; i++) {
		if (!i_isdigit(value[i]))
			return FALSE;
		tm.tm_year = tm.tm_year * 10 + (value[i]-'0');
	}

	if (len == 2) {
		/* two digit year, assume 1970+ */
		if (tm.tm_year < 70)
			tm.tm_year += 100;
	} else {
		if (tm.tm_year < 1900)
			return FALSE;
		tm.tm_year -= 1900;
	}

	/* hh */
	token = next_token(ctx, &value, &len);
	if (token != 'A' || len != 2 ||
	    !i_isdigit(value[0]) || !i_isdigit(value[1]))
		return FALSE;
	tm.tm_hour = (value[0]-'0') * 10 + (value[1]-'0');

	/* :mm */
	token = next_token(ctx, &value, &len);
	if (token != ':')
		return FALSE;
	token = next_token(ctx, &value, &len);
	if (token != 'A' || len != 2 ||
	    !i_isdigit(value[0]) || !i_isdigit(value[1]))
		return FALSE;
	tm.tm_min = (value[0]-'0') * 10 + (value[1]-'0');

	/* [:ss] */
	token = next_token(ctx, &value, &len);
	if (token == ':') {
		token = next_token(ctx, &value, &len);
		if (token != 'A' || len != 2 ||
		    !i_isdigit(value[0]) || !i_isdigit(value[1]))
			return FALSE;
		tm.tm_sec = (value[0]-'0') * 10 + (value[1]-'0');
	}

	/* timezone */
	if (token != 'A')
		return FALSE;
	*timezone_offset = parse_timezone(value, len);

	tm.tm_isdst = -1;
	*time = utc_mktime(&tm);
	if (*time == (time_t)-1)
		return FALSE;

	*time -= *timezone_offset;

	return TRUE;
}

int message_date_parse(const char *data, time_t *time, int *timezone_offset)
{
	struct message_tokenizer *ctx;
	int ret;

	if (data == NULL || *data == '\0')
		return FALSE;

	ctx = message_tokenize_init((const unsigned char *) data, (size_t)-1,
				    NULL, NULL);
	ret = mail_date_parse_tokens(ctx, time, timezone_offset);
	message_tokenize_deinit(ctx);

	return ret;
}

const char *message_date_create(time_t time)
{
	struct tm *tm;
	int offset, negative;

	tm = localtime(&time);
	offset = utc_offset(tm, time);
	if (offset >= 0)
		negative = 0;
	else {
		negative = 1;
		offset = -offset;
	}

	return t_strdup_printf("%s, %02d %s %04d %02d:%02d:%02d %c%02d%02d",
			       weekday_names[tm->tm_wday],
			       tm->tm_mday,
			       month_names[tm->tm_mon],
			       tm->tm_year+1900,
			       tm->tm_hour, tm->tm_min, tm->tm_sec,
			       negative ? '-' : '+', offset / 60, offset % 60);
}

--- NEW FILE: message-date.h ---
#ifndef __MESSAGE_DATE
#define __MESSAGE_DATE

/* Parses RFC2822 date/time string. timezone_offset is filled with the
   timezone's difference to UTC in minutes. */
int message_date_parse(const char *data, time_t *time, int *timezone_offset);

/* Create RFC2822 date/time string from given time in local timezone. */
const char *message_date_create(time_t time);

#endif

--- NEW FILE: message-tokenize.c ---
/* Copyright (C) 2002 Timo Sirainen */

#include "lib.h"
#include "str.h"
#include "strescape.h"
#include "message-tokenize.h"

struct message_tokenizer {
	const unsigned char *data;
	size_t size;

	MessageTokenizeErrorFunc error_func;
	void *error_context;

	int token;
	size_t token_pos, token_len;
	size_t parse_pos;

	unsigned int skip_comments:1;
	unsigned int dot_token:1;

	unsigned int in_bracket:1;
};

#define PARSE_ERROR() \
	STMT_START { \
	if (tok->error_func != NULL && \
	    !tok->error_func(data, i, '\0', tok->error_context)) { \
		tok->token = TOKEN_LAST; \
		return TOKEN_LAST; \
	} \
	} STMT_END

#define PARSE_ERROR_MISSING(c) \
	STMT_START { \
	if (tok->error_func != NULL && \
	    !tok->error_func(data, i, c, tok->error_context)) { \
		tok->token = TOKEN_LAST; \
		return TOKEN_LAST; \
	} \
	} STMT_END


struct message_tokenizer *
message_tokenize_init(const unsigned char *data, size_t size,
		      MessageTokenizeErrorFunc error_func, void *error_context)
{
	struct message_tokenizer *tok;

	tok = i_new(struct message_tokenizer, 1);
	tok->data = data;
	tok->size = size;

	tok->error_func = error_func;
	tok->error_context = error_context;

	tok->skip_comments = TRUE;
	tok->dot_token = TRUE;

	tok->token = -1;
	return tok;
}

void message_tokenize_deinit(struct message_tokenizer *tok)
{
	i_free(tok);
}

void message_tokenize_skip_comments(struct message_tokenizer *tok, int set)
{
	tok->skip_comments = set;
}

void message_tokenize_dot_token(struct message_tokenizer *tok, int set)
{
	tok->dot_token = set;
}

enum message_token message_tokenize_next(struct message_tokenizer *tok)
{
	int token, level, last_atom;
	const unsigned char *data;
	size_t i, size;

	if (tok->token == TOKEN_LAST)
		return TOKEN_LAST;

	data = tok->data;
	size = tok->size;

	tok->token = TOKEN_LAST;

	last_atom = FALSE;
	for (i = tok->parse_pos; i < size && data[i] != '\0'; i++) {
		token = -1;
		switch (data[i]) {
		case ' ':
		case '\t':
		case '\r':
		case '\n':
			/* skip whitespace */
			break;

		case '(':
			/* (comment) - nesting is allowed */
			if (last_atom)
				break;

			token = '(';
			tok->token_pos = ++i;

			level = 1;
			for (; i < size && data[i] != '\0'; i++) {
				if (data[i] == '\\' &&
				    i+1 < size && data[i+1] != '\0')
					i++;
				else if (data[i] == '(')
					level++;
				else if (data[i] == ')') {
					if (--level == 0)
						break;
				}
			}

			if (level > 0)
				PARSE_ERROR_MISSING(')');

			tok->token_len = (size_t) (i - tok->token_pos);
			break;

		case '[':
			/* domain literal - nesting isn't allowed */
			if (last_atom)
				break;

			token = '[';
			tok->token_pos = ++i;

			while (i < size && data[i] != '\0' && data[i] != ']') {
				if (data[i] == '\\' &&
				    i+1 < size && data[i+1] != '\0')
					i++;
				else if (data[i] == '[') {
					/* nesting not allowed, but
					   continue anyway */
					PARSE_ERROR();
				}

				i++;
			}

			if (i == size || data[i] == '\0')
				PARSE_ERROR_MISSING(']');

			tok->token_len = (size_t) (i - tok->token_pos);
			break;

		case '"':
			/* quoted string */
			if (last_atom)
				break;

			token = '"';
			tok->token_pos = ++i;

			while (i < size && data[i] != '\0' && data[i] != '"') {
				if (data[i] == '\\' &&
				    i+1 < size && data[i+1] != '\0')
					i++;
				i++;
			}

			if (i == size || data[i] == '\0')
				PARSE_ERROR_MISSING('"');

			tok->token_len = (size_t) (i - tok->token_pos);
			break;

		case '<':
			if (last_atom)
				break;

			if (tok->in_bracket) {
				/* '<' cannot be nested */
				PARSE_ERROR();
			}

			token = '<';
			tok->in_bracket = TRUE;
			break;
		case '>':
			if (last_atom)
				break;

			if (!tok->in_bracket) {
				/* missing '<' */
                                PARSE_ERROR();
			}

			token = '>';
			tok->in_bracket = FALSE;
			break;

		case ')':
		case ']':
		case '\\':
			PARSE_ERROR();
			/* fall through */

		/* RFC822 specials: */
		case '@':
		case ',':
		case ';':
		case ':':
		case '.':
		/* RFC 2045 specials: */
		case '/':
		case '?':
		case '=':
			token = tok->data[i];
			if (token != '.' || tok->dot_token)
				break;
			/* fall through */
		default:
			/* atom */
			token = 'A';
			if (!last_atom) {
				tok->token = token;
				tok->token_pos = i;
				last_atom = TRUE;
			}
			break;
		}

		if (last_atom) {
			if (token != 'A') {
				/* end of atom */
				tok->token_len = (size_t) (i - tok->token_pos);
				last_atom = FALSE;
				break;
			}
		} else {
			if (token != -1) {
				tok->token = token;
				if (i < tok->size && data[i] != '\0')
					i++;
				break;
			}
		}

		if (i == tok->size || data[i] == '\0') {
			/* unexpected eol */
			break;
		}
	}

	if (last_atom) {
		/* end of atom */
		tok->token_len = (size_t) (i - tok->token_pos);
	}

	tok->parse_pos = i;

	if (tok->token == TOKEN_LAST && tok->in_bracket &&
	    tok->error_func != NULL) {
		if (tok->error_func(data, i, '>', tok->error_context))
			tok->token = TOKEN_LAST;
	}

	return tok->token;
}

enum message_token message_tokenize_get(const struct message_tokenizer *tok)
{
	return tok->token;
}

const unsigned char *
message_tokenize_get_value(const struct message_tokenizer *tok, size_t *len)
{
	i_assert(IS_TOKEN_STRING(tok->token));

	*len = tok->token_len;
	return tok->data + tok->token_pos;
}

void message_tokenize_get_string(struct message_tokenizer *tok,
				 string_t *str, string_t *comments,
				 const enum message_token *stop_tokens)
{
	enum message_token token;
	const unsigned char *value;
	size_t len;
	int i, token_str, last_str;

	last_str = FALSE;
	while ((token = message_tokenize_next(tok)) != TOKEN_LAST) {
		for (i = 0; stop_tokens[i] != TOKEN_LAST; i++)
			if (token == stop_tokens[i])
				return;

		if (token == TOKEN_COMMENT) {
			/* handle comment specially */
			if (comments != NULL) {
				if (str_len(comments) > 0)
					str_append_c(comments, ' ');

				value = message_tokenize_get_value(tok, &len);
				str_append_unescaped(comments, value, len);
			}
			continue;
		}

		token_str = token == TOKEN_ATOM || token == TOKEN_QSTRING ||
			token == TOKEN_DLITERAL || token == TOKEN_COMMENT;

		if (!token_str)
			str_append_c(str, token);
		else if (token == TOKEN_QSTRING) {
			/* unescape only quoted strings, since we're removing
			   the quotes. for domain literals I don't see much
			   point in unescaping if [] is still kept.. */
			if (last_str)
				str_append_c(str, ' ');

			value = message_tokenize_get_value(tok, &len);
			str_append_unescaped(str, value, len);
		} else {
			if (last_str)
				str_append_c(str, ' ');

			if (token == TOKEN_DLITERAL)
				str_append_c(str, '[');

			value = message_tokenize_get_value(tok, &len);
			str_append_n(str, value, len);

			if (token == TOKEN_DLITERAL)
				str_append_c(str, ']');
		}

		last_str = token_str;
	}
}

--- NEW FILE: message-tokenize.h ---
#ifndef __MESSAGE_TOKENIZE_H
#define __MESSAGE_TOKENIZE_H

#define IS_TOKEN_STRING(token) \
	((token) == TOKEN_ATOM || (token) == TOKEN_QSTRING || \
	 (token) == TOKEN_COMMENT || (token) == TOKEN_DLITERAL)

enum message_token {
	TOKEN_ATOM	= 'A',
	TOKEN_QSTRING	= '"',
	TOKEN_COMMENT	= '(',
	TOKEN_DLITERAL	= '[',

	/* RFC822 specials:

	   '<', '>', '@', ',', ';', ':', '\'
	   '.' (not included in RFC2045 -> optional)

	   RFC2045 tspecials:

	   '/', '?', '=' */

	TOKEN_LAST	= 0
};

struct message_tokenizer;

/* Parsing is aborted if returns FALSE. There's two kinds of errors:

   missing_char == '\0': unexpected character at str[pos]
   missing_char != '\0': missing character */
typedef int (*MessageTokenizeErrorFunc)(const unsigned char *str, size_t pos,
					char missing_char, void *context);

/* Tokenize the string. Returns NULL if string is empty. Memory for
   returned array is allocated from data stack. You don't have to use
   the tokens_count, since last token is always 0. */
struct message_tokenizer *
message_tokenize_init(const unsigned char *data, size_t size,
		      MessageTokenizeErrorFunc error_func, void *error_context);
void message_tokenize_deinit(struct message_tokenizer *tok);

/* Specify whether comments should be silently skipped (default yes). */
void message_tokenize_skip_comments(struct message_tokenizer *tok, int set);
/* Specify whether '.' should be treated as a separate token (default yes). */
void message_tokenize_dot_token(struct message_tokenizer *tok, int set);

/* Parse the next token and return it. */
enum message_token message_tokenize_next(struct message_tokenizer *tok);

/* Return the current token. */
enum message_token message_tokenize_get(const struct message_tokenizer *tok);

/* - not including enclosing "", () or []
   - '\' isn't expanded
   - [CR+]LF+LWSP (continued header) isn't removed */
const unsigned char *
message_tokenize_get_value(const struct message_tokenizer *tok, size_t *len);

/* Read tokens as a string, all quoted strings will be unquoted.
   Reads until stop_token is found. */
void message_tokenize_get_string(struct message_tokenizer *tok,
				 string_t *str, string_t *comments,
				 const enum message_token *stop_tokens);

#endif

Index: Makefile.am
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/Makefile.am,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- Makefile.am	16 Dec 2002 03:26:55 -0000	1.6
+++ Makefile.am	5 Jan 2003 13:09:52 -0000	1.7
@@ -5,29 +5,29 @@
 	-I$(top_srcdir)/src/lib-charset
 
 libmail_a_SOURCES = \
+	message-address.c \
 	message-body-search.c \
 	message-content-parser.c \
+	message-date.c \
 	message-header-decode.c \
 	message-header-search.c \
 	message-parser.c \
 	message-part-serialize.c \
 	message-send.c \
 	message-size.c \
-	rfc822-address.c \
-	rfc822-date.c \
-	rfc822-tokenize.c \
+	message-tokenize.c \
 	quoted-printable.c
 
 noinst_HEADERS = \
+	message-address.h \
 	message-body-search.h \
 	message-content-parser.h \
+	message-date.h \
 	message-header-decode.h \
 	message-header-search.h \
 	message-parser.h \
 	message-part-serialize.h \
 	message-send.h \
 	message-size.h \
-	rfc822-address.h \
-	rfc822-date.h \
-	rfc822-tokenize.h \
+	message-tokenize.h \
 	quoted-printable.h

Index: message-body-search.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-body-search.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- message-body-search.c	4 Jan 2003 17:26:30 -0000	1.8
+++ message-body-search.c	5 Jan 2003 13:09:52 -0000	1.9
@@ -14,8 +14,8 @@
 
 #define DECODE_BLOCK_SIZE 8192
 
-typedef struct {
-	Pool pool;
+struct body_search_context {
+	pool_t pool;
 
 	const char *key;
 	size_t key_len;
@@ -23,16 +23,16 @@
 	const char *charset;
 	unsigned int unknown_charset:1;
 	unsigned int search_header:1;
-} BodySearchContext;
+};
 
-typedef struct {
-	BodySearchContext *body_ctx;
+struct part_search_context {
+	struct body_search_context *body_ctx;
 
-	HeaderSearchContext *hdr_search_ctx;
-	CharsetTranslation *translation;
+	struct header_search_context *hdr_search_ctx;
+	struct charset_translation *translation;
 
-	Buffer *decode_buf;
-	Buffer *match_buf;
+	buffer_t *decode_buf;
+	buffer_t *match_buf;
 
 	char *content_type;
 	char *content_charset;
@@ -43,12 +43,12 @@
 	unsigned int content_type_text:1; /* text/any or message/any */
 	unsigned int ignore_header:1;
 	unsigned int found:1;
-} PartSearchContext;
+};
 
 static void parse_content_type(const unsigned char *value, size_t value_len,
 			       void *context)
 {
-	PartSearchContext *ctx = context;
+	struct part_search_context *ctx = context;
 
 	if (ctx->content_type != NULL) {
 		ctx->content_type = i_strndup(value, value_len);
@@ -63,7 +63,7 @@
 			 const unsigned char *value, size_t value_len,
 			 int value_quoted, void *context)
 {
-	PartSearchContext *ctx = context;
+	struct part_search_context *ctx = context;
 
 	if (name_len == 7 && memcasecmp(name, "charset", 7) == 0 &&
 	    ctx->content_charset == NULL) {
@@ -75,7 +75,7 @@
 static void parse_content_encoding(const unsigned char *value, size_t value_len,
 				   void *context)
 {
-	PartSearchContext *ctx = context;
+	struct part_search_context *ctx = context;
 
 	switch (value_len) {
 	case 4:
@@ -101,12 +101,12 @@
 	}
 }
 
-static void header_find(MessagePart *part __attr_unused__,
+static void header_find(struct message_part *part __attr_unused__,
 			const unsigned char *name, size_t name_len,
 			const unsigned char *value, size_t value_len,
 			void *context)
 {
-	PartSearchContext *ctx = context;
+	struct part_search_context *ctx = context;
 
 	if (ctx->found)
 		return;
@@ -129,7 +129,8 @@
 	}
 }
 
-static int message_search_header(PartSearchContext *ctx, IStream *input)
+static int message_search_header(struct part_search_context *ctx,
+				 struct istream *input)
 {
 	ctx->hdr_search_ctx = message_header_search_init(data_stack_pool,
 							 ctx->body_ctx->key,
@@ -143,7 +144,8 @@
 	return ctx->found;
 }
 
-static int message_search_decoded_block(PartSearchContext *ctx, Buffer *block)
+static int message_search_decoded_block(struct part_search_context *ctx,
+					buffer_t *block)
 {
 	const unsigned char *p, *end, *key;
 	size_t key_len, block_size, *matches, match_count, value;
@@ -191,11 +193,12 @@
 }
 
 /* returns 1 = found, 0 = not found, -1 = error in input data */
-static int message_search_body_block(PartSearchContext *ctx, Buffer *block)
+static int message_search_body_block(struct part_search_context *ctx,
+				     buffer_t *block)
 {
 	const unsigned char *inbuf;
-	Buffer *outbuf;
-        CharsetResult result;
+	buffer_t *outbuf;
+        enum charset_result result;
 	size_t block_pos, inbuf_size, inbuf_left, ret;
 
 	outbuf = buffer_create_static(data_stack_pool, DECODE_BLOCK_SIZE);
@@ -250,11 +253,12 @@
 	return 0;
 }
 
-static int message_search_body(PartSearchContext *ctx, IStream *input,
-			       MessagePart *part)
+static int message_search_body(struct part_search_context *ctx,
+			       struct istream *input,
+			       struct message_part *part)
 {
 	const unsigned char *data;
-	Buffer *decodebuf;
+	buffer_t *decodebuf;
 	size_t data_size, pos;
 	uoff_t old_limit;
 	ssize_t ret;
@@ -336,13 +340,13 @@
 	return found;
 }
 
-static int message_body_search_init(BodySearchContext *ctx, const char *key,
-				    const char *charset, int *unknown_charset,
-				    int search_header)
+static int message_body_search_init(struct body_search_context *ctx,
+				    const char *key, const char *charset,
+				    int *unknown_charset, int search_header)
 {
 	size_t key_len;
 
-	memset(ctx, 0, sizeof(BodySearchContext));
+	memset(ctx, 0, sizeof(struct body_search_context));
 
 	/* get the key uppercased */
 	key = charset_to_ucase_utf8_string(charset, unknown_charset,
@@ -362,10 +366,11 @@
 	return TRUE;
 }
 
-static int message_body_search_ctx(BodySearchContext *ctx, IStream *input,
-				   MessagePart *part)
+static int message_body_search_ctx(struct body_search_context *ctx,
+				   struct istream *input,
+				   struct message_part *part)
 {
-	PartSearchContext part_ctx;
+	struct part_search_context part_ctx;
 	int found;
 
 	found = FALSE;
@@ -404,10 +409,10 @@
 }
 
 int message_body_search(const char *key, const char *charset,
-			int *unknown_charset, IStream *input,
-			MessagePart *part, int search_header)
+			int *unknown_charset, struct istream *input,
+			struct message_part *part, int search_header)
 {
-        BodySearchContext ctx;
+        struct body_search_context ctx;
 
 	if (!message_body_search_init(&ctx, key, charset, unknown_charset,
 				      search_header))

Index: message-body-search.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-body-search.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- message-body-search.h	6 Dec 2002 01:09:23 -0000	1.3
+++ message-body-search.h	5 Jan 2003 13:09:52 -0000	1.4
@@ -1,12 +1,14 @@
 #ifndef __MESSAGE_BODY_SEARCH_H
 #define __MESSAGE_BODY_SEARCH_H
 
+struct message_part;
+
 /* Returns 1 if key is found from input buffer, 0 if not and -1 if error.
    There's two possible errors: either the charset is unknown or the key
    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, IStream *input,
-			MessagePart *part, int search_header);
+			int *unknown_charset, struct istream *input,
+			struct message_part *part, int search_header);
 
 #endif

Index: message-content-parser.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-content-parser.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- message-content-parser.c	4 Jan 2003 17:26:30 -0000	1.6
+++ message-content-parser.c	5 Jan 2003 13:09:52 -0000	1.7
@@ -2,7 +2,7 @@
 
 #include "lib.h"
 #include "str.h"
-#include "rfc822-tokenize.h"
+#include "message-tokenize.h"
 #include "message-content-parser.h"
 
 void message_content_parse_header(const unsigned char *data, size_t size,
@@ -10,48 +10,48 @@
 				  ParseContentParamFunc param_func,
 				  void *context)
 {
-	static const Rfc822Token stop_tokens[] = { ';', TOKEN_LAST };
-	Rfc822TokenizeContext *ctx;
-	Rfc822Token token;
-	String *str;
+	static const enum message_token stop_tokens[] = { ';', TOKEN_LAST };
+	struct message_tokenizer *tok;
+	enum message_token token;
+	string_t *str;
 	const unsigned char *key, *value;
 	size_t key_len, value_len;
 
-	ctx = rfc822_tokenize_init(data, size, NULL, NULL);
-        rfc822_tokenize_dot_token(ctx, FALSE);
+	tok = message_tokenize_init(data, size, NULL, NULL);
+        message_tokenize_dot_token(tok, FALSE);
 
 	t_push();
 	str = t_str_new(256);
 
         /* first ';' separates the parameters */
-	rfc822_tokenize_get_string(ctx, str, NULL, stop_tokens);
+	message_tokenize_get_string(tok, str, NULL, stop_tokens);
 
 	if (func != NULL)
 		func(str_data(str), str_len(str), context);
 
 	t_pop();
 
-	if (param_func != NULL && rfc822_tokenize_get(ctx) == ';') {
+	if (param_func != NULL && message_tokenize_get(tok) == ';') {
 		/* parse the parameters */
-		while ((token = rfc822_tokenize_next(ctx)) != TOKEN_LAST) {
+		while ((token = message_tokenize_next(tok)) != TOKEN_LAST) {
 			/* <token> "=" <token> | <quoted-string> */
 			if (token != TOKEN_ATOM)
 				continue;
 
-			key = rfc822_tokenize_get_value(ctx, &key_len);
+			key = message_tokenize_get_value(tok, &key_len);
 
-			if (rfc822_tokenize_next(ctx) != '=')
+			if (message_tokenize_next(tok) != '=')
 				continue;
 
-			token = rfc822_tokenize_next(ctx);
+			token = message_tokenize_next(tok);
 			if (token != TOKEN_ATOM && token != TOKEN_QSTRING)
 				continue;
 
-			value = rfc822_tokenize_get_value(ctx, &value_len);
+			value = message_tokenize_get_value(tok, &value_len);
 			param_func(key, key_len, value, value_len,
 				   token == TOKEN_QSTRING, context);
 		}
 	}
 
-	rfc822_tokenize_deinit(ctx);
+	message_tokenize_deinit(tok);
 }

Index: message-header-decode.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-header-decode.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- message-header-decode.c	16 Dec 2002 03:26:55 -0000	1.1
+++ message-header-decode.c	5 Jan 2003 13:09:52 -0000	1.2
@@ -50,7 +50,7 @@
 {
 	const unsigned char *text;
 	const char *charset, *encoding;
-	Buffer *decodebuf;
+	buffer_t *decodebuf;
 	size_t text_size;
 	int ret;
 

Index: message-header-search.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-header-search.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- message-header-search.c	4 Jan 2003 17:26:30 -0000	1.11
+++ message-header-search.c	5 Jan 2003 13:09:52 -0000	1.12
@@ -11,14 +11,14 @@
 
 #include <ctype.h>
 
-struct _HeaderSearchContext {
-	Pool pool;
+struct header_search_context {
+	pool_t pool;
 
 	unsigned char *key;
 	size_t key_len;
 	char *key_charset;
 
-	Buffer *match_buf;
+	buffer_t *match_buf;
 
 	unsigned int found:1;
 	unsigned int last_newline:1;
@@ -28,17 +28,17 @@
 };
 
 static void search_loop(const unsigned char *data, size_t size,
-			HeaderSearchContext *ctx);
+			struct header_search_context *ctx);
 
-HeaderSearchContext *
-message_header_search_init(Pool pool, const char *key, const char *charset,
+struct header_search_context *
+message_header_search_init(pool_t pool, const char *key, const char *charset,
 			   int *unknown_charset)
 {
-	HeaderSearchContext *ctx;
+	struct header_search_context *ctx;
 	size_t key_len;
 	const unsigned char *p;
 
-	ctx = p_new(pool, HeaderSearchContext, 1);
+	ctx = p_new(pool, struct header_search_context, 1);
 	ctx->pool = pool;
 
 	/* get the key uppercased */
@@ -70,9 +70,9 @@
 	return ctx;
 }
 
-void message_header_search_free(HeaderSearchContext *ctx)
+void message_header_search_free(struct header_search_context *ctx)
 {
-	Pool pool;
+	pool_t pool;
 
 	buffer_free(ctx->match_buf);
 
@@ -83,7 +83,8 @@
 }
 
 static void search_with_charset(const unsigned char *data, size_t size,
-				const char *charset, HeaderSearchContext *ctx)
+				const char *charset,
+				struct header_search_context *ctx)
 {
 	const char *utf8_data;
 	size_t utf8_size;
@@ -111,7 +112,7 @@
 }
 
 static void search_loop(const unsigned char *data, size_t size,
-			HeaderSearchContext *ctx)
+			struct header_search_context *ctx)
 {
 	size_t pos, *matches, match_count, value;
 	ssize_t i;
@@ -186,7 +187,7 @@
 static int search_block(const unsigned char *data, size_t size,
 			const char *charset, void *context)
 {
-	HeaderSearchContext *ctx = context;
+	struct header_search_context *ctx = context;
 
 	t_push();
 	if (charset != NULL) {
@@ -201,14 +202,14 @@
 }
 
 int message_header_search(const unsigned char *header_block, size_t size,
-			  HeaderSearchContext *ctx)
+			  struct header_search_context *ctx)
 {
 	if (!ctx->found)
 		message_header_decode(header_block, size, search_block, ctx);
 	return ctx->found;
 }
 
-void message_header_search_reset(HeaderSearchContext *ctx)
+void message_header_search_reset(struct header_search_context *ctx)
 {
 	buffer_set_used_size(ctx->match_buf, 0);
 	ctx->found = FALSE;

Index: message-header-search.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-header-search.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- message-header-search.h	8 Dec 2002 05:23:08 -0000	1.3
+++ message-header-search.h	5 Jan 2003 13:09:52 -0000	1.4
@@ -1,24 +1,24 @@
 #ifndef __MESSAGE_HEADER_SEARCH_H
 #define __MESSAGE_HEADER_SEARCH_H
 
-typedef struct _HeaderSearchContext HeaderSearchContext;
+struct header_search_context;
 
 /* Initialize new search. Returns NULL if charset is unknown or key is not
    valid in specified charset. */
-HeaderSearchContext *
-message_header_search_init(Pool pool, const char *key, const char *charset,
+struct header_search_context *
+message_header_search_init(pool_t pool, const char *key, const char *charset,
 			   int *unknown_charset);
 
 /* Free search context. Not needed if you just destroy the pool. */
-void message_header_search_free(HeaderSearchContext *ctx);
+void message_header_search_free(struct header_search_context *ctx);
 
 /* Returns TRUE if key is found from header. This function may be called
    multiple times with partial header blocks, but the blocks must contain only
    full lines so RFC2047 parsing can be done. */
 int message_header_search(const unsigned char *header_block, size_t size,
-			  HeaderSearchContext *ctx);
+			  struct header_search_context *ctx);
 
 /* Next call to message_header_search() will begin a new header. */
-void message_header_search_reset(HeaderSearchContext *ctx);
+void message_header_search_reset(struct header_search_context *ctx);
 
 #endif

Index: message-parser.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-parser.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- message-parser.c	4 Jan 2003 17:26:30 -0000	1.31
+++ message-parser.c	5 Jan 2003 13:09:52 -0000	1.32
@@ -7,36 +7,41 @@
 #include "message-parser.h"
 #include "message-size.h"
 
-typedef struct _MessageBoundary {
-	struct _MessageBoundary *next;
+struct message_boundary {
+	struct message_boundary *next;
 
-	MessagePart *part;
+	struct message_part *part;
 	const char *boundary;
 	size_t len;
-} MessageBoundary;
+};
 
-typedef struct {
-	Pool pool;
-	MessagePart *part;
+struct parser_context {
+	pool_t pool;
+	struct message_part *part;
 
 	char *last_boundary;
 	char *last_content_type;
-	MessageBoundary *boundaries;
+	struct message_boundary *boundaries;
 
 	MessageHeaderFunc func;
 	void *context;
-} MessageParseContext;
+};
 
-static MessagePart *message_parse_part(IStream *input,
-				       MessageParseContext *parse_ctx);
-static MessagePart *message_parse_body(IStream *input,
-				       MessageBoundary *boundaries,
-				       MessageSize *body_size);
-static MessagePart *message_skip_boundary(IStream *input,
-					  MessageBoundary *boundaries,
-					  MessageSize *boundary_size);
+static struct message_part *
+message_parse_part(struct istream *input,
+		   struct parser_context *parser_ctx);
 
-static void message_size_add_part(MessageSize *dest, MessagePart *part)
+static struct message_part *
+message_parse_body(struct istream *input, struct message_boundary *boundaries,
+		   struct message_size *body_size);
+
+static struct message_part *
+message_skip_boundary(struct istream *input,
+		      struct message_boundary *boundaries,
+		      struct message_size *boundary_size);
+
+static void message_size_add_part(struct message_size *dest,
+				  struct message_part *part)
 {
 	dest->physical_size +=
 		part->header_size.physical_size +
@@ -47,11 +52,12 @@
 	dest->lines += part->header_size.lines + part->body_size.lines;
 }
 
-static MessagePart *message_part_append(Pool pool, MessagePart *parent)
+static struct message_part *
+message_part_append(pool_t pool, struct message_part *parent)
 {
-	MessagePart *part, **list;
+	struct message_part *part, **list;
 
-	part = p_new(pool, MessagePart, 1);
+	part = p_new(pool, struct message_part, 1);
 	part->parent = parent;
 
 	/* set child position */
@@ -71,24 +77,24 @@
 static void parse_content_type(const unsigned char *value, size_t value_len,
 			       void *context)
 {
-	MessageParseContext *parse_ctx = context;
+	struct parser_context *parser_ctx = context;
 	const char *str;
 
-	if (parse_ctx->last_content_type != NULL || value_len == 0)
+	if (parser_ctx->last_content_type != NULL || value_len == 0)
 		return;
 
-	str = parse_ctx->last_content_type =
-		p_strndup(parse_ctx->pool, value, value_len);
+	str = parser_ctx->last_content_type =
+		p_strndup(parser_ctx->pool, value, value_len);
 
 	if (strcasecmp(str, "message/rfc822") == 0)
-		parse_ctx->part->flags |= MESSAGE_PART_FLAG_MESSAGE_RFC822;
+		parser_ctx->part->flags |= MESSAGE_PART_FLAG_MESSAGE_RFC822;
 	else if (strncasecmp(str, "text/", 5) == 0)
-		parse_ctx->part->flags |= MESSAGE_PART_FLAG_TEXT;
+		parser_ctx->part->flags |= MESSAGE_PART_FLAG_TEXT;
 	else if (strncasecmp(str, "multipart/", 10) == 0) {
-		parse_ctx->part->flags |= MESSAGE_PART_FLAG_MULTIPART;
+		parser_ctx->part->flags |= MESSAGE_PART_FLAG_MULTIPART;
 
 		if (strcasecmp(str+10, "digest") == 0) {
-			parse_ctx->part->flags |=
+			parser_ctx->part->flags |=
 				MESSAGE_PART_FLAG_MULTIPART_DIGEST;
 		}
 	}
@@ -99,31 +105,31 @@
 			 const unsigned char *value, size_t value_len,
 			 int value_quoted, void *context)
 {
-	MessageParseContext *parse_ctx = context;
+	struct parser_context *parser_ctx = context;
 
-	if ((parse_ctx->part->flags & MESSAGE_PART_FLAG_MULTIPART) == 0 ||
+	if ((parser_ctx->part->flags & MESSAGE_PART_FLAG_MULTIPART) == 0 ||
 	    name_len != 8 || memcasecmp(name, "boundary", 8) != 0)
 		return;
 
-	if (parse_ctx->last_boundary == NULL) {
-		parse_ctx->last_boundary =
-			p_strndup(parse_ctx->pool, value, value_len);
+	if (parser_ctx->last_boundary == NULL) {
+		parser_ctx->last_boundary =
+			p_strndup(parser_ctx->pool, value, value_len);
 		if (value_quoted)
-			str_unescape(parse_ctx->last_boundary);
+			str_unescape(parser_ctx->last_boundary);
 	}
 }
 
-static void parse_header_field(MessagePart *part,
+static void parse_header_field(struct message_part *part,
 			       const unsigned char *name, size_t name_len,
 			       const unsigned char *value, size_t value_len,
 			       void *context)
 {
-	MessageParseContext *parse_ctx = context;
+	struct parser_context *parser_ctx = context;
 
 	/* call the user-defined header parser */
-	if (parse_ctx->func != NULL) {
-		parse_ctx->func(part, name, name_len, value, value_len,
-				parse_ctx->context);
+	if (parser_ctx->func != NULL) {
+		parser_ctx->func(part, name, name_len, value, value_len,
+				 parser_ctx->context);
 	}
 
 	if (name_len == 12 && memcasecmp(name, "Content-Type", 12) == 0) {
@@ -131,41 +137,42 @@
 		message_content_parse_header(value, value_len,
 					     parse_content_type,
 					     parse_content_type_param,
-					     parse_ctx);
+					     parser_ctx);
 	}
 }
 
-static MessagePart *message_parse_multipart(IStream *input,
-					    MessageParseContext *parse_ctx)
+static struct message_part *
+message_parse_multipart(struct istream *input,
+			struct parser_context *parser_ctx)
 {
-	MessagePart *parent_part, *next_part, *part;
-	MessageBoundary *b;
+	struct message_part *parent_part, *next_part, *part;
+	struct message_boundary *b;
 
 	/* multipart message. add new boundary */
-	b = t_new(MessageBoundary, 1);
-	b->part = parse_ctx->part;
-	b->boundary = parse_ctx->last_boundary;
+	b = t_new(struct message_boundary, 1);
+	b->part = parser_ctx->part;
+	b->boundary = parser_ctx->last_boundary;
 	b->len = strlen(b->boundary);
 
-	b->next = parse_ctx->boundaries;
-	parse_ctx->boundaries = b;
+	b->next = parser_ctx->boundaries;
+	parser_ctx->boundaries = b;
 
 	/* reset fields */
-	parse_ctx->last_boundary = NULL;
-	parse_ctx->last_content_type = NULL;
+	parser_ctx->last_boundary = NULL;
+	parser_ctx->last_content_type = NULL;
 
 	/* skip the data before the first boundary */
-	parent_part = parse_ctx->part;
-	next_part = message_skip_boundary(input, parse_ctx->boundaries,
+	parent_part = parser_ctx->part;
+	next_part = message_skip_boundary(input, parser_ctx->boundaries,
 					  &parent_part->body_size);
 
 	/* now, parse the parts */
 	while (next_part == parent_part) {
 		/* new child */
-		part = message_part_append(parse_ctx->pool, parent_part);
+		part = message_part_append(parser_ctx->pool, parent_part);
 
-                parse_ctx->part = part;
-		next_part = message_parse_part(input, parse_ctx);
+                parser_ctx->part = part;
+		next_part = message_parse_part(input, parser_ctx);
 
 		/* update our size */
 		message_size_add_part(&parent_part->body_size, part);
@@ -174,95 +181,96 @@
 			break;
 
 		/* skip the boundary */
-		next_part = message_skip_boundary(input, parse_ctx->boundaries,
+		next_part = message_skip_boundary(input, parser_ctx->boundaries,
 						  &parent_part->body_size);
 	}
 
 	/* remove boundary */
-	i_assert(parse_ctx->boundaries == b);
-	parse_ctx->boundaries = b->next;
+	i_assert(parser_ctx->boundaries == b);
+	parser_ctx->boundaries = b->next;
 	return next_part;
 }
 
 #define MUTEX_FLAGS \
 	(MESSAGE_PART_FLAG_MESSAGE_RFC822 | MESSAGE_PART_FLAG_MULTIPART)
 
-static MessagePart *message_parse_part(IStream *input,
-				       MessageParseContext *parse_ctx)
+static struct message_part *
+message_parse_part(struct istream *input, struct parser_context *parser_ctx)
 {
-	MessagePart *next_part, *part;
+	struct message_part *next_part, *part;
 	uoff_t hdr_size;
 
-	message_parse_header(parse_ctx->part, input,
-			     &parse_ctx->part->header_size,
-			     parse_header_field, parse_ctx);
+	message_parse_header(parser_ctx->part, input,
+			     &parser_ctx->part->header_size,
+			     parse_header_field, parser_ctx);
 
-	i_assert((parse_ctx->part->flags & MUTEX_FLAGS) != MUTEX_FLAGS);
+	i_assert((parser_ctx->part->flags & MUTEX_FLAGS) != MUTEX_FLAGS);
 
 	/* update message position/size */
-	hdr_size = parse_ctx->part->header_size.physical_size;
+	hdr_size = parser_ctx->part->header_size.physical_size;
 
-	if (parse_ctx->last_boundary != NULL)
-		return message_parse_multipart(input, parse_ctx);
+	if (parser_ctx->last_boundary != NULL)
+		return message_parse_multipart(input, parser_ctx);
 
-	if (parse_ctx->last_content_type == NULL) {
-		if (parse_ctx->part->parent != NULL &&
-		    (parse_ctx->part->parent->flags &
+	if (parser_ctx->last_content_type == NULL) {
+		if (parser_ctx->part->parent != NULL &&
+		    (parser_ctx->part->parent->flags &
 		     MESSAGE_PART_FLAG_MULTIPART_DIGEST)) {
 			/* when there's no content-type specified and we're
 			   below multipart/digest, the assume message/rfc822
 			   content-type */
-			parse_ctx->part->flags |=
+			parser_ctx->part->flags |=
 				MESSAGE_PART_FLAG_MESSAGE_RFC822;
 		} else {
 			/* otherwise we default to text/plain */
-			parse_ctx->part->flags |= MESSAGE_PART_FLAG_TEXT;
+			parser_ctx->part->flags |= MESSAGE_PART_FLAG_TEXT;
 		}
 	}
 
-	parse_ctx->last_boundary = NULL;
-        parse_ctx->last_content_type = NULL;
+	parser_ctx->last_boundary = NULL;
+        parser_ctx->last_content_type = NULL;
 
-	if (parse_ctx->part->flags & MESSAGE_PART_FLAG_MESSAGE_RFC822) {
+	if (parser_ctx->part->flags & MESSAGE_PART_FLAG_MESSAGE_RFC822) {
 		/* message/rfc822 part - the message body begins with
 		   headers again, this works pretty much the same as
 		   a single multipart/mixed item */
-		part = message_part_append(parse_ctx->pool, parse_ctx->part);
+		part = message_part_append(parser_ctx->pool, parser_ctx->part);
 
-		parse_ctx->part = part;
-		next_part = message_parse_part(input, parse_ctx);
-		parse_ctx->part = part->parent;
+		parser_ctx->part = part;
+		next_part = message_parse_part(input, parser_ctx);
+		parser_ctx->part = part->parent;
 
 		/* our body size is the size of header+body in message/rfc822 */
 		message_size_add_part(&part->parent->body_size, part);
 	} else {
 		/* normal message, read until the next boundary */
-		part = parse_ctx->part;
-		next_part = message_parse_body(input, parse_ctx->boundaries,
+		part = parser_ctx->part;
+		next_part = message_parse_body(input, parser_ctx->boundaries,
 					       &part->body_size);
 	}
 
 	return next_part;
 }
 
-MessagePart *message_parse(Pool pool, IStream *input,
-			   MessageHeaderFunc func, void *context)
+struct message_part *message_parse(pool_t pool, struct istream *input,
+				   MessageHeaderFunc func, void *context)
 {
-	MessagePart *part;
-	MessageParseContext parse_ctx;
+	struct message_part *part;
+	struct parser_context parser_ctx;
 
-	memset(&parse_ctx, 0, sizeof(parse_ctx));
-	parse_ctx.pool = pool;
-	parse_ctx.func = func;
-	parse_ctx.context = context;
-	parse_ctx.part = part = p_new(pool, MessagePart, 1);
+	memset(&parser_ctx, 0, sizeof(parser_ctx));
+	parser_ctx.pool = pool;
+	parser_ctx.func = func;
+	parser_ctx.context = context;
+	parser_ctx.part = part = p_new(pool, struct message_part, 1);
 
-	message_parse_part(input, &parse_ctx);
+	message_parse_part(input, &parser_ctx);
 	return part;
 }
 
 /* skip over to next line increasing message size */
-static void message_skip_line(IStream *input, MessageSize *msg_size)
+static void message_skip_line(struct istream *input,
+			      struct message_size *msg_size)
 {
 	const unsigned char *msg;
 	size_t i, size, startpos;
@@ -304,8 +312,8 @@
 	}
 }
 
-void message_parse_header(MessagePart *part, IStream *input,
-			  MessageSize *hdr_size,
+void message_parse_header(struct message_part *part, struct istream *input,
+			  struct message_size *hdr_size,
 			  MessageHeaderFunc func, void *context)
 {
 	const unsigned char *msg;
@@ -314,7 +322,7 @@
 	int ret;
 
 	if (hdr_size != NULL)
-		memset(hdr_size, 0, sizeof(MessageSize));
+		memset(hdr_size, 0, sizeof(struct message_size));
 
 	missing_cr_count = startpos = line_start = 0;
 	colon_pos = UINT_MAX;
@@ -433,8 +441,9 @@
 	}
 }
 
-static MessageBoundary *boundary_find(MessageBoundary *boundaries,
-				      const unsigned char *msg, size_t len)
+static struct message_boundary *
+boundary_find(struct message_boundary *boundaries,
+	      const unsigned char *msg, size_t len)
 {
 	while (boundaries != NULL) {
 		if (boundaries->len <= len &&
@@ -450,11 +459,12 @@
 /* read until next boundary is found. if skip_over = FALSE, stop at the
    [\r]\n before the boundary, otherwise leave it right after the known
    boundary so the ending "--" can be checked. */
-static MessageBoundary *
-message_find_boundary(IStream *input, MessageBoundary *boundaries,
-		      MessageSize *msg_size, int skip_over)
+static struct message_boundary *
+message_find_boundary(struct istream *input,
+		      struct message_boundary *boundaries,
+		      struct message_size *msg_size, int skip_over)
 {
-	MessageBoundary *boundary;
+	struct message_boundary *boundary;
 	const unsigned char *msg;
 	size_t i, size, startpos, line_start, missing_cr_count;
 
@@ -544,11 +554,11 @@
 	return boundary;
 }
 
-static MessagePart *message_parse_body(IStream *input,
-				       MessageBoundary *boundaries,
-				       MessageSize *body_size)
+static struct message_part *
+message_parse_body(struct istream *input, struct message_boundary *boundaries,
+		   struct message_size *body_size)
 {
-	MessageBoundary *boundary;
+	struct message_boundary *boundary;
 
 	if (boundaries == NULL) {
 		message_get_body_size(input, body_size, (uoff_t)-1, NULL);
@@ -562,11 +572,12 @@
 
 /* skip data until next boundary is found. if it's end boundary,
    skip the footer as well. */
-static MessagePart *message_skip_boundary(IStream *input,
-					  MessageBoundary *boundaries,
-					  MessageSize *boundary_size)
+static struct message_part *
+message_skip_boundary(struct istream *input,
+		      struct message_boundary *boundaries,
+		      struct message_size *boundary_size)
 {
-	MessageBoundary *boundary;
+	struct message_boundary *boundary;
 	const unsigned char *msg;
 	size_t size;
 	int end_boundary;

Index: message-parser.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-parser.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- message-parser.h	4 Jan 2003 17:26:30 -0000	1.14
+++ message-parser.h	5 Jan 2003 13:09:52 -0000	1.15
@@ -4,11 +4,7 @@
 #define IS_LWSP(c) \
 	((c) == ' ' || (c) == '\t')
 
-typedef struct _MessagePart MessagePart;
-typedef struct _MessagePosition MessagePosition;
-typedef struct _MessageSize MessageSize;
-
-typedef enum {
+enum message_part_flags {
 	MESSAGE_PART_FLAG_MULTIPART		= 0x01,
 	MESSAGE_PART_FLAG_MULTIPART_DIGEST	= 0x02,
 	MESSAGE_PART_FLAG_MESSAGE_RFC822	= 0x04,
@@ -18,45 +14,45 @@
 
 	/* content-transfer-encoding: binary */
 	MESSAGE_PART_FLAG_BINARY		= 0x10
-} MessagePartFlags;
+};
 
-struct _MessageSize {
+struct message_size {
 	uoff_t physical_size;
 	uoff_t virtual_size;
 	unsigned int lines;
 };
 
-struct _MessagePart {
-	MessagePart *parent;
-	MessagePart *next;
-	MessagePart *children;
+struct message_part {
+	struct message_part *parent;
+	struct message_part *next;
+	struct message_part *children;
 
 	uoff_t physical_pos; /* absolute position from beginning of message */
-	MessageSize header_size;
-	MessageSize body_size;
+	struct message_size header_size;
+	struct message_size body_size;
 
-	MessagePartFlags flags;
+	enum message_part_flags flags;
 	void *context;
 };
 
 /* NOTE: name and value aren't \0-terminated. Also called once at end of
    headers with name_len = value_len = 0. */
-typedef void (*MessageHeaderFunc)(MessagePart *part,
+typedef void (*MessageHeaderFunc)(struct message_part *part,
 				  const unsigned char *name, size_t name_len,
 				  const unsigned char *value, size_t value_len,
 				  void *context);
 
 /* func is called for each field in message header. */
-MessagePart *message_parse(Pool pool, IStream *input,
-			   MessageHeaderFunc func, void *context);
+struct message_part *message_parse(pool_t pool, struct 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, input will point to beginning of message
    body. */
-void message_parse_header(MessagePart *part, IStream *input,
-			  MessageSize *hdr_size,
+void message_parse_header(struct message_part *part, struct istream *input,
+			  struct message_size *hdr_size,
 			  MessageHeaderFunc func, void *context);
 
 #endif

Index: message-part-serialize.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-part-serialize.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- message-part-serialize.c	9 Dec 2002 17:31:41 -0000	1.10
+++ message-part-serialize.c	5 Jan 2003 13:09:52 -0000	1.11
@@ -17,7 +17,7 @@
 */
 
 /* struct is 8 byte aligned */
-typedef struct {
+struct serialized_message_part {
 	uoff_t physical_pos;
   
 	uoff_t header_physical_size;
@@ -31,18 +31,18 @@
 
 	unsigned int children_count;
 	unsigned int flags;
-} SerializedMessagePart;
+};
 
-static unsigned int _message_part_serialize(MessagePart *part, Buffer *dest)
+static unsigned int
+_message_part_serialize(struct message_part *part, buffer_t *dest)
 {
-	SerializedMessagePart *spart;
+	struct serialized_message_part *spart;
 	unsigned int count = 1;
 
 	while (part != NULL) {
 		/* create serialized part */
-		spart = buffer_append_space(dest,
-					    sizeof(SerializedMessagePart));
-		memset(spart, 0, sizeof(SerializedMessagePart));
+		spart = buffer_append_space(dest, sizeof(*spart));
+		memset(spart, 0, sizeof(*spart));
 
 		spart->physical_pos = part->physical_pos;
 
@@ -69,18 +69,18 @@
 	return count;
 }
 
-void message_part_serialize(MessagePart *part, Buffer *dest)
+void message_part_serialize(struct message_part *part, buffer_t *dest)
 {
 	_message_part_serialize(part, dest);
 }
 
-static MessagePart *
-message_part_deserialize_part(Pool pool, MessagePart *parent,
-			      const SerializedMessagePart **spart_pos,
+static struct message_part *
+message_part_deserialize_part(pool_t pool, struct message_part *parent,
+			      const struct serialized_message_part **spart_pos,
 			      size_t *count, unsigned int child_count)
 {
-        const SerializedMessagePart *spart;
-	MessagePart *part, *first_part, **next_part;
+        const struct serialized_message_part *spart;
+	struct message_part *part, *first_part, **next_part;
 	unsigned int i;
 
 	first_part = NULL;
@@ -90,7 +90,7 @@
 		(*spart_pos)++;
 		(*count)--;
 
-		part = p_new(pool, MessagePart, 1);
+		part = p_new(pool, struct message_part, 1);
 		part->physical_pos = spart->physical_pos;
 
 		part->header_size.physical_size = spart->header_physical_size;
@@ -118,18 +118,18 @@
 	return first_part;
 }
 
-MessagePart *message_part_deserialize(Pool pool, const void *data,
-				      size_t size)
+struct message_part *message_part_deserialize(pool_t pool, const void *data,
+					      size_t size)
 {
-        const SerializedMessagePart *spart;
+        const struct serialized_message_part *spart;
 	size_t count;
 
 	/* make sure it looks valid */
-	if (size < sizeof(SerializedMessagePart))
+	if (size < sizeof(struct serialized_message_part))
 		return NULL;
 
 	spart = data;
-	count = size / sizeof(SerializedMessagePart);
+	count = size / sizeof(struct serialized_message_part);
 	if (count > UINT_MAX)
 		return NULL;
 
@@ -138,15 +138,15 @@
 }
 
 int message_part_serialize_update_header(void *data, size_t size,
-					 MessageSize *hdr_size)
+					 struct message_size *hdr_size)
 {
-	SerializedMessagePart *spart = data;
+	struct serialized_message_part *spart = data;
 	uoff_t first_pos;
 	off_t pos_diff;
 	size_t i, count;
 
 	/* make sure it looks valid */
-	if (size < sizeof(SerializedMessagePart))
+	if (size < sizeof(struct serialized_message_part))
 		return FALSE;
 
 	if (hdr_size->physical_size >= OFF_T_MAX ||
@@ -163,7 +163,7 @@
 
 	if (pos_diff != 0) {
 		/* have to update all positions, but skip the first one */
-		count = (size / sizeof(SerializedMessagePart))-1;
+		count = (size / sizeof(struct serialized_message_part))-1;
 		spart++;
 
 		for (i = 0; i < count; i++, spart++) {
@@ -179,13 +179,13 @@
 }
 
 int message_part_deserialize_size(const void *data, size_t size,
-				  MessageSize *hdr_size,
-				  MessageSize *body_size)
+				  struct message_size *hdr_size,
+				  struct message_size *body_size)
 {
-        const SerializedMessagePart *spart = data;
+        const struct serialized_message_part *spart = data;
 
 	/* make sure it looks valid */
-	if (size < sizeof(SerializedMessagePart))
+	if (size < sizeof(struct serialized_message_part))
 		return FALSE;
 
 	hdr_size->physical_size = spart->header_physical_size;

Index: message-part-serialize.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-part-serialize.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- message-part-serialize.h	8 Dec 2002 05:23:08 -0000	1.5
+++ message-part-serialize.h	5 Jan 2003 13:09:52 -0000	1.6
@@ -1,19 +1,23 @@
 #ifndef __MESSAGE_PART_SERIALIZE_H
 #define __MESSAGE_PART_SERIALIZE_H
 
+struct message_part;
+struct message_size;
+
 /* Serialize message part. */
-void message_part_serialize(MessagePart *part, Buffer *dest);
+void message_part_serialize(struct message_part *part, buffer_t *dest);
 
-/* Generate MessagePart from serialized data. */
-MessagePart *message_part_deserialize(Pool pool, const void *data, size_t size);
+/* Generate struct message_part from serialized data. */
+struct message_part *message_part_deserialize(pool_t pool, const void *data,
+					      size_t size);
 
-/* Update header size in serialized MessagePart. */
+/* Update header size in serialized struct message_part. */
 int message_part_serialize_update_header(void *data, size_t size,
-					 MessageSize *hdr_size);
+					 struct message_size *hdr_size);
 
-/* Get message size from serialized MessagePart data. */
+/* Get message size from serialized struct message_part data. */
 int message_part_deserialize_size(const void *data, size_t size,
-				  MessageSize *hdr_size,
-				  MessageSize *body_size);
+				  struct message_size *hdr_size,
+				  struct message_size *body_size);
 
 #endif

Index: message-send.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-send.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- message-send.c	27 Dec 2002 13:05:53 -0000	1.13
+++ message-send.c	5 Jan 2003 13:09:52 -0000	1.14
@@ -3,10 +3,12 @@
 #include "lib.h"
 #include "istream.h"
 #include "ostream.h"
+#include "message-parser.h"
 #include "message-send.h"
 #include "message-size.h"
 
-int message_send(OStream *output, IStream *input, MessageSize *msg_size,
+int message_send(struct ostream *output, struct istream *input,
+		 struct message_size *msg_size,
 		 uoff_t virtual_skip, uoff_t max_virtual_size)
 {
 	const unsigned char *msg;

Index: message-send.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-send.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- message-send.h	6 Dec 2002 01:09:23 -0000	1.6
+++ message-send.h	5 Jan 2003 13:09:52 -0000	1.7
@@ -1,13 +1,14 @@
 #ifndef __MESSAGE_SEND_H
 #define __MESSAGE_SEND_H
 
-#include "message-parser.h"
+struct message_size;
 
 /* 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 input begins with LF, CR is inserted
    before it unless virtual_skip = 1. Returns TRUE if successful. */
-int message_send(OStream *output, IStream *input, MessageSize *msg_size,
+int message_send(struct ostream *output, struct istream *input,
+		 struct message_size *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.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- message-size.c	27 Dec 2002 13:05:53 -0000	1.10
+++ message-size.c	5 Jan 2003 13:09:52 -0000	1.11
@@ -5,12 +5,12 @@
 #include "message-parser.h"
 #include "message-size.h"
 
-void message_get_header_size(IStream *input, MessageSize *hdr)
+void message_get_header_size(struct istream *input, struct message_size *hdr)
 {
 	const unsigned char *msg;
 	size_t i, size, startpos, missing_cr_count;
 
-	memset(hdr, 0, sizeof(MessageSize));
+	memset(hdr, 0, sizeof(struct message_size));
 
 	missing_cr_count = 0; startpos = 0;
 	while (i_stream_read_data(input, &msg, &size, startpos) > 0) {
@@ -55,14 +55,14 @@
 	i_assert(hdr->virtual_size >= hdr->physical_size);
 }
 
-void message_get_body_size(IStream *input, MessageSize *body,
+void message_get_body_size(struct istream *input, struct message_size *body,
 			   uoff_t max_virtual_size, int *last_cr)
 {
 	const unsigned char *msg;
 	size_t i, size, startpos, missing_cr_count;
 	int cr;
 
-	memset(body, 0, sizeof(MessageSize));
+	memset(body, 0, sizeof(struct message_size));
 
 	cr = 0;
 	missing_cr_count = 0; startpos = 0;
@@ -110,8 +110,8 @@
 		*last_cr = cr;
 }
 
-void message_skip_virtual(IStream *input, uoff_t virtual_skip,
-			  MessageSize *msg_size, int *cr_skipped)
+void message_skip_virtual(struct istream *input, uoff_t virtual_skip,
+			  struct message_size *msg_size, int *cr_skipped)
 {
 	const unsigned char *msg;
 	size_t i, size, startpos;
@@ -168,7 +168,8 @@
 	}
 }
 
-void message_size_add(MessageSize *dest, const MessageSize *src)
+void message_size_add(struct message_size *dest,
+		      const struct message_size *src)
 {
 	dest->virtual_size += src->virtual_size;
 	dest->physical_size += src->physical_size;

Index: message-size.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-size.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- message-size.h	27 Dec 2002 13:05:53 -0000	1.7
+++ message-size.h	5 Jan 2003 13:09:52 -0000	1.8
@@ -1,24 +1,25 @@
 #ifndef __MESSAGE_SIZE_H
 #define __MESSAGE_SIZE_H
 
-#include "message-parser.h"
+struct message_size;
 
 /* Calculate size of message header. Leave the input point to first
    character in body. */
-void message_get_header_size(IStream *input, MessageSize *hdr);
+void message_get_header_size(struct istream *input, struct message_size *hdr);
 /* Calculate size of message body. Read only max_virtual_size virtual bytes,
    if you want it unlimited, use (uoff_t)-1. If last_cr is not NULL, it's set
    to 1 if last character is CR, 2 if it's virtual CR. */
-void message_get_body_size(IStream *input, MessageSize *body,
+void message_get_body_size(struct istream *input, struct message_size *body,
 			   uoff_t max_virtual_size, int *last_cr);
 
 /* 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(IStream *input, uoff_t virtual_skip,
-			  MessageSize *msg_size, int *cr_skipped);
+void message_skip_virtual(struct istream *input, uoff_t virtual_skip,
+			  struct message_size *msg_size, int *cr_skipped);
 
 /* Sum contents of src into dest. */
-void message_size_add(MessageSize *dest, const MessageSize *src);
+void message_size_add(struct message_size *dest,
+		      const struct message_size *src);
 
 #endif

Index: quoted-printable.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/quoted-printable.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- quoted-printable.c	16 Dec 2002 03:26:55 -0000	1.3
+++ quoted-printable.c	5 Jan 2003 13:09:52 -0000	1.4
@@ -6,7 +6,7 @@
 #include "quoted-printable.h"
 
 void quoted_printable_decode(const unsigned char *src, size_t src_size,
-			     size_t *src_pos_r, Buffer *dest)
+			     size_t *src_pos_r, buffer_t *dest)
 {
 	char hexbuf[3];
 	size_t src_pos, next;

Index: quoted-printable.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/quoted-printable.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- quoted-printable.h	8 Dec 2002 05:23:08 -0000	1.2
+++ quoted-printable.h	5 Jan 2003 13:09:52 -0000	1.3
@@ -8,6 +8,6 @@
    If src_pos is non-NULL, it's updated to first non-translated character in
    src. */
 void quoted_printable_decode(const unsigned char *src, size_t src_size,
-			     size_t *src_pos_r, Buffer *dest);
+			     size_t *src_pos_r, buffer_t *dest);
 
 #endif

--- rfc822-address.c DELETED ---

--- rfc822-address.h DELETED ---

--- rfc822-date.c DELETED ---

--- rfc822-date.h DELETED ---

--- rfc822-tokenize.c DELETED ---

--- rfc822-tokenize.h DELETED ---




More information about the dovecot-cvs mailing list