Mercurial > dovecot > original-hg > dovecot-1.2
view src/lib-mail/message-send.c @ 7086:7ed926ed7aa4 HEAD
Updated copyright notices to include year 2008.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 01 Jan 2008 22:05:21 +0200 |
parents | 65c69a53a7be |
children | c63cc3580150 |
line wrap: on
line source
/* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */ #include "lib.h" #include "istream.h" #include "ostream.h" #include "message-parser.h" #include "message-send.h" #include "message-size.h" void message_skip_virtual(struct istream *input, uoff_t virtual_skip, struct message_size *msg_size, bool cr_skipped, bool *last_cr) { const unsigned char *msg; size_t i, size, startpos; if (virtual_skip == 0) { *last_cr = cr_skipped; return; } *last_cr = FALSE; startpos = 0; while (i_stream_read_data(input, &msg, &size, startpos) > 0) { for (i = startpos; i < size && virtual_skip > 0; i++) { virtual_skip--; if (msg[i] == '\r') { /* CR */ if (virtual_skip == 0) *last_cr = TRUE; } else if (msg[i] == '\n') { /* LF */ if ((i == 0 && !cr_skipped) || (i > 0 && msg[i-1] != '\r')) { /* missing CR */ if (msg_size != NULL) msg_size->virtual_size++; if (virtual_skip == 0) { /* CR/LF boundary */ *last_cr = TRUE; break; } virtual_skip--; } /* increase after making sure we didn't break at virtual \r */ if (msg_size != NULL) msg_size->lines++; } } i_stream_skip(input, i); if (msg_size != NULL) { msg_size->physical_size += i; msg_size->virtual_size += i; } if (i < size) break; cr_skipped = msg[i-1] == '\r'; } }