diff options
author | Bertrand Guiheneuf <bertrand@src.gnome.org> | 1999-05-21 05:24:54 +0800 |
---|---|---|
committer | Bertrand Guiheneuf <bertrand@src.gnome.org> | 1999-05-21 05:24:54 +0800 |
commit | bdf895136ea393bd59960623d7cab970900048f7 (patch) | |
tree | 6d1f724e51cbaaf4fef4047edf41b61d6df0bc85 /camel/camel-mime-message.c | |
parent | 1cf9ad83368e754a5b8072f3ed820785609eb709 (diff) | |
download | gsoc2013-evolution-bdf895136ea393bd59960623d7cab970900048f7.tar gsoc2013-evolution-bdf895136ea393bd59960623d7cab970900048f7.tar.gz gsoc2013-evolution-bdf895136ea393bd59960623d7cab970900048f7.tar.bz2 gsoc2013-evolution-bdf895136ea393bd59960623d7cab970900048f7.tar.lz gsoc2013-evolution-bdf895136ea393bd59960623d7cab970900048f7.tar.xz gsoc2013-evolution-bdf895136ea393bd59960623d7cab970900048f7.tar.zst gsoc2013-evolution-bdf895136ea393bd59960623d7cab970900048f7.zip |
recipient list printing
* camel/camel-mime-message.c (_write_to_file):
recipient list printing
* tests/test1.c (main): more tests.
svn path=/trunk/; revision=936
Diffstat (limited to 'camel/camel-mime-message.c')
-rw-r--r-- | camel/camel-mime-message.c | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c index c561b89fee..270cbcc5ef 100644 --- a/camel/camel-mime-message.c +++ b/camel/camel-mime-message.c @@ -320,7 +320,7 @@ _add_recipient (CamelMimeMessage *mime_message, GString *recipient_type, GString existent_list = (GList *)g_hash_table_lookup (mime_message->recipients, recipient_type); /* if the recipient is already in this list, do nothing */ - if ( existent_list && g_list_find_custom (existent_list, (gpointer)recipient, g_string_equal_for_hash) ) { + if ( existent_list && g_list_find_custom (existent_list, (gpointer)recipient, g_string_equal_for_glist) ) { g_string_free (recipient_type, FALSE); g_string_free (recipient, FALSE); return; @@ -378,7 +378,7 @@ _remove_recipient (CamelMimeMessage *mime_message, GString *recipient_type, GStr (gpointer)&(recipients_list)) ) return; - /* look for the recipient to remoce */ + /* look for the recipient to remove */ old_element = g_list_find_custom (recipients_list, recipient, g_string_equal_for_hash); if (old_element) { /* if recipient exists, remove it */ @@ -490,11 +490,39 @@ camel_mime_message_get_message_number (CamelMimeMessage *mime_message) #endif #define WHPTF gmime_write_header_pair_to_file +static void +_write_one_recipient_to_file (gpointer key, gpointer value, gpointer user_data) +{ + GString *recipient_type = (GString *)key; + GList *recipients = (GList *)value; + GString *current; + FILE *file = (FILE *)user_data; + + if ( (recipient_type) && (recipient_type->str) && + (recipients) ) + { + gboolean first; + + fprintf(file, "%s: ", recipient_type->str); + first = TRUE; + while (recipients) { + current = (GString *)recipients->data; + if ( (current) && (current->str) ) { + if (!first) fprintf(file, ", "); + else first = FALSE; + fprintf(file, "%s", current->str); + } + recipients = g_list_next(recipients); + + } + fprintf(file, "\n"); + } +} static void -_write_recipients_to_file (CamelDataWrapper *data_wrapper, FILE *file) +_write_recipients_to_file (CamelMimeMessage *mime_message, FILE *file) { - + g_hash_table_foreach (mime_message->recipients, _write_one_recipient_to_file, (gpointer)file); } static void @@ -504,6 +532,7 @@ _write_to_file (CamelDataWrapper *data_wrapper, FILE *file) WHPTF (file, "From", mm->from); WHPTF (file, "Reply-To", mm->reply_to); + _write_recipients_to_file (mm, file); WHPTF (file, "Date", mm->received_date); WHPTF (file, "Subject", mm->subject); CAMEL_DATA_WRAPPER_CLASS (parent_class)->write_to_file (data_wrapper, file); |