message-send.c revision 1c64ce475b982a84d55ce3028721e4a123b05ef2
/* Copyright (C) 2002 Timo Sirainen */
#include "lib.h"
#include "iobuffer.h"
#include "message-send.h"
#include "message-size.h"
{
unsigned char *msg;
int cr_skipped, add_cr;
if (msg_size->physical_size == 0 ||
return TRUE;
/* no need to kludge with CRs, we can use sendfile() */
max_virtual_size) > 0;
}
/* go through the message data and insert CRs where needed. */
for (i = 0; i < size; i++) {
if (msg[i] == '\n') {
if ((i == 0 && !cr_skipped) ||
/* missing CR */
if (max_virtual_size > 0)
break;
}
}
if (max_virtual_size > 0) {
if (--max_virtual_size == 0) {
i++;
break;
}
}
}
return FALSE;
if (add_cr) {
return FALSE;
}
/* see if we've reached the limit */
if (max_virtual_size == 0)
break;
cr_skipped = TRUE;
io_buffer_skip(inbuf, i);
}
return TRUE;
}