[dovecot-cvs] dovecot/src/lib-mail message-decoder.c, 1.8, 1.9 message-decoder.h, 1.1, 1.2
tss at dovecot.org
tss at dovecot.org
Tue Apr 3 21:03:57 EEST 2007
Update of /var/lib/cvs/dovecot/src/lib-mail
In directory talvi:/tmp/cvs-serv5142/lib-mail
Modified Files:
message-decoder.c message-decoder.h
Log Message:
Renamed message_decoder_init() to message_decoder_init_ucase() and changed
it to uppercase all the output.
Index: message-decoder.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-mail/message-decoder.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- message-decoder.c 3 Apr 2007 18:02:44 -0000 1.8
+++ message-decoder.c 3 Apr 2007 18:03:55 -0000 1.9
@@ -44,7 +44,7 @@
unsigned int charset_utf8:1;
};
-struct message_decoder_context *message_decoder_init(void)
+struct message_decoder_context *message_decoder_init_ucase(void)
{
struct message_decoder_context *ctx;
@@ -77,9 +77,9 @@
struct charset_translation *t;
bool unknown_charset;
- if (charset == NULL || strcasecmp(charset, "UTF-8") == 0) {
+ if (charset == NULL || charset_is_utf8(charset)) {
/* ASCII */
- buffer_append(ctx->buf, data, size);
+ _charset_utf8_ucase(data, size, ctx->buf, ctx->buf->used);
return TRUE;
}
@@ -141,6 +141,8 @@
struct message_header_line *hdr,
struct message_block *output)
{
+ size_t value_len;
+
if (hdr->continues) {
hdr->use_full_value = TRUE;
return FALSE;
@@ -165,11 +167,19 @@
buffer_set_used_size(ctx->buf, 0);
message_header_decode(hdr->full_value, hdr->full_value_len,
message_decode_header_callback, ctx);
+ value_len = ctx->buf->used;
+
+ _charset_utf8_ucase((const unsigned char *)hdr->name, hdr->name_len,
+ ctx->buf, ctx->buf->used);
+ buffer_append_c(ctx->buf, '\0');
ctx->hdr = *hdr;
ctx->hdr.full_value = ctx->buf->data;
- ctx->hdr.full_value_len = ctx->buf->used;
+ ctx->hdr.full_value_len = value_len;
ctx->hdr.value_len = 0;
+ ctx->hdr.name = CONST_PTR_OFFSET(ctx->buf->data,
+ ctx->hdr.full_value_len);
+ ctx->hdr.name_len = ctx->buf->used - 1 - value_len;
output->hdr = &ctx->hdr;
return TRUE;
Index: message-decoder.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-mail/message-decoder.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- message-decoder.h 17 Sep 2006 16:23:44 -0000 1.1
+++ message-decoder.h 3 Apr 2007 18:03:55 -0000 1.2
@@ -4,8 +4,9 @@
struct message_block;
/* Decode message's contents as UTF-8, both the headers and the MIME bodies.
- The bodies are decoded from quoted-printable and base64 formats if needed. */
-struct message_decoder_context *message_decoder_init(void);
+ The bodies are decoded from quoted-printable and base64 formats if needed.
+ The data is returned uppercased. */
+struct message_decoder_context *message_decoder_init_ucase(void);
void message_decoder_deinit(struct message_decoder_context **ctx);
/* Decode input and return decoded output. Headers are returned only in their
More information about the dovecot-cvs
mailing list