Added missing case when replacing '.' in send().

This commit is contained in:
Vincent Richard 2005-04-26 19:46:36 +00:00
parent 7919198c3e
commit 44ff5f63a1

View File

@ -310,6 +310,7 @@ void SMTPTransport::send(const mailbox& expeditor, const mailboxList& recipients
progress->start(total); progress->start(total);
char buffer[65536]; char buffer[65536];
char previousChar = '\0';
while (!is.eof()) while (!is.eof())
{ {
@ -322,7 +323,13 @@ void SMTPTransport::send(const mailbox& expeditor, const mailboxList& recipients
while ((pos = std::find(pos, end, '.')) != end) while ((pos = std::find(pos, end, '.')) != end)
{ {
if (pos > buffer && *(pos - 1) == '\n') // '\n' in the previous buffer, '.' in the current one
if (pos == buffer && previousChar == '\n')
{
m_socket->sendRaw(".", 1);
}
// Both '\n' and '.' are in the current buffer
else if (pos > buffer && *(pos - 1) == '\n')
{ {
m_socket->sendRaw(start, pos - start); m_socket->sendRaw(start, pos - start);
m_socket->sendRaw(".", 1); m_socket->sendRaw(".", 1);
@ -333,6 +340,11 @@ void SMTPTransport::send(const mailbox& expeditor, const mailboxList& recipients
++pos; ++pos;
} }
if (read > 0)
previousChar = buffer[read - 1];
else
previousChar = '\0';
// Send the remaining data // Send the remaining data
m_socket->sendRaw(start, end - start); m_socket->sendRaw(start, end - start);