aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-medium.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-05-17 02:23:15 +0800
committerDan Winship <danw@src.gnome.org>2001-05-17 02:23:15 +0800
commit71002d1544cdbcf825377602dd738c15f910b93b (patch)
tree46f8f339b9e69f2e170a57b0fd9a09cfbff5eca1 /camel/camel-medium.c
parent7e5b838da2848ea29a502813d917cee022cbdb35 (diff)
downloadgsoc2013-evolution-71002d1544cdbcf825377602dd738c15f910b93b.tar
gsoc2013-evolution-71002d1544cdbcf825377602dd738c15f910b93b.tar.gz
gsoc2013-evolution-71002d1544cdbcf825377602dd738c15f910b93b.tar.bz2
gsoc2013-evolution-71002d1544cdbcf825377602dd738c15f910b93b.tar.lz
gsoc2013-evolution-71002d1544cdbcf825377602dd738c15f910b93b.tar.xz
gsoc2013-evolution-71002d1544cdbcf825377602dd738c15f910b93b.tar.zst
gsoc2013-evolution-71002d1544cdbcf825377602dd738c15f910b93b.zip
New function to return an array of all headers.
* camel-medium.c (camel_medium_get_headers): New function to return an array of all headers. (camel_medium_free_headers): And free them. * camel-mime-part.c (get_headers, free_headers): Implement this for CamelMimePart. (Works for CamelMimeMessage too.) svn path=/trunk/; revision=9849
Diffstat (limited to 'camel/camel-medium.c')
-rw-r--r--camel/camel-medium.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/camel/camel-medium.c b/camel/camel-medium.c
index a54e5ab721..5baa35e7dc 100644
--- a/camel/camel-medium.c
+++ b/camel/camel-medium.c
@@ -46,6 +46,9 @@ static void set_header (CamelMedium *medium, const gchar *header_name, const voi
static void remove_header (CamelMedium *medium, const gchar *header_name);
static const void *get_header (CamelMedium *medium, const gchar *header_name);
+static GArray *get_headers (CamelMedium *medium);
+static void free_headers (CamelMedium *medium, GArray *headers);
+
static CamelDataWrapper *get_content_object (CamelMedium *medium);
static void set_content_object (CamelMedium *medium,
CamelDataWrapper *content);
@@ -66,6 +69,9 @@ camel_medium_class_init (CamelMediumClass *camel_medium_class)
camel_medium_class->remove_header = remove_header;
camel_medium_class->get_header = get_header;
+ camel_medium_class->get_headers = get_headers;
+ camel_medium_class->free_headers = free_headers;
+
camel_medium_class->set_content_object = set_content_object;
camel_medium_class->get_content_object = get_content_object;
}
@@ -220,6 +226,56 @@ camel_medium_get_header(CamelMedium *medium, const char *header_name)
}
+static GArray *
+get_headers(CamelMedium *medium)
+{
+ g_warning("No %s::get_headers implemented", camel_type_to_name(CAMEL_OBJECT_GET_TYPE(medium)));
+ return NULL;
+}
+
+/**
+ * camel_medium_get_headers:
+ * @medium: a medium
+ *
+ * Returns an array of all header name/value pairs (as
+ * CamelMediumHeader structures). The values will be decoded
+ * to UTF-8 for any headers that are recognized by Camel. The
+ * caller should not modify the returned data.
+ *
+ * Return value: the array of headers, which must be freed with
+ * camel_medium_free_headers().
+ **/
+GArray *
+camel_medium_get_headers(CamelMedium *medium)
+{
+ g_return_val_if_fail (CAMEL_IS_MEDIUM (medium), NULL);
+
+ return CM_CLASS (medium)->get_headers (medium);
+}
+
+static void
+free_headers (CamelMedium *medium, GArray *headers)
+{
+ g_warning("No %s::free_headers implemented", camel_type_to_name(CAMEL_OBJECT_GET_TYPE(medium)));
+}
+
+/**
+ * camel_medium_free_headers:
+ * @medium: a medium
+ * @headers: an array of headers returned from camel_medium_get_headers()
+ *
+ * Frees @headers
+ **/
+void
+camel_medium_free_headers (CamelMedium *medium, GArray *headers)
+{
+ g_return_if_fail (CAMEL_IS_MEDIUM (medium));
+ g_return_if_fail (headers != NULL);
+
+ CM_CLASS (medium)->free_headers (medium, headers);
+}
+
+
static CamelDataWrapper *
get_content_object(CamelMedium *medium)
{