From f168e3972c9c24648d26a3c97fb6ba317877afe4 Mon Sep 17 00:00:00 2001 From: NotZed Date: Mon, 8 May 2000 06:17:33 +0000 Subject: Format From and Reply-To to at least a decoded string. Should probably 2000-05-08 NotZed * camel-mime-message.c (process_header): Format From and Reply-To to at least a decoded string. Should probably store them as an camelinternetaddress. svn path=/trunk/; revision=2908 --- camel/ChangeLog | 4 ++++ camel/camel-mime-message.c | 24 ++++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) (limited to 'camel') diff --git a/camel/ChangeLog b/camel/ChangeLog index afe10fe07c..cfb0984c30 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,5 +1,9 @@ 2000-05-08 NotZed + * camel-mime-message.c (process_header): Format From and Reply-To + to at least a decoded string. Should probably store them as an + camelinternetaddress. + * Merged NEW_SUMMARY branch back to trunk, and resolved conflicts. * providers/mbox/camel-mbox-summary.c (camel_mbox_summary_update): diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c index d6fdc2c0a6..aa6cbeee4c 100644 --- a/camel/camel-mime-message.c +++ b/camel/camel-mime-message.c @@ -561,6 +561,22 @@ write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) return CAMEL_DATA_WRAPPER_CLASS (parent_class)->write_to_stream (data_wrapper, stream); } +static char * +format_address(const char *text) +{ + struct _header_address *addr; + char *ret; + + addr = header_address_decode(text); + if (addr) { + ret = header_address_list_format(addr); + header_address_list_clear(&addr); + } else { + ret = g_strdup(text); + } + return ret; +} + /* FIXME: check format of fields. */ static gboolean process_header(CamelMedium *medium, const char *header_name, const char *header_value) @@ -572,12 +588,12 @@ process_header(CamelMedium *medium, const char *header_name, const char *header_ header_type = (CamelHeaderType) g_hash_table_lookup (header_name_table, header_name); switch (header_type) { case HEADER_FROM: - g_free(message->from); /* FIXME: parse the from line into something useful */ - message->from = g_strdup(header_value); + g_free(message->from); + message->from = format_address(header_value); break; case HEADER_REPLY_TO: - g_free(message->reply_to); /* FIXME: parse the from line into something useful */ - message->reply_to = g_strdup(header_value); + g_free(message->reply_to); + message->reply_to = format_address(header_value); break; case HEADER_SUBJECT: g_free(message->subject); -- cgit v1.2.3