Re: [gmime-devel] changes to message headers being ignored
- From: Jeffrey Stedfast <fejj gnome org>
- To: evil legacy <evil legacy gmail com>
- Cc: gmime-devel-list gnome org
- Subject: Re: [gmime-devel] changes to message headers being ignored
- Date: Wed, 13 Jun 2012 10:24:59 -0400
Thank evil, that was a great catch!
I've just fixed this in git master.
Jeff
On 05/10/2012 10:04 AM, evil legacy wrote:
Hey all,
When creating a message object from a stream, (e.g parsing a mime file),
then changing a header such as subject and regenerating the mime again,
the generated mime doesn't reflect the changes
unless message->mime_part->headers stream is manually set to NULL.
code to reproduce:
<code>
void print_mime(GMimeMessage *m)
{
GMimeStream *stdout_stream = g_mime_stream_fs_new(0);
g_mime_object_write_to_stream((GMimeObject *)m, stdout_stream);
}
int main(int argc, char **argv)
{
GMimeMessage *message;
GMimeParser *parser;
GMimeStream *stream;
g_mime_init(0);
const char *mime = "From: foo example com";
stream = g_mime_stream_mem_new_with_buffer(mime, strlen(mime));
parser = g_mime_parser_new_with_stream (stream);
message = g_mime_parser_construct_message (parser);
printf("mime 0\n");
print_mime(message);
printf("-----------\n");
g_mime_message_set_sender(message, "bar example com");
printf("mime 1\n");
print_mime(message);
printf("-----------\n");
g_mime_header_list_set_stream(message->mime_part->headers, NULL);
printf("mime 2\n");
print_mime(message);
printf("-----------\n");
return 0;
}
</code>
output:
mime 0
From: foo example com
-----------
mime 1
From: foo example com
-----------
mime 2
From: bar example com
MIME-Version: 1.0
as you see, only after calling
g_mime_header_list_set_stream(message->mime_part->headers, NULL)
we get the expected result.
maybe this should be added somewhere in message_write_to_stream() in
gmime/gmime-message.c
(P.S as always, tested with 2.4 and 2.6)
Best Regards,
Eddie.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]