예제 #1
0
char * mailstream_read_multiline(mailstream * s, size_t size,
				  MMAPString * stream_buffer,
				  MMAPString * multiline_buffer,
				  size_t progr_rate,
				  progress_function * progr_fun,
				  mailprogress_function * body_progr_fun, void * context)
{
  size_t count;
  char * line;
  size_t last;

  if (mmap_string_assign(multiline_buffer, "") == NULL)
    return NULL;

  count = 0;
  last = 0;

  while ((line = mailstream_read_line_remove_eol(s, stream_buffer)) != NULL) {
    if (mailstream_is_end_multiline(line))
      return multiline_buffer->str;

    if (line[0] == '.') {
      if (mmap_string_append(multiline_buffer, line + 1) == NULL)
	return NULL;
    }
    else {
      if (mmap_string_append(multiline_buffer, line) == NULL)
	return NULL;
    }
    if (mmap_string_append(multiline_buffer, "\r\n") == NULL)
      return NULL;

    count += strlen(line);
    if ((size != 0) && (progr_rate != 0) && (progr_fun != NULL))
      if (count - last >= progr_rate) {
	      if (progr_fun != NULL) {
          (* progr_fun)(count, size);
        }
	      if (body_progr_fun != NULL) {
					body_progr_fun(count, size, context);
		    }
        last = count;
      }
  }

  return NULL;
}
예제 #2
0
파일: mailpop3.c 프로젝트: CodaFi/etPanKit
static char * read_line(mailpop3 * f)
{
  return mailstream_read_line_remove_eol(f->pop3_stream, f->pop3_stream_buffer);
}
예제 #3
0
static char * read_line(newsnntp * f)
{
  return mailstream_read_line_remove_eol(f->nntp_stream, f->nntp_stream_buffer);
}
예제 #4
0
static char * read_line(mailsmtp * session)
{
  return mailstream_read_line_remove_eol(session->stream,
					 session->line_buffer);
}