aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-12-29 03:28:39 +0800
committerDan Winship <danw@src.gnome.org>2000-12-29 03:28:39 +0800
commit156996ac5eaaddea369e4ae001c06c45f5ad76f4 (patch)
tree4d6f8c6714002dfe6baf2717980bf9530a3c2fb2 /camel
parent1351da8fd7d1207e79cc811f300f3ccbc68ce3c7 (diff)
downloadgsoc2013-evolution-156996ac5eaaddea369e4ae001c06c45f5ad76f4.tar
gsoc2013-evolution-156996ac5eaaddea369e4ae001c06c45f5ad76f4.tar.gz
gsoc2013-evolution-156996ac5eaaddea369e4ae001c06c45f5ad76f4.tar.bz2
gsoc2013-evolution-156996ac5eaaddea369e4ae001c06c45f5ad76f4.tar.lz
gsoc2013-evolution-156996ac5eaaddea369e4ae001c06c45f5ad76f4.tar.xz
gsoc2013-evolution-156996ac5eaaddea369e4ae001c06c45f5ad76f4.tar.zst
gsoc2013-evolution-156996ac5eaaddea369e4ae001c06c45f5ad76f4.zip
Remove this. It was only a thin wrapper around struct _header_content_type
* gmime-content-field.[ch]: Remove this. It was only a thin wrapper around struct _header_content_type anyway, and didn't match the naming scheme of anything else. * Makefile.am: Remove gmime-content-field.[ch] * camel.h: Remove gmime-content-field.h * camel-types.h: Add CamelContentType as a typedef for struct _header_content_type (especially for use outside of camel). * camel-multipart.c: * camel-mime-part.c: * camel-mime-message.c: * camel-folder-summary.c: * camel-folder-search.c: * camel-data-wrapper.[ch]: Use CamelContentType and header_content_type_* functions rather than the GMime stuff. * camel-mime-part-utils.c: * camel-medium.c: Remove unused gmime-content-field.h include. svn path=/trunk/; revision=7186
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog24
-rw-r--r--camel/Makefile.am2
-rw-r--r--camel/camel-data-wrapper.c32
-rw-r--r--camel/camel-data-wrapper.h11
-rw-r--r--camel/camel-folder-search.c3
-rw-r--r--camel/camel-folder-summary.c8
-rw-r--r--camel/camel-medium.c1
-rw-r--r--camel/camel-mime-message.c11
-rw-r--r--camel/camel-mime-part-utils.c1
-rw-r--r--camel/camel-mime-part.c32
-rw-r--r--camel/camel-mime-part.h4
-rw-r--r--camel/camel-multipart.c6
-rw-r--r--camel/camel-types.h4
-rw-r--r--camel/camel.h1
-rw-r--r--camel/gmime-content-field.c237
-rw-r--r--camel/gmime-content-field.h71
16 files changed, 79 insertions, 369 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index dee6af3053..4339e498d9 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,27 @@
+2000-12-28 Dan Winship <danw@helixcode.com>
+
+ * gmime-content-field.[ch]: Remove this. It was only a thin
+ wrapper around struct _header_content_type anyway, and didn't
+ match the naming scheme of anything else.
+
+ * Makefile.am: Remove gmime-content-field.[ch]
+
+ * camel.h: Remove gmime-content-field.h
+
+ * camel-types.h: Add CamelContentType as a typedef for struct
+ _header_content_type (especially for use outside of camel).
+
+ * camel-multipart.c:
+ * camel-mime-part.c:
+ * camel-mime-message.c:
+ * camel-folder-summary.c:
+ * camel-folder-search.c:
+ * camel-data-wrapper.[ch]: Use CamelContentType and
+ header_content_type_* functions rather than the GMime stuff.
+
+ * camel-mime-part-utils.c:
+ * camel-medium.c: Remove unused gmime-content-field.h include.
+
2000-12-27 Dan Winship <danw@helixcode.com>
* providers/pop3/camel-pop3-store.c (connect_to_server): Fix the
diff --git a/camel/Makefile.am b/camel/Makefile.am
index 318b1596f4..24483b16f2 100644
--- a/camel/Makefile.am
+++ b/camel/Makefile.am
@@ -62,7 +62,6 @@ libcamel_la_SOURCES = \
camel-url.c \
camel-charset-map.c \
camel.c \
- gmime-content-field.c \
gstring-util.c \
hash-table-utils.c \
string-utils.c
@@ -116,7 +115,6 @@ libcamelinclude_HEADERS = \
camel-uid-cache.h \
camel-url.h \
camel.h \
- gmime-content-field.h \
gstring-util.h \
hash-table-utils.h \
string-utils.h
diff --git a/camel/camel-data-wrapper.c b/camel/camel-data-wrapper.c
index 52cf60bd33..061e664b92 100644
--- a/camel/camel-data-wrapper.c
+++ b/camel/camel-data-wrapper.c
@@ -24,6 +24,8 @@
*/
#include <config.h>
#include "camel-data-wrapper.h"
+#include "camel-mime-utils.h"
+#include "camel-stream.h"
#include "camel-exception.h"
#include <errno.h>
@@ -40,8 +42,8 @@ static int construct_from_stream(CamelDataWrapper *, CamelStream *);
static int write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
static void set_mime_type (CamelDataWrapper *data_wrapper, const gchar *mime_type);
static gchar *get_mime_type (CamelDataWrapper *data_wrapper);
-static GMimeContentField *get_mime_type_field (CamelDataWrapper *data_wrapper);
-static void set_mime_type_field (CamelDataWrapper *data_wrapper, GMimeContentField *mime_type);
+static CamelContentType *get_mime_type_field (CamelDataWrapper *data_wrapper);
+static void set_mime_type_field (CamelDataWrapper *data_wrapper, CamelContentType *mime_type);
static void
camel_data_wrapper_class_init (CamelDataWrapperClass *camel_data_wrapper_class)
@@ -63,7 +65,7 @@ camel_data_wrapper_init (gpointer object, gpointer klass)
{
CamelDataWrapper *camel_data_wrapper = CAMEL_DATA_WRAPPER (object);
- camel_data_wrapper->mime_type = gmime_content_field_new (NULL, NULL);
+ camel_data_wrapper->mime_type = header_content_type_new ("application", "octet-stream");
}
static void
@@ -72,7 +74,7 @@ camel_data_wrapper_finalize (CamelObject *object)
CamelDataWrapper *camel_data_wrapper = CAMEL_DATA_WRAPPER (object);
if (camel_data_wrapper->mime_type)
- gmime_content_field_unref (camel_data_wrapper->mime_type);
+ header_content_type_unref (camel_data_wrapper->mime_type);
if (camel_data_wrapper->stream)
camel_object_unref (CAMEL_OBJECT (camel_data_wrapper->stream));
@@ -173,8 +175,9 @@ camel_data_wrapper_construct_from_stream (CamelDataWrapper *data_wrapper,
static void
set_mime_type (CamelDataWrapper *data_wrapper, const gchar *mime_type)
{
- gmime_content_field_construct_from_string (data_wrapper->mime_type,
- mime_type);
+ if (data_wrapper->mime_type)
+ header_content_type_unref (data_wrapper->mime_type);
+ data_wrapper->mime_type = header_content_type_decode (mime_type);
}
/**
@@ -202,14 +205,15 @@ camel_data_wrapper_set_mime_type (CamelDataWrapper *data_wrapper,
static gchar *
get_mime_type (CamelDataWrapper *data_wrapper)
{
- return gmime_content_field_get_mime_type (data_wrapper->mime_type);
+ return header_content_type_format (data_wrapper->mime_type);
}
/**
* camel_data_wrapper_get_mime_type:
* @data_wrapper: a data wrapper
*
- * Return value: the text form of the data wrapper's MIME type
+ * Return value: the text form of the data wrapper's MIME type,
+ * which the caller must free.
**/
gchar *
camel_data_wrapper_get_mime_type (CamelDataWrapper *data_wrapper)
@@ -220,7 +224,7 @@ camel_data_wrapper_get_mime_type (CamelDataWrapper *data_wrapper)
}
-static GMimeContentField *
+static CamelContentType *
get_mime_type_field (CamelDataWrapper *data_wrapper)
{
return data_wrapper->mime_type;
@@ -232,7 +236,7 @@ get_mime_type_field (CamelDataWrapper *data_wrapper)
*
* Return value: the parsed form of the data wrapper's MIME type
**/
-GMimeContentField *
+CamelContentType *
camel_data_wrapper_get_mime_type_field (CamelDataWrapper *data_wrapper)
{
g_return_val_if_fail (CAMEL_IS_DATA_WRAPPER (data_wrapper), NULL);
@@ -250,21 +254,21 @@ camel_data_wrapper_get_mime_type_field (CamelDataWrapper *data_wrapper)
**/
static void
set_mime_type_field (CamelDataWrapper *data_wrapper,
- GMimeContentField *mime_type)
+ CamelContentType *mime_type)
{
g_return_if_fail (CAMEL_IS_DATA_WRAPPER (data_wrapper));
g_return_if_fail (mime_type != NULL);
if (data_wrapper->mime_type)
- gmime_content_field_unref (data_wrapper->mime_type);
+ header_content_type_unref (data_wrapper->mime_type);
data_wrapper->mime_type = mime_type;
if (mime_type)
- gmime_content_field_ref (data_wrapper->mime_type);
+ header_content_type_ref (data_wrapper->mime_type);
}
void
camel_data_wrapper_set_mime_type_field (CamelDataWrapper *data_wrapper,
- GMimeContentField *mime_type)
+ CamelContentType *mime_type)
{
CDW_CLASS (data_wrapper)->set_mime_type_field (data_wrapper, mime_type);
}
diff --git a/camel/camel-data-wrapper.h b/camel/camel-data-wrapper.h
index ff4dda649f..024155b6c1 100644
--- a/camel/camel-data-wrapper.h
+++ b/camel/camel-data-wrapper.h
@@ -35,7 +35,6 @@ extern "C" {
#endif /* __cplusplus }*/
#include <camel/camel-object.h>
-#include <camel/gmime-content-field.h>
#define CAMEL_DATA_WRAPPER_TYPE (camel_data_wrapper_get_type ())
#define CAMEL_DATA_WRAPPER(obj) (CAMEL_CHECK_CAST((obj), CAMEL_DATA_WRAPPER_TYPE, CamelDataWrapper))
@@ -46,7 +45,7 @@ struct _CamelDataWrapper
{
CamelObject parent_object;
- GMimeContentField *mime_type;
+ CamelContentType *mime_type;
CamelStream *stream;
};
@@ -61,9 +60,9 @@ typedef struct {
void (*set_mime_type) (CamelDataWrapper *data_wrapper,
const gchar * mime_type);
gchar * (*get_mime_type) (CamelDataWrapper *data_wrapper);
- GMimeContentField * (*get_mime_type_field) (CamelDataWrapper *data_wrapper);
+ CamelContentType * (*get_mime_type_field) (CamelDataWrapper *data_wrapper);
void (*set_mime_type_field) (CamelDataWrapper *data_wrapper,
- GMimeContentField *mime_type_field);
+ CamelContentType *mime_type_field);
int (*write_to_stream) (CamelDataWrapper *data_wrapper,
CamelStream *stream);
@@ -82,9 +81,9 @@ int camel_data_wrapper_write_to_stream (CamelDataWrappe
void camel_data_wrapper_set_mime_type (CamelDataWrapper *data_wrapper,
const gchar *mime_type);
gchar * camel_data_wrapper_get_mime_type (CamelDataWrapper *data_wrapper);
-GMimeContentField * camel_data_wrapper_get_mime_type_field (CamelDataWrapper *data_wrapper);
+CamelContentType * camel_data_wrapper_get_mime_type_field (CamelDataWrapper *data_wrapper);
void camel_data_wrapper_set_mime_type_field (CamelDataWrapper *data_wrapper,
- GMimeContentField *mime_type);
+ CamelContentType *mime_type);
int camel_data_wrapper_construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
diff --git a/camel/camel-folder-search.c b/camel/camel-folder-search.c
index 365580ffa8..97fcf6557a 100644
--- a/camel/camel-folder-search.c
+++ b/camel/camel-folder-search.c
@@ -37,7 +37,6 @@
#include "camel-medium.h"
#include "camel-multipart.h"
#include "camel-mime-message.h"
-#include "gmime-content-field.h"
#include "camel-stream-mem.h"
#include "e-util/e-memory.h"
@@ -578,7 +577,7 @@ message_body_contains(CamelDataWrapper *object, regex_t *pattern)
} else if (CAMEL_IS_MIME_MESSAGE(containee)) {
/* for messages we only look at its contents */
truth = message_body_contains((CamelDataWrapper *)containee, pattern);
- } else if (gmime_content_field_is_type(CAMEL_DATA_WRAPPER(containee)->mime_type, "text", "*")) {
+ } else if (header_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "text", "*")) {
/* for all other text parts, we look inside, otherwise we dont care */
CamelStreamMem *mem = (CamelStreamMem *)camel_stream_mem_new();
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index b6d8fc910e..89b18e5141 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -2073,10 +2073,10 @@ summary_build_content_info_message(CamelFolderSummary *s, CamelMessageInfo *msgi
add a reference, probably need fixing for multithreading */
/* check for attachments */
- if (gmime_content_field_is_type(CAMEL_DATA_WRAPPER(containee)->mime_type, "multipart", "*")) {
- if (gmime_content_field_is_type(CAMEL_DATA_WRAPPER(containee)->mime_type, "multipart", "mixed"))
+ if (header_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "multipart", "*")) {
+ if (header_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "multipart", "mixed"))
msginfo->flags |= CAMEL_MESSAGE_ATTACHMENTS;
- } else if (!gmime_content_field_is_type(CAMEL_DATA_WRAPPER(containee)->mime_type, "text", "*"))
+ } else if (!header_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "text", "*"))
msginfo->flags |= CAMEL_MESSAGE_ATTACHMENTS;
/* using the object types is more accurate than using the mime/types */
@@ -2099,7 +2099,7 @@ summary_build_content_info_message(CamelFolderSummary *s, CamelMessageInfo *msgi
my_list_append((struct _node **)&info->childs, (struct _node *)child);
}
} else if (p->index
- && gmime_content_field_is_type(CAMEL_DATA_WRAPPER(containee)->mime_type, "text", "*")) {
+ && header_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "text", "*")) {
/* index all text parts if we're indexing */
CamelStreamMem *mem = (CamelStreamMem *)camel_stream_mem_new();
diff --git a/camel/camel-medium.c b/camel/camel-medium.c
index ebda9c470d..1854cf1891 100644
--- a/camel/camel-medium.c
+++ b/camel/camel-medium.c
@@ -26,7 +26,6 @@
#include <stdio.h>
#include <ctype.h>
#include "camel-medium.h"
-#include "gmime-content-field.h"
#include "string-utils.h"
#include "hash-table-utils.h"
diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c
index 4851771e43..40199eac21 100644
--- a/camel/camel-mime-message.c
+++ b/camel/camel-mime-message.c
@@ -28,7 +28,6 @@
#include "camel-mime-message.h"
#include "camel-multipart.h"
-#include "gmime-content-field.h"
#include "camel-stream-mem.h"
#include "string-utils.h"
#include "hash-table-utils.h"
@@ -602,7 +601,7 @@ find_best_encoding(CamelMimePart *part, CamelBestencRequired required, CamelBest
return CAMEL_MIME_PART_ENCODING_DEFAULT;
}
- istext = gmime_content_field_is_type(part->content_type, "text", "*");
+ istext = header_content_type_is(part->content_type, "text", "*");
if (istext) {
flags = CAMEL_BESTENC_GET_CHARSET|CAMEL_BESTENC_GET_ENCODING;
} else {
@@ -621,7 +620,7 @@ find_best_encoding(CamelMimePart *part, CamelBestencRequired required, CamelBest
/* if we're not looking for the best charset, then use the one we have */
if (istext && (required & CAMEL_BESTENC_GET_CHARSET) == 0
- && (charsetin = gmime_content_field_get_parameter(part->content_type, "charset"))) {
+ && (charsetin = header_content_type_param(part->content_type, "charset"))) {
/* if libunicode doesn't support it, we dont really have utf8 anyway, so
we dont need a converter */
charenc = camel_mime_filter_charset_new_convert("UTF-8", charsetin);
@@ -716,12 +715,12 @@ best_encoding(CamelMimeMessage *msg, CamelMimePart *part, void *datap)
camel_mime_part_set_encoding(part, encoding);
if ((data->required & CAMEL_BESTENC_GET_CHARSET) != 0) {
- if (gmime_content_field_is_type(part->content_type, "text", "*")) {
+ if (header_content_type_is(part->content_type, "text", "*")) {
char *newct;
/* FIXME: ick, the part content_type interface needs fixing bigtime */
- gmime_content_field_set_parameter(part->content_type, "charset", charset?charset:"us-ascii");
- newct = header_content_type_format(part->content_type->content_type);
+ header_content_type_set_param(part->content_type, "charset", charset?charset:"us-ascii");
+ newct = header_content_type_format(part->content_type);
if (newct) {
d(printf("Setting content-type to %s\n", newct));
diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c
index 84cdf25055..6d9f7e1804 100644
--- a/camel/camel-mime-part-utils.c
+++ b/camel/camel-mime-part-utils.c
@@ -23,7 +23,6 @@
*/
#include <config.h>
#include <string.h>
-#include "gmime-content-field.h"
#include "string-utils.h"
#include "camel-mime-part-utils.h"
#include "camel-mime-message.h"
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
index e553e60257..4f44b4edd6 100644
--- a/camel/camel-mime-part.c
+++ b/camel/camel-mime-part.c
@@ -27,7 +27,6 @@
#include <string.h>
#include "camel-mime-part.h"
#include <stdio.h>
-#include "gmime-content-field.h"
#include "string-utils.h"
#include "hash-table-utils.h"
#include "camel-mime-part-utils.h"
@@ -126,7 +125,7 @@ camel_mime_part_init (gpointer object, gpointer klass)
{
CamelMimePart *camel_mime_part = CAMEL_MIME_PART (object);
- camel_mime_part->content_type = gmime_content_field_new ("text", "plain");
+ camel_mime_part->content_type = header_content_type_new ("text", "plain");
camel_mime_part->description = NULL;
camel_mime_part->disposition = NULL;
camel_mime_part->content_id = NULL;
@@ -148,7 +147,7 @@ camel_mime_part_finalize (CamelObject *object)
header_disposition_unref(mime_part->disposition);
if (mime_part->content_type)
- gmime_content_field_unref (mime_part->content_type);
+ header_content_type_unref (mime_part->content_type);
header_raw_clear(&mime_part->headers);
}
@@ -212,7 +211,9 @@ process_header(CamelMedium *medium, const char *header_name, const char *header_
mime_part->content_MD5 = g_strdup(header_value);
break;
case HEADER_CONTENT_TYPE:
- gmime_content_field_construct_from_string(mime_part->content_type, header_value);
+ if (mime_part->content_type)
+ header_content_type_unref (mime_part->content_type);
+ mime_part->content_type = header_content_type_decode (header_value);
break;
default:
return FALSE;
@@ -363,7 +364,7 @@ camel_mime_part_get_filename (CamelMimePart *mime_part)
return name;
}
- return gmime_content_field_get_parameter (mime_part->content_type, "name");
+ return header_content_type_param (mime_part->content_type, "name");
}
@@ -444,7 +445,7 @@ camel_mime_part_set_content_type (CamelMimePart *mime_part, gchar *content_type)
"Content-Type", content_type);
}
-GMimeContentField *
+CamelContentType *
camel_mime_part_get_content_type (CamelMimePart *mime_part)
{
return mime_part->content_type;
@@ -458,16 +459,15 @@ static void
set_content_object (CamelMedium *medium, CamelDataWrapper *content)
{
CamelMimePart *mime_part = CAMEL_MIME_PART (medium);
- GMimeContentField *object_content_field;
+ CamelContentType *object_content_type;
parent_class->set_content_object (medium, content);
- object_content_field = camel_data_wrapper_get_mime_type_field (content);
- if (mime_part->content_type &&
- (mime_part->content_type != object_content_field)) {
+ object_content_type = camel_data_wrapper_get_mime_type_field (content);
+ if (mime_part->content_type != object_content_type) {
char *txt;
- txt = header_content_type_format(object_content_field?object_content_field->content_type:NULL);
+ txt = header_content_type_format (object_content_type);
camel_medium_set_header (CAMEL_MEDIUM (mime_part), "Content-Type", txt);
g_free(txt);
}
@@ -539,8 +539,8 @@ write_to_stream(CamelDataWrapper *data_wrapper, CamelStream *stream)
break;
}
- if (gmime_content_field_is_type(mp->content_type, "text", "*")) {
- charset = gmime_content_field_get_parameter(mp->content_type, "charset");
+ if (header_content_type_is(mp->content_type, "text", "*")) {
+ charset = header_content_type_param(mp->content_type, "charset");
if (!(charset == NULL || !strcasecmp(charset, "us-ascii") || !strcasecmp(charset, "utf-8"))) {
charenc = (CamelMimeFilter *)camel_mime_filter_charset_new_convert("utf-8", charset);
}
@@ -556,7 +556,7 @@ write_to_stream(CamelDataWrapper *data_wrapper, CamelStream *stream)
}
/* we only re-do crlf on encoded blocks */
- if (filter && gmime_content_field_is_type(mp->content_type, "text", "*")) {
+ if (filter && header_content_type_is(mp->content_type, "text", "*")) {
CamelMimeFilter *crlf = camel_mime_filter_crlf_new(CAMEL_MIME_FILTER_CRLF_ENCODE,
CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY);
@@ -601,7 +601,9 @@ construct_from_parser(CamelMimePart *dw, CamelMimeParser *mp)
switch (camel_mime_parser_step(mp, &buf, &len)) {
case HSCAN_MESSAGE:
/* set the default type of a message always */
- gmime_content_field_construct_from_string (dw->content_type, "message/rfc822");
+ if (dw->content_type)
+ header_content_type_unref (dw->content_type);
+ dw->content_type = header_content_type_decode ("message/rfc822");
case HSCAN_HEADER:
case HSCAN_MULTIPART:
/* we have the headers, build them into 'us' */
diff --git a/camel/camel-mime-part.h b/camel/camel-mime-part.h
index 4d8140c259..d5d703b325 100644
--- a/camel/camel-mime-part.h
+++ b/camel/camel-mime-part.h
@@ -69,7 +69,7 @@ struct _CamelMimePart
GList *content_languages;
CamelMimePartEncodingType encoding;
- GMimeContentField *content_type;
+ CamelContentType *content_type;
struct _header_raw *headers; /* mime headers */
};
@@ -110,7 +110,7 @@ const GList *camel_mime_part_get_content_languages (CamelMimePart *mime_part);
/* FIXME: what about content-type parameters? what about major/minor parts? */
void camel_mime_part_set_content_type (CamelMimePart *mime_part, gchar *content_type);
-GMimeContentField *camel_mime_part_get_content_type (CamelMimePart *mime_part);
+CamelContentType *camel_mime_part_get_content_type (CamelMimePart *mime_part);
const gchar * camel_mime_part_encoding_to_string (CamelMimePartEncodingType encoding);
CamelMimePartEncodingType camel_mime_part_encoding_from_string (const gchar *string);
diff --git a/camel/camel-multipart.c b/camel/camel-multipart.c
index c5a5f81b22..898bd7ace6 100644
--- a/camel/camel-multipart.c
+++ b/camel/camel-multipart.c
@@ -29,7 +29,6 @@
*/
#include <config.h>
-#include "gmime-content-field.h"
#include "camel-stream-mem.h"
#include "camel-multipart.h"
#include "camel-mime-part.h"
@@ -368,8 +367,7 @@ set_boundary (CamelMultipart *multipart, gchar *boundary)
boundary = bbuf;
}
- gmime_content_field_set_parameter (cdw->mime_type, "boundary",
- boundary);
+ header_content_type_set_param (cdw->mime_type, "boundary", boundary);
}
/**
@@ -397,7 +395,7 @@ get_boundary (CamelMultipart *multipart)
CamelDataWrapper *cdw = CAMEL_DATA_WRAPPER (multipart);
g_return_val_if_fail (cdw->mime_type != NULL, NULL);
- return gmime_content_field_get_parameter (cdw->mime_type, "boundary");
+ return header_content_type_param (cdw->mime_type, "boundary");
}
/**
diff --git a/camel/camel-types.h b/camel/camel-types.h
index bc3c226ed3..12401ccab7 100644
--- a/camel/camel-types.h
+++ b/camel/camel-types.h
@@ -28,6 +28,7 @@ extern "C" {
#endif /* __cplusplus }*/
typedef struct _CamelAddress CamelAddress;
+typedef struct _header_content_type CamelContentType;
typedef struct _CamelDataWrapper CamelDataWrapper;
typedef struct _CamelException CamelException;
typedef struct _CamelFolder CamelFolder;
@@ -68,6 +69,3 @@ typedef struct _CamelTransport CamelTransport;
#endif /* __cplusplus */
#endif /* CAMEL_TYPES_H */
-
-
-
diff --git a/camel/camel.h b/camel/camel.h
index fefadafb18..6de1ae6462 100644
--- a/camel/camel.h
+++ b/camel/camel.h
@@ -64,7 +64,6 @@ extern "C" {
#include <camel/camel-transport.h>
#include <camel/camel-uid-cache.h>
#include <camel/camel-url.h>
-#include <camel/gmime-content-field.h>
#include <camel/gstring-util.h>
#include <camel/hash-table-utils.h>
#include <camel/string-utils.h>
diff --git a/camel/gmime-content-field.c b/camel/gmime-content-field.c
deleted file mode 100644
index 4d38314873..0000000000
--- a/camel/gmime-content-field.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* mime-content_field.c : mime content type field utilities */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include "gmime-content-field.h"
-#include "string-utils.h"
-#include <string.h>
-#include "camel-mime-utils.h"
-
-/**
- * gmime_content_field_new: Creates a new GMimeContentField object
- * @type: mime type
- * @subtype: mime subtype
- *
- * Creates a GMimeContentField object and initialize it with
- * a mime type and a mime subtype. For example,
- * gmime_content_field_new ("application", "postcript");
- * will create a content field with complete mime type
- * "application/postscript"
- *
- * Return value: The newly created GMimeContentField object
- **/
-GMimeContentField *
-gmime_content_field_new (const gchar *type, const gchar *subtype)
-{
- GMimeContentField *ctf;
-
- ctf = g_new (GMimeContentField, 1);
- ctf->content_type = header_content_type_new(type, subtype);
- ctf->type = ctf->content_type->type;
- ctf->subtype = ctf->content_type->subtype;
- ctf->ref = 1;
- return ctf;
-}
-
-/**
- * gmime_content_field_ref: add a reference to a GMimeContentField object
- * @content_field: GMimeContentField object
- *
- * Tell a GMimeContentField object that something holds a reference
- * on him. This, coupled with the corresponding
- * gmime_content_field_unref() method allow several
- * objects to use the same GMimeContentField object.
- **/
-void
-gmime_content_field_ref (GMimeContentField *content_field)
-{
- content_field->ref += 1;
- header_content_type_ref (content_field->content_type);
-}
-
-/**
- * gmime_content_field_unref: remove a reference to a GMimeContentField object
- * @content_field: GMimeContentField object
- *
- * Tell a GMimeContentField object that something which
- * was holding a reference to him does not need it anymore.
- * When no more reference exist, the GMimeContentField object
- * is freed using gmime_content_field_free().
- *
- **/
-void
-gmime_content_field_unref (GMimeContentField *content_field)
-{
- if (!content_field) return;
-
- content_field->ref -= 1;
- header_content_type_unref (content_field->content_type);
- if (content_field->ref <= 0)
- g_free (content_field);
-}
-
-
-
-/**
- * gmime_content_field_set_parameter: set a parameter for a GMimeContentField object
- * @content_field: content field
- * @attribute: parameter name
- * @value: paramteter value
- *
- * set a parameter (called attribute in RFC 2045) of a content field. Meaningfull
- * or valid parameters name depend on the content type object. For example,
- * gmime_content_field_set_parameter (cf, "charset", "us-ascii");
- * will make sense for a "text/plain" content field but not for a
- * "image/gif". This routine does not check parameter validity.
- **/
-void
-gmime_content_field_set_parameter (GMimeContentField *content_field, const gchar *attribute, const gchar *value)
-{
- header_content_type_set_param(content_field->content_type, attribute, value);
-}
-
-/**
- * gmime_content_field_write_to_stream: write a mime content type to a stream
- * @content_field: content type object
- * @stream: the stream
- *
- *
- **/
-void
-gmime_content_field_write_to_stream (GMimeContentField *content_field, CamelStream *stream)
-{
- char *txt;
-
- if (!content_field)
- return;
-
- txt = header_content_type_format(content_field->content_type);
- if (txt) {
- camel_stream_printf (stream, "Content-Type: %s\n", txt);
- g_free(txt);
- }
-}
-
-/**
- * gmime_content_field_get_mime_type: return the mime type of the content field object
- * @content_field: content field object
- *
- * A RFC 2045 content type field contains the mime type in the
- * form "type/subtype" (example : "application/postscript") and some
- * parameters (attribute/value pairs). This routine returns the mime type
- * in a gchar object. THIS OBJECT MUST BE FREED BY THE CALLER.
- *
- * Return value: the mime type in the form "type/subtype" or NULL if not defined.
- **/
-gchar *
-gmime_content_field_get_mime_type (GMimeContentField *content_field)
-{
- gchar *mime_type;
-
- if (!content_field->content_type->type) return NULL;
-
- if (content_field->content_type->subtype)
- mime_type = g_strdup_printf ("%s/%s", content_field->content_type->type, content_field->content_type->subtype);
- else
- mime_type = g_strdup (content_field->content_type->type);
- return mime_type;
-}
-
-/**
- * gmime_content_field_get_parameter: return the value of a mime type parameter
- * @content_field: content field object
- * @name: name of the parameter
- *
- * Returns the value of a parameter contained in the content field
- * object. The content type is formed of a mime type, a mime subtype,
- * and a parameter list. Each parameter is a name/value pair. This
- * routine returns the value assiciated to a given name.
- * When the parameter does not exist, NULL is returned.
- *
- * Return value: parameter value, or NULL if not found.
- **/
-const gchar *
-gmime_content_field_get_parameter (GMimeContentField *content_field, const gchar *name)
-{
- g_assert (content_field);
-
- g_assert (name);
- return header_content_type_param(content_field->content_type, name);
-}
-
-
-
-
-/**
- * gmime_content_field_construct_from_string: construct a ContentType object by parsing a string.
- *
- * @content_field: content type object to construct
- * @string: string containing the content type field
- *
- * Parse a string containing a content type field as defined in
- * RFC 2045, and construct the corresponding ContentType object.
- * The string is not modified and not used in the ContentType
- * object. It can and must be freed by the calling part.
- **/
-void
-gmime_content_field_construct_from_string (GMimeContentField *content_field, const gchar *string)
-{
- struct _header_content_type *new;
-
- g_assert (string);
- g_assert (content_field);
-
- new = header_content_type_decode(string);
- if (content_field->content_type)
- header_content_type_unref(content_field->content_type);
-
- if (new == NULL) {
- new = header_content_type_new(NULL, NULL);
- g_warning("Cannot parse content-type string: %s", string);
- }
- content_field->content_type = new;
- content_field->type = new->type;
- content_field->subtype = new->subtype;
-}
-
-/**
- * gmime_content_field_is_type:
- * @content_field: An initialised GMimeContentField.
- * @type: MIME Major type name.
- * @subtype: MIME subtype.
- *
- * Returns true if the content_field is of the type @type and subtype @subtype.
- * If @subtype is the special wildcard "*", then it will match any type.
- *
- * If the @content_field is empty, then it will match "text/plain", or "text/ *".
- *
- * Return value:
- **/
-int
-gmime_content_field_is_type (GMimeContentField *content_field, const char *type, const char *subtype)
-{
- return header_content_type_is(content_field->content_type, type, subtype);
-}
diff --git a/camel/gmime-content-field.h b/camel/gmime-content-field.h
deleted file mode 100644
index 5a28d0fedb..0000000000
--- a/camel/gmime-content-field.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* mime-content_field.h : mime content type field utilities */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef GMIME_CONTENT_FIELD_H
-#define GMIME_CONTENT_FIELD_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <glib.h>
-#include <stdio.h>
-#include <camel/camel-stream.h>
-#include <camel/camel-mime-utils.h>
-
-typedef struct {
- struct _header_content_type *content_type;
-
- /* these should be deprecated (use the accessors) */
- char *type; /* these are only copies of the ones in content_type */
- char *subtype;
-
- gint ref;
-
-} GMimeContentField;
-
-GMimeContentField *gmime_content_field_new (const gchar *type, const gchar *subtype);
-void gmime_content_field_ref (GMimeContentField *content_field);
-void gmime_content_field_unref (GMimeContentField *content_field);
-
-void gmime_content_field_set_parameter (GMimeContentField *content_field, const gchar *attribute, const gchar *value);
-void gmime_content_field_write_to_stream (GMimeContentField *content_field, CamelStream *stream);
-void gmime_content_field_construct_from_string (GMimeContentField *content_field, const gchar *string);
-void gmime_content_field_free (GMimeContentField *content_field);
-gchar * gmime_content_field_get_mime_type (GMimeContentField *content_field);
-const gchar *gmime_content_field_get_parameter (GMimeContentField *content_field, const gchar *name);
-
-int gmime_content_field_is_type (GMimeContentField *content_field, const char *type, const char *subtype);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* GMIME_CONTENT_FIELD_H */