aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
Diffstat (limited to 'camel')
-rw-r--r--camel/camel-mime-message.c14
-rw-r--r--camel/camel-mime-part.c4
-rw-r--r--camel/camel-recipient.c18
-rw-r--r--camel/camel-recipient.h8
-rw-r--r--camel/gmime-utils.c7
-rw-r--r--camel/gmime-utils.h12
6 files changed, 44 insertions, 19 deletions
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);