diff options
author | bertrand <Bertrand.Guiheneuf@aful.org> | 1999-09-02 19:19:40 +0800 |
---|---|---|
committer | Bertrand Guiheneuf <bertrand@src.gnome.org> | 1999-09-02 19:19:40 +0800 |
commit | 5c7fc6df1165a26c7dfca91f9664c4e860856824 (patch) | |
tree | f0edec368083102280630c6d7f2ac3f88c98add3 | |
parent | acfd8adff8c507d6ee738993866aefa12361b172 (diff) | |
download | gsoc2013-evolution-5c7fc6df1165a26c7dfca91f9664c4e860856824.tar gsoc2013-evolution-5c7fc6df1165a26c7dfca91f9664c4e860856824.tar.gz gsoc2013-evolution-5c7fc6df1165a26c7dfca91f9664c4e860856824.tar.bz2 gsoc2013-evolution-5c7fc6df1165a26c7dfca91f9664c4e860856824.tar.lz gsoc2013-evolution-5c7fc6df1165a26c7dfca91f9664c4e860856824.tar.xz gsoc2013-evolution-5c7fc6df1165a26c7dfca91f9664c4e860856824.tar.zst gsoc2013-evolution-5c7fc6df1165a26c7dfca91f9664c4e860856824.zip |
changed decl to fit CRLFunc. (_write_recipients_to_stream): calls
1999-09-02 bertrand <Bertrand.Guiheneuf@aful.org>
* camel/camel-mime-message.c (_write_one_recipient_to_stream):
changed decl to fit CRLFunc.
(_write_recipients_to_stream):
calls camel_recipient_foreach_recipient_type now.
* camel/camel-recipient.c (camel_recipient_foreach_recipient_type):
new convinience function. Iterate over all recipient types.
* camel/gmime-utils.c (gmime_write_header_table_to_stream):
s/write_header_table_to_stream/gmime_write_header_table_to_stream/
(gmime_write_header_with_glist_to_stream):
s/write_header_with_glist_to_stream/gmime_write_header_with_glist_to_stream/
svn path=/trunk/; revision=1167
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | camel/camel-mime-message.c | 14 | ||||
-rw-r--r-- | camel/camel-mime-part.c | 4 | ||||
-rw-r--r-- | camel/camel-recipient.c | 18 | ||||
-rw-r--r-- | camel/camel-recipient.h | 8 | ||||
-rw-r--r-- | camel/gmime-utils.c | 7 | ||||
-rw-r--r-- | camel/gmime-utils.h | 12 |
7 files changed, 59 insertions, 19 deletions
@@ -1,3 +1,18 @@ +1999-09-02 bertrand <Bertrand.Guiheneuf@aful.org> + + * camel/camel-mime-message.c (_write_one_recipient_to_stream): + changed decl to fit CRLFunc. + (_write_recipients_to_stream): + calls camel_recipient_foreach_recipient_type now. + + * camel/camel-recipient.c (camel_recipient_foreach_recipient_type): + new convinience function. Iterate over all recipient types. + + * camel/gmime-utils.c (gmime_write_header_table_to_stream): + s/write_header_table_to_stream/gmime_write_header_table_to_stream/ + (gmime_write_header_with_glist_to_stream): + s/write_header_with_glist_to_stream/gmime_write_header_with_glist_to_stream/ + 1999-09-01 bertrand <Bertrand.Guiheneuf@aful.org> * camel/camel-mime-message.c (_finalize): diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c index f26db4b358..edbf61f3d3 100644 --- a/camel/camel-mime-message.c +++ b/camel/camel-mime-message.c @@ -563,20 +563,22 @@ camel_mime_message_get_message_number (CamelMimeMessage *mime_message) #define WHPT gmime_write_header_pair_to_stream static void -_write_one_recipient_to_stream (gpointer key, gpointer value, gpointer user_data) +_write_one_recipient_to_stream (gchar *recipient_type, + GList *recipient_list, + gpointer user_data) { - gchar *recipient_type = (gchar *)key; - GList *recipients = (GList *)value; - // gchar *current; + CamelStream *stream = (CamelStream *)user_data; if (recipient_type) - write_header_with_glist_to_stream (stream, recipient_type, recipients, ", "); + gmime_write_header_with_glist_to_stream (stream, recipient_type, recipient_list, ", "); } static void _write_recipients_to_stream (CamelMimeMessage *mime_message, CamelStream *stream) { - //g_hash_table_foreach (mime_message->recipients, _write_one_recipient_to_stream, (gpointer)stream); + camel_recipient_foreach_recipient_type (mime_message->recipients, + _write_one_recipient_to_stream, + (gpointer)stream); } static void diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c index 99ba85bfa0..a3e5913873 100644 --- a/camel/camel-mime-part.c +++ b/camel/camel-mime-part.c @@ -665,10 +665,10 @@ _write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) CAMEL_LOG_FULL_DEBUG ( "CamelMimePart::write_to_stream writing content-id\n"); WHPT (stream, "Content-id", mp->content_id); CAMEL_LOG_FULL_DEBUG ( "CamelMimePart::write_to_stream writing content-languages\n"); - write_header_with_glist_to_stream (stream, "Content-Language", mp->content_languages,", "); + gmime_write_header_with_glist_to_stream (stream, "Content-Language", mp->content_languages,", "); CAMEL_LOG_FULL_DEBUG ( "CamelMimePart::write_to_stream writing other headers\n"); - write_header_table_to_stream (stream, medium->headers); + gmime_write_header_table_to_stream (stream, medium->headers); CAMEL_LOG_FULL_DEBUG ( "CamelMimePart::write_to_stream writing content-type\n"); gmime_content_field_write_to_stream (mp->content_type, stream); diff --git a/camel/camel-recipient.c b/camel/camel-recipient.c index b73152c238..436af5058b 100644 --- a/camel/camel-recipient.c +++ b/camel/camel-recipient.c @@ -66,7 +66,7 @@ _free_recipient_list (gpointer key, gpointer value, gpointer user_data) void camel_recipient_table_free (CamelRecipientTable *recipient_table) { - g_return_if_fail (recipient_table); + if (!recipient_table) return; /* free each recipient list */ g_hash_table_foreach (recipient_table->recipient_hash_table, _free_recipient_list, NULL); @@ -79,7 +79,8 @@ camel_recipient_table_free (CamelRecipientTable *recipient_table) void camel_recipient_table_unref (CamelRecipientTable *recipient_table) { - g_return_if_fail (recipient_table); + if (!recipient_table) return; + recipient_table->ref_count -= 1; if (recipient_table->ref_count <1) camel_recipient_table_free (recipient_table); @@ -142,7 +143,7 @@ camel_recipient_table_add_list (CamelRecipientTable *recipient_table, if (existent_list) - g_list_concat (existent_list, recipient_type); + g_list_concat (existent_list, recipient_list); else g_hash_table_insert (recipient_table->recipient_hash_table, g_strdup (recipient_type), recipients_list); } @@ -191,3 +192,14 @@ camel_recipient_table_get (CamelRecipientTable *recipient_table, { return (const GList *)g_hash_table_lookup (recipient_table->recipient_hash_table, recipient_type); } + + + + +void +camel_recipient_foreach_recipient_type (CamelRecipientTable *recipient_table, + CRLFunc func, + gpointer user_data) +{ + g_hash_table_foreach (recipient_table->recipient_hash_table, (GHFunc)func, user_data); +} diff --git a/camel/camel-recipient.h b/camel/camel-recipient.h index 447cf5f10e..c568e6e2ba 100644 --- a/camel/camel-recipient.h +++ b/camel/camel-recipient.h @@ -43,6 +43,11 @@ typedef struct { } CamelRecipientTable; +typedef void (*CRLFunc) (gchar *recipient_type, + GList *recipient_list, + gpointer user_data); + + CamelRecipientTable *camel_recipient_table_new (); @@ -66,6 +71,9 @@ void camel_recipient_table_remove (CamelRecipientTable *recipient_table, const GList *camel_recipient_table_get (CamelRecipientTable *recipient_table, const gchar *recipient_type); +void camel_recipient_foreach_recipient_type (CamelRecipientTable *recipient_table, + CRLFunc func, + gpointer user_data); #ifdef __cplusplus diff --git a/camel/gmime-utils.c b/camel/gmime-utils.c index ace58f93b6..6551cd330d 100644 --- a/camel/gmime-utils.c +++ b/camel/gmime-utils.c @@ -62,7 +62,7 @@ _write_one_header_to_stream (gpointer key, gpointer value, gpointer user_data) } void -write_header_table_to_stream (CamelStream *stream, GHashTable *header_table) +gmime_write_header_table_to_stream (CamelStream *stream, GHashTable *header_table) { CAMEL_LOG_FULL_DEBUG ( "write_header_table_to_stream:: Entering\n"); g_hash_table_foreach (header_table, @@ -73,7 +73,10 @@ write_header_table_to_stream (CamelStream *stream, GHashTable *header_table) void -write_header_with_glist_to_stream (CamelStream *stream, const gchar *header_name, GList *header_values, const gchar *separator) +gmime_write_header_with_glist_to_stream (CamelStream *stream, + const gchar *header_name, + GList *header_values, + const gchar *separator) { gchar *current; diff --git a/camel/gmime-utils.h b/camel/gmime-utils.h index 0aacef768c..ab8b5334b3 100644 --- a/camel/gmime-utils.h +++ b/camel/gmime-utils.h @@ -47,13 +47,13 @@ void gmime_write_header_pair_to_stream (CamelStream *stream, const gchar* name, const gchar *value); -void write_header_table_to_stream (CamelStream *stream, - GHashTable *header_table); +void gmime_write_header_table_to_stream (CamelStream *stream, + GHashTable *header_table); -void write_header_with_glist_to_stream (CamelStream *stream, - const gchar *header_name, - GList *header_values, - const gchar *separator); +void gmime_write_header_with_glist_to_stream (CamelStream *stream, + const gchar *header_name, + GList *header_values, + const gchar *separator); GArray *get_header_array_from_stream (CamelStream *stream); gchar *gmime_read_line_from_stream (CamelStream *stream); |