Skip to content

Commit

Permalink
lib-mail: Added message_header_line_write()
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen committed Jan 18, 2016
1 parent 5c7c62f commit d45a4c7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/lib-mail/message-header-parser.c
Expand Up @@ -394,3 +394,18 @@ void message_parse_header(struct istream *input, struct message_size *hdr_size,
/* call after the final skipping */
callback(NULL, context);
}

void message_header_line_write(buffer_t *output,
const struct message_header_line *hdr)
{
if (!hdr->continued) {
buffer_append(output, hdr->name, strlen(hdr->name));
buffer_append(output, hdr->middle, hdr->middle_len);
}
buffer_append(output, hdr->value, hdr->value_len);
if (!hdr->no_newline) {
if (hdr->crlf_newline)
buffer_append_c(output, '\r');
buffer_append_c(output, '\n');
}
}
5 changes: 5 additions & 0 deletions src/lib-mail/message-header-parser.h
Expand Up @@ -69,4 +69,9 @@ void message_parse_header(struct istream *input, struct message_size *hdr_size,
struct message_header_line *hdr, typeof(context))), \
(message_header_callback_t *)callback, context)

/* Write the header line to buffer exactly as it was read, including the
newline. */
void message_header_line_write(buffer_t *output,
const struct message_header_line *hdr);

#endif

0 comments on commit d45a4c7

Please sign in to comment.