Logo Search packages:      
Sourcecode: pwlib version File versions

BOOL PSMTPServer::OnTextData ( PCharArray &  buffer,
BOOL &  completed 
) [protected, virtual]

Read a standard text message that is being received by the socket. The text message is terminated by a line with a '.' character alone.

The default behaviour is to read the data into the buffer parameter until either the end of the message or when the messageBufferSize bytes have been read.

Returns:
TRUE if partial message received, FALSE if the end of the data was received.

Definition at line 778 of file inetmail.cxx.

References PString::GetLength(), and PInternetProtocol::ReadLine().

{
  PString line;
  while (ReadLine(line)) {
    PINDEX len = line.GetLength();
    if (len == 1 && line[0] == '.') {
      completed = TRUE;
      return TRUE;
    }

    PINDEX start = (len > 1 && line[0] == '.' && line[1] == '.') ? 1 : 0;
    PINDEX size = buffer.GetSize();
    len -= start;
    memcpy(buffer.GetPointer(size + len + 2) + size,
           ((const char *)line)+start, len);
    size += len;
    buffer[size++] = '\r';
    buffer[size++] = '\n';
    if (size > messageBufferSize)
      return TRUE;
  }
  return FALSE;
}


Generated by  Doxygen 1.6.0   Back to index