From 44ff5f63a1fda3a7edbf7a2d8b72504cfc88f243 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Tue, 26 Apr 2005 19:46:36 +0000 Subject: [PATCH] Added missing case when replacing '.' in send(). --- src/messaging/smtp/SMTPTransport.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/messaging/smtp/SMTPTransport.cpp b/src/messaging/smtp/SMTPTransport.cpp index 58e000ac..16fc1454 100644 --- a/src/messaging/smtp/SMTPTransport.cpp +++ b/src/messaging/smtp/SMTPTransport.cpp @@ -310,6 +310,7 @@ void SMTPTransport::send(const mailbox& expeditor, const mailboxList& recipients progress->start(total); char buffer[65536]; + char previousChar = '\0'; while (!is.eof()) { @@ -322,7 +323,13 @@ void SMTPTransport::send(const mailbox& expeditor, const mailboxList& recipients 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(".", 1); @@ -333,6 +340,11 @@ void SMTPTransport::send(const mailbox& expeditor, const mailboxList& recipients ++pos; } + if (read > 0) + previousChar = buffer[read - 1]; + else + previousChar = '\0'; + // Send the remaining data m_socket->sendRaw(start, end - start);