aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
Diffstat (limited to 'camel')
-rw-r--r--camel/camel-mime-part.c176
-rw-r--r--camel/camel-mime-part.h6
-rw-r--r--camel/gstring-util.c22
-rw-r--r--camel/gstring-util.h1
4 files changed, 202 insertions, 3 deletions
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
index eed4e5de0a..4f882bbeef 100644
--- a/camel/camel-mime-part.c
+++ b/camel/camel-mime-part.c
@@ -91,3 +91,179 @@ __camel_mime_part_add_header (CamelMimePart *mime_part, GString *header_name, GS
g_hash_table_insert (mime_part->headers, header_name, header_value);
}
+
+
+
+
+
+
+static void
+__camel_mime_part_remove_header (CamelMimePart *mime_part, GString *header_name)
+{
+
+ gboolean header_exists;
+ GString *old_header_name;
+ GString *old_header_value;
+
+ header_exists = g_hash_table_lookup_extended (mime_part->headers, header_name,
+ (gpointer *) &old_header_name,
+ (gpointer *) &old_header_value);
+ if (header_exists) {
+ g_string_free (old_header_name, TRUE);
+ g_string_free (old_header_value, TRUE);
+ }
+
+ g_hash_table_remove (mime_part->headers, header_name);
+
+}
+
+
+static GString *
+__camel_mime_part_get_header (CamelMimePart *mime_part, GString *header_name)
+{
+
+ GString *old_header_name;
+ GString *old_header_value;
+ GString *header_value;
+
+ header_value = (GString *)g_hash_table_lookup (mime_part->headers, header_name);
+ return header_value;
+}
+
+
+static void
+__camel_mime_part_set_description (CamelMimePart *mime_part, GString *description)
+{
+ if (mime_part->description) g_free(mime_part->description);
+ mime_part->description = description;
+}
+
+
+static GString *
+__camel_mime_part_get_description (CamelMimePart *mime_part)
+{
+ return mime_part->description;
+}
+
+
+
+static void
+__camel_mime_part_set_disposition (CamelMimePart *mime_part, GString *disposition)
+{
+ if (mime_part->disposition) g_free(mime_part->disposition);
+ mime_part->disposition = disposition;
+}
+
+
+static GString *
+__camel_mime_part_get_disposition (CamelMimePart *mime_part)
+{
+ return mime_part->disposition;
+}
+
+
+
+static void
+__camel_mime_part_set_filename (CamelMimePart *mime_part, GString *filename)
+{
+ if (mime_part->filename) g_free(mime_part->filename);
+ mime_part->filename = filename;
+}
+
+
+static GString *
+__camel_mime_part_get_filename (CamelMimePart *mime_part)
+{
+ return mime_part->filename;
+}
+
+
+
+/* this routine must not be public */
+static void
+__camel_mime_part_set_content_id (CamelMimePart *mime_part, GString *content_id)
+{
+ if (mime_part->content_id) g_free(mime_part->content_id);
+ mime_part->content_id = content_id;
+}
+
+
+static GString *
+__camel_mime_part_get_content_id (CamelMimePart *mime_part)
+{
+ return mime_part->content_id;
+}
+
+
+
+/* this routine must not be public */
+static void
+__camel_mime_part_set_content_MD5 (CamelMimePart *mime_part, GString *content_MD5)
+{
+ if (mime_part->content_MD5) g_free(mime_part->content_MD5);
+ mime_part->content_MD5 = content_MD5;
+}
+
+
+static GString *
+__camel_mime_part_get_content_MD5 (CamelMimePart *mime_part)
+{
+ return mime_part->content_MD5;
+}
+
+
+
+
+static void
+__camel_mime_part_set_encoding (CamelMimePart *mime_part, GString *encoding)
+{
+ if (mime_part->encoding) g_free(mime_part->encoding);
+ mime_part->encoding = encoding;
+}
+
+
+static GString *
+__camel_mime_part_get_encoding (CamelMimePart *mime_part)
+{
+ return mime_part->encoding;
+}
+
+
+
+
+static void
+__camel_mime_part_set_content_languages (CamelMimePart *mime_part, GList *content_languages)
+{
+ if (mime_part->content_languages) g_string_list_free(mime_part->content_languages);
+ mime_part->content_languages = content_languages;
+}
+
+
+static GList *
+__camel_mime_part_get_content_languages (CamelMimePart *mime_part)
+{
+ return mime_part->content_languages;
+}
+
+
+
+
+
+static void
+__camel_mime_part_set_header_lines (CamelMimePart *mime_part, GList *header_lines)
+{
+ if (mime_part->header_lines) g_string_list_free(mime_part->header_lines);
+ mime_part->header_lines = header_lines;
+}
+
+
+static GList *
+__camel_mime_part_get_header_lines (CamelMimePart *mime_part)
+{
+ return mime_part->header_lines;
+}
+
+
+
+
+
diff --git a/camel/camel-mime-part.h b/camel/camel-mime-part.h
index 0d5d16b4e4..17714e9191 100644
--- a/camel/camel-mime-part.h
+++ b/camel/camel-mime-part.h
@@ -51,9 +51,11 @@ typedef struct
GString *description;
GString *disposition;
GString *content_id;
- GString *content_md5;
+ GString *content_MD5;
+ GList *content_languages;
GString *encoding;
- GList *languages;
+ GString *filename;
+ GList *header_lines;
} CamelMimePart;
diff --git a/camel/gstring-util.c b/camel/gstring-util.c
index 43e482154e..05cdc08beb 100644
--- a/camel/gstring-util.c
+++ b/camel/gstring-util.c
@@ -201,7 +201,27 @@ g_string_equal_for_hash (gconstpointer v, gconstpointer v2)
*
* Return value:
**/
-guint g_string_hash (gconstpointer v)
+guint
+g_string_hash (gconstpointer v)
{
return g_str_hash(((const GString*)v)->str);
}
+
+
+
+
+/* utility func : frees a GString element in a GList */
+static void
+__g_string_list_free_string (gpointer data, gpointer user_data)
+{
+ GString *string = (GString *)data;
+ g_string_free(string, TRUE);
+}
+
+
+void
+g_string_list_free (GList *string_list)
+{
+ g_list_foreach(string_list, __g_string_list_free_string, NULL);
+ g_list_free(string_list);
+}
diff --git a/camel/gstring-util.h b/camel/gstring-util.h
index 2c118329ed..fcd2c5dc69 100644
--- a/camel/gstring-util.h
+++ b/camel/gstring-util.h
@@ -49,6 +49,7 @@ void g_string_append_g_string(GString *dest_string, GString *other_string);
gboolean g_string_equal_for_hash (gconstpointer v, gconstpointer v2);
guint g_string_hash (gconstpointer v);
+void g_string_list_free (GList *string_list);
#ifdef __cplusplus
}