aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-09-19 01:07:09 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-09-19 01:07:09 +0800
commitdf21ede0c7bb0cf36ff095400e38d46950a030a5 (patch)
treecd2c957ceb136b8d85467f561fa1c97bdd5c03a4 /camel
parenta72785e2a7fa4e59e4297610ea3070ce79632d0b (diff)
downloadgsoc2013-evolution-df21ede0c7bb0cf36ff095400e38d46950a030a5.tar
gsoc2013-evolution-df21ede0c7bb0cf36ff095400e38d46950a030a5.tar.gz
gsoc2013-evolution-df21ede0c7bb0cf36ff095400e38d46950a030a5.tar.bz2
gsoc2013-evolution-df21ede0c7bb0cf36ff095400e38d46950a030a5.tar.lz
gsoc2013-evolution-df21ede0c7bb0cf36ff095400e38d46950a030a5.tar.xz
gsoc2013-evolution-df21ede0c7bb0cf36ff095400e38d46950a030a5.tar.zst
gsoc2013-evolution-df21ede0c7bb0cf36ff095400e38d46950a030a5.zip
s/HSCAN_/CAMEL_MIME_PARSER_STATE_/g and
2003-08-26 Jeffrey Stedfast <fejj@ximian.com> * camel-mime-parser.[c,h]: s/HSCAN_/CAMEL_MIME_PARSER_STATE_/g and s/_header_state/_camel_mime_parser_state/g * camel-filter-driver.c: Same. * camel-folder-summary.c: Here too. * camel-http-stream.c: And here. * camel-mime-message.c: ... * camel-mime-part-utils.c: ... * camel-mime-part.c: ... * camel-movemail.c: ... * camel-multipart-signed.c: ... * camel-multipart.c: ... * providers/local/camel-mbox-folder.c: ... * providers/local/camel-mbox-summary.c: ... * providers/local/camel-mh-summary.c: ... * providers/nntp/camel-nntp-summary.c: ... * providers/pop3/camel-pop3-folder.c: ... 2003-08-25 Jeffrey Stedfast <fejj@ximian.com> * camel-mime-utils.[c,h]: Namespaced. * camel-data-wrapper.c: updated for namespace changed made to camel-mime-utils.[c,h] * camel-digest-folder.c: updated for namespace changed made to camel-mime-utils.[c,h] * camel-filter-driver.c: updated for namespace changed made to camel-mime-utils.[c,h] * camel-filter-search.c: updated for namespace changed made to camel-mime-utils.[c,h] * camel-folder-search.c: updated for namespace changed made to camel-mime-utils.[c,h] * camel-folder-summary.[c,h]: updated for namespace changed made to camel-mime-utils.[c,h] * camel-http-stream.c: updated for namespace changed made to camel-mime-utils.[c,h] * camel-http-stream.h: updated for namespace changed made to camel-mime-utils.[c,h] * camel-internet-address.c: updated for namespace changed made to camel-mime-utils.[c,h] * camel-medium.[c,h]: updated for namespace changed made to camel-mime-utils.[c,h] * camel-mime-message.c: updated for namespace changed made to camel-mime-utils.[c,h] * camel-mime-parser.[c,h]: updated for namespace changed made to camel-mime-utils.[c,h] * camel-mime-part-utils.c: updated for namespace changed made to camel-mime-utils.[c,h] * camel-mime-part.[c,h]: updated for namespace changed made to camel-mime-utils.[c,h] * camel-movemail.c: updated for namespace changed made to camel-mime-utils.[c,h] * camel-multipart-encrypted.c: updated for namespace changed made to camel-mime-utils.[c,h] * camel-multipart-signed.c: updated for namespace changed made to camel-mime-utils.[c,h] * camel-multipart.c: updated for namespace changed made to camel-mime-utils.[c,h] * camel-search-private.[c,h]: updated for namespace changed made to camel-mime-utils.[c,h] * camel-types.h: updated for namespace changed made to camel-mime-utils.[c,h] * providers/imap/camel-imap-folder.c: updated for namespace changed made to camel-mime-utils.[c,h] * providers/imap/camel-imap-store-summary.c: updated for namespace changed made to camel-mime-utils.[c,h] * providers/imap/camel-imap-utils.c: updated for namespace changed made to camel-mime-utils.[c,h] * providers/imapp/camel-imapp-utils.[c,h]: updated for namespace changed made to camel-mime-utils.[c,h] * providers/local/camel-local-summary.[c,h]: updated for namespace changed made to camel-mime-utils.[c,h] * providers/local/camel-maildir-summary.c: updated for namespace changed made to camel-mime-utils.[c,h] * providers/local/camel-mbox-summary.c: updated for namespace changed made to camel-mime-utils.[c,h] * providers/local/camel-spool-summary.h: updated for namespace changed made to camel-mime-utils.[c,h] * providers/nntp/camel-nntp-summary.c: updated for namespace changed made to camel-mime-utils.[c,h] * providers/nntp/camel-nntp-utils.c: updated for namespace changed made to camel-mime-utils.[c,h] * providers/pop3/camel-pop3-folder.c: updated for namespace changed made to camel-mime-utils.[c,h] * providers/sendmail/camel-sendmail-transport.c: updated for namespace changed made to camel-mime-utils.[c,h] * providers/smtp/camel-smtp-transport.c: updated for namespace changed made to camel-mime-utils.[c,h] svn path=/trunk/; revision=22613
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog136
-rw-r--r--camel/camel-data-wrapper.c16
-rw-r--r--camel/camel-digest-folder.c2
-rw-r--r--camel/camel-filter-driver.c4
-rw-r--r--camel/camel-filter-search.c4
-rw-r--r--camel/camel-folder-search.c5
-rw-r--r--camel/camel-folder-summary.c152
-rw-r--r--camel/camel-folder-summary.h16
-rw-r--r--camel/camel-http-stream.c36
-rw-r--r--camel/camel-http-stream.h2
-rw-r--r--camel/camel-internet-address.c12
-rw-r--r--camel/camel-medium.c69
-rw-r--r--camel/camel-medium.h23
-rw-r--r--camel/camel-mime-message.c98
-rw-r--r--camel/camel-mime-parser.c335
-rw-r--r--camel/camel-mime-parser.h103
-rw-r--r--camel/camel-mime-part-utils.c16
-rw-r--r--camel/camel-mime-part.c136
-rw-r--r--camel/camel-mime-part.h4
-rw-r--r--camel/camel-mime-utils.c350
-rw-r--r--camel/camel-mime-utils.h188
-rw-r--r--camel/camel-movemail.c6
-rw-r--r--camel/camel-multipart-encrypted.c10
-rw-r--r--camel/camel-multipart-signed.c22
-rw-r--r--camel/camel-multipart.c12
-rw-r--r--camel/camel-search-private.c10
-rw-r--r--camel/camel-search-private.h2
-rw-r--r--camel/camel-types.h3
-rw-r--r--camel/providers/imap/camel-imap-folder.c10
-rw-r--r--camel/providers/imap/camel-imap-store-summary.c1
-rw-r--r--camel/providers/imap/camel-imap-utils.c14
-rw-r--r--camel/providers/imapp/camel-imapp-utils.c64
-rw-r--r--camel/providers/imapp/camel-imapp-utils.h6
-rw-r--r--camel/providers/local/camel-local-summary.c30
-rw-r--r--camel/providers/local/camel-local-summary.h2
-rw-r--r--camel/providers/local/camel-maildir-summary.c4
-rw-r--r--camel/providers/local/camel-mbox-folder.c2
-rw-r--r--camel/providers/local/camel-mbox-summary.c28
-rw-r--r--camel/providers/local/camel-mh-summary.c2
-rw-r--r--camel/providers/local/camel-spool-summary.h2
-rw-r--r--camel/providers/nntp/camel-nntp-summary.c21
-rw-r--r--camel/providers/nntp/camel-nntp-utils.c9
-rw-r--r--camel/providers/pop3/camel-pop3-folder.c8
-rw-r--r--camel/providers/sendmail/camel-sendmail-transport.c6
-rw-r--r--camel/providers/smtp/camel-smtp-transport.c6
45 files changed, 1076 insertions, 911 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index be87be5a29..ffbfd278f2 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,139 @@
+2003-08-26 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-mime-parser.[c,h]: s/HSCAN_/CAMEL_MIME_PARSER_STATE_/g and
+ s/_header_state/_camel_mime_parser_state/g
+
+ * camel-filter-driver.c: Same.
+
+ * camel-folder-summary.c: Here too.
+
+ * camel-http-stream.c: And here.
+
+ * camel-mime-message.c: ...
+
+ * camel-mime-part-utils.c: ...
+
+ * camel-mime-part.c: ...
+
+ * camel-movemail.c: ...
+
+ * camel-multipart-signed.c: ...
+
+ * camel-multipart.c: ...
+
+ * providers/local/camel-mbox-folder.c: ...
+
+ * providers/local/camel-mbox-summary.c: ...
+
+ * providers/local/camel-mh-summary.c: ...
+
+ * providers/nntp/camel-nntp-summary.c: ...
+
+ * providers/pop3/camel-pop3-folder.c: ...
+
+2003-08-25 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-mime-utils.[c,h]: Namespaced.
+
+ * camel-data-wrapper.c: updated for namespace changed made to
+ camel-mime-utils.[c,h]
+
+ * camel-digest-folder.c: updated for namespace changed made to
+ camel-mime-utils.[c,h]
+
+ * camel-filter-driver.c: updated for namespace changed made to
+ camel-mime-utils.[c,h]
+
+ * camel-filter-search.c: updated for namespace changed made to
+ camel-mime-utils.[c,h]
+
+ * camel-folder-search.c: updated for namespace changed made to
+ camel-mime-utils.[c,h]
+
+ * camel-folder-summary.[c,h]: updated for namespace changed made
+ to camel-mime-utils.[c,h]
+
+ * camel-http-stream.c: updated for namespace changed made to
+ camel-mime-utils.[c,h]
+
+ * camel-http-stream.h: updated for namespace changed made to
+ camel-mime-utils.[c,h]
+
+ * camel-internet-address.c: updated for namespace changed made to
+ camel-mime-utils.[c,h]
+
+ * camel-medium.[c,h]: updated for namespace changed made to
+ camel-mime-utils.[c,h]
+
+ * camel-mime-message.c: updated for namespace changed made to
+ camel-mime-utils.[c,h]
+
+ * camel-mime-parser.[c,h]: updated for namespace changed made to
+ camel-mime-utils.[c,h]
+
+ * camel-mime-part-utils.c: updated for namespace changed made to
+ camel-mime-utils.[c,h]
+
+ * camel-mime-part.[c,h]: updated for namespace changed made to
+ camel-mime-utils.[c,h]
+
+ * camel-movemail.c: updated for namespace changed made to
+ camel-mime-utils.[c,h]
+
+ * camel-multipart-encrypted.c: updated for namespace changed made
+ to camel-mime-utils.[c,h]
+
+ * camel-multipart-signed.c: updated for namespace changed made to
+ camel-mime-utils.[c,h]
+
+ * camel-multipart.c: updated for namespace changed made to
+ camel-mime-utils.[c,h]
+
+ * camel-search-private.[c,h]: updated for namespace changed made
+ to camel-mime-utils.[c,h]
+
+ * camel-types.h: updated for namespace changed made to
+ camel-mime-utils.[c,h]
+
+ * providers/imap/camel-imap-folder.c: updated for namespace
+ changed made to camel-mime-utils.[c,h]
+
+ * providers/imap/camel-imap-store-summary.c: updated for namespace
+ changed made to camel-mime-utils.[c,h]
+
+ * providers/imap/camel-imap-utils.c: updated for namespace changed
+ made to camel-mime-utils.[c,h]
+
+ * providers/imapp/camel-imapp-utils.[c,h]: updated for namespace
+ changed made to camel-mime-utils.[c,h]
+
+ * providers/local/camel-local-summary.[c,h]: updated for namespace
+ changed made to camel-mime-utils.[c,h]
+
+ * providers/local/camel-maildir-summary.c: updated for namespace
+ changed made to camel-mime-utils.[c,h]
+
+ * providers/local/camel-mbox-summary.c: updated for namespace
+ changed made to camel-mime-utils.[c,h]
+
+ * providers/local/camel-spool-summary.h: updated for namespace
+ changed made to camel-mime-utils.[c,h]
+
+ * providers/nntp/camel-nntp-summary.c: updated for namespace
+ changed made to camel-mime-utils.[c,h]
+
+ * providers/nntp/camel-nntp-utils.c: updated for namespace changed
+ made to camel-mime-utils.[c,h]
+
+ * providers/pop3/camel-pop3-folder.c: updated for namespace
+ changed made to camel-mime-utils.[c,h]
+
+ * providers/sendmail/camel-sendmail-transport.c: updated for
+ namespace changed made to camel-mime-utils.[c,h]
+
+ * providers/smtp/camel-smtp-transport.c: updated for namespace
+ changed made to camel-mime-utils.[c,h]
+
2003-09-16 Jeffrey Stedfast <fejj@ximian.com>
* providers/local/camel-mbox-folder.c
diff --git a/camel/camel-data-wrapper.c b/camel/camel-data-wrapper.c
index 7230f77d6d..9cacbaf5e3 100644
--- a/camel/camel-data-wrapper.c
+++ b/camel/camel-data-wrapper.c
@@ -75,7 +75,7 @@ camel_data_wrapper_init (gpointer object, gpointer klass)
camel_data_wrapper->priv = g_malloc (sizeof (struct _CamelDataWrapperPrivate));
pthread_mutex_init (&camel_data_wrapper->priv->stream_lock, NULL);
- camel_data_wrapper->mime_type = header_content_type_new ("application", "octet-stream");
+ camel_data_wrapper->mime_type = camel_content_type_new ("application", "octet-stream");
camel_data_wrapper->encoding = CAMEL_MIME_PART_ENCODING_DEFAULT;
camel_data_wrapper->offline = FALSE;
}
@@ -90,7 +90,7 @@ camel_data_wrapper_finalize (CamelObject *object)
g_free (camel_data_wrapper->priv);
if (camel_data_wrapper->mime_type)
- header_content_type_unref (camel_data_wrapper->mime_type);
+ camel_content_type_unref (camel_data_wrapper->mime_type);
if (camel_data_wrapper->stream)
camel_object_unref (camel_data_wrapper->stream);
@@ -198,7 +198,7 @@ decode_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
break;
}
- if (header_content_type_is (data_wrapper->mime_type, "text", "*")) {
+ if (camel_content_type_is (data_wrapper->mime_type, "text", "*")) {
filter = camel_mime_filter_crlf_new (CAMEL_MIME_FILTER_CRLF_DECODE,
CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY);
camel_stream_filter_add (CAMEL_STREAM_FILTER (fstream), filter);
@@ -270,8 +270,8 @@ static void
set_mime_type (CamelDataWrapper *data_wrapper, const char *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);
+ camel_content_type_unref (data_wrapper->mime_type);
+ data_wrapper->mime_type = camel_content_type_decode (mime_type);
}
/**
@@ -299,7 +299,7 @@ camel_data_wrapper_set_mime_type (CamelDataWrapper *data_wrapper,
static char *
get_mime_type (CamelDataWrapper *data_wrapper)
{
- return header_content_type_simple (data_wrapper->mime_type);
+ return camel_content_type_simple (data_wrapper->mime_type);
}
/**
@@ -354,10 +354,10 @@ set_mime_type_field (CamelDataWrapper *data_wrapper,
g_return_if_fail (mime_type != NULL);
if (data_wrapper->mime_type)
- header_content_type_unref (data_wrapper->mime_type);
+ camel_content_type_unref (data_wrapper->mime_type);
data_wrapper->mime_type = mime_type;
if (mime_type)
- header_content_type_ref (data_wrapper->mime_type);
+ camel_content_type_ref (data_wrapper->mime_type);
}
void
diff --git a/camel/camel-digest-folder.c b/camel/camel-digest-folder.c
index 2f4ae06740..595be88318 100644
--- a/camel/camel-digest-folder.c
+++ b/camel/camel-digest-folder.c
@@ -221,7 +221,7 @@ camel_digest_folder_new (CamelStore *parent_store, CamelMimeMessage *message)
return NULL;
/* Make sure we have a multipart/digest subpart or at least some message/rfc822 attachments... */
- if (!header_content_type_is (CAMEL_DATA_WRAPPER (message)->mime_type, "multipart", "digest")) {
+ if (!camel_content_type_is (CAMEL_DATA_WRAPPER (message)->mime_type, "multipart", "digest")) {
if (!multipart_contains_message_parts (CAMEL_MULTIPART (wrapper)))
return NULL;
}
diff --git a/camel/camel-filter-driver.c b/camel/camel-filter-driver.c
index 204da435c7..8ac4d8690e 100644
--- a/camel/camel-filter-driver.c
+++ b/camel/camel-filter-driver.c
@@ -1127,7 +1127,7 @@ camel_filter_driver_filter_mbox (CamelFilterDriver *driver, const char *mbox, co
source_url = g_strdup_printf ("file://%s", mbox);
- while (camel_mime_parser_step (mp, 0, 0) == HSCAN_FROM) {
+ while (camel_mime_parser_step (mp, 0, 0) == CAMEL_MIME_PARSER_STATE_FROM) {
CamelMessageInfo *info;
CamelMimeMessage *msg;
int pc = 0;
@@ -1349,7 +1349,7 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver, CamelMimeMessage
}
if (info == NULL) {
- struct _header_raw *h;
+ struct _camel_header_raw *h;
if (message) {
camel_object_ref (CAMEL_OBJECT (message));
diff --git a/camel/camel-filter-search.c b/camel/camel-filter-search.c
index 5f9e5ebffa..0fa2c5984a 100644
--- a/camel/camel-filter-search.c
+++ b/camel/camel-filter-search.c
@@ -163,7 +163,7 @@ check_header (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMess
else {
ct = camel_mime_part_get_content_type (CAMEL_MIME_PART (message));
if (ct) {
- charset = header_content_type_param (ct, "charset");
+ charset = camel_content_type_param (ct, "charset");
charset = e_iconv_charset_name (charset);
}
}
@@ -262,7 +262,7 @@ get_full_header (CamelMimeMessage *message)
CamelMimePart *mp = CAMEL_MIME_PART (message);
GString *str = g_string_new ("");
char *ret;
- struct _header_raw *h;
+ struct _camel_header_raw *h;
for (h = mp->headers; h; h = h->next) {
if (h->value != NULL) {
diff --git a/camel/camel-folder-search.c b/camel/camel-folder-search.c
index bf762478b6..7045726df3 100644
--- a/camel/camel-folder-search.c
+++ b/camel/camel-folder-search.c
@@ -1,5 +1,6 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 2000,2001 Ximian Inc.
+ * Copyright (C) 2000-2003 Ximian Inc.
*
* Authors: Michael Zucchi <notzed@ximian.com>
*
@@ -850,7 +851,7 @@ match_words_1message (CamelDataWrapper *object, struct _camel_search_words *word
} else if (CAMEL_IS_MIME_MESSAGE (containee)) {
/* for messages we only look at its contents */
truth = match_words_1message((CamelDataWrapper *)containee, words, mask);
- } else if (header_content_type_is(CAMEL_DATA_WRAPPER (containee)->mime_type, "text", "*")) {
+ } else if (camel_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 5efc369cb5..d7c08219c5 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -90,14 +90,14 @@ static int my_list_size(struct _node **list);
static int summary_header_load(CamelFolderSummary *, FILE *);
static int summary_header_save(CamelFolderSummary *, FILE *);
-static CamelMessageInfo * message_info_new(CamelFolderSummary *, struct _header_raw *);
+static CamelMessageInfo * message_info_new(CamelFolderSummary *, struct _camel_header_raw *);
static CamelMessageInfo * message_info_new_from_parser(CamelFolderSummary *, CamelMimeParser *);
static CamelMessageInfo * message_info_new_from_message(CamelFolderSummary *s, CamelMimeMessage *msg);
static CamelMessageInfo * message_info_load(CamelFolderSummary *, FILE *);
static int message_info_save(CamelFolderSummary *, FILE *, CamelMessageInfo *);
static void message_info_free(CamelFolderSummary *, CamelMessageInfo *);
-static CamelMessageContentInfo * content_info_new(CamelFolderSummary *, struct _header_raw *);
+static CamelMessageContentInfo * content_info_new(CamelFolderSummary *, struct _camel_header_raw *);
static CamelMessageContentInfo * content_info_new_from_parser(CamelFolderSummary *, CamelMimeParser *);
static CamelMessageContentInfo * content_info_new_from_message(CamelFolderSummary *s, CamelMimePart *mp);
static CamelMessageContentInfo * content_info_load(CamelFolderSummary *, FILE *);
@@ -810,7 +810,7 @@ void camel_folder_summary_add(CamelFolderSummary *s, CamelMessageInfo *info)
*
* Return value: The newly added record.
**/
-CamelMessageInfo *camel_folder_summary_add_from_header(CamelFolderSummary *s, struct _header_raw *h)
+CamelMessageInfo *camel_folder_summary_add_from_header(CamelFolderSummary *s, struct _camel_header_raw *h)
{
CamelMessageInfo *info = camel_folder_summary_info_new_from_header(s, h);
@@ -869,7 +869,7 @@ CamelMessageInfo *camel_folder_summary_add_from_message(CamelFolderSummary *s, C
* Return value: Guess? This info record MUST be freed using
* camel_folder_summary_info_free(), camel_message_info_free() will not work.
**/
-CamelMessageInfo *camel_folder_summary_info_new_from_header(CamelFolderSummary *s, struct _header_raw *h)
+CamelMessageInfo *camel_folder_summary_info_new_from_header(CamelFolderSummary *s, struct _camel_header_raw *h)
{
return ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s))) -> message_info_new(s, h);
}
@@ -907,7 +907,7 @@ CamelMessageInfo *camel_folder_summary_info_new_from_parser(CamelFolderSummary *
/* should this check the parser is in the right state, or assume it is?? */
start = camel_mime_parser_tell(mp);
- if (camel_mime_parser_step(mp, &buffer, &len) != HSCAN_EOF) {
+ if (camel_mime_parser_step(mp, &buffer, &len) != CAMEL_MIME_PARSER_STATE_EOF) {
info = ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->message_info_new_from_parser(s, mp);
camel_mime_parser_unstep(mp);
@@ -1452,9 +1452,9 @@ static CamelMessageInfo * message_info_new_from_parser(CamelFolderSummary *s, Ca
state = camel_mime_parser_state(mp);
switch (state) {
- case HSCAN_HEADER:
- case HSCAN_MESSAGE:
- case HSCAN_MULTIPART:
+ case CAMEL_MIME_PARSER_STATE_HEADER:
+ case CAMEL_MIME_PARSER_STATE_MESSAGE:
+ case CAMEL_MIME_PARSER_STATE_MULTIPART:
mi = ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->message_info_new(s, camel_mime_parser_headers_raw(mp));
break;
default:
@@ -1469,13 +1469,13 @@ static CamelMessageContentInfo * content_info_new_from_parser(CamelFolderSummary
CamelMessageContentInfo *ci = NULL;
switch (camel_mime_parser_state(mp)) {
- case HSCAN_HEADER:
- case HSCAN_MESSAGE:
- case HSCAN_MULTIPART:
+ case CAMEL_MIME_PARSER_STATE_HEADER:
+ case CAMEL_MIME_PARSER_STATE_MESSAGE:
+ case CAMEL_MIME_PARSER_STATE_MULTIPART:
ci = ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->content_info_new(s, camel_mime_parser_headers_raw(mp));
if (ci) {
ci->type = camel_mime_parser_content_type(mp);
- header_content_type_ref(ci->type);
+ camel_content_type_ref(ci->type);
}
break;
default:
@@ -1504,17 +1504,17 @@ static CamelMessageContentInfo * content_info_new_from_message(CamelFolderSummar
}
static char *
-summary_format_address(struct _header_raw *h, const char *name, const char *charset)
+summary_format_address(struct _camel_header_raw *h, const char *name, const char *charset)
{
- struct _header_address *addr;
+ struct _camel_header_address *addr;
const char *text;
char *ret;
- text = header_raw_find (&h, name, NULL);
- addr = header_address_decode (text, charset);
+ text = camel_header_raw_find (&h, name, NULL);
+ addr = camel_header_address_decode (text, charset);
if (addr) {
- ret = header_address_list_format (addr);
- header_address_list_clear (&addr);
+ ret = camel_header_address_list_format (addr);
+ camel_header_address_list_clear (&addr);
} else {
ret = g_strdup (text);
}
@@ -1523,15 +1523,15 @@ summary_format_address(struct _header_raw *h, const char *name, const char *char
}
static char *
-summary_format_string (struct _header_raw *h, const char *name, const char *charset)
+summary_format_string (struct _camel_header_raw *h, const char *name, const char *charset)
{
const char *text;
- text = header_raw_find (&h, name, NULL);
+ text = camel_header_raw_find (&h, name, NULL);
if (text) {
while (isspace ((unsigned) *text))
text++;
- return header_decode_string (text, charset);
+ return camel_header_decode_string (text, charset);
} else {
return NULL;
}
@@ -1593,23 +1593,23 @@ camel_folder_summary_content_info_new(CamelFolderSummary *s)
}
static CamelMessageInfo *
-message_info_new(CamelFolderSummary *s, struct _header_raw *h)
+message_info_new(CamelFolderSummary *s, struct _camel_header_raw *h)
{
CamelMessageInfo *mi;
const char *received;
guchar digest[16];
- struct _header_references *refs, *irt, *scan;
+ struct _camel_header_references *refs, *irt, *scan;
char *msgid;
int count;
char *subject, *from, *to, *cc, *mlist;
- struct _header_content_type *ct = NULL;
+ CamelContentType *ct = NULL;
const char *content, *charset = NULL;
mi = camel_folder_summary_info_new(s);
- if ((content = header_raw_find(&h, "Content-Type", NULL))
- && (ct = header_content_type_decode(content))
- && (charset = header_content_type_param(ct, "charset"))
+ if ((content = camel_header_raw_find(&h, "Content-Type", NULL))
+ && (ct = camel_content_type_decode(content))
+ && (charset = camel_content_type_param(ct, "charset"))
&& (strcasecmp(charset, "us-ascii") == 0))
charset = NULL;
@@ -1619,10 +1619,10 @@ message_info_new(CamelFolderSummary *s, struct _header_raw *h)
from = summary_format_address(h, "from", charset);
to = summary_format_address(h, "to", charset);
cc = summary_format_address(h, "cc", charset);
- mlist = header_raw_check_mailing_list(&h);
+ mlist = camel_header_raw_check_mailing_list(&h);
if (ct)
- header_content_type_unref(ct);
+ camel_content_type_unref(ct);
#ifdef DOEPOOLV
e_poolv_set(mi->strings, CAMEL_MESSAGE_INFO_SUBJECT, subject, TRUE);
@@ -1646,16 +1646,16 @@ message_info_new(CamelFolderSummary *s, struct _header_raw *h)
mi->user_flags = NULL;
mi->user_tags = NULL;
- mi->date_sent = header_decode_date(header_raw_find(&h, "date", NULL), NULL);
- received = header_raw_find(&h, "received", NULL);
+ mi->date_sent = camel_header_decode_date(camel_header_raw_find(&h, "date", NULL), NULL);
+ received = camel_header_raw_find(&h, "received", NULL);
if (received)
received = strrchr(received, ';');
if (received)
- mi->date_received = header_decode_date(received + 1, NULL);
+ mi->date_received = camel_header_decode_date(received + 1, NULL);
else
mi->date_received = 0;
- msgid = header_msgid_decode(header_raw_find(&h, "message-id", NULL));
+ msgid = camel_header_msgid_decode(camel_header_raw_find(&h, "message-id", NULL));
if (msgid) {
md5_get_digest(msgid, strlen(msgid), digest);
memcpy(mi->message_id.id.hash, digest, sizeof(mi->message_id.id.hash));
@@ -1663,8 +1663,8 @@ message_info_new(CamelFolderSummary *s, struct _header_raw *h)
}
/* decode our references and in-reply-to headers */
- refs = header_references_decode (header_raw_find (&h, "references", NULL));
- irt = header_references_inreplyto_decode (header_raw_find (&h, "in-reply-to", NULL));
+ refs = camel_header_references_decode (camel_header_raw_find (&h, "references", NULL));
+ irt = camel_header_references_inreplyto_decode (camel_header_raw_find (&h, "in-reply-to", NULL));
if (refs || irt) {
if (irt) {
/* The References field is populated from the ``References'' and/or ``In-Reply-To''
@@ -1677,7 +1677,7 @@ message_info_new(CamelFolderSummary *s, struct _header_raw *h)
refs = irt;
}
- count = header_references_list_size(&refs);
+ count = camel_header_references_list_size(&refs);
mi->references = g_malloc(sizeof(*mi->references) + ((count-1) * sizeof(mi->references->references[0])));
count = 0;
scan = refs;
@@ -1688,7 +1688,7 @@ message_info_new(CamelFolderSummary *s, struct _header_raw *h)
scan = scan->next;
}
mi->references->size = count;
- header_references_list_clear(&refs);
+ camel_header_references_list_clear(&refs);
}
return mi;
@@ -1867,7 +1867,7 @@ message_info_free(CamelFolderSummary *s, CamelMessageInfo *mi)
}
static CamelMessageContentInfo *
-content_info_new (CamelFolderSummary *s, struct _header_raw *h)
+content_info_new (CamelFolderSummary *s, struct _camel_header_raw *h)
{
CamelMessageContentInfo *ci;
const char *charset;
@@ -1875,9 +1875,9 @@ content_info_new (CamelFolderSummary *s, struct _header_raw *h)
ci = camel_folder_summary_content_info_new (s);
charset = e_iconv_locale_charset ();
- ci->id = header_msgid_decode (header_raw_find (&h, "content-id", NULL));
- ci->description = header_decode_string (header_raw_find (&h, "content-description", NULL), NULL);
- ci->encoding = header_content_encoding_decode (header_raw_find (&h, "content-transfer-encoding", NULL));
+ ci->id = camel_header_msgid_decode (camel_header_raw_find (&h, "content-id", NULL));
+ ci->description = camel_header_decode_string (camel_header_raw_find (&h, "content-description", NULL), NULL);
+ ci->encoding = camel_header_content_encoding_decode (camel_header_raw_find (&h, "content-transfer-encoding", NULL));
return ci;
}
@@ -1888,7 +1888,7 @@ content_info_load(CamelFolderSummary *s, FILE *in)
CamelMessageContentInfo *ci;
char *type, *subtype;
guint32 count, i;
- struct _header_content_type *ct;
+ CamelContentType *ct;
io(printf("Loading content info\n"));
@@ -1896,7 +1896,7 @@ content_info_load(CamelFolderSummary *s, FILE *in)
camel_folder_summary_decode_token(in, &type);
camel_folder_summary_decode_token(in, &subtype);
- ct = header_content_type_new(type, subtype);
+ ct = camel_content_type_new(type, subtype);
g_free(type); /* can this be removed? */
g_free(subtype);
if (camel_file_util_decode_uint32(in, &count) == -1 || count > 500)
@@ -1909,7 +1909,7 @@ content_info_load(CamelFolderSummary *s, FILE *in)
if (!(name && value))
goto error;
- header_content_type_set_param(ct, name, value);
+ camel_content_type_set_param(ct, name, value);
/* TODO: do this so we dont have to double alloc/free */
g_free(name);
g_free(value);
@@ -1935,8 +1935,8 @@ content_info_load(CamelFolderSummary *s, FILE *in)
static int
content_info_save(CamelFolderSummary *s, FILE *out, CamelMessageContentInfo *ci)
{
- struct _header_content_type *ct;
- struct _header_param *hp;
+ CamelContentType *ct;
+ struct _camel_header_param *hp;
io(printf("Saving content info\n"));
@@ -1965,7 +1965,7 @@ content_info_save(CamelFolderSummary *s, FILE *out, CamelMessageContentInfo *ci)
static void
content_info_free(CamelFolderSummary *s, CamelMessageContentInfo *ci)
{
- header_content_type_unref(ci->type);
+ camel_content_type_unref(ci->type);
g_free(ci->id);
g_free(ci->description);
g_free(ci->encoding);
@@ -1992,7 +1992,7 @@ summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, Cam
size_t len;
char *buffer;
CamelMessageContentInfo *info = NULL;
- struct _header_content_type *ct;
+ CamelContentType *ct;
int body;
int enc_id = -1, chr_id = -1, html_id = -1, idx_id = -1;
struct _CamelFolderSummaryPrivate *p = _PRIVATE(s);
@@ -2009,20 +2009,20 @@ summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, Cam
info = ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->content_info_new_from_parser(s, mp);
switch(state) {
- case HSCAN_HEADER:
+ case CAMEL_MIME_PARSER_STATE_HEADER:
/* check content type for indexing, then read body */
ct = camel_mime_parser_content_type(mp);
/* update attachments flag as we go */
- if (!header_content_type_is(ct, "text", "*"))
+ if (!camel_content_type_is(ct, "text", "*"))
msginfo->flags |= CAMEL_MESSAGE_ATTACHMENTS;
- if (p->index && header_content_type_is(ct, "text", "*")) {
+ if (p->index && camel_content_type_is(ct, "text", "*")) {
char *encoding;
const char *charset;
d(printf("generating index:\n"));
- encoding = header_content_encoding_decode(camel_mime_parser_header(mp, "content-transfer-encoding", NULL));
+ encoding = camel_header_content_encoding_decode(camel_mime_parser_header(mp, "content-transfer-encoding", NULL));
if (encoding) {
if (!strcasecmp(encoding, "base64")) {
d(printf(" decoding base64\n"));
@@ -2051,7 +2051,7 @@ summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, Cam
g_free(encoding);
}
- charset = header_content_type_param(ct, "charset");
+ charset = camel_content_type_param(ct, "charset");
if (charset!=NULL
&& !(strcasecmp(charset, "us-ascii")==0
|| strcasecmp(charset, "utf-8")==0)) {
@@ -2073,7 +2073,7 @@ summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, Cam
/* we do charset conversions before this filter, which isn't strictly correct,
but works in most cases */
- if (header_content_type_is(ct, "text", "html")) {
+ if (camel_content_type_is(ct, "text", "html")) {
if (p->filter_html == NULL)
p->filter_html = camel_mime_filter_html_new();
else
@@ -2085,7 +2085,7 @@ summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, Cam
idx_id = camel_mime_parser_filter_add(mp, (CamelMimeFilter *)p->filter_index);
}
/* and scan/index everything */
- while (camel_mime_parser_step(mp, &buffer, &len) != HSCAN_BODY_END)
+ while (camel_mime_parser_step(mp, &buffer, &len) != CAMEL_MIME_PARSER_STATE_BODY_END)
;
/* and remove the filters */
camel_mime_parser_filter_remove(mp, enc_id);
@@ -2093,14 +2093,14 @@ summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, Cam
camel_mime_parser_filter_remove(mp, html_id);
camel_mime_parser_filter_remove(mp, idx_id);
break;
- case HSCAN_MULTIPART:
+ case CAMEL_MIME_PARSER_STATE_MULTIPART:
d(printf("Summarising multipart\n"));
/* update attachments flag as we go */
ct = camel_mime_parser_content_type(mp);
- if (header_content_type_is(ct, "multipart", "mixed"))
+ if (camel_content_type_is(ct, "multipart", "mixed"))
msginfo->flags |= CAMEL_MESSAGE_ATTACHMENTS;
- while (camel_mime_parser_step(mp, &buffer, &len) != HSCAN_MULTIPART_END) {
+ while (camel_mime_parser_step(mp, &buffer, &len) != CAMEL_MIME_PARSER_STATE_MULTIPART_END) {
camel_mime_parser_unstep(mp);
part = summary_build_content_info(s, msginfo, mp);
if (part) {
@@ -2109,7 +2109,7 @@ summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, Cam
}
}
break;
- case HSCAN_MESSAGE:
+ case CAMEL_MIME_PARSER_STATE_MESSAGE:
d(printf("Summarising message\n"));
/* update attachments flag as we go */
msginfo->flags |= CAMEL_MESSAGE_ATTACHMENTS;
@@ -2120,7 +2120,7 @@ summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, Cam
my_list_append((struct _node **)&info->childs, (struct _node *)part);
}
state = camel_mime_parser_step(mp, &buffer, &len);
- if (state != HSCAN_MESSAGE_END) {
+ if (state != CAMEL_MIME_PARSER_STATE_MESSAGE_END) {
g_error("Bad parser state: Expecing MESSAGE_END or MESSAGE_EOF, got: %d", state);
camel_mime_parser_unstep(mp);
}
@@ -2154,10 +2154,10 @@ summary_build_content_info_message(CamelFolderSummary *s, CamelMessageInfo *msgi
add a reference, probably need fixing for multithreading */
/* check for attachments */
- 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"))
+ if (camel_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "multipart", "*")) {
+ if (camel_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "multipart", "mixed"))
msginfo->flags |= CAMEL_MESSAGE_ATTACHMENTS;
- } else if (!header_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "text", "*"))
+ } else if (!camel_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 */
@@ -2180,11 +2180,11 @@ summary_build_content_info_message(CamelFolderSummary *s, CamelMessageInfo *msgi
my_list_append((struct _node **)&info->childs, (struct _node *)child);
}
} else if (p->filter_stream
- && header_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "text", "*")) {
+ && camel_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "text", "*")) {
int html_id = -1, idx_id = -1;
/* pre-attach html filter if required, otherwise just index filter */
- if (header_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "text", "html")) {
+ if (camel_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "text", "html")) {
if (p->filter_html == NULL)
p->filter_html = camel_mime_filter_html_new();
else
@@ -2588,16 +2588,16 @@ void camel_message_info_ref(CamelMessageInfo *info)
* Returns a new CamelMessageInfo structure populated by the header.
**/
CamelMessageInfo *
-camel_message_info_new_from_header (struct _header_raw *header)
+camel_message_info_new_from_header (struct _camel_header_raw *header)
{
CamelMessageInfo *info;
char *subject, *from, *to, *cc, *mlist;
- struct _header_content_type *ct = NULL;
+ CamelContentType *ct = NULL;
const char *content, *date, *charset = NULL;
- if ((content = header_raw_find(&header, "Content-Type", NULL))
- && (ct = header_content_type_decode(content))
- && (charset = header_content_type_param(ct, "charset"))
+ if ((content = camel_header_raw_find(&header, "Content-Type", NULL))
+ && (ct = camel_content_type_decode(content))
+ && (charset = camel_content_type_param(ct, "charset"))
&& (strcasecmp(charset, "us-ascii") == 0))
charset = NULL;
@@ -2607,11 +2607,11 @@ camel_message_info_new_from_header (struct _header_raw *header)
from = summary_format_address(header, "from", charset);
to = summary_format_address(header, "to", charset);
cc = summary_format_address(header, "cc", charset);
- date = header_raw_find(&header, "date", NULL);
- mlist = header_raw_check_mailing_list(&header);
+ date = camel_header_raw_find(&header, "date", NULL);
+ mlist = camel_header_raw_check_mailing_list(&header);
if (ct)
- header_content_type_unref(ct);
+ camel_content_type_unref(ct);
info = camel_message_info_new();
@@ -2622,16 +2622,16 @@ camel_message_info_new_from_header (struct _header_raw *header)
camel_message_info_set_mlist(info, mlist);
if (date)
- info->date_sent = header_decode_date (date, NULL);
+ info->date_sent = camel_header_decode_date (date, NULL);
else
info->date_sent = time (NULL);
- date = header_raw_find (&header, "received", NULL);
+ date = camel_header_raw_find (&header, "received", NULL);
if (date && (date = strrchr (date, ';')))
date++;
if (date)
- info->date_received = header_decode_date (date, NULL);
+ info->date_received = camel_header_decode_date (date, NULL);
else
info->date_received = time (NULL);
diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h
index 0f92ff6248..48713b1a3c 100644
--- a/camel/camel-folder-summary.h
+++ b/camel/camel-folder-summary.h
@@ -48,7 +48,7 @@ struct _CamelMessageContentInfo {
struct _CamelMessageContentInfo *childs;
struct _CamelMessageContentInfo *parent;
- struct _header_content_type *type;
+ CamelContentType *type;
char *id;
char *description;
char *encoding; /* this should be an enum?? */
@@ -191,7 +191,7 @@ struct _CamelFolderSummaryClass {
int (*summary_header_save)(CamelFolderSummary *, FILE *);
/* create/save/load an individual message info */
- CamelMessageInfo * (*message_info_new)(CamelFolderSummary *, struct _header_raw *);
+ CamelMessageInfo * (*message_info_new)(CamelFolderSummary *, struct _camel_header_raw *);
CamelMessageInfo * (*message_info_new_from_parser)(CamelFolderSummary *, CamelMimeParser *);
CamelMessageInfo * (*message_info_new_from_message)(CamelFolderSummary *, CamelMimeMessage *);
CamelMessageInfo * (*message_info_load)(CamelFolderSummary *, FILE *);
@@ -199,7 +199,7 @@ struct _CamelFolderSummaryClass {
void (*message_info_free)(CamelFolderSummary *, CamelMessageInfo *);
/* save/load individual content info's */
- CamelMessageContentInfo * (*content_info_new)(CamelFolderSummary *, struct _header_raw *);
+ CamelMessageContentInfo * (*content_info_new)(CamelFolderSummary *, struct _camel_header_raw *);
CamelMessageContentInfo * (*content_info_new_from_parser)(CamelFolderSummary *, CamelMimeParser *);
CamelMessageContentInfo * (*content_info_new_from_message)(CamelFolderSummary *, CamelMimePart *);
CamelMessageContentInfo * (*content_info_load)(CamelFolderSummary *, FILE *);
@@ -235,13 +235,13 @@ void camel_folder_summary_touch(CamelFolderSummary *s);
void camel_folder_summary_add(CamelFolderSummary *, CamelMessageInfo *info);
/* build/add raw summary items */
-CamelMessageInfo *camel_folder_summary_add_from_header(CamelFolderSummary *, struct _header_raw *);
+CamelMessageInfo *camel_folder_summary_add_from_header(CamelFolderSummary *, struct _camel_header_raw *);
CamelMessageInfo *camel_folder_summary_add_from_parser(CamelFolderSummary *, CamelMimeParser *);
CamelMessageInfo *camel_folder_summary_add_from_message(CamelFolderSummary *, CamelMimeMessage *);
/* Just build raw summary items */
CamelMessageInfo *camel_folder_summary_info_new(CamelFolderSummary *s);
-CamelMessageInfo *camel_folder_summary_info_new_from_header(CamelFolderSummary *, struct _header_raw *);
+CamelMessageInfo *camel_folder_summary_info_new_from_header(CamelFolderSummary *, struct _camel_header_raw *);
CamelMessageInfo *camel_folder_summary_info_new_from_parser(CamelFolderSummary *, CamelMimeParser *);
CamelMessageInfo *camel_folder_summary_info_new_from_message(CamelFolderSummary *, CamelMimeMessage *);
@@ -267,8 +267,8 @@ GPtrArray *camel_folder_summary_array(CamelFolderSummary *s);
void camel_folder_summary_array_free(CamelFolderSummary *s, GPtrArray *array);
/* summary formatting utils */
-char *camel_folder_summary_format_address(struct _header_raw *h, const char *name);
-char *camel_folder_summary_format_string(struct _header_raw *h, const char *name);
+char *camel_folder_summary_format_address(struct _camel_header_raw *h, const char *name);
+char *camel_folder_summary_format_string(struct _camel_header_raw *h, const char *name);
/* basically like strings, but certain keywords can be compressed and de-cased */
int camel_folder_summary_encode_token(FILE *, const char *);
@@ -296,7 +296,7 @@ void camel_tag_list_free(CamelTag **list);
other external interfaces that use message info's */
CamelMessageInfo *camel_message_info_new(void);
void camel_message_info_ref(CamelMessageInfo *info);
-CamelMessageInfo *camel_message_info_new_from_header(struct _header_raw *header);
+CamelMessageInfo *camel_message_info_new_from_header(struct _camel_header_raw *header);
void camel_message_info_dup_to(const CamelMessageInfo *from, CamelMessageInfo *to);
void camel_message_info_free(CamelMessageInfo *mi);
diff --git a/camel/camel-http-stream.c b/camel/camel-http-stream.c
index 3217a11f55..40bf71fdd3 100644
--- a/camel/camel-http-stream.c
+++ b/camel/camel-http-stream.c
@@ -96,10 +96,10 @@ camel_http_stream_finalize (CamelObject *object)
camel_object_unref(http->parser);
if (http->content_type)
- header_content_type_unref (http->content_type);
+ camel_content_type_unref (http->content_type);
if (http->headers)
- header_raw_clear (&http->headers);
+ camel_header_raw_clear (&http->headers);
if (http->session)
camel_object_unref(http->session);
@@ -261,7 +261,7 @@ http_get_statuscode (CamelHttpStream *http)
/* parse the HTTP status code */
if (!strncasecmp (buffer, "HTTP/", 5)) {
token = http_next_token (buffer);
- http->statuscode = header_decode_int (&token);
+ http->statuscode = camel_header_decode_int (&token);
return http->statuscode;
}
@@ -273,7 +273,7 @@ http_get_statuscode (CamelHttpStream *http)
static int
http_get_headers (CamelHttpStream *http)
{
- struct _header_raw *headers, *node, *tail;
+ struct _camel_header_raw *headers, *node, *tail;
const char *type;
char *buf;
size_t len;
@@ -286,27 +286,27 @@ http_get_headers (CamelHttpStream *http)
camel_mime_parser_init_with_stream (http->parser, http->read);
switch (camel_mime_parser_step (http->parser, &buf, &len)) {
- case HSCAN_MESSAGE:
- case HSCAN_HEADER:
+ case CAMEL_MIME_PARSER_STATE_MESSAGE:
+ case CAMEL_MIME_PARSER_STATE_HEADER:
headers = camel_mime_parser_headers_raw (http->parser);
if (http->content_type)
- header_content_type_unref (http->content_type);
- type = header_raw_find (&headers, "Content-Type", NULL);
+ camel_content_type_unref (http->content_type);
+ type = camel_header_raw_find (&headers, "Content-Type", NULL);
if (type)
- http->content_type = header_content_type_decode (type);
+ http->content_type = camel_content_type_decode (type);
else
http->content_type = NULL;
if (http->headers)
- header_raw_clear (&http->headers);
+ camel_header_raw_clear (&http->headers);
http->headers = NULL;
- tail = (struct _header_raw *) &http->headers;
+ tail = (struct _camel_header_raw *) &http->headers;
d(printf("HTTP Headers:\n"));
while (headers) {
d(printf(" %s:%s\n", headers->name, headers->value));
- node = g_new (struct _header_raw, 1);
+ node = g_new (struct _camel_header_raw, 1);
node->next = NULL;
node->name = g_strdup (headers->name);
node->value = g_strdup (headers->value);
@@ -432,13 +432,13 @@ stream_read (CamelStream *stream, char *buffer, size_t n)
case 302: {
char *loc;
- header_content_type_unref (http->content_type);
+ camel_content_type_unref (http->content_type);
http->content_type = NULL;
http_disconnect(http);
- loc = g_strdup(header_raw_find(&http->headers, "Location", NULL));
+ loc = g_strdup(camel_header_raw_find(&http->headers, "Location", NULL));
if (loc == NULL) {
- header_raw_clear(&http->headers);
+ camel_header_raw_clear(&http->headers);
return -1;
}
@@ -449,11 +449,11 @@ stream_read (CamelStream *stream, char *buffer, size_t n)
http->url = camel_url_new(loc, NULL);
if (http->url == NULL) {
printf("redirect url '%s' cannot be parsed\n", loc);
- header_raw_clear (&http->headers);
+ camel_header_raw_clear (&http->headers);
return -1;
}
d(printf(" redirect url = %p\n", http->url));
- header_raw_clear (&http->headers);
+ camel_header_raw_clear (&http->headers);
goto redirect;
break; }
@@ -536,7 +536,7 @@ camel_http_stream_get_content_type (CamelHttpStream *http_stream)
}
if (http_stream->content_type)
- header_content_type_ref (http_stream->content_type);
+ camel_content_type_ref (http_stream->content_type);
return http_stream->content_type;
}
diff --git a/camel/camel-http-stream.h b/camel/camel-http-stream.h
index 41a82d0def..94272ee6c3 100644
--- a/camel/camel-http-stream.h
+++ b/camel/camel-http-stream.h
@@ -59,7 +59,7 @@ struct _CamelHttpStream {
CamelMimeParser *parser;
CamelContentType *content_type;
- struct _header_raw *headers;
+ struct _camel_header_raw *headers;
CamelHttpMethod method;
struct _CamelSession *session;
diff --git a/camel/camel-internet-address.c b/camel/camel-internet-address.c
index 80b68ab053..bc65ea71ea 100644
--- a/camel/camel-internet-address.c
+++ b/camel/camel-internet-address.c
@@ -84,18 +84,18 @@ camel_internet_address_get_type(void)
static int
internet_decode (CamelAddress *a, const char *raw)
{
- struct _header_address *ha, *n;
+ struct _camel_header_address *ha, *n;
int count = a->addresses->len;
/* Should probably use its own decoder or something */
- ha = header_address_decode(raw, NULL);
+ ha = camel_header_address_decode(raw, NULL);
if (ha) {
n = ha;
while (n) {
if (n->type == HEADER_ADDRESS_NAME) {
camel_internet_address_add((CamelInternetAddress *)a, n->name, n->v.addr);
} else if (n->type == HEADER_ADDRESS_GROUP) {
- struct _header_address *g = n->v.members;
+ struct _camel_header_address *g = n->v.members;
while (g) {
if (g->type == HEADER_ADDRESS_NAME)
camel_internet_address_add((CamelInternetAddress *)a, g->name, g->v.addr);
@@ -105,7 +105,7 @@ internet_decode (CamelAddress *a, const char *raw)
}
n = n->next;
}
- header_address_list_clear(&ha);
+ camel_header_address_list_clear(&ha);
}
return a->addresses->len - count;
@@ -413,7 +413,7 @@ camel_internet_address_find_address(CamelInternetAddress *a, const char *address
char *
camel_internet_address_encode_address(int *inlen, const char *real, const char *addr)
{
- char *name = header_encode_phrase(real);
+ char *name = camel_header_encode_phrase(real);
char *ret = NULL, *addra = NULL;
int len = *inlen;
GString *out = g_string_new("");
@@ -422,7 +422,7 @@ camel_internet_address_encode_address(int *inlen, const char *real, const char *
if (name && name[0]) {
if (strlen(name) + len > CAMEL_FOLD_SIZE) {
- char *folded = header_address_fold(name, len);
+ char *folded = camel_header_address_fold(name, len);
char *last;
g_string_append(out, folded);
g_free(folded);
diff --git a/camel/camel-medium.c b/camel/camel-medium.c
index 5699a29ee6..b3964f29e3 100644
--- a/camel/camel-medium.c
+++ b/camel/camel-medium.c
@@ -40,11 +40,11 @@ static CamelDataWrapperClass *parent_class = NULL;
#define CM_CLASS(so) CAMEL_MEDIUM_CLASS (CAMEL_OBJECT_GET_CLASS(so))
static gboolean is_offline (CamelDataWrapper *data_wrapper);
-static void add_header (CamelMedium *medium, const gchar *header_name,
- const void *header_value);
-static void set_header (CamelMedium *medium, const gchar *header_name, const void *header_value);
-static void remove_header (CamelMedium *medium, const gchar *header_name);
-static const void *get_header (CamelMedium *medium, const gchar *header_name);
+static void add_header (CamelMedium *medium, const char *name,
+ const void *value);
+static void set_header (CamelMedium *medium, const char *name, const void *value);
+static void remove_header (CamelMedium *medium, const char *name);
+static const void *get_header (CamelMedium *medium, const char *name);
static GArray *get_headers (CamelMedium *medium);
static void free_headers (CamelMedium *medium, GArray *headers);
@@ -121,17 +121,16 @@ is_offline (CamelDataWrapper *data_wrapper)
}
static void
-add_header (CamelMedium *medium, const gchar *header_name,
- const void *header_value)
+add_header (CamelMedium *medium, const char *name, const void *value)
{
- g_warning("No %s::add_header implemented, adding %s", camel_type_to_name(CAMEL_OBJECT_GET_TYPE(medium)), header_name);
+ g_warning("No %s::add_header implemented, adding %s", camel_type_to_name(CAMEL_OBJECT_GET_TYPE(medium)), name);
}
/**
* camel_medium_add_header:
* @medium: a CamelMedium
- * @header_name: name of the header
- * @header_value: value of the header
+ * @name: name of the header
+ * @value: value of the header
*
* Adds a header to a medium.
*
@@ -140,78 +139,78 @@ add_header (CamelMedium *medium, const gchar *header_name,
* headers. No we dont, order isn't important! Z
**/
void
-camel_medium_add_header (CamelMedium *medium, const gchar *header_name, const void *header_value)
+camel_medium_add_header (CamelMedium *medium, const char *name, const void *value)
{
g_return_if_fail (CAMEL_IS_MEDIUM (medium));
- g_return_if_fail (header_name != NULL);
- g_return_if_fail (header_value != NULL);
+ g_return_if_fail (name != NULL);
+ g_return_if_fail (value != NULL);
- CM_CLASS (medium)->add_header(medium, header_name, header_value);
+ CM_CLASS (medium)->add_header(medium, name, value);
}
static void
-set_header (CamelMedium *medium, const char *header_name, const void *header_value)
+set_header (CamelMedium *medium, const char *name, const void *value)
{
- g_warning("No %s::set_header implemented, setting %s", camel_type_to_name(CAMEL_OBJECT_GET_TYPE(medium)), header_name);
+ g_warning("No %s::set_header implemented, setting %s", camel_type_to_name(CAMEL_OBJECT_GET_TYPE(medium)), name);
}
/**
* camel_medium_set_header:
* @medium: a CamelMedium
- * @header_name: name of the header
- * @header_value: value of the header
+ * @name: name of the header
+ * @value: value of the header
*
* Sets the value of a header. Any other occurances of the header
* will be removed. Setting a %NULL header can be used to remove
* the header also.
**/
void
-camel_medium_set_header (CamelMedium *medium, const char *header_name, const void *header_value)
+camel_medium_set_header (CamelMedium *medium, const char *name, const void *value)
{
g_return_if_fail (CAMEL_IS_MEDIUM (medium));
- g_return_if_fail (header_name != NULL);
+ g_return_if_fail (name != NULL);
- if (header_value == NULL)
- CM_CLASS(medium)->remove_header(medium, header_name);
+ if (value == NULL)
+ CM_CLASS(medium)->remove_header(medium, name);
else
- CM_CLASS(medium)->set_header(medium, header_name, header_value);
+ CM_CLASS(medium)->set_header(medium, name, value);
}
static void
-remove_header(CamelMedium *medium, const char *header_name)
+remove_header(CamelMedium *medium, const char *name)
{
- g_warning("No %s::remove_header implemented, removing %s", camel_type_to_name(CAMEL_OBJECT_GET_TYPE(medium)), header_name);
+ g_warning("No %s::remove_header implemented, removing %s", camel_type_to_name(CAMEL_OBJECT_GET_TYPE(medium)), name);
}
/**
* camel_medium_remove_header:
* @medium: a medium
- * @header_name: the name of the header
+ * @name: the name of the header
*
* Removes the named header from the medium. All occurances of the
* header are removed.
**/
void
-camel_medium_remove_header(CamelMedium *medium, const char *header_name)
+camel_medium_remove_header(CamelMedium *medium, const char *name)
{
g_return_if_fail (CAMEL_IS_MEDIUM (medium));
- g_return_if_fail (header_name != NULL);
+ g_return_if_fail (name != NULL);
- CM_CLASS(medium)->remove_header(medium, header_name);
+ CM_CLASS(medium)->remove_header(medium, name);
}
static const void *
-get_header(CamelMedium *medium, const char *header_name)
+get_header(CamelMedium *medium, const char *name)
{
- g_warning("No %s::get_header implemented, getting %s", camel_type_to_name(CAMEL_OBJECT_GET_TYPE(medium)), header_name);
+ g_warning("No %s::get_header implemented, getting %s", camel_type_to_name(CAMEL_OBJECT_GET_TYPE(medium)), name);
return NULL;
}
/**
* camel_medium_get_header:
* @medium: a medium
- * @header_name: the name of the header
+ * @name: the name of the header
*
* Returns the value of the named header in the medium, or %NULL if
* it is unset. The caller should not modify or free the data.
@@ -223,12 +222,12 @@ get_header(CamelMedium *medium, const char *header_name)
* Return value: the value of the named header, or %NULL
**/
const void *
-camel_medium_get_header(CamelMedium *medium, const char *header_name)
+camel_medium_get_header(CamelMedium *medium, const char *name)
{
g_return_val_if_fail (CAMEL_IS_MEDIUM (medium), NULL);
- g_return_val_if_fail (header_name != NULL, NULL);
+ g_return_val_if_fail (name != NULL, NULL);
- return CM_CLASS (medium)->get_header (medium, header_name);
+ return CM_CLASS (medium)->get_header (medium, name);
}
diff --git a/camel/camel-medium.h b/camel/camel-medium.h
index 26040b2a94..7b01eae39f 100644
--- a/camel/camel-medium.h
+++ b/camel/camel-medium.h
@@ -31,7 +31,7 @@
#ifdef __cplusplus
extern "C" {
#pragma }
-#endif /* __cplusplus }*/
+#endif /* __cplusplus */
#include <camel/camel-data-wrapper.h>
@@ -46,8 +46,7 @@ typedef struct {
const char *value;
} CamelMediumHeader;
-struct _CamelMedium
-{
+struct _CamelMedium {
CamelDataWrapper parent_object;
/* The content of the medium, as opposed to our parent
@@ -55,34 +54,32 @@ struct _CamelMedium
* content.
*/
CamelDataWrapper *content;
-
};
typedef struct {
CamelDataWrapperClass parent_class;
/* Virtual methods */
- void (*add_header) (CamelMedium *medium, const gchar *header_name, const void *header_value);
- void (*set_header) (CamelMedium *medium, const gchar *header_name, const void *header_value);
- void (*remove_header) (CamelMedium *medium, const gchar *header_name);
- const void * (*get_header) (CamelMedium *medium, const gchar *header_name);
+ void (*add_header) (CamelMedium *medium, const char *name, const void *value);
+ void (*set_header) (CamelMedium *medium, const char *name, const void *value);
+ void (*remove_header) (CamelMedium *medium, const char *name);
+ const void * (*get_header) (CamelMedium *medium, const char *name);
GArray * (*get_headers) (CamelMedium *medium);
void (*free_headers) (CamelMedium *medium, GArray *headers);
CamelDataWrapper * (*get_content_object) (CamelMedium *medium);
void (*set_content_object) (CamelMedium *medium, CamelDataWrapper *content);
-
} CamelMediumClass;
/* Standard Camel function */
CamelType camel_medium_get_type (void);
/* Header get/set interface */
-void camel_medium_add_header (CamelMedium *medium, const gchar *header_name, const void *header_value);
-void camel_medium_set_header (CamelMedium *medium, const gchar *header_name, const void *header_value);
-void camel_medium_remove_header (CamelMedium *medium, const gchar *header_name);
-const void *camel_medium_get_header (CamelMedium *medium, const gchar *header_name);
+void camel_medium_add_header (CamelMedium *medium, const char *name, const void *value);
+void camel_medium_set_header (CamelMedium *medium, const char *name, const void *value);
+void camel_medium_remove_header (CamelMedium *medium, const char *name);
+const void *camel_medium_get_header (CamelMedium *medium, const char *name);
GArray *camel_medium_get_headers (CamelMedium *medium);
void camel_medium_free_headers (CamelMedium *medium, GArray *headers);
diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c
index a0700fc3a5..65e4207a19 100644
--- a/camel/camel-mime-message.c
+++ b/camel/camel-mime-message.c
@@ -80,9 +80,9 @@ static char *recipient_names[] = {
};
static ssize_t write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
-static void add_header (CamelMedium *medium, const char *header_name, const void *header_value);
-static void set_header (CamelMedium *medium, const char *header_name, const void *header_value);
-static void remove_header (CamelMedium *medium, const char *header_name);
+static void add_header (CamelMedium *medium, const char *name, const void *value);
+static void set_header (CamelMedium *medium, const char *name, const void *value);
+static void remove_header (CamelMedium *medium, const char *name);
static int construct_from_parser (CamelMimePart *, CamelMimeParser *);
static void unref_recipient (gpointer key, gpointer value, gpointer user_data);
@@ -99,10 +99,10 @@ camel_mime_message_class_init (CamelMimeMessageClass *camel_mime_message_class)
CamelMediumClass *camel_medium_class = CAMEL_MEDIUM_CLASS (camel_mime_message_class);
int i;
- parent_class = CAMEL_MIME_PART_CLASS(camel_type_get_global_classfuncs (camel_mime_part_get_type ()));
-
+ parent_class = CAMEL_MIME_PART_CLASS (camel_type_get_global_classfuncs (camel_mime_part_get_type ()));
+
header_name_table = g_hash_table_new (camel_strcase_hash, camel_strcase_equal);
- for (i=0;header_names[i];i++)
+ for (i = 0;header_names[i]; i++)
g_hash_table_insert (header_name_table, header_names[i], GINT_TO_POINTER(i+1));
/* virtual method overload */
@@ -211,7 +211,7 @@ camel_mime_message_set_date (CamelMimeMessage *message, time_t date, int offset
message->date = date;
message->date_offset = offset;
- datestr = header_format_date (date, offset);
+ datestr = camel_header_format_date (date, offset);
CAMEL_MEDIUM_CLASS (parent_class)->set_header ((CamelMedium *)message, "Date", datestr);
g_free (datestr);
}
@@ -235,7 +235,7 @@ camel_mime_message_get_date_received (CamelMimeMessage *msg, int *offset)
if (received)
received = strrchr (received, ';');
if (received)
- msg->date_received = header_decode_date (received + 1, &msg->date_received_offset);
+ msg->date_received = camel_header_decode_date (received + 1, &msg->date_received_offset);
}
if (offset)
@@ -258,7 +258,7 @@ camel_mime_message_set_message_id (CamelMimeMessage *mime_message, const char *m
if (message_id) {
id = g_strstrip (g_strdup (message_id));
} else {
- id = header_msgid_generate ();
+ id = camel_header_msgid_generate ();
}
mime_message->message_id = id;
@@ -321,7 +321,7 @@ camel_mime_message_set_subject (CamelMimeMessage *mime_message, const char *subj
g_free (mime_message->subject);
mime_message->subject = g_strstrip (g_strdup (subject));
- text = header_encode_string((unsigned char *)mime_message->subject);
+ text = camel_header_encode_string((unsigned char *)mime_message->subject);
CAMEL_MEDIUM_CLASS(parent_class)->set_header(CAMEL_MEDIUM (mime_message), "Subject", text);
g_free (text);
}
@@ -466,9 +466,9 @@ construct_from_parser (CamelMimePart *dw, CamelMimeParser *mp)
/* ... then clean up the follow-on state */
state = camel_mime_parser_step (mp, &buf, &len);
switch (state) {
- case HSCAN_EOF: case HSCAN_FROM_END: /* these doesn't belong to us */
+ case CAMEL_MIME_PARSER_STATE_EOF: case CAMEL_MIME_PARSER_STATE_FROM_END: /* these doesn't belong to us */
camel_mime_parser_unstep (mp);
- case HSCAN_MESSAGE_END:
+ case CAMEL_MIME_PARSER_STATE_MESSAGE_END:
break;
default:
g_error ("Bad parser state: Expecing MESSAGE_END or EOF or EOM, got: %d", camel_mime_parser_state (mp));
@@ -516,35 +516,35 @@ write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
/* FIXME: check format of fields. */
static gboolean
-process_header (CamelMedium *medium, const char *header_name, const char *header_value)
+process_header (CamelMedium *medium, const char *name, const char *value)
{
CamelHeaderType header_type;
CamelMimeMessage *message = CAMEL_MIME_MESSAGE (medium);
CamelInternetAddress *addr;
const char *charset;
- header_type = (CamelHeaderType)g_hash_table_lookup (header_name_table, header_name);
+ header_type = (CamelHeaderType) g_hash_table_lookup (header_name_table, name);
switch (header_type) {
case HEADER_FROM:
if (message->from)
camel_object_unref (CAMEL_OBJECT (message->from));
message->from = camel_internet_address_new ();
- camel_address_decode (CAMEL_ADDRESS (message->from), header_value);
+ camel_address_decode (CAMEL_ADDRESS (message->from), value);
break;
case HEADER_REPLY_TO:
if (message->reply_to)
camel_object_unref (CAMEL_OBJECT (message->reply_to));
message->reply_to = camel_internet_address_new ();
- camel_address_decode (CAMEL_ADDRESS (message->reply_to), header_value);
+ camel_address_decode (CAMEL_ADDRESS (message->reply_to), value);
break;
case HEADER_SUBJECT:
g_free (message->subject);
if (((CamelDataWrapper *) message)->mime_type) {
- charset = header_content_type_param (((CamelDataWrapper *) message)->mime_type, "charset");
+ charset = camel_content_type_param (((CamelDataWrapper *) message)->mime_type, "charset");
charset = e_iconv_charset_name (charset);
} else
charset = NULL;
- message->subject = g_strstrip (header_decode_string (header_value, charset));
+ message->subject = g_strstrip (camel_header_decode_string (value, charset));
break;
case HEADER_TO:
case HEADER_CC:
@@ -552,15 +552,15 @@ process_header (CamelMedium *medium, const char *header_name, const char *header
case HEADER_RESENT_TO:
case HEADER_RESENT_CC:
case HEADER_RESENT_BCC:
- addr = g_hash_table_lookup (message->recipients, header_name);
- if (header_value)
- camel_address_decode (CAMEL_ADDRESS (addr), header_value);
+ addr = g_hash_table_lookup (message->recipients, name);
+ if (value)
+ camel_address_decode (CAMEL_ADDRESS (addr), value);
else
camel_address_remove (CAMEL_ADDRESS (addr), -1);
break;
case HEADER_DATE:
- if (header_value) {
- message->date = header_decode_date (header_value, &message->date_offset);
+ if (value) {
+ message->date = camel_header_decode_date (value, &message->date_offset);
} else {
message->date = CAMEL_MESSAGE_DATE_CURRENT;
message->date_offset = 0;
@@ -568,8 +568,8 @@ process_header (CamelMedium *medium, const char *header_name, const char *header
break;
case HEADER_MESSAGE_ID:
g_free (message->message_id);
- if (header_value)
- message->message_id = header_msgid_decode (header_value);
+ if (value)
+ message->message_id = camel_header_msgid_decode (value);
else
message->message_id = NULL;
break;
@@ -581,27 +581,27 @@ process_header (CamelMedium *medium, const char *header_name, const char *header
}
static void
-set_header (CamelMedium *medium, const char *header_name, const void *header_value)
+set_header (CamelMedium *medium, const char *name, const void *value)
{
- process_header (medium, header_name, header_value);
- parent_class->parent_class.set_header (medium, header_name, header_value);
+ process_header (medium, name, value);
+ parent_class->parent_class.set_header (medium, name, value);
}
static void
-add_header (CamelMedium *medium, const char *header_name, const void *header_value)
+add_header (CamelMedium *medium, const char *name, const void *value)
{
/* if we process it, then it must be forced unique as well ... */
- if (process_header (medium, header_name, header_value))
- parent_class->parent_class.set_header (medium, header_name, header_value);
+ if (process_header (medium, name, value))
+ parent_class->parent_class.set_header (medium, name, value);
else
- parent_class->parent_class.add_header (medium, header_name, header_value);
+ parent_class->parent_class.add_header (medium, name, value);
}
static void
-remove_header (CamelMedium *medium, const char *header_name)
+remove_header (CamelMedium *medium, const char *name)
{
- process_header (medium, header_name, NULL);
- parent_class->parent_class.remove_header (medium, header_name);
+ process_header (medium, name, NULL);
+ parent_class->parent_class.remove_header (medium, name);
}
typedef gboolean (*CamelPartFunc)(CamelMimeMessage *, CamelMimePart *, void *data);
@@ -698,7 +698,7 @@ find_best_encoding (CamelMimePart *part, CamelBestencRequired required, CamelBes
return CAMEL_MIME_PART_ENCODING_DEFAULT;
}
- istext = header_content_type_is (((CamelDataWrapper *) part)->mime_type, "text", "*");
+ istext = camel_content_type_is (((CamelDataWrapper *) part)->mime_type, "text", "*");
if (istext) {
flags = CAMEL_BESTENC_GET_CHARSET | CAMEL_BESTENC_GET_ENCODING;
enctype |= CAMEL_BESTENC_TEXT;
@@ -718,7 +718,7 @@ find_best_encoding (CamelMimePart *part, CamelBestencRequired required, CamelBes
/* if we're looking for the best charset, then we need to convert to UTF-8 */
if (istext && (required & CAMEL_BESTENC_GET_CHARSET) != 0
- && (charsetin = header_content_type_param (content->mime_type, "charset"))) {
+ && (charsetin = camel_content_type_param (content->mime_type, "charset"))) {
charenc = camel_mime_filter_charset_new_convert (charsetin, "UTF-8");
if (charenc != NULL)
idc = camel_stream_filter_add (filter, (CamelMimeFilter *)charenc);
@@ -741,7 +741,7 @@ find_best_encoding (CamelMimePart *part, CamelBestencRequired required, CamelBes
d(printf("best charset = %s\n", charsetin ? charsetin : "(null)"));
charset = g_strdup (charsetin);
- charsetin = header_content_type_param (content->mime_type, "charset");
+ charsetin = camel_content_type_param (content->mime_type, "charset");
} else {
charset = NULL;
}
@@ -813,13 +813,13 @@ best_encoding (CamelMimeMessage *msg, CamelMimePart *part, void *datap)
camel_mime_part_set_encoding (part, encoding);
if ((data->required & CAMEL_BESTENC_GET_CHARSET) != 0) {
- if (header_content_type_is (((CamelDataWrapper *) part)->mime_type, "text", "*")) {
+ if (camel_content_type_is (((CamelDataWrapper *) part)->mime_type, "text", "*")) {
char *newct;
/* FIXME: ick, the part content_type interface needs fixing bigtime */
- header_content_type_set_param (((CamelDataWrapper *) part)->mime_type, "charset",
+ camel_content_type_set_param (((CamelDataWrapper *) part)->mime_type, "charset",
charset ? charset : "us-ascii");
- newct = header_content_type_format (((CamelDataWrapper *) part)->mime_type);
+ newct = camel_content_type_format (((CamelDataWrapper *) part)->mime_type);
if (newct) {
d(printf("Setting content-type to %s\n", newct));
@@ -909,7 +909,7 @@ static char *tz_days[] = {
char *
camel_mime_message_build_mbox_from (CamelMimeMessage *message)
{
- struct _header_raw *header = ((CamelMimePart *)message)->headers;
+ struct _camel_header_raw *header = ((CamelMimePart *)message)->headers;
GString *out = g_string_new("From ");
char *ret;
const char *tmp;
@@ -917,11 +917,11 @@ camel_mime_message_build_mbox_from (CamelMimeMessage *message)
int offset;
struct tm tm;
- tmp = header_raw_find (&header, "Sender", NULL);
+ tmp = camel_header_raw_find (&header, "Sender", NULL);
if (tmp == NULL)
- tmp = header_raw_find (&header, "From", NULL);
+ tmp = camel_header_raw_find (&header, "From", NULL);
if (tmp != NULL) {
- struct _header_address *addr = header_address_decode (tmp, NULL);
+ struct _camel_header_address *addr = camel_header_address_decode (tmp, NULL);
tmp = NULL;
if (addr) {
@@ -929,7 +929,7 @@ camel_mime_message_build_mbox_from (CamelMimeMessage *message)
g_string_append (out, addr->v.addr);
tmp = "";
}
- header_address_unref (addr);
+ camel_header_address_unref (addr);
}
}
@@ -937,7 +937,7 @@ camel_mime_message_build_mbox_from (CamelMimeMessage *message)
g_string_append (out, "unknown@nodomain.now.au");
/* try use the received header to get the date */
- tmp = header_raw_find (&header, "Received", NULL);
+ tmp = camel_header_raw_find (&header, "Received", NULL);
if (tmp) {
tmp = strrchr(tmp, ';');
if (tmp)
@@ -946,9 +946,9 @@ camel_mime_message_build_mbox_from (CamelMimeMessage *message)
/* if there isn't one, try the Date field */
if (tmp == NULL)
- tmp = header_raw_find (&header, "Date", NULL);
+ tmp = camel_header_raw_find (&header, "Date", NULL);
- thetime = header_decode_date (tmp, &offset);
+ thetime = camel_header_decode_date (tmp, &offset);
thetime += ((offset / 100) * (60 * 60)) + (offset % 100) * 60;
gmtime_r (&thetime, &tm);
g_string_append_printf (out, " %s %s %2d %02d:%02d:%02d %4d\n",
diff --git a/camel/camel-mime-parser.c b/camel/camel-mime-parser.c
index decac00db7..7f2c515b3b 100644
--- a/camel/camel-mime-parser.c
+++ b/camel/camel-mime-parser.c
@@ -203,7 +203,7 @@ struct _header_scan_state {
/* global state */
- enum _header_state state;
+ enum _camel_mime_parser_state state;
/* for building headers during scanning */
char *outbuf;
@@ -248,14 +248,14 @@ struct _header_scan_state {
struct _header_scan_stack {
struct _header_scan_stack *parent;
- enum _header_state savestate; /* state at invocation of this part */
+ enum _camel_mime_parser_state savestate; /* state at invocation of this part */
#ifdef MEMPOOL
MemPool *pool; /* memory pool to keep track of headers/etc at this level */
#endif
- struct _header_raw *headers; /* headers for this part */
+ struct _camel_header_raw *headers; /* headers for this part */
- struct _header_content_type *content_type;
+ CamelContentType *content_type;
/* I dont use GString's casue you can't efficiently append a buffer to them */
GByteArray *pretext; /* for multipart types, save the pre-boundary data here */
@@ -297,23 +297,23 @@ static void camel_mime_parser_init (CamelMimeParser *obj);
#if d(!)0
static char *states[] = {
- "HSCAN_INITIAL",
- "HSCAN_PRE_FROM", /* pre-from data */
- "HSCAN_FROM", /* got 'From' line */
- "HSCAN_HEADER", /* toplevel header */
- "HSCAN_BODY", /* scanning body of message */
- "HSCAN_MULTIPART", /* got multipart header */
- "HSCAN_MESSAGE", /* rfc822/news message */
-
- "HSCAN_PART", /* part of a multipart */
-
- "HSCAN_EOF", /* end of file */
- "HSCAN_PRE_FROM_END",
- "HSCAN_FROM_END",
- "HSCAN_HEAER_END",
- "HSCAN_BODY_END",
- "HSCAN_MULTIPART_END",
- "HSCAN_MESSAGE_END",
+ "CAMEL_MIME_PARSER_STATE_INITIAL",
+ "CAMEL_MIME_PARSER_STATE_PRE_FROM", /* pre-from data */
+ "CAMEL_MIME_PARSER_STATE_FROM", /* got 'From' line */
+ "CAMEL_MIME_PARSER_STATE_HEADER", /* toplevel header */
+ "CAMEL_MIME_PARSER_STATE_BODY", /* scanning body of message */
+ "CAMEL_MIME_PARSER_STATE_MULTIPART", /* got multipart header */
+ "CAMEL_MIME_PARSER_STATE_MESSAGE", /* rfc822/news message */
+
+ "CAMEL_MIME_PARSER_STATE_PART", /* part of a multipart */
+
+ "CAMEL_MIME_PARSER_STATE_EOF", /* end of file */
+ "CAMEL_MIME_PARSER_STATE_PRE_FROM_END",
+ "CAMEL_MIME_PARSER_STATE_FROM_END",
+ "CAMEL_MIME_PARSER_STATE_HEAER_END",
+ "CAMEL_MIME_PARSER_STATE_BODY_END",
+ "CAMEL_MIME_PARSER_STATE_MULTIPART_END",
+ "CAMEL_MIME_PARSER_STATE_MESSAGE_END",
};
#endif
@@ -388,7 +388,7 @@ camel_mime_parser_new (void)
*
* Note that filters are only applied to the body content of messages, and once
* a filter has been set, all content returned by a filter_step() with a state
- * of HSCAN_BODY will have passed through the filter.
+ * of CAMEL_MIME_PARSER_STATE_BODY will have passed through the filter.
*
* Return value: An id that may be passed to filter_remove() to remove
* the filter, or -1 if the operation failed.
@@ -462,7 +462,7 @@ camel_mime_parser_header(CamelMimeParser *m, const char *name, int *offset)
if (s->parts &&
s->parts->headers) {
- return header_raw_find(&s->parts->headers, name, offset);
+ return camel_header_raw_find(&s->parts->headers, name, offset);
}
return NULL;
}
@@ -478,7 +478,7 @@ camel_mime_parser_header(CamelMimeParser *m, const char *name, int *offset)
* Return value: The raw headers, or NULL if there are no headers
* defined for the current part or state. These are READ ONLY.
**/
-struct _header_raw *
+struct _camel_header_raw *
camel_mime_parser_headers_raw(CamelMimeParser *m)
{
struct _header_scan_state *s = _PRIVATE(m);
@@ -505,7 +505,7 @@ byte_array_to_string(GByteArray *array)
* @m:
*
* Retrieve the preface text for the current multipart.
- * Can only be used when the state is HSCAN_MULTIPART_END.
+ * Can only be used when the state is CAMEL_MIME_PARSER_STATE_MULTIPART_END.
*
* Return value: The preface text, or NULL if there wasn't any.
**/
@@ -526,7 +526,7 @@ camel_mime_parser_preface(CamelMimeParser *m)
*
* Retrieve the postface text for the current multipart.
* Only returns valid data when the current state if
- * HSCAN_MULTIPART_END.
+ * CAMEL_MIME_PARSER_STATE_MULTIPART_END.
*
* Return value: The postface text, or NULL if there wasn't any.
**/
@@ -546,10 +546,10 @@ camel_mime_parser_postface(CamelMimeParser *m)
* @m:
*
* Get the last scanned "From " line, from a recently scanned from.
- * This should only be called in the HSCAN_FROM state. The
+ * This should only be called in the CAMEL_MIME_PARSER_STATE_FROM state. The
* from line will include the closing \n found (if there was one).
*
- * The return value will remain valid while in the HSCAN_FROM
+ * The return value will remain valid while in the CAMEL_MIME_PARSER_STATE_FROM
* state, or any deeper state.
*
* Return value: The From line, or NULL if called out of context.
@@ -607,46 +607,48 @@ camel_mime_parser_init_with_stream(CamelMimeParser *m, CamelStream *stream)
/**
* camel_mime_parser_scan_from:
- * @m:
+ * @parser: MIME parser object
* @scan_from: #TRUE if the scanner should scan From lines.
*
* Tell the scanner if it should scan "^From " lines or not.
*
* If the scanner is scanning from lines, two additional
- * states HSCAN_FROM and HSCAN_FROM_END will be returned
+ * states CAMEL_MIME_PARSER_STATE_FROM and CAMEL_MIME_PARSER_STATE_FROM_END will be returned
* to the caller during parsing.
*
* This may also be preceeded by an optional
- * HSCAN_PRE_FROM state which contains the scanned data
+ * CAMEL_MIME_PARSER_STATE_PRE_FROM state which contains the scanned data
* found before the From line is encountered. See also
* scan_pre_from().
**/
void
-camel_mime_parser_scan_from(CamelMimeParser *m, int scan_from)
+camel_mime_parser_scan_from (CamelMimeParser *parser, gboolean scan_from)
{
- struct _header_scan_state *s = _PRIVATE(m);
+ struct _header_scan_state *s = _PRIVATE (parser);
+
s->scan_from = scan_from;
}
/**
* camel_mime_parser_scan_pre_from:
- * @:
+ * @parser: MIME parser object
* @scan_pre_from: #TRUE if we want to get pre-from data.
*
* Tell the scanner whether we want to know abou the pre-from
* data during a scan. If we do, then we may get an additional
- * state HSCAN_PRE_FROM which returns the specified data.
+ * state CAMEL_MIME_PARSER_STATE_PRE_FROM which returns the specified data.
**/
void
-camel_mime_parser_scan_pre_from(CamelMimeParser *m, int scan_pre_from)
+camel_mime_parser_scan_pre_from (CamelMimeParser *parser, gboolean scan_pre_from)
{
- struct _header_scan_state *s = _PRIVATE(m);
+ struct _header_scan_state *s = _PRIVATE (parser);
+
s->scan_pre_from = scan_pre_from;
}
/**
* camel_mime_parser_content_type:
- * @m:
+ * @parser: MIME parser object
*
* Get the content type defined in the current part.
*
@@ -654,21 +656,22 @@ camel_mime_parser_scan_pre_from(CamelMimeParser *m, int scan_pre_from)
* is no content-type defined for this part of state of the
* parser.
**/
-struct _header_content_type *
-camel_mime_parser_content_type(CamelMimeParser *m)
+CamelContentType *
+camel_mime_parser_content_type (CamelMimeParser *parser)
{
- struct _header_scan_state *s = _PRIVATE(m);
-
+ struct _header_scan_state *s = _PRIVATE (parser);
+
/* FIXME: should this search up until it's found the 'right'
content-type? can it? */
if (s->parts)
return s->parts->content_type;
+
return NULL;
}
/**
* camel_mime_parser_unstep:
- * @m:
+ * @parser: MIME parser object
*
* Cause the last step operation to repeat itself. If this is
* called repeated times, then the same step will be repeated
@@ -677,16 +680,17 @@ camel_mime_parser_content_type(CamelMimeParser *m)
* Note that it is not possible to scan back using this function,
* only to have a way of peeking the next state.
**/
-void camel_mime_parser_unstep(CamelMimeParser *m)
+void
+camel_mime_parser_unstep (CamelMimeParser *parser)
{
- struct _header_scan_state *s = _PRIVATE(m);
-
+ struct _header_scan_state *s = _PRIVATE (parser);
+
s->unstep++;
}
/**
* camel_mime_parser_drop_step:
- * @m:
+ * @parser: MIME parser object
*
* Drop the last step call. This should only be used
* in conjunction with seeking of the stream as the
@@ -695,17 +699,18 @@ void camel_mime_parser_unstep(CamelMimeParser *m)
*
* Use this call with care.
**/
-void camel_mime_parser_drop_step(CamelMimeParser *m)
+void
+camel_mime_parser_drop_step (CamelMimeParser *parser)
{
- struct _header_scan_state *s = _PRIVATE(m);
-
+ struct _header_scan_state *s = _PRIVATE (parser);
+
s->unstep = 0;
folder_scan_drop_step(s);
}
/**
* camel_mime_parser_step:
- * @m:
+ * @parser: MIME parser object
* @databuffer: Pointer to accept a pointer to the data
* associated with this step (if any). May be #NULL,
* in which case datalength is also ingored.
@@ -716,7 +721,7 @@ void camel_mime_parser_drop_step(CamelMimeParser *m)
* has been called, then continue to return the same state
* for that many calls.
*
- * If the step is HSCAN_BODY then the databuffer and datalength
+ * If the step is CAMEL_MIME_PARSER_STATE_BODY then the databuffer and datalength
* pointers will be setup to point to the internal data buffer
* of the scanner and may be processed as required. Any
* filters will have already been applied to this data.
@@ -728,10 +733,10 @@ void camel_mime_parser_drop_step(CamelMimeParser *m)
* Return value: The current new state of the parser
* is returned.
**/
-enum _header_state
-camel_mime_parser_step(CamelMimeParser *m, char **databuffer, size_t *datalength)
+enum _camel_mime_parser_state
+camel_mime_parser_step (CamelMimeParser *parser, char **databuffer, size_t *datalength)
{
- struct _header_scan_state *s = _PRIVATE(m);
+ struct _header_scan_state *s = _PRIVATE (parser);
d(printf("OLD STATE: '%s' :\n", states[s->state]));
@@ -755,7 +760,7 @@ camel_mime_parser_step(CamelMimeParser *m, char **databuffer, size_t *datalength
/**
* camel_mime_parser_read:
- * @m:
+ * @parser: MIME parser object
* @databuffer:
* @len:
*
@@ -774,9 +779,9 @@ camel_mime_parser_step(CamelMimeParser *m, char **databuffer, size_t *datalength
* Return value: The number of bytes available, or -1 on error.
**/
int
-camel_mime_parser_read(CamelMimeParser *m, const char **databuffer, int len)
+camel_mime_parser_read (CamelMimeParser *parser, const char **databuffer, int len)
{
- struct _header_scan_state *s = _PRIVATE(m);
+ struct _header_scan_state *s = _PRIVATE (parser);
int there;
if (len == 0)
@@ -806,34 +811,35 @@ camel_mime_parser_read(CamelMimeParser *m, const char **databuffer, int len)
/**
* camel_mime_parser_tell:
- * @m:
+ * @parser: MIME parser object
*
* Return the current scanning offset. The meaning of this
* value will depend on the current state of the parser.
*
* An incomplete listing of the states:
*
- * HSCAN_INITIAL, The start of the current message.
- * HSCAN_HEADER, HSCAN_MESSAGE, HSCAN_MULTIPART, the character
+ * CAMEL_MIME_PARSER_STATE_INITIAL, The start of the current message.
+ * CAMEL_MIME_PARSER_STATE_HEADER, CAMEL_MIME_PARSER_STATE_MESSAGE, CAMEL_MIME_PARSER_STATE_MULTIPART, the character
* position immediately after the end of the header.
- * HSCAN_BODY, Position within the message of the start
+ * CAMEL_MIME_PARSER_STATE_BODY, Position within the message of the start
* of the current data block.
- * HSCAN_*_END, The position of the character starting
+ * CAMEL_MIME_PARSER_STATE_*_END, The position of the character starting
* the next section of the scan (the last position + 1 of
* the respective current state).
*
* Return value: See above.
**/
-off_t camel_mime_parser_tell(CamelMimeParser *m)
+off_t
+camel_mime_parser_tell (CamelMimeParser *parser)
{
- struct _header_scan_state *s = _PRIVATE(m);
+ struct _header_scan_state *s = _PRIVATE (parser);
return folder_tell(s);
}
/**
* camel_mime_parser_tell_start_headers:
- * @m:
+ * @parser: MIME parser object
*
* Find out the position within the file of where the
* headers started, this is cached by the parser
@@ -842,16 +848,17 @@ off_t camel_mime_parser_tell(CamelMimeParser *m)
* Return value: The header start position, or -1 if
* no headers were scanned in the current state.
**/
-off_t camel_mime_parser_tell_start_headers(CamelMimeParser *m)
+off_t
+camel_mime_parser_tell_start_headers (CamelMimeParser *parser)
{
- struct _header_scan_state *s = _PRIVATE(m);
+ struct _header_scan_state *s = _PRIVATE (parser);
return s->start_of_headers;
}
/**
* camel_mime_parser_tell_start_from:
- * @m:
+ * @parser: MIME parser object
*
* If the parser is scanning From lines, then this returns
* the position of the start of the From line.
@@ -859,17 +866,18 @@ off_t camel_mime_parser_tell_start_headers(CamelMimeParser *m)
* Return value: The start of the from line, or -1 if there
* was no From line, or From lines are not being scanned.
**/
-off_t camel_mime_parser_tell_start_from(CamelMimeParser *m)
+off_t
+camel_mime_parser_tell_start_from (CamelMimeParser *parser)
{
- struct _header_scan_state *s = _PRIVATE(m);
+ struct _header_scan_state *s = _PRIVATE (parser);
return s->start_of_from;
}
/**
* camel_mime_parser_seek:
- * @m:
- * @off: Number of bytes to offset the seek by.
+ * @parser: MIME parser object
+ * @offset: Number of bytes to offset the seek by.
* @whence: SEEK_SET, SEEK_CUR, SEEK_END
*
* Reset the source position to a known value.
@@ -883,29 +891,33 @@ off_t camel_mime_parser_tell_start_from(CamelMimeParser *m)
* an error (for example, trying to seek on a non-seekable
* stream or file descriptor).
**/
-off_t camel_mime_parser_seek(CamelMimeParser *m, off_t off, int whence)
+off_t
+camel_mime_parser_seek(CamelMimeParser *parser, off_t offset, int whence)
{
- struct _header_scan_state *s = _PRIVATE(m);
- return folder_seek(s, off, whence);
+ struct _header_scan_state *s = _PRIVATE (parser);
+
+ return folder_seek(s, offset, whence);
}
/**
* camel_mime_parser_state:
- * @m:
+ * @parser: MIME parser object
*
* Get the current parser state.
*
* Return value: The current parser state.
**/
-enum _header_state camel_mime_parser_state(CamelMimeParser *m)
+enum _camel_mime_parser_state
+camel_mime_parser_state (CamelMimeParser *parser)
{
- struct _header_scan_state *s = _PRIVATE(m);
+ struct _header_scan_state *s = _PRIVATE (parser);
+
return s->state;
}
/**
* camel_mime_parser_stream:
- * @m:
+ * @parser: MIME parser object
*
* Get the stream, if any, the parser has been initialised
* with. May be used to setup sub-streams, but should not
@@ -916,15 +928,17 @@ enum _header_state camel_mime_parser_state(CamelMimeParser *m)
* if the parser is reading from a file descriptor or is
* uninitialised.
**/
-CamelStream *camel_mime_parser_stream(CamelMimeParser *m)
+CamelStream *
+camel_mime_parser_stream (CamelMimeParser *parser)
{
- struct _header_scan_state *s = _PRIVATE(m);
+ struct _header_scan_state *s = _PRIVATE (parser);
+
return s->stream;
}
/**
* camel_mime_parser_fd:
- * @m:
+ * @parser: MIME parser object
*
* Return the file descriptor, if any, the parser has been
* initialised with.
@@ -936,17 +950,20 @@ CamelStream *camel_mime_parser_stream(CamelMimeParser *m)
* Return value: The file descriptor or -1 if the parser
* is reading from a stream or has not been initialised.
**/
-int camel_mime_parser_fd(CamelMimeParser *m)
+int
+camel_mime_parser_fd (CamelMimeParser *parser)
{
- struct _header_scan_state *s = _PRIVATE(m);
+ struct _header_scan_state *s = _PRIVATE (parser);
+
return s->fd;
}
/* Return errno of the parser, incase any error occured during processing */
-int camel_mime_parser_errno(CamelMimeParser *m)
+int
+camel_mime_parser_errno (CamelMimeParser *parser)
{
- struct _header_scan_state *s = _PRIVATE(m);
-
+ struct _header_scan_state *s = _PRIVATE (parser);
+
return s->ioerrno;
}
@@ -1071,9 +1088,9 @@ folder_pull_part(struct _header_scan_state *s)
#ifdef MEMPOOL
mempool_free(h->pool);
#else
- header_raw_clear(&h->headers);
+ camel_header_raw_clear(&h->headers);
#endif
- header_content_type_unref(h->content_type);
+ camel_content_type_unref(h->content_type);
if (h->pretext)
g_byte_array_free(h->pretext, TRUE);
if (h->posttext)
@@ -1169,7 +1186,7 @@ folder_boundary_check(struct _header_scan_state *s, const char *boundary, int *l
static void
header_append_mempool(struct _header_scan_state *s, struct _header_scan_stack *h, char *header, int offset)
{
- struct _header_raw *l, *n;
+ struct _camel_header_raw *l, *n;
char *content;
content = strchr(header, ':');
@@ -1192,7 +1209,7 @@ header_append_mempool(struct _header_scan_state *s, struct _header_scan_stack *h
n->offset = offset;
- l = (struct _header_raw *)&h->headers;
+ l = (struct _camel_header_raw *)&h->headers;
while (l->next) {
l = l->next;
}
@@ -1519,7 +1536,7 @@ folder_scan_init(void)
s->parts = NULL;
- s->state = HSCAN_INITIAL;
+ s->state = CAMEL_MIME_PARSER_STATE_INITIAL;
return s;
}
@@ -1530,7 +1547,7 @@ drop_states(struct _header_scan_state *s)
folder_scan_drop_step(s);
}
s->unstep = 0;
- s->state = HSCAN_INITIAL;
+ s->state = CAMEL_MIME_PARSER_STATE_INITIAL;
}
static void
@@ -1581,7 +1598,7 @@ folder_scan_step(struct _header_scan_state *s, char **databuffer, size_t *datale
const char *bound;
int type;
int state;
- struct _header_content_type *ct = NULL;
+ CamelContentType *ct = NULL;
struct _header_scan_filter *f;
size_t presize;
@@ -1608,7 +1625,7 @@ tail_recurse:
switch (s->state) {
#ifdef USE_FROM
- case HSCAN_INITIAL:
+ case CAMEL_MIME_PARSER_STATE_INITIAL:
if (s->scan_from) {
h = g_malloc0(sizeof(*h));
h->boundary = g_strdup("From ");
@@ -1616,13 +1633,13 @@ tail_recurse:
h->boundarylenfinal = h->boundarylen;
h->from_line = g_byte_array_new();
folder_push_part(s, h);
- s->state = HSCAN_PRE_FROM;
+ s->state = CAMEL_MIME_PARSER_STATE_PRE_FROM;
} else {
s->start_of_from = -1;
goto scan_header;
}
- case HSCAN_PRE_FROM:
+ case CAMEL_MIME_PARSER_STATE_PRE_FROM:
h = s->parts;
do {
@@ -1637,68 +1654,68 @@ tail_recurse:
d(printf("found 'From '\n"));
s->start_of_from = folder_tell(s);
folder_scan_skip_line(s, h->from_line);
- h->savestate = HSCAN_INITIAL;
- s->state = HSCAN_FROM;
+ h->savestate = CAMEL_MIME_PARSER_STATE_INITIAL;
+ s->state = CAMEL_MIME_PARSER_STATE_FROM;
} else {
folder_pull_part(s);
- s->state = HSCAN_EOF;
+ s->state = CAMEL_MIME_PARSER_STATE_EOF;
}
return;
#else
- case HSCAN_INITIAL:
- case HSCAN_PRE_FROM:
+ case CAMEL_MIME_PARSER_STATE_INITIAL:
+ case CAMEL_MIME_PARSER_STATE_PRE_FROM:
#endif /* !USE_FROM */
scan_header:
- case HSCAN_FROM:
+ case CAMEL_MIME_PARSER_STATE_FROM:
s->start_of_headers = folder_tell(s);
h = folder_scan_header(s, &state);
#ifdef USE_FROM
if (s->scan_from)
- h->savestate = HSCAN_FROM_END;
+ h->savestate = CAMEL_MIME_PARSER_STATE_FROM_END;
else
#endif
- h->savestate = HSCAN_EOF;
+ h->savestate = CAMEL_MIME_PARSER_STATE_EOF;
/* FIXME: should this check for MIME-Version: 1.0 as well? */
- type = HSCAN_HEADER;
- if ( (content = header_raw_find(&h->headers, "Content-Type", NULL))
- && (ct = header_content_type_decode(content))) {
+ type = CAMEL_MIME_PARSER_STATE_HEADER;
+ if ( (content = camel_header_raw_find(&h->headers, "Content-Type", NULL))
+ && (ct = camel_content_type_decode(content))) {
if (!strcasecmp(ct->type, "multipart")) {
- if (!header_content_type_is(ct, "multipart", "signed")
- && (bound = header_content_type_param(ct, "boundary"))) {
+ if (!camel_content_type_is(ct, "multipart", "signed")
+ && (bound = camel_content_type_param(ct, "boundary"))) {
d(printf("multipart, boundary = %s\n", bound));
h->boundarylen = strlen(bound)+2;
h->boundarylenfinal = h->boundarylen+2;
h->boundary = g_malloc(h->boundarylen+3);
sprintf(h->boundary, "--%s--", bound);
- type = HSCAN_MULTIPART;
+ type = CAMEL_MIME_PARSER_STATE_MULTIPART;
} else {
- /*header_content_type_unref(ct);
- ct = header_content_type_decode("text/plain");*/
+ /*camel_content_type_unref(ct);
+ ct = camel_content_type_decode("text/plain");*/
/* We can't quite do this, as it will mess up all the offsets ... */
-/* header_raw_replace(&h->headers, "Content-Type", "text/plain", offset);*/
+/* camel_header_raw_replace(&h->headers, "Content-Type", "text/plain", offset);*/
/*g_warning("Multipart with no boundary, treating as text/plain");*/
}
} else if (!strcasecmp(ct->type, "message")) {
if (!strcasecmp(ct->subtype, "rfc822")
|| !strcasecmp(ct->subtype, "news")
/*|| !strcasecmp(ct->subtype, "partial")*/) {
- type = HSCAN_MESSAGE;
+ type = CAMEL_MIME_PARSER_STATE_MESSAGE;
}
}
} else {
/* make the default type for multipart/digest be message/rfc822 */
if ((s->parts
- && header_content_type_is(s->parts->content_type, "multipart", "digest"))) {
- ct = header_content_type_decode("message/rfc822");
- type = HSCAN_MESSAGE;
+ && camel_content_type_is(s->parts->content_type, "multipart", "digest"))) {
+ ct = camel_content_type_decode("message/rfc822");
+ type = CAMEL_MIME_PARSER_STATE_MESSAGE;
d(printf("parent was multipart/digest, autoupgrading to message/rfc822?\n"));
/* maybe we should do this too?
header_raw_append_parse(&h->headers, "Content-Type: message/rfc822", -1);*/
} else {
- ct = header_content_type_decode("text/plain");
+ ct = camel_content_type_decode("text/plain");
}
}
h->content_type = ct;
@@ -1706,10 +1723,10 @@ tail_recurse:
s->state = type;
return;
- case HSCAN_HEADER:
- s->state = HSCAN_BODY;
+ case CAMEL_MIME_PARSER_STATE_HEADER:
+ s->state = CAMEL_MIME_PARSER_STATE_BODY;
- case HSCAN_BODY:
+ case CAMEL_MIME_PARSER_STATE_BODY:
h = s->parts;
*datalength = 0;
presize = SCAN_HEAD;
@@ -1745,10 +1762,10 @@ tail_recurse:
if (*datalength > 0)
return;
- s->state = HSCAN_BODY_END;
+ s->state = CAMEL_MIME_PARSER_STATE_BODY_END;
break;
- case HSCAN_MULTIPART:
+ case CAMEL_MIME_PARSER_STATE_MULTIPART:
h = s->parts;
do {
do {
@@ -1774,9 +1791,9 @@ tail_recurse:
d(printf("got boundary: %s\n", hb->boundary));
folder_scan_skip_line(s, NULL);
if (!state) {
- s->state = HSCAN_FROM;
+ s->state = CAMEL_MIME_PARSER_STATE_FROM;
folder_scan_step(s, databuffer, datalength);
- s->parts->savestate = HSCAN_MULTIPART; /* set return state for the new head part */
+ s->parts->savestate = CAMEL_MIME_PARSER_STATE_MULTIPART; /* set return state for the new head part */
return;
}
} else {
@@ -1784,26 +1801,26 @@ tail_recurse:
}
} while (1);
- s->state = HSCAN_MULTIPART_END;
+ s->state = CAMEL_MIME_PARSER_STATE_MULTIPART_END;
break;
- case HSCAN_MESSAGE:
- s->state = HSCAN_FROM;
+ case CAMEL_MIME_PARSER_STATE_MESSAGE:
+ s->state = CAMEL_MIME_PARSER_STATE_FROM;
folder_scan_step(s, databuffer, datalength);
- s->parts->savestate = HSCAN_MESSAGE_END;
+ s->parts->savestate = CAMEL_MIME_PARSER_STATE_MESSAGE_END;
break;
- case HSCAN_FROM_END:
- case HSCAN_BODY_END:
- case HSCAN_MULTIPART_END:
- case HSCAN_MESSAGE_END:
+ case CAMEL_MIME_PARSER_STATE_FROM_END:
+ case CAMEL_MIME_PARSER_STATE_BODY_END:
+ case CAMEL_MIME_PARSER_STATE_MULTIPART_END:
+ case CAMEL_MIME_PARSER_STATE_MESSAGE_END:
s->state = s->parts->savestate;
folder_pull_part(s);
- if (s->state & HSCAN_END)
+ if (s->state & CAMEL_MIME_PARSER_STATE_END)
return;
goto tail_recurse;
- case HSCAN_EOF:
+ case CAMEL_MIME_PARSER_STATE_EOF:
return;
default:
@@ -1819,30 +1836,30 @@ static void
folder_scan_drop_step(struct _header_scan_state *s)
{
switch (s->state) {
- case HSCAN_EOF:
- s->state = HSCAN_INITIAL;
- case HSCAN_INITIAL:
+ case CAMEL_MIME_PARSER_STATE_EOF:
+ s->state = CAMEL_MIME_PARSER_STATE_INITIAL;
+ case CAMEL_MIME_PARSER_STATE_INITIAL:
return;
- case HSCAN_FROM:
- case HSCAN_PRE_FROM:
- s->state = HSCAN_INITIAL;
+ case CAMEL_MIME_PARSER_STATE_FROM:
+ case CAMEL_MIME_PARSER_STATE_PRE_FROM:
+ s->state = CAMEL_MIME_PARSER_STATE_INITIAL;
folder_pull_part(s);
return;
- case HSCAN_MESSAGE:
- case HSCAN_HEADER:
- case HSCAN_MULTIPART:
+ case CAMEL_MIME_PARSER_STATE_MESSAGE:
+ case CAMEL_MIME_PARSER_STATE_HEADER:
+ case CAMEL_MIME_PARSER_STATE_MULTIPART:
- case HSCAN_FROM_END:
- case HSCAN_BODY_END:
- case HSCAN_MULTIPART_END:
- case HSCAN_MESSAGE_END:
+ case CAMEL_MIME_PARSER_STATE_FROM_END:
+ case CAMEL_MIME_PARSER_STATE_BODY_END:
+ case CAMEL_MIME_PARSER_STATE_MULTIPART_END:
+ case CAMEL_MIME_PARSER_STATE_MESSAGE_END:
s->state = s->parts->savestate;
folder_pull_part(s);
- if (s->state & HSCAN_END) {
- s->state &= ~HSCAN_END;
+ if (s->state & CAMEL_MIME_PARSER_STATE_END) {
+ s->state &= ~CAMEL_MIME_PARSER_STATE_END;
}
return;
default:
@@ -1886,16 +1903,16 @@ int main(int argc, char **argv)
s->scan_from = FALSE;
#if 0
h = g_malloc0(sizeof(*h));
- h->savestate = HSCAN_EOF;
+ h->savestate = CAMEL_MIME_PARSER_STATE_EOF;
folder_push_part(s, h);
#endif
- while (s->state != HSCAN_EOF) {
+ while (s->state != CAMEL_MIME_PARSER_STATE_EOF) {
folder_scan_step(s, &data, &len);
printf("\n -- PARSER STEP RETURN -- %d '%s'\n\n", s->state, states[s->state]);
switch (s->state) {
- case HSCAN_HEADER:
+ case CAMEL_MIME_PARSER_STATE_HEADER:
if (s->parts->content_type
- && (charset = header_content_type_param(s->parts->content_type, "charset"))) {
+ && (charset = camel_content_type_param(s->parts->content_type, "charset"))) {
if (strcasecmp(charset, "us-ascii")) {
#if 0
folder_push_filter_charset(s, "UTF-8", charset);
@@ -1907,7 +1924,7 @@ int main(int argc, char **argv)
charset = NULL;
}
- encoding = header_raw_find(&s->parts->headers, "Content-transfer-encoding", 0);
+ encoding = camel_header_raw_find(&s->parts->headers, "Content-transfer-encoding", 0);
printf("encoding = '%s'\n", encoding);
if (encoding && !strncasecmp(encoding, " base64", 7)) {
printf("adding base64 filter\n");
@@ -1933,10 +1950,10 @@ int main(int argc, char **argv)
}
break;
- case HSCAN_BODY:
+ case CAMEL_MIME_PARSER_STATE_BODY:
printf("got body %d '%.*s'\n", len, len, data);
break;
- case HSCAN_BODY_END:
+ case CAMEL_MIME_PARSER_STATE_BODY_END:
printf("end body %d '%.*s'\n", len, len, data);
if (encoding && !strncasecmp(encoding, " base64", 7)) {
printf("removing filters\n");
diff --git a/camel/camel-mime-parser.h b/camel/camel-mime-parser.h
index 25571bfb1c..db85133cbc 100644
--- a/camel/camel-mime-parser.h
+++ b/camel/camel-mime-parser.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 2000 Ximian Inc.
+ * Copyright (C) 2000-2003 Ximian Inc.
*
* Authors: Michael Zucchi <notzed@ximian.com>
*
@@ -43,27 +43,26 @@ typedef struct _CamelMimeParserClass CamelMimeParserClass;
/* NOTE: if you add more states, you may need to bump the
start of the END tags to 16 or 32, etc - so they are
the same as the matching start tag, with a bit difference */
-enum _header_state {
- HSCAN_INITIAL,
- HSCAN_PRE_FROM, /* data before a 'From' line */
- HSCAN_FROM, /* got 'From' line */
- HSCAN_HEADER, /* toplevel header */
- HSCAN_BODY, /* scanning body of message */
- HSCAN_MULTIPART, /* got multipart header */
- HSCAN_MESSAGE, /* rfc822 message */
-
- HSCAN_PART, /* part of a multipart */
-
- HSCAN_END = 8, /* bit mask for 'end' flags */
-
- HSCAN_EOF = 8, /* end of file */
- HSCAN_PRE_FROM_END, /* pre from end */
- HSCAN_FROM_END, /* end of whole from bracket */
- HSCAN_HEADER_END, /* dummy value */
- HSCAN_BODY_END, /* end of message */
- HSCAN_MULTIPART_END, /* end of multipart */
- HSCAN_MESSAGE_END, /* end of message */
-
+enum _camel_mime_parser_state {
+ CAMEL_MIME_PARSER_STATE_INITIAL,
+ CAMEL_MIME_PARSER_STATE_PRE_FROM, /* data before a 'From' line */
+ CAMEL_MIME_PARSER_STATE_FROM, /* got 'From' line */
+ CAMEL_MIME_PARSER_STATE_HEADER, /* toplevel header */
+ CAMEL_MIME_PARSER_STATE_BODY, /* scanning body of message */
+ CAMEL_MIME_PARSER_STATE_MULTIPART, /* got multipart header */
+ CAMEL_MIME_PARSER_STATE_MESSAGE, /* rfc822 message */
+
+ CAMEL_MIME_PARSER_STATE_PART, /* part of a multipart */
+
+ CAMEL_MIME_PARSER_STATE_END = 8, /* bit mask for 'end' flags */
+
+ CAMEL_MIME_PARSER_STATE_EOF = 8, /* end of file */
+ CAMEL_MIME_PARSER_STATE_PRE_FROM_END, /* pre from end */
+ CAMEL_MIME_PARSER_STATE_FROM_END, /* end of whole from bracket */
+ CAMEL_MIME_PARSER_STATE_HEADER_END, /* dummy value */
+ CAMEL_MIME_PARSER_STATE_BODY_END, /* end of message */
+ CAMEL_MIME_PARSER_STATE_MULTIPART_END, /* end of multipart */
+ CAMEL_MIME_PARSER_STATE_MESSAGE_END, /* end of message */
};
struct _CamelMimeParser {
@@ -75,70 +74,70 @@ struct _CamelMimeParser {
struct _CamelMimeParserClass {
CamelObjectClass parent_class;
- void (*message)(CamelMimeParser *, void *headers);
- void (*part)(CamelMimeParser *);
- void (*content)(CamelMimeParser *);
+ void (*message) (CamelMimeParser *parser, void *headers);
+ void (*part) (CamelMimeParser *parser);
+ void (*content) (CamelMimeParser *parser);
};
-CamelType camel_mime_parser_get_type (void);
-CamelMimeParser *camel_mime_parser_new (void);
+CamelType camel_mime_parser_get_type (void);
+CamelMimeParser *camel_mime_parser_new (void);
/* quick-fix for parser not erroring, we can find out if it had an error afterwards */
-int camel_mime_parser_errno (CamelMimeParser *);
+int camel_mime_parser_errno (CamelMimeParser *parser);
/* using an fd will be a little faster, but not much (over a simple stream) */
-int camel_mime_parser_init_with_fd(CamelMimeParser *, int fd);
-int camel_mime_parser_init_with_stream(CamelMimeParser *m, CamelStream *stream);
+int camel_mime_parser_init_with_fd (CamelMimeParser *parser, int fd);
+int camel_mime_parser_init_with_stream (CamelMimeParser *parser, CamelStream *stream);
/* get the stream or fd back of the parser */
-CamelStream *camel_mime_parser_stream(CamelMimeParser *m);
-int camel_mime_parser_fd(CamelMimeParser *m);
+CamelStream *camel_mime_parser_stream (CamelMimeParser *parser);
+int camel_mime_parser_fd (CamelMimeParser *parser);
/* scan 'From' separators? */
-void camel_mime_parser_scan_from(CamelMimeParser *, int);
+void camel_mime_parser_scan_from (CamelMimeParser *parser, gboolean scan_from);
/* Do we want to know about the pre-from data? */
-void camel_mime_parser_scan_pre_from(CamelMimeParser *, int);
+void camel_mime_parser_scan_pre_from (CamelMimeParser *parser, gboolean scan_pre_from);
/* what headers to save, MUST include ^Content-Type: */
-int camel_mime_parser_set_header_regex(CamelMimeParser *m, char *matchstr);
+int camel_mime_parser_set_header_regex (CamelMimeParser *parser, char *matchstr);
/* normal interface */
-enum _header_state camel_mime_parser_step(CamelMimeParser *, char **, size_t *);
-void camel_mime_parser_unstep(CamelMimeParser *);
-void camel_mime_parser_drop_step(CamelMimeParser *m);
-enum _header_state camel_mime_parser_state(CamelMimeParser *);
+enum _camel_mime_parser_state camel_mime_parser_step (CamelMimeParser *parser, char **buf, size_t *buflen);
+void camel_mime_parser_unstep (CamelMimeParser *parser);
+void camel_mime_parser_drop_step (CamelMimeParser *parser);
+enum _camel_mime_parser_state camel_mime_parser_state (CamelMimeParser *parser);
/* read through the parser */
-int camel_mime_parser_read(CamelMimeParser *m, const char **databuffer, int len);
+int camel_mime_parser_read (CamelMimeParser *parser, const char **databuffer, int len);
/* get content type for the current part/header */
-struct _header_content_type *camel_mime_parser_content_type(CamelMimeParser *);
+CamelContentType *camel_mime_parser_content_type (CamelMimeParser *parser);
/* get/change raw header by name */
-const char *camel_mime_parser_header(CamelMimeParser *, const char *, int *offset);
+const char *camel_mime_parser_header (CamelMimeParser *parser, const char *name, int *offset);
/* get all raw headers. READ ONLY! */
-struct _header_raw *camel_mime_parser_headers_raw(CamelMimeParser *);
+struct _camel_header_raw *camel_mime_parser_headers_raw (CamelMimeParser *parser);
/* get multipart pre/postface */
-const char *camel_mime_parser_preface(CamelMimeParser *m);
-const char *camel_mime_parser_postface(CamelMimeParser *m);
+const char *camel_mime_parser_preface (CamelMimeParser *parser);
+const char *camel_mime_parser_postface (CamelMimeParser *parser);
/* return the from line content */
-const char *camel_mime_parser_from_line(CamelMimeParser *m);
+const char *camel_mime_parser_from_line (CamelMimeParser *parser);
/* add a processing filter for body contents */
-int camel_mime_parser_filter_add(CamelMimeParser *, CamelMimeFilter *);
-void camel_mime_parser_filter_remove(CamelMimeParser *, int);
+int camel_mime_parser_filter_add (CamelMimeParser *parser, CamelMimeFilter *filter);
+void camel_mime_parser_filter_remove (CamelMimeParser *parser, int id);
/* these should be used with caution, because the state will not
track the seeked position */
/* FIXME: something to bootstrap the state? */
-off_t camel_mime_parser_tell(CamelMimeParser *);
-off_t camel_mime_parser_seek(CamelMimeParser *, off_t, int);
+off_t camel_mime_parser_tell (CamelMimeParser *parser);
+off_t camel_mime_parser_seek (CamelMimeParser *parser, off_t offset, int whence);
-off_t camel_mime_parser_tell_start_headers(CamelMimeParser *);
-off_t camel_mime_parser_tell_start_from(CamelMimeParser *);
+off_t camel_mime_parser_tell_start_headers (CamelMimeParser *parser);
+off_t camel_mime_parser_tell_start_from (CamelMimeParser *parser);
#ifdef __cplusplus
}
diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c
index 0f80507fd7..e2df274abb 100644
--- a/camel/camel-mime-part-utils.c
+++ b/camel/camel-mime-part-utils.c
@@ -66,7 +66,7 @@ simple_data_wrapper_construct_from_parser (CamelDataWrapper *dw, CamelMimeParser
/* read in the entire content */
buffer = g_byte_array_new ();
- while (camel_mime_parser_step (mp, &buf, &len) != HSCAN_BODY_END) {
+ while (camel_mime_parser_step (mp, &buf, &len) != CAMEL_MIME_PARSER_STATE_BODY_END) {
d(printf("appending o/p data: %d: %.*s\n", len, len, buf));
g_byte_array_append (buffer, buf, len);
}
@@ -88,13 +88,13 @@ camel_mime_part_construct_content_from_parser (CamelMimePart *dw, CamelMimeParse
ct = camel_mime_parser_content_type (mp);
- encoding = header_content_encoding_decode (camel_mime_parser_header (mp, "Content-Transfer-Encoding", NULL));
+ encoding = camel_header_content_encoding_decode (camel_mime_parser_header (mp, "Content-Transfer-Encoding", NULL));
switch (camel_mime_parser_state (mp)) {
- case HSCAN_HEADER:
+ case CAMEL_MIME_PARSER_STATE_HEADER:
d(printf("Creating body part\n"));
/* multipart/signed is some fucked up type that we must treat as binary data, fun huh, idiots. */
- if (header_content_type_is (ct, "multipart", "signed")) {
+ if (camel_content_type_is (ct, "multipart", "signed")) {
content = (CamelDataWrapper *) camel_multipart_signed_new ();
camel_multipart_construct_from_parser ((CamelMultipart *) content, mp);
} else {
@@ -102,16 +102,16 @@ camel_mime_part_construct_content_from_parser (CamelMimePart *dw, CamelMimeParse
simple_data_wrapper_construct_from_parser (content, mp);
}
break;
- case HSCAN_MESSAGE:
+ case CAMEL_MIME_PARSER_STATE_MESSAGE:
d(printf("Creating message part\n"));
content = (CamelDataWrapper *) camel_mime_message_new ();
camel_mime_part_construct_from_parser ((CamelMimePart *)content, mp);
break;
- case HSCAN_MULTIPART:
+ case CAMEL_MIME_PARSER_STATE_MULTIPART:
d(printf("Creating multi-part\n"));
- if (header_content_type_is (ct, "multipart", "encrypted"))
+ if (camel_content_type_is (ct, "multipart", "encrypted"))
content = (CamelDataWrapper *) camel_multipart_encrypted_new ();
- else if (header_content_type_is (ct, "multipart", "signed"))
+ else if (camel_content_type_is (ct, "multipart", "signed"))
content = (CamelDataWrapper *) camel_multipart_signed_new ();
else
content = (CamelDataWrapper *) camel_multipart_new ();
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
index ac6e357b5b..88ec42c53d 100644
--- a/camel/camel-mime-part.c
+++ b/camel/camel-mime-part.c
@@ -4,8 +4,9 @@
/*
* Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
* Michael Zucchi <notzed@ximian.com>
+ * Jeffrey Stedfast <fejj@ximian.com>
*
- * Copyright 1999, 2000 Ximian, Inc. (www.ximian.com)
+ * Copyright 1999-2003 Ximian, Inc. (www.ximian.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
@@ -22,6 +23,7 @@
* USA
*/
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -76,10 +78,10 @@ static ssize_t write_to_stream (CamelDataWrapper *dw, Ca
static int construct_from_stream (CamelDataWrapper *dw, CamelStream *stream);
/* from CamelMedium */
-static void add_header (CamelMedium *medium, const char *header_name, const void *header_value);
-static void set_header (CamelMedium *medium, const char *header_name, const void *header_value);
-static void remove_header (CamelMedium *medium, const char *header_name);
-static const void *get_header (CamelMedium *medium, const char *header_name);
+static void add_header (CamelMedium *medium, const char *name, const void *value);
+static void set_header (CamelMedium *medium, const char *name, const void *value);
+static void remove_header (CamelMedium *medium, const char *name);
+static const void *get_header (CamelMedium *medium, const char *name);
static GArray *get_headers (CamelMedium *medium);
static void free_headers (CamelMedium *medium, GArray *headers);
@@ -92,9 +94,9 @@ static int construct_from_parser (CamelMimePart *mime_part
static void set_disposition (CamelMimePart *mime_part, const char *disposition);
/* format output of headers */
-static int write_references(CamelStream *stream, struct _header_raw *h);
-/*static int write_fold(CamelStream *stream, struct _header_raw *h);*/
-static int write_raw(CamelStream *stream, struct _header_raw *h);
+static int write_references(CamelStream *stream, struct _camel_header_raw *h);
+/*static int write_fold(CamelStream *stream, struct _camel_header_raw *h);*/
+static int write_raw(CamelStream *stream, struct _camel_header_raw *h);
/* loads in a hash table the set of header names we */
@@ -155,8 +157,8 @@ camel_mime_part_init (gpointer object, gpointer klass)
CamelMimePart *mime_part = CAMEL_MIME_PART (object);
if (((CamelDataWrapper *) mime_part)->mime_type)
- header_content_type_unref (((CamelDataWrapper *) mime_part)->mime_type);
- ((CamelDataWrapper *) mime_part)->mime_type = header_content_type_new ("text", "plain");
+ camel_content_type_unref (((CamelDataWrapper *) mime_part)->mime_type);
+ ((CamelDataWrapper *) mime_part)->mime_type = camel_content_type_new ("text", "plain");
mime_part->description = NULL;
mime_part->disposition = NULL;
@@ -178,9 +180,9 @@ camel_mime_part_finalize (CamelObject *object)
g_free (mime_part->content_MD5);
g_free (mime_part->content_location);
camel_string_list_free (mime_part->content_languages);
- header_disposition_unref(mime_part->disposition);
+ camel_content_disposition_unref(mime_part->disposition);
- header_raw_clear(&mime_part->headers);
+ camel_header_raw_clear(&mime_part->headers);
}
@@ -208,7 +210,7 @@ camel_mime_part_get_type (void)
/* **** */
static gboolean
-process_header(CamelMedium *medium, const char *header_name, const char *header_value)
+process_header(CamelMedium *medium, const char *name, const char *value)
{
CamelMimePart *mime_part = CAMEL_MIME_PART (medium);
CamelHeaderType header_type;
@@ -219,41 +221,41 @@ process_header(CamelMedium *medium, const char *header_name, const char *header_
/* known, the job is done in the parsing routine. If not, */
/* we simply add the header in a raw fashion */
- header_type = (CamelHeaderType) g_hash_table_lookup (header_name_table, header_name);
+ header_type = (CamelHeaderType) g_hash_table_lookup (header_name_table, name);
switch (header_type) {
case HEADER_DESCRIPTION: /* raw header->utf8 conversion */
g_free (mime_part->description);
if (((CamelDataWrapper *) mime_part)->mime_type) {
- charset = header_content_type_param (((CamelDataWrapper *) mime_part)->mime_type, "charset");
+ charset = camel_content_type_param (((CamelDataWrapper *) mime_part)->mime_type, "charset");
charset = e_iconv_charset_name (charset);
} else
charset = NULL;
- mime_part->description = g_strstrip (header_decode_string (header_value, charset));
+ mime_part->description = g_strstrip (camel_header_decode_string (value, charset));
break;
case HEADER_DISPOSITION:
- set_disposition (mime_part, header_value);
+ set_disposition (mime_part, value);
break;
case HEADER_CONTENT_ID:
g_free (mime_part->content_id);
- mime_part->content_id = header_contentid_decode (header_value);
+ mime_part->content_id = camel_header_contentid_decode (value);
break;
case HEADER_ENCODING:
- text = header_token_decode (header_value);
+ text = camel_header_token_decode (value);
mime_part->encoding = camel_mime_part_encoding_from_string (text);
g_free (text);
break;
case HEADER_CONTENT_MD5:
g_free (mime_part->content_MD5);
- mime_part->content_MD5 = g_strdup (header_value);
+ mime_part->content_MD5 = g_strdup (value);
break;
case HEADER_CONTENT_LOCATION:
g_free (mime_part->content_location);
- mime_part->content_location = header_location_decode (header_value);
+ mime_part->content_location = camel_header_location_decode (value);
break;
case HEADER_CONTENT_TYPE:
if (((CamelDataWrapper *) mime_part)->mime_type)
- header_content_type_unref (((CamelDataWrapper *) mime_part)->mime_type);
- ((CamelDataWrapper *) mime_part)->mime_type = header_content_type_decode (header_value);
+ camel_content_type_unref (((CamelDataWrapper *) mime_part)->mime_type);
+ ((CamelDataWrapper *) mime_part)->mime_type = camel_content_type_decode (value);
break;
default:
return FALSE;
@@ -262,16 +264,16 @@ process_header(CamelMedium *medium, const char *header_name, const char *header_
}
static void
-set_header (CamelMedium *medium, const char *header_name, const void *header_value)
+set_header (CamelMedium *medium, const char *name, const void *value)
{
CamelMimePart *part = CAMEL_MIME_PART (medium);
- process_header(medium, header_name, header_value);
- header_raw_replace(&part->headers, header_name, header_value, -1);
+ process_header(medium, name, value);
+ camel_header_raw_replace(&part->headers, name, value, -1);
}
static void
-add_header (CamelMedium *medium, const char *header_name, const void *header_value)
+add_header (CamelMedium *medium, const char *name, const void *value)
{
CamelMimePart *part = CAMEL_MIME_PART (medium);
@@ -280,27 +282,27 @@ add_header (CamelMedium *medium, const char *header_name, const void *header_val
/* we simply add the header in a raw fashion */
/* If it was one of the headers we handled, it must be unique, set it instead of add */
- if (process_header(medium, header_name, header_value))
- header_raw_replace(&part->headers, header_name, header_value, -1);
+ if (process_header(medium, name, value))
+ camel_header_raw_replace(&part->headers, name, value, -1);
else
- header_raw_append(&part->headers, header_name, header_value, -1);
+ camel_header_raw_append(&part->headers, name, value, -1);
}
static void
-remove_header (CamelMedium *medium, const char *header_name)
+remove_header (CamelMedium *medium, const char *name)
{
CamelMimePart *part = (CamelMimePart *)medium;
- process_header(medium, header_name, NULL);
- header_raw_remove(&part->headers, header_name);
+ process_header(medium, name, NULL);
+ camel_header_raw_remove(&part->headers, name);
}
static const void *
-get_header (CamelMedium *medium, const char *header_name)
+get_header (CamelMedium *medium, const char *name)
{
CamelMimePart *part = (CamelMimePart *)medium;
- return header_raw_find(&part->headers, header_name, NULL);
+ return camel_header_raw_find(&part->headers, name, NULL);
}
static GArray *
@@ -309,7 +311,7 @@ get_headers (CamelMedium *medium)
CamelMimePart *part = (CamelMimePart *)medium;
GArray *headers;
CamelMediumHeader header;
- struct _header_raw *h;
+ struct _camel_header_raw *h;
headers = g_array_new (FALSE, FALSE, sizeof (CamelMediumHeader));
for (h = part->headers; h; h = h->next) {
@@ -331,7 +333,7 @@ free_headers (CamelMedium *medium, GArray *gheaders)
void
camel_mime_part_set_description (CamelMimePart *mime_part, const char *description)
{
- char *text = header_encode_string (description);
+ char *text = camel_header_encode_string (description);
camel_medium_set_header (CAMEL_MEDIUM (mime_part),
"Content-Description", text);
@@ -349,9 +351,9 @@ camel_mime_part_get_description (CamelMimePart *mime_part)
static void
set_disposition (CamelMimePart *mime_part, const char *disposition)
{
- header_disposition_unref(mime_part->disposition);
+ camel_content_disposition_unref(mime_part->disposition);
if (disposition)
- mime_part->disposition = header_disposition_decode(disposition);
+ mime_part->disposition = camel_content_disposition_decode(disposition);
else
mime_part->disposition = NULL;
}
@@ -370,7 +372,7 @@ camel_mime_part_set_disposition (CamelMimePart *mime_part, const char *dispositi
g_free(mime_part->disposition->disposition);
mime_part->disposition->disposition = g_strdup(disposition);
}
- text = header_disposition_format(mime_part->disposition);
+ text = camel_content_disposition_format(mime_part->disposition);
camel_medium_set_header (CAMEL_MEDIUM (mime_part),
"Content-Disposition", text);
@@ -396,17 +398,17 @@ camel_mime_part_set_filename (CamelMimePart *mime_part, const char *filename)
char *str;
if (mime_part->disposition == NULL)
- mime_part->disposition = header_disposition_decode("attachment");
+ mime_part->disposition = camel_content_disposition_decode("attachment");
- header_set_param(&mime_part->disposition->params, "filename", filename);
- str = header_disposition_format(mime_part->disposition);
+ camel_header_set_param(&mime_part->disposition->params, "filename", filename);
+ str = camel_content_disposition_format(mime_part->disposition);
camel_medium_set_header (CAMEL_MEDIUM (mime_part),
"Content-Disposition", str);
g_free(str);
- header_content_type_set_param (((CamelDataWrapper *) mime_part)->mime_type, "name", filename);
- str = header_content_type_format (((CamelDataWrapper *) mime_part)->mime_type);
+ camel_content_type_set_param (((CamelDataWrapper *) mime_part)->mime_type, "name", filename);
+ str = camel_content_type_format (((CamelDataWrapper *) mime_part)->mime_type);
camel_medium_set_header (CAMEL_MEDIUM (mime_part), "Content-Type", str);
g_free (str);
}
@@ -415,12 +417,12 @@ const char *
camel_mime_part_get_filename (CamelMimePart *mime_part)
{
if (mime_part->disposition) {
- const char *name = header_param (mime_part->disposition->params, "filename");
+ const char *name = camel_header_param (mime_part->disposition->params, "filename");
if (name)
return name;
}
- return header_content_type_param (((CamelDataWrapper *) mime_part)->mime_type, "name");
+ return camel_content_type_param (((CamelDataWrapper *) mime_part)->mime_type, "name");
}
@@ -434,7 +436,7 @@ camel_mime_part_set_content_id (CamelMimePart *mime_part, const char *contentid)
if (contentid)
id = g_strstrip (g_strdup (contentid));
else
- id = header_msgid_generate ();
+ id = camel_header_msgid_generate ();
cid = g_strdup_printf ("<%s>", id);
g_free (id);
@@ -545,7 +547,7 @@ set_content_object (CamelMedium *medium, CamelDataWrapper *content)
if (mime_part->mime_type != content_type) {
char *txt;
- txt = header_content_type_format (content_type);
+ txt = camel_content_type_format (content_type);
camel_medium_set_header (CAMEL_MEDIUM (mime_part), "Content-Type", txt);
g_free (txt);
}
@@ -554,7 +556,7 @@ set_content_object (CamelMedium *medium, CamelDataWrapper *content)
/**********************************************************************/
static ssize_t
-write_references(CamelStream *stream, struct _header_raw *h)
+write_references(CamelStream *stream, struct _camel_header_raw *h)
{
ssize_t len, out, total;
char *v, *ids, *ide;
@@ -598,12 +600,12 @@ write_references(CamelStream *stream, struct _header_raw *h)
#if 0
/* not needed - yet - handled by default case */
static ssize_t
-write_fold(CamelStream *stream, struct _header_raw *h)
+write_fold(CamelStream *stream, struct _camel_header_raw *h)
{
char *val;
int count;
- val = header_fold(h->value, strlen(h->name));
+ val = camel_header_fold(h->value, strlen(h->name));
count = camel_stream_printf(stream, "%s%s%s\n", h->name, isspace(val[0]) ? ":" : ": ", val);
g_free(val);
@@ -612,7 +614,7 @@ write_fold(CamelStream *stream, struct _header_raw *h)
#endif
static ssize_t
-write_raw(CamelStream *stream, struct _header_raw *h)
+write_raw(CamelStream *stream, struct _camel_header_raw *h)
{
char *val = h->value;
@@ -636,9 +638,9 @@ write_to_stream (CamelDataWrapper *dw, CamelStream *stream)
/* TODO: content-languages header? */
if (mp->headers) {
- struct _header_raw *h = mp->headers;
+ struct _camel_header_raw *h = mp->headers;
char *val;
- ssize_t (*writefn)(CamelStream *stream, struct _header_raw *);
+ ssize_t (*writefn)(CamelStream *stream, struct _camel_header_raw *);
/* fold/write the headers. But dont fold headers that are already formatted
(e.g. ones with parameter-lists, that we know about, and have created) */
@@ -648,7 +650,7 @@ write_to_stream (CamelDataWrapper *dw, CamelStream *stream)
g_warning("h->value is NULL here for %s", h->name);
count = 0;
} else if ((writefn = g_hash_table_lookup(header_formatted_table, h->name)) == NULL) {
- val = header_fold(val, strlen(h->name));
+ val = camel_header_fold(val, strlen(h->name));
count = camel_stream_printf(stream, "%s%s%s\n", h->name, isspace(val[0]) ? ":" : ": ", val);
g_free(val);
} else {
@@ -676,9 +678,9 @@ write_to_stream (CamelDataWrapper *dw, CamelStream *stream)
gboolean reencode = FALSE;
const char *filename;
- if (header_content_type_is (dw->mime_type, "text", "*")) {
- content_charset = header_content_type_param (content->mime_type, "charset");
- part_charset = header_content_type_param (dw->mime_type, "charset");
+ if (camel_content_type_is (dw->mime_type, "text", "*")) {
+ content_charset = camel_content_type_param (content->mime_type, "charset");
+ part_charset = camel_content_type_param (dw->mime_type, "charset");
if (content_charset && part_charset) {
content_charset = e_iconv_charset_name (content_charset);
@@ -722,7 +724,7 @@ write_to_stream (CamelDataWrapper *dw, CamelStream *stream)
}
/* we only re-do crlf on encoded blocks */
- if (filter && header_content_type_is (dw->mime_type, "text", "*")) {
+ if (filter && camel_content_type_is (dw->mime_type, "text", "*")) {
CamelMimeFilter *crlf = camel_mime_filter_crlf_new(CAMEL_MIME_FILTER_CRLF_ENCODE,
CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY);
@@ -775,7 +777,7 @@ static int
construct_from_parser (CamelMimePart *mime_part, CamelMimeParser *mp)
{
CamelDataWrapper *dw = (CamelDataWrapper *) mime_part;
- struct _header_raw *headers;
+ struct _camel_header_raw *headers;
const char *content;
char *buf;
size_t len;
@@ -784,18 +786,18 @@ construct_from_parser (CamelMimePart *mime_part, CamelMimeParser *mp)
d(printf("mime_part::construct_from_parser()\n"));
switch (camel_mime_parser_step(mp, &buf, &len)) {
- case HSCAN_MESSAGE:
+ case CAMEL_MIME_PARSER_STATE_MESSAGE:
/* set the default type of a message always */
if (dw->mime_type)
- header_content_type_unref (dw->mime_type);
- dw->mime_type = header_content_type_decode ("message/rfc822");
- case HSCAN_HEADER:
- case HSCAN_MULTIPART:
+ camel_content_type_unref (dw->mime_type);
+ dw->mime_type = camel_content_type_decode ("message/rfc822");
+ case CAMEL_MIME_PARSER_STATE_HEADER:
+ case CAMEL_MIME_PARSER_STATE_MULTIPART:
/* we have the headers, build them into 'us' */
headers = camel_mime_parser_headers_raw(mp);
/* if content-type exists, process it first, set for fallback charset in headers */
- content = header_raw_find(&headers, "content-type", NULL);
+ content = camel_header_raw_find(&headers, "content-type", NULL);
if (content)
process_header((CamelMedium *)dw, "content-type", content);
diff --git a/camel/camel-mime-part.h b/camel/camel-mime-part.h
index ff2a311446..5c3d7d9b59 100644
--- a/camel/camel-mime-part.h
+++ b/camel/camel-mime-part.h
@@ -46,12 +46,12 @@ extern "C" {
struct _CamelMimePart {
CamelMedium parent_object;
- struct _header_raw *headers; /* mime headers */
+ struct _camel_header_raw *headers; /* mime headers */
/* All fields here are -** PRIVATE **- */
/* TODO: these should be in a camelcontentinfo */
char *description;
- CamelMimeDisposition *disposition;
+ CamelContentDisposition *disposition;
char *content_id;
char *content_MD5;
char *content_location;
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index 5ed7cf6bea..6f719a8f5b 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -1193,7 +1193,7 @@ header_decode_text (const char *in, size_t inlen, const char *default_charset)
}
char *
-header_decode_string (const char *in, const char *default_charset)
+camel_header_decode_string (const char *in, const char *default_charset)
{
if (in == NULL)
return NULL;
@@ -1310,7 +1310,7 @@ rfc2047_encode_word(GString *outstring, const char *in, size_t len, const char *
/* TODO: Should this worry about quotes?? */
char *
-header_encode_string (const unsigned char *in)
+camel_header_encode_string (const unsigned char *in)
{
const unsigned char *inptr = in, *start, *word;
gboolean last_was_encoded = FALSE;
@@ -1608,7 +1608,7 @@ header_encode_phrase_merge_words (GList **wordsp)
/* encodes a phrase sequence (different quoting/encoding rules to strings) */
char *
-header_encode_phrase (const unsigned char *in)
+camel_header_encode_phrase (const unsigned char *in)
{
struct _phrase_word *word = NULL, *last_word = NULL;
GList *words, *wordl;
@@ -1622,7 +1622,8 @@ header_encode_phrase (const unsigned char *in)
if (!words)
return NULL;
- while (header_encode_phrase_merge_words (&words));
+ while (header_encode_phrase_merge_words (&words))
+ ;
out = g_string_new ("");
@@ -1708,7 +1709,7 @@ decode_token (const char **in)
}
char *
-header_token_decode(const char *in)
+camel_header_token_decode(const char *in)
{
if (in == NULL)
return NULL;
@@ -1805,7 +1806,7 @@ header_decode_value(const char **in)
/* should this return -1 for no int? */
int
-header_decode_int(const char **in)
+camel_header_decode_int(const char **in)
{
const char *inptr = *in;
int c, v=0;
@@ -1950,7 +1951,7 @@ header_decode_rfc2184_param (const char **in, char **paramp, gboolean *value_is_
*value_is_encoded = TRUE;
} else {
/* form := param*#=value or param*#*=value */
- *part = header_decode_int (&inptr);
+ *part = camel_header_decode_int (&inptr);
header_decode_lwsp (&inptr);
if (*inptr == '*') {
/* form := param*#*=value */
@@ -2076,7 +2077,7 @@ header_decode_param (const char **in, char **paramp, char **valuep, int *is_rfc2
}
char *
-header_param (struct _header_param *p, const char *name)
+camel_header_param (struct _camel_header_param *p, const char *name)
{
while (p && strcasecmp (p->name, name) != 0)
p = p->next;
@@ -2085,10 +2086,10 @@ header_param (struct _header_param *p, const char *name)
return NULL;
}
-struct _header_param *
-header_set_param (struct _header_param **l, const char *name, const char *value)
+struct _camel_header_param *
+camel_header_set_param (struct _camel_header_param **l, const char *name, const char *value)
{
- struct _header_param *p = (struct _header_param *)l, *pn;
+ struct _camel_header_param *p = (struct _camel_header_param *)l, *pn;
if (name == NULL)
return NULL;
@@ -2123,21 +2124,21 @@ header_set_param (struct _header_param **l, const char *name, const char *value)
}
const char *
-header_content_type_param (struct _header_content_type *t, const char *name)
+camel_content_type_param (CamelContentType *t, const char *name)
{
if (t==NULL)
return NULL;
- return header_param (t->params, name);
+ return camel_header_param (t->params, name);
}
void
-header_content_type_set_param (struct _header_content_type *t, const char *name, const char *value)
+camel_content_type_set_param (CamelContentType *t, const char *name, const char *value)
{
- header_set_param (&t->params, name, value);
+ camel_header_set_param (&t->params, name, value);
}
/**
- * header_content_type_is:
+ * camel_content_type_is:
* @ct: A content type specifier, or #NULL.
* @type: A type to check against.
* @subtype: A subtype to check against, or "*" to match any subtype.
@@ -2149,7 +2150,7 @@ header_content_type_set_param (struct _header_content_type *t, const char *name,
* Return value: #TRUE or #FALSE depending on the matching of the type.
**/
int
-header_content_type_is(struct _header_content_type *ct, const char *type, const char *subtype)
+camel_content_type_is(CamelContentType *ct, const char *type, const char *subtype)
{
/* no type == text/plain or text/"*" */
if (ct==NULL || (ct->type == NULL && ct->subtype == NULL)) {
@@ -2166,9 +2167,9 @@ header_content_type_is(struct _header_content_type *ct, const char *type, const
}
void
-header_param_list_free(struct _header_param *p)
+camel_header_param_list_free(struct _camel_header_param *p)
{
- struct _header_param *n;
+ struct _camel_header_param *n;
while (p) {
n = p->next;
@@ -2179,10 +2180,10 @@ header_param_list_free(struct _header_param *p)
}
}
-struct _header_content_type *
-header_content_type_new(const char *type, const char *subtype)
+CamelContentType *
+camel_content_type_new(const char *type, const char *subtype)
{
- struct _header_content_type *t = g_malloc(sizeof(*t));
+ CamelContentType *t = g_malloc(sizeof(*t));
t->type = g_strdup(type);
t->subtype = g_strdup(subtype);
@@ -2192,7 +2193,7 @@ header_content_type_new(const char *type, const char *subtype)
}
void
-header_content_type_ref(struct _header_content_type *ct)
+camel_content_type_ref(CamelContentType *ct)
{
if (ct)
ct->refcount++;
@@ -2200,11 +2201,11 @@ header_content_type_ref(struct _header_content_type *ct)
void
-header_content_type_unref(struct _header_content_type *ct)
+camel_content_type_unref(CamelContentType *ct)
{
if (ct) {
if (ct->refcount <= 1) {
- header_param_list_free(ct->params);
+ camel_header_param_list_free(ct->params);
g_free(ct->type);
g_free(ct->subtype);
g_free(ct);
@@ -2332,7 +2333,7 @@ header_decode_addrspec(const char **in)
*(word) '<' [ *('@' domain ) ':' ] word *( '.' word) @ domain
*/
-static struct _header_address *
+static struct _camel_header_address *
header_decode_mailbox(const char **in, const char *charset)
{
const char *inptr = *in;
@@ -2340,7 +2341,7 @@ header_decode_mailbox(const char **in, const char *charset)
int closeme = FALSE;
GString *addr;
GString *name = NULL;
- struct _header_address *address = NULL;
+ struct _camel_header_address *address = NULL;
const char *comment = NULL;
addr = g_string_new("");
@@ -2355,7 +2356,7 @@ header_decode_mailbox(const char **in, const char *charset)
char *text, *last;
/* perform internationalised decoding, and append */
- text = header_decode_string (pre, charset);
+ text = camel_header_decode_string (pre, charset);
g_string_append (name, text);
last = pre;
g_free(text);
@@ -2457,7 +2458,7 @@ header_decode_mailbox(const char **in, const char *charset)
g_string_append_c(addr, *inptr);
/* check for address is encoded word ... */
- text = header_decode_string(addr->str, charset);
+ text = camel_header_decode_string(addr->str, charset);
if (name == NULL) {
name = addr;
addr = g_string_new("");
@@ -2513,7 +2514,7 @@ header_decode_mailbox(const char **in, const char *charset)
if (comend > comstart) {
d(printf(" looking at subset '%.*s'\n", comend-comstart, comstart));
tmp = g_strndup (comstart, comend-comstart);
- text = header_decode_string (tmp, charset);
+ text = camel_header_decode_string (tmp, charset);
name = g_string_new (text);
g_free (tmp);
g_free (text);
@@ -2541,7 +2542,7 @@ header_decode_mailbox(const char **in, const char *charset)
addr = out;
}
- address = header_address_new_name(name ? name->str : "", addr->str);
+ address = camel_header_address_new_name(name ? name->str : "", addr->str);
}
d(printf("got mailbox: %s\n", addr->str));
@@ -2553,13 +2554,13 @@ header_decode_mailbox(const char **in, const char *charset)
return address;
}
-static struct _header_address *
+static struct _camel_header_address *
header_decode_address(const char **in, const char *charset)
{
const char *inptr = *in;
char *pre;
GString *group = g_string_new("");
- struct _header_address *addr = NULL, *member;
+ struct _camel_header_address *addr = NULL, *member;
/* pre-scan, trying to work out format, discard results */
header_decode_lwsp(&inptr);
@@ -2571,7 +2572,7 @@ header_decode_address(const char **in, const char *charset)
header_decode_lwsp(&inptr);
if (*inptr == ':') {
d(printf("group detected: %s\n", group->str));
- addr = header_address_new_group(group->str);
+ addr = camel_header_address_new_group(group->str);
/* that was a group spec, scan mailbox's */
inptr++;
/* FIXME: check rfc 2047 encodings of words, here or above in the loop */
@@ -2581,7 +2582,7 @@ header_decode_address(const char **in, const char *charset)
do {
member = header_decode_mailbox(&inptr, charset);
if (member)
- header_address_add_member(addr, member);
+ camel_header_address_add_member(addr, member);
header_decode_lwsp(&inptr);
if (*inptr == ',')
inptr++;
@@ -2638,7 +2639,7 @@ header_msgid_decode_internal(const char **in)
}
char *
-header_msgid_decode(const char *in)
+camel_header_msgid_decode(const char *in)
{
if (in == NULL)
return NULL;
@@ -2647,7 +2648,7 @@ header_msgid_decode(const char *in)
}
char *
-header_contentid_decode (const char *in)
+camel_header_contentid_decode (const char *in)
{
const char *inptr = in;
gboolean at = FALSE;
@@ -2664,7 +2665,7 @@ header_contentid_decode (const char *in)
/* make sure the content-id is not "" which can happen if we get a
* content-id such as <.@> (which Eudora likes to use...) */
- if ((buf = header_msgid_decode (inptr)) != NULL && *buf)
+ if ((buf = camel_header_msgid_decode (inptr)) != NULL && *buf)
return buf;
g_free (buf);
@@ -2714,9 +2715,9 @@ header_contentid_decode (const char *in)
}
void
-header_references_list_append_asis(struct _header_references **list, char *ref)
+camel_header_references_list_append_asis(struct _camel_header_references **list, char *ref)
{
- struct _header_references *w = (struct _header_references *)list, *n;
+ struct _camel_header_references *w = (struct _camel_header_references *)list, *n;
while (w->next)
w = w->next;
n = g_malloc(sizeof(*n));
@@ -2726,10 +2727,10 @@ header_references_list_append_asis(struct _header_references **list, char *ref)
}
int
-header_references_list_size(struct _header_references **list)
+camel_header_references_list_size(struct _camel_header_references **list)
{
int count = 0;
- struct _header_references *w = *list;
+ struct _camel_header_references *w = *list;
while (w) {
count++;
w = w->next;
@@ -2738,9 +2739,9 @@ header_references_list_size(struct _header_references **list)
}
void
-header_references_list_clear(struct _header_references **list)
+camel_header_references_list_clear(struct _camel_header_references **list)
{
- struct _header_references *w = *list, *n;
+ struct _camel_header_references *w = *list, *n;
while (w) {
n = w->next;
g_free(w->id);
@@ -2751,9 +2752,9 @@ header_references_list_clear(struct _header_references **list)
}
static void
-header_references_decode_single (const char **in, struct _header_references **head)
+header_references_decode_single (const char **in, struct _camel_header_references **head)
{
- struct _header_references *ref;
+ struct _camel_header_references *ref;
const char *inptr = *in;
char *id, *word;
@@ -2762,7 +2763,7 @@ header_references_decode_single (const char **in, struct _header_references **he
if (*inptr == '<') {
id = header_msgid_decode_internal (&inptr);
if (id) {
- ref = g_malloc (sizeof (struct _header_references));
+ ref = g_malloc (sizeof (struct _camel_header_references));
ref->next = *head;
ref->id = id;
*head = ref;
@@ -2780,10 +2781,10 @@ header_references_decode_single (const char **in, struct _header_references **he
*in = inptr;
}
-struct _header_references *
-header_references_inreplyto_decode (const char *in)
+struct _camel_header_references *
+camel_header_references_inreplyto_decode (const char *in)
{
- struct _header_references *ref = NULL;
+ struct _camel_header_references *ref = NULL;
if (in == NULL || in[0] == '\0')
return NULL;
@@ -2794,10 +2795,10 @@ header_references_inreplyto_decode (const char *in)
}
/* generate a list of references, from most recent up */
-struct _header_references *
-header_references_decode (const char *in)
+struct _camel_header_references *
+camel_header_references_decode (const char *in)
{
- struct _header_references *refs = NULL;
+ struct _camel_header_references *refs = NULL;
if (in == NULL || in[0] == '\0')
return NULL;
@@ -2808,13 +2809,13 @@ header_references_decode (const char *in)
return refs;
}
-struct _header_references *
-header_references_dup(const struct _header_references *list)
+struct _camel_header_references *
+camel_header_references_dup(const struct _camel_header_references *list)
{
- struct _header_references *new = NULL, *tmp;
+ struct _camel_header_references *new = NULL, *tmp;
while (list) {
- tmp = g_new(struct _header_references, 1);
+ tmp = g_new(struct _camel_header_references, 1);
tmp->next = new;
tmp->id = g_strdup(list->id);
new = tmp;
@@ -2823,8 +2824,8 @@ header_references_dup(const struct _header_references *list)
return new;
}
-struct _header_address *
-header_mailbox_decode(const char *in, const char *charset)
+struct _camel_header_address *
+camel_header_mailbox_decode(const char *in, const char *charset)
{
if (in == NULL)
return NULL;
@@ -2832,11 +2833,11 @@ header_mailbox_decode(const char *in, const char *charset)
return header_decode_mailbox(&in, charset);
}
-struct _header_address *
-header_address_decode(const char *in, const char *charset)
+struct _camel_header_address *
+camel_header_address_decode(const char *in, const char *charset)
{
const char *inptr = in, *last;
- struct _header_address *list = NULL, *addr;
+ struct _camel_header_address *list = NULL, *addr;
d(printf("decoding To: '%s'\n", in));
@@ -2851,7 +2852,7 @@ header_address_decode(const char *in, const char *charset)
last = inptr;
addr = header_decode_address(&inptr, charset);
if (addr)
- header_address_list_append(&list, addr);
+ camel_header_address_list_append(&list, addr);
header_decode_lwsp(&inptr);
if (*inptr == ',')
inptr++;
@@ -2871,7 +2872,7 @@ header_address_decode(const char *in, const char *charset)
}
void
-header_mime_decode(const char *in, int *maj, int *min)
+camel_header_mime_decode(const char *in, int *maj, int *min)
{
const char *inptr = in;
int major=-1, minor=-1;
@@ -2881,13 +2882,13 @@ header_mime_decode(const char *in, int *maj, int *min)
if (in != NULL) {
header_decode_lwsp(&inptr);
if (isdigit(*inptr)) {
- major = header_decode_int(&inptr);
+ major = camel_header_decode_int(&inptr);
header_decode_lwsp(&inptr);
if (*inptr == '.') {
inptr++;
header_decode_lwsp(&inptr);
if (isdigit(*inptr))
- minor = header_decode_int(&inptr);
+ minor = camel_header_decode_int(&inptr);
}
}
}
@@ -2900,18 +2901,18 @@ header_mime_decode(const char *in, int *maj, int *min)
d(printf("major = %d, minor = %d\n", major, minor));
}
-static struct _header_param *
+static struct _camel_header_param *
header_decode_param_list (const char **in)
{
const char *inptr = *in;
- struct _header_param *head = NULL, *tail = NULL;
+ struct _camel_header_param *head = NULL, *tail = NULL;
gboolean last_was_rfc2184 = FALSE;
gboolean is_rfc2184 = FALSE;
header_decode_lwsp (&inptr);
while (*inptr == ';') {
- struct _header_param *param;
+ struct _camel_header_param *param;
char *name, *value;
int rfc2184_part;
@@ -2950,7 +2951,7 @@ header_decode_param_list (const char **in)
}
}
- param = g_malloc (sizeof (struct _header_param));
+ param = g_malloc (sizeof (struct _camel_header_param));
param->name = name;
param->value = value;
param->next = NULL;
@@ -2984,8 +2985,8 @@ header_decode_param_list (const char **in)
return head;
}
-struct _header_param *
-header_param_list_decode(const char *in)
+struct _camel_header_param *
+camel_header_param_list_decode(const char *in)
{
if (in == NULL)
return NULL;
@@ -3107,7 +3108,7 @@ header_encode_param (const unsigned char *in, gboolean *encoded)
}
void
-header_param_list_format_append (GString *out, struct _header_param *p)
+camel_header_param_list_format_append (GString *out, struct _camel_header_param *p)
{
int used = out->len;
@@ -3208,23 +3209,23 @@ header_param_list_format_append (GString *out, struct _header_param *p)
}
char *
-header_param_list_format(struct _header_param *p)
+camel_header_param_list_format(struct _camel_header_param *p)
{
GString *out = g_string_new("");
char *ret;
- header_param_list_format_append(out, p);
+ camel_header_param_list_format_append(out, p);
ret = out->str;
g_string_free(out, FALSE);
return ret;
}
-struct _header_content_type *
-header_content_type_decode(const char *in)
+CamelContentType *
+camel_content_type_decode(const char *in)
{
const char *inptr = in;
char *type, *subtype = NULL;
- struct _header_content_type *t = NULL;
+ CamelContentType *t = NULL;
if (in==NULL)
return NULL;
@@ -3244,7 +3245,7 @@ header_content_type_decode(const char *in)
w(g_warning("MIME type with no subtype: %s", in));
}
- t = header_content_type_new(type, subtype);
+ t = camel_content_type_new(type, subtype);
t->params = header_decode_param_list(&inptr);
g_free(type);
g_free(subtype);
@@ -3256,9 +3257,9 @@ header_content_type_decode(const char *in)
}
void
-header_content_type_dump(struct _header_content_type *ct)
+camel_content_type_dump(CamelContentType *ct)
{
- struct _header_param *p;
+ struct _camel_header_param *p;
printf("Content-Type: ");
if (ct==NULL) {
@@ -3277,7 +3278,7 @@ header_content_type_dump(struct _header_content_type *ct)
}
char *
-header_content_type_format (struct _header_content_type *ct)
+camel_content_type_format (CamelContentType *ct)
{
GString *out;
char *ret;
@@ -3298,7 +3299,7 @@ header_content_type_format (struct _header_content_type *ct)
} else {
g_string_append_printf (out, "%s/%s", ct->type, ct->subtype);
}
- header_param_list_format_append (out, ct->params);
+ camel_header_param_list_format_append (out, ct->params);
ret = out->str;
g_string_free (out, FALSE);
@@ -3307,7 +3308,7 @@ header_content_type_format (struct _header_content_type *ct)
}
char *
-header_content_type_simple (struct _header_content_type *ct)
+camel_content_type_simple (CamelContentType *ct)
{
if (ct->type == NULL) {
w(g_warning ("Content-Type with no main type"));
@@ -3323,17 +3324,17 @@ header_content_type_simple (struct _header_content_type *ct)
}
char *
-header_content_encoding_decode(const char *in)
+camel_header_content_encoding_decode(const char *in)
{
if (in)
return decode_token(&in);
return NULL;
}
-CamelMimeDisposition *
-header_disposition_decode(const char *in)
+CamelContentDisposition *
+camel_content_disposition_decode(const char *in)
{
- CamelMimeDisposition *d = NULL;
+ CamelContentDisposition *d = NULL;
const char *inptr = in;
if (in == NULL)
@@ -3349,18 +3350,18 @@ header_disposition_decode(const char *in)
}
void
-header_disposition_ref(CamelMimeDisposition *d)
+camel_content_disposition_ref(CamelContentDisposition *d)
{
if (d)
d->refcount++;
}
void
-header_disposition_unref(CamelMimeDisposition *d)
+camel_content_disposition_unref(CamelContentDisposition *d)
{
if (d) {
if (d->refcount<=1) {
- header_param_list_free(d->params);
+ camel_header_param_list_free(d->params);
g_free(d->disposition);
g_free(d);
} else {
@@ -3370,7 +3371,7 @@ header_disposition_unref(CamelMimeDisposition *d)
}
char *
-header_disposition_format(CamelMimeDisposition *d)
+camel_content_disposition_format(CamelContentDisposition *d)
{
GString *out;
char *ret;
@@ -3383,7 +3384,7 @@ header_disposition_format(CamelMimeDisposition *d)
out = g_string_append(out, d->disposition);
else
out = g_string_append(out, "attachment");
- header_param_list_format_append(out, d->params);
+ camel_header_param_list_format_append(out, d->params);
ret = out->str;
g_string_free(out, FALSE);
@@ -3422,7 +3423,7 @@ static char *tz_days [] = {
};
char *
-header_format_date(time_t time, int offset)
+camel_header_format_date(time_t time, int offset)
{
struct tm tm;
@@ -3447,7 +3448,7 @@ header_format_date(time_t time, int offset)
/* convert a date to time_t representation */
/* this is an awful mess oh well */
time_t
-header_decode_date(const char *in, int *saveoffset)
+camel_header_decode_date(const char *in, int *saveoffset)
{
const char *inptr = in;
char *monthname;
@@ -3487,7 +3488,7 @@ header_decode_date(const char *in, int *saveoffset)
}
}
}
- tm.tm_mday = header_decode_int(&inptr);
+ tm.tm_mday = camel_header_decode_int(&inptr);
monthname = decode_token(&inptr);
if (monthname) {
for (i=0;i<sizeof(tz_months)/sizeof(tz_months[0]);i++) {
@@ -3498,7 +3499,7 @@ header_decode_date(const char *in, int *saveoffset)
}
g_free(monthname);
}
- year = header_decode_int(&inptr);
+ year = camel_header_decode_int(&inptr);
if (year < 69) {
tm.tm_year = 100 + year;
} else if (year < 100) {
@@ -3509,25 +3510,25 @@ header_decode_date(const char *in, int *saveoffset)
tm.tm_year = year - 1900;
}
/* get the time ... yurck */
- tm.tm_hour = header_decode_int(&inptr);
+ tm.tm_hour = camel_header_decode_int(&inptr);
header_decode_lwsp(&inptr);
if (*inptr == ':')
inptr++;
- tm.tm_min = header_decode_int(&inptr);
+ tm.tm_min = camel_header_decode_int(&inptr);
header_decode_lwsp(&inptr);
if (*inptr == ':')
inptr++;
- tm.tm_sec = header_decode_int(&inptr);
+ tm.tm_sec = camel_header_decode_int(&inptr);
header_decode_lwsp(&inptr);
if (*inptr == '+'
|| *inptr == '-') {
offset = (*inptr++)=='-'?-1:1;
- offset = offset * header_decode_int(&inptr);
+ offset = offset * camel_header_decode_int(&inptr);
d(printf("abs signed offset = %d\n", offset));
if (offset < -1200 || offset > 1200)
offset = 0;
} else if (isdigit(*inptr)) {
- offset = header_decode_int(&inptr);
+ offset = camel_header_decode_int(&inptr);
d(printf("abs offset = %d\n", offset));
if (offset < -1200 || offset > 1200)
offset = 0;
@@ -3547,7 +3548,7 @@ header_decode_date(const char *in, int *saveoffset)
header_decode_lwsp(&inptr);
if (*inptr == '+' || *inptr == '-') {
int sign = (*inptr++)=='-'?-1:1;
- offset = offset + (header_decode_int(&inptr)*sign);
+ offset = offset + (camel_header_decode_int(&inptr)*sign);
}
d(printf("named offset = %d\n", offset));
}
@@ -3565,7 +3566,7 @@ header_decode_date(const char *in, int *saveoffset)
d({
char *tmp;
- tmp = header_format_date(t, offset);
+ tmp = camel_header_format_date(t, offset);
printf(" encoded again: %s\n", tmp);
g_free(tmp);
});
@@ -3577,7 +3578,7 @@ header_decode_date(const char *in, int *saveoffset)
}
char *
-header_location_decode(const char *in)
+camel_header_location_decode(const char *in)
{
const char *p;
@@ -3607,7 +3608,7 @@ header_location_decode(const char *in)
#ifdef CHECKS
static void
-check_header(struct _header_raw *h)
+check_header(struct _camel_header_raw *h)
{
unsigned char *p;
@@ -3623,7 +3624,7 @@ check_header(struct _header_raw *h)
#endif
void
-header_raw_append_parse(struct _header_raw **list, const char *header, int offset)
+camel_header_raw_append_parse(struct _camel_header_raw **list, const char *header, int offset)
{
register const char *in;
size_t fieldlen;
@@ -3643,13 +3644,13 @@ header_raw_append_parse(struct _header_raw **list, const char *header, int offse
memcpy(name, header, fieldlen);
name[fieldlen] = 0;
- header_raw_append(list, name, in, offset);
+ camel_header_raw_append(list, name, in, offset);
}
void
-header_raw_append(struct _header_raw **list, const char *name, const char *value, int offset)
+camel_header_raw_append(struct _camel_header_raw **list, const char *name, const char *value, int offset)
{
- struct _header_raw *l, *n;
+ struct _camel_header_raw *l, *n;
d(printf("Header: %s: %s\n", name, value));
@@ -3661,7 +3662,7 @@ header_raw_append(struct _header_raw **list, const char *name, const char *value
#ifdef CHECKS
check_header(n);
#endif
- l = (struct _header_raw *)list;
+ l = (struct _camel_header_raw *)list;
while (l->next) {
l = l->next;
}
@@ -3671,21 +3672,21 @@ header_raw_append(struct _header_raw **list, const char *name, const char *value
#if 0
if (!strcasecmp(name, "To")) {
printf("- Decoding To\n");
- header_to_decode(value);
+ camel_header_to_decode(value);
} else if (!strcasecmp(name, "Content-type")) {
printf("- Decoding content-type\n");
- header_content_type_dump(header_content_type_decode(value));
+ camel_content_type_dump(camel_content_type_decode(value));
} else if (!strcasecmp(name, "MIME-Version")) {
printf("- Decoding mime version\n");
- header_mime_decode(value);
+ camel_header_mime_decode(value);
}
#endif
}
-static struct _header_raw *
-header_raw_find_node(struct _header_raw **list, const char *name)
+static struct _camel_header_raw *
+header_raw_find_node(struct _camel_header_raw **list, const char *name)
{
- struct _header_raw *l;
+ struct _camel_header_raw *l;
l = *list;
while (l) {
@@ -3697,9 +3698,9 @@ header_raw_find_node(struct _header_raw **list, const char *name)
}
const char *
-header_raw_find(struct _header_raw **list, const char *name, int *offset)
+camel_header_raw_find(struct _camel_header_raw **list, const char *name, int *offset)
{
- struct _header_raw *l;
+ struct _camel_header_raw *l;
l = header_raw_find_node(list, name);
if (l) {
@@ -3711,9 +3712,9 @@ header_raw_find(struct _header_raw **list, const char *name, int *offset)
}
const char *
-header_raw_find_next(struct _header_raw **list, const char *name, int *offset, const char *last)
+camel_header_raw_find_next(struct _camel_header_raw **list, const char *name, int *offset, const char *last)
{
- struct _header_raw *l;
+ struct _camel_header_raw *l;
if (last == NULL || name == NULL)
return NULL;
@@ -3721,11 +3722,11 @@ header_raw_find_next(struct _header_raw **list, const char *name, int *offset, c
l = *list;
while (l && l->value != last)
l = l->next;
- return header_raw_find(&l, name, offset);
+ return camel_header_raw_find(&l, name, offset);
}
static void
-header_raw_free(struct _header_raw *l)
+header_raw_free(struct _camel_header_raw *l)
{
g_free(l->name);
g_free(l->value);
@@ -3733,12 +3734,12 @@ header_raw_free(struct _header_raw *l)
}
void
-header_raw_remove(struct _header_raw **list, const char *name)
+camel_header_raw_remove(struct _camel_header_raw **list, const char *name)
{
- struct _header_raw *l, *p;
+ struct _camel_header_raw *l, *p;
/* the next pointer is at the head of the structure, so this is safe */
- p = (struct _header_raw *)list;
+ p = (struct _camel_header_raw *)list;
l = *list;
while (l) {
if (!strcasecmp(l->name, name)) {
@@ -3753,16 +3754,16 @@ header_raw_remove(struct _header_raw **list, const char *name)
}
void
-header_raw_replace(struct _header_raw **list, const char *name, const char *value, int offset)
+camel_header_raw_replace(struct _camel_header_raw **list, const char *name, const char *value, int offset)
{
- header_raw_remove(list, name);
- header_raw_append(list, name, value, offset);
+ camel_header_raw_remove(list, name);
+ camel_header_raw_append(list, name, value, offset);
}
void
-header_raw_clear(struct _header_raw **list)
+camel_header_raw_clear(struct _camel_header_raw **list)
{
- struct _header_raw *l, *n;
+ struct _camel_header_raw *l, *n;
l = *list;
while (l) {
n = l->next;
@@ -3773,7 +3774,7 @@ header_raw_clear(struct _header_raw **list)
}
char *
-header_msgid_generate (void)
+camel_header_msgid_generate (void)
{
static pthread_mutex_t count_lock = PTHREAD_MUTEX_INITIALIZER;
#define COUNT_LOCK() pthread_mutex_lock (&count_lock)
@@ -3850,14 +3851,14 @@ static struct {
};
char *
-header_raw_check_mailing_list(struct _header_raw **list)
+camel_header_raw_check_mailing_list(struct _camel_header_raw **list)
{
const char *v;
regmatch_t match[3];
int i;
for (i = 0; i < sizeof (mail_list_magic) / sizeof (mail_list_magic[0]); i++) {
- v = header_raw_find (list, mail_list_magic[i].name, NULL);
+ v = camel_header_raw_find (list, mail_list_magic[i].name, NULL);
if (v != NULL && regexec (&mail_list_magic[i].regex, v, 3, match, 0) == 0 && match[1].rm_so != -1) {
char *list;
int len1, len2;
@@ -3883,48 +3884,52 @@ header_raw_check_mailing_list(struct _header_raw **list)
}
/* ok, here's the address stuff, what a mess ... */
-struct _header_address *header_address_new(void)
+struct _camel_header_address *
+camel_header_address_new (void)
{
- struct _header_address *h;
+ struct _camel_header_address *h;
h = g_malloc0(sizeof(*h));
h->type = HEADER_ADDRESS_NONE;
h->refcount = 1;
return h;
}
-struct _header_address *header_address_new_name(const char *name, const char *addr)
+struct _camel_header_address *
+camel_header_address_new_name(const char *name, const char *addr)
{
- struct _header_address *h;
-
- h = header_address_new();
+ struct _camel_header_address *h;
+ h = camel_header_address_new();
h->type = HEADER_ADDRESS_NAME;
h->name = g_strdup(name);
h->v.addr = g_strdup(addr);
return h;
}
-struct _header_address *header_address_new_group(const char *name)
+struct _camel_header_address *
+camel_header_address_new_group (const char *name)
{
- struct _header_address *h;
+ struct _camel_header_address *h;
- h = header_address_new();
+ h = camel_header_address_new();
h->type = HEADER_ADDRESS_GROUP;
h->name = g_strdup(name);
return h;
}
-void header_address_ref(struct _header_address *h)
+void
+camel_header_address_ref(struct _camel_header_address *h)
{
if (h)
h->refcount++;
}
-void header_address_unref(struct _header_address *h)
+void
+camel_header_address_unref(struct _camel_header_address *h)
{
if (h) {
if (h->refcount <= 1) {
if (h->type == HEADER_ADDRESS_GROUP) {
- header_address_list_clear(&h->v.members);
+ camel_header_address_list_clear(&h->v.members);
} else if (h->type == HEADER_ADDRESS_NAME) {
g_free(h->v.addr);
}
@@ -3936,7 +3941,8 @@ void header_address_unref(struct _header_address *h)
}
}
-void header_address_set_name(struct _header_address *h, const char *name)
+void
+camel_header_address_set_name(struct _camel_header_address *h, const char *name)
{
if (h) {
g_free(h->name);
@@ -3944,7 +3950,8 @@ void header_address_set_name(struct _header_address *h, const char *name)
}
}
-void header_address_set_addr(struct _header_address *h, const char *addr)
+void
+camel_header_address_set_addr(struct _camel_header_address *h, const char *addr)
{
if (h) {
if (h->type == HEADER_ADDRESS_NAME
@@ -3958,13 +3965,14 @@ void header_address_set_addr(struct _header_address *h, const char *addr)
}
}
-void header_address_set_members(struct _header_address *h, struct _header_address *group)
+void
+camel_header_address_set_members(struct _camel_header_address *h, struct _camel_header_address *group)
{
if (h) {
if (h->type == HEADER_ADDRESS_GROUP
|| h->type == HEADER_ADDRESS_NONE) {
h->type = HEADER_ADDRESS_GROUP;
- header_address_list_clear(&h->v.members);
+ camel_header_address_list_clear(&h->v.members);
/* should this ref them? */
h->v.members = group;
} else {
@@ -3973,21 +3981,23 @@ void header_address_set_members(struct _header_address *h, struct _header_addres
}
}
-void header_address_add_member(struct _header_address *h, struct _header_address *member)
+void
+camel_header_address_add_member(struct _camel_header_address *h, struct _camel_header_address *member)
{
if (h) {
if (h->type == HEADER_ADDRESS_GROUP
|| h->type == HEADER_ADDRESS_NONE) {
h->type = HEADER_ADDRESS_GROUP;
- header_address_list_append(&h->v.members, member);
+ camel_header_address_list_append(&h->v.members, member);
}
}
}
-void header_address_list_append_list(struct _header_address **l, struct _header_address **h)
+void
+camel_header_address_list_append_list(struct _camel_header_address **l, struct _camel_header_address **h)
{
if (l) {
- struct _header_address *n = (struct _header_address *)l;
+ struct _camel_header_address *n = (struct _camel_header_address *)l;
while (n->next)
n = n->next;
@@ -3996,21 +4006,23 @@ void header_address_list_append_list(struct _header_address **l, struct _header_
}
-void header_address_list_append(struct _header_address **l, struct _header_address *h)
+void
+camel_header_address_list_append(struct _camel_header_address **l, struct _camel_header_address *h)
{
if (h) {
- header_address_list_append_list(l, &h);
+ camel_header_address_list_append_list(l, &h);
h->next = NULL;
}
}
-void header_address_list_clear(struct _header_address **l)
+void
+camel_header_address_list_clear(struct _camel_header_address **l)
{
- struct _header_address *a, *n;
+ struct _camel_header_address *a, *n;
a = *l;
while (a) {
n = a->next;
- header_address_unref(a);
+ camel_header_address_unref(a);
a = n;
}
*l = NULL;
@@ -4019,7 +4031,7 @@ void header_address_list_clear(struct _header_address **l)
/* if encode is true, then the result is suitable for mailing, otherwise
the result is suitable for display only (and may not even be re-parsable) */
static void
-header_address_list_encode_append (GString *out, int encode, struct _header_address *a)
+header_address_list_encode_append (GString *out, int encode, struct _camel_header_address *a)
{
char *text;
@@ -4027,7 +4039,7 @@ header_address_list_encode_append (GString *out, int encode, struct _header_addr
switch (a->type) {
case HEADER_ADDRESS_NAME:
if (encode)
- text = header_encode_phrase (a->name);
+ text = camel_header_encode_phrase (a->name);
else
text = a->name;
if (text && *text)
@@ -4039,7 +4051,7 @@ header_address_list_encode_append (GString *out, int encode, struct _header_addr
break;
case HEADER_ADDRESS_GROUP:
if (encode)
- text = header_encode_phrase (a->name);
+ text = camel_header_encode_phrase (a->name);
else
text = a->name;
g_string_append_printf (out, "%s: ", text);
@@ -4059,7 +4071,7 @@ header_address_list_encode_append (GString *out, int encode, struct _header_addr
}
char *
-header_address_list_encode (struct _header_address *a)
+camel_header_address_list_encode (struct _camel_header_address *a)
{
GString *out;
char *ret;
@@ -4076,7 +4088,7 @@ header_address_list_encode (struct _header_address *a)
}
char *
-header_address_list_format (struct _header_address *a)
+camel_header_address_list_format (struct _camel_header_address *a)
{
GString *out;
char *ret;
@@ -4094,7 +4106,7 @@ header_address_list_format (struct _header_address *a)
}
char *
-header_address_fold (const char *in, size_t headerlen)
+camel_header_address_fold (const char *in, size_t headerlen)
{
size_t len, outlen;
const char *inptr = in, *space, *p, *n;
@@ -4128,7 +4140,7 @@ header_address_fold (const char *in, size_t headerlen)
/* we need to fold, so first unfold (if we need to), then process */
if (needunfold)
- inptr = in = header_unfold (in);
+ inptr = in = camel_header_unfold (in);
out = g_string_new ("");
outlen = headerlen + 2;
@@ -4170,7 +4182,7 @@ header_address_fold (const char *in, size_t headerlen)
/* simple header folding */
/* will work even if the header is already folded */
char *
-header_fold(const char *in, size_t headerlen)
+camel_header_fold(const char *in, size_t headerlen)
{
size_t len, outlen, i;
const char *inptr = in, *space, *p, *n;
@@ -4204,7 +4216,7 @@ header_fold(const char *in, size_t headerlen)
/* we need to fold, so first unfold (if we need to), then process */
if (needunfold)
- inptr = in = header_unfold(in);
+ inptr = in = camel_header_unfold(in);
out = g_string_new("");
outlen = headerlen+2;
@@ -4249,7 +4261,7 @@ header_fold(const char *in, size_t headerlen)
}
char *
-header_unfold(const char *in)
+camel_header_unfold(const char *in)
{
char *out = g_malloc(strlen(in)+1);
const char *inptr = in;
diff --git a/camel/camel-mime-utils.h b/camel/camel-mime-utils.h
index b58bcbea72..7035b7696d 100644
--- a/camel/camel-mime-utils.h
+++ b/camel/camel-mime-utils.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 2000 Ximian Inc.
+ * Copyright (C) 2000-2003 Ximian Inc.
*
* Authors: Michael Zucchi <notzed@ximian.com>
* Jeffrey Stedfast <fejj@ximian.com>
@@ -32,9 +32,9 @@ extern "C" {
#include <time.h>
#include <glib.h>
-/* maximum recommended size of a line from header_fold() */
+/* maximum recommended size of a line from camel_header_fold() */
#define CAMEL_FOLD_SIZE (77)
-/* maximum hard size of a line from header_fold() */
+/* maximum hard size of a line from camel_header_fold() */
#define CAMEL_FOLD_MAX_SIZE (998)
#define CAMEL_UUDECODE_STATE_INIT (0)
@@ -55,53 +55,53 @@ typedef enum _CamelMimePartEncodingType {
} CamelMimePartEncodingType;
/* a list of references for this message */
-struct _header_references {
- struct _header_references *next;
+struct _camel_header_references {
+ struct _camel_header_references *next;
char *id;
};
-struct _header_param {
- struct _header_param *next;
+struct _camel_header_param {
+ struct _camel_header_param *next;
char *name;
char *value;
};
/* describes a content-type */
-struct _header_content_type {
+typedef struct {
char *type;
char *subtype;
- struct _header_param *params;
+ struct _camel_header_param *params;
unsigned int refcount;
-};
+} CamelContentType;
/* a raw rfc822 header */
/* the value MUST be US-ASCII */
-struct _header_raw {
- struct _header_raw *next;
+struct _camel_header_raw {
+ struct _camel_header_raw *next;
char *name;
char *value;
int offset; /* in file, if known */
};
-typedef struct _CamelMimeDisposition {
+typedef struct {
char *disposition;
- struct _header_param *params;
+ struct _camel_header_param *params;
unsigned int refcount;
-} CamelMimeDisposition;
+} CamelContentDisposition;
-enum _header_address_type {
+enum _camel_header_address_t {
HEADER_ADDRESS_NONE, /* uninitialised */
HEADER_ADDRESS_NAME,
HEADER_ADDRESS_GROUP
};
-struct _header_address {
- struct _header_address *next;
- enum _header_address_type type;
+struct _camel_header_address {
+ struct _camel_header_address *next;
+ enum _camel_header_address_t type;
char *name;
union {
char *addr;
- struct _header_address *members;
+ struct _camel_header_address *members;
} v;
unsigned int refcount;
};
@@ -110,116 +110,116 @@ struct _header_address {
void camel_mime_utils_init(void);
/* Address lists */
-struct _header_address *header_address_new(void);
-struct _header_address *header_address_new_name(const char *name, const char *addr);
-struct _header_address *header_address_new_group(const char *name);
-void header_address_ref(struct _header_address *);
-void header_address_unref(struct _header_address *);
-void header_address_set_name(struct _header_address *, const char *name);
-void header_address_set_addr(struct _header_address *, const char *addr);
-void header_address_set_members(struct _header_address *, struct _header_address *group);
-void header_address_add_member(struct _header_address *, struct _header_address *member);
-void header_address_list_append_list(struct _header_address **l, struct _header_address **h);
-void header_address_list_append(struct _header_address **, struct _header_address *);
-void header_address_list_clear(struct _header_address **);
-
-struct _header_address *header_address_decode(const char *in, const char *charset);
-struct _header_address *header_mailbox_decode(const char *in, const char *charset);
+struct _camel_header_address *camel_header_address_new (void);
+struct _camel_header_address *camel_header_address_new_name (const char *name, const char *addr);
+struct _camel_header_address *camel_header_address_new_group (const char *name);
+void camel_header_address_ref (struct _camel_header_address *);
+void camel_header_address_unref (struct _camel_header_address *);
+void camel_header_address_set_name (struct _camel_header_address *, const char *name);
+void camel_header_address_set_addr (struct _camel_header_address *, const char *addr);
+void camel_header_address_set_members (struct _camel_header_address *, struct _camel_header_address *group);
+void camel_header_address_add_member (struct _camel_header_address *, struct _camel_header_address *member);
+void camel_header_address_list_append_list (struct _camel_header_address **l, struct _camel_header_address **h);
+void camel_header_address_list_append (struct _camel_header_address **, struct _camel_header_address *);
+void camel_header_address_list_clear (struct _camel_header_address **);
+
+struct _camel_header_address *camel_header_address_decode (const char *in, const char *charset);
+struct _camel_header_address *camel_header_mailbox_decode (const char *in, const char *charset);
/* for mailing */
-char *header_address_list_encode(struct _header_address *a);
+char *camel_header_address_list_encode (struct _camel_header_address *a);
/* for display */
-char *header_address_list_format(struct _header_address *a);
+char *camel_header_address_list_format (struct _camel_header_address *a);
/* structured header prameters */
-struct _header_param *header_param_list_decode(const char *in);
-char *header_param(struct _header_param *p, const char *name);
-struct _header_param *header_set_param(struct _header_param **l, const char *name, const char *value);
-void header_param_list_format_append(GString *out, struct _header_param *p);
-char *header_param_list_format(struct _header_param *p);
-void header_param_list_free(struct _header_param *p);
+struct _camel_header_param *camel_header_param_list_decode (const char *in);
+char *camel_header_param (struct _camel_header_param *p, const char *name);
+struct _camel_header_param *camel_header_set_param (struct _camel_header_param **l, const char *name, const char *value);
+void camel_header_param_list_format_append (GString *out, struct _camel_header_param *p);
+char *camel_header_param_list_format (struct _camel_header_param *p);
+void camel_header_param_list_free (struct _camel_header_param *p);
/* Content-Type header */
-struct _header_content_type *header_content_type_new(const char *type, const char *subtype);
-struct _header_content_type *header_content_type_decode(const char *in);
-void header_content_type_unref(struct _header_content_type *ct);
-void header_content_type_ref(struct _header_content_type *ct);
-const char *header_content_type_param(struct _header_content_type *t, const char *name);
-void header_content_type_set_param(struct _header_content_type *t, const char *name, const char *value);
-int header_content_type_is(struct _header_content_type *ct, const char *type, const char *subtype);
-char *header_content_type_format(struct _header_content_type *ct);
-char *header_content_type_simple(struct _header_content_type *ct);
+CamelContentType *camel_content_type_new (const char *type, const char *subtype);
+CamelContentType *camel_content_type_decode (const char *in);
+void camel_content_type_unref (CamelContentType *ct);
+void camel_content_type_ref (CamelContentType *ct);
+const char *camel_content_type_param (CamelContentType *t, const char *name);
+void camel_content_type_set_param (CamelContentType *t, const char *name, const char *value);
+int camel_content_type_is (CamelContentType *ct, const char *type, const char *subtype);
+char *camel_content_type_format (CamelContentType *ct);
+char *camel_content_type_simple (CamelContentType *ct);
/* DEBUGGING function */
-void header_content_type_dump(struct _header_content_type *ct);
+void camel_content_type_dump (CamelContentType *ct);
/* Content-Disposition header */
-CamelMimeDisposition *header_disposition_decode(const char *in);
-void header_disposition_ref(CamelMimeDisposition *);
-void header_disposition_unref(CamelMimeDisposition *);
-char *header_disposition_format(CamelMimeDisposition *d);
+CamelContentDisposition *camel_content_disposition_decode (const char *in);
+void camel_content_disposition_ref (CamelContentDisposition *);
+void camel_content_disposition_unref (CamelContentDisposition *);
+char *camel_content_disposition_format (CamelContentDisposition *d);
/* decode the contents of a content-encoding header */
-char *header_content_encoding_decode(const char *in);
+char *camel_header_content_encoding_decode (const char *in);
/* raw headers */
-void header_raw_append(struct _header_raw **list, const char *name, const char *value, int offset);
-void header_raw_append_parse(struct _header_raw **list, const char *header, int offset);
-const char *header_raw_find(struct _header_raw **list, const char *name, int *offset);
-const char *header_raw_find_next(struct _header_raw **list, const char *name, int *offset, const char *last);
-void header_raw_replace(struct _header_raw **list, const char *name, const char *value, int offset);
-void header_raw_remove(struct _header_raw **list, const char *name);
-void header_raw_fold(struct _header_raw **list);
-void header_raw_clear(struct _header_raw **list);
+void camel_header_raw_append (struct _camel_header_raw **list, const char *name, const char *value, int offset);
+void camel_header_raw_append_parse (struct _camel_header_raw **list, const char *header, int offset);
+const char *camel_header_raw_find (struct _camel_header_raw **list, const char *name, int *offset);
+const char *camel_header_raw_find_next (struct _camel_header_raw **list, const char *name, int *offset, const char *last);
+void camel_header_raw_replace (struct _camel_header_raw **list, const char *name, const char *value, int offset);
+void camel_header_raw_remove (struct _camel_header_raw **list, const char *name);
+void camel_header_raw_fold (struct _camel_header_raw **list);
+void camel_header_raw_clear (struct _camel_header_raw **list);
-char *header_raw_check_mailing_list(struct _header_raw **list);
+char *camel_header_raw_check_mailing_list (struct _camel_header_raw **list);
/* fold a header */
-char *header_address_fold (const char *in, size_t headerlen);
-char *header_fold (const char *in, size_t headerlen);
-char *header_unfold (const char *in);
+char *camel_header_address_fold (const char *in, size_t headerlen);
+char *camel_header_fold (const char *in, size_t headerlen);
+char *camel_header_unfold (const char *in);
/* decode a header which is a simple token */
-char *header_token_decode (const char *in);
+char *camel_header_token_decode (const char *in);
-int header_decode_int (const char **in);
+int camel_header_decode_int (const char **in);
/* decode/encode a string type, like a subject line */
-char *header_decode_string (const char *in, const char *default_charset);
-char *header_encode_string (const unsigned char *in);
+char *camel_header_decode_string (const char *in, const char *default_charset);
+char *camel_header_encode_string (const unsigned char *in);
/* encode a phrase, like the real name of an address */
-char *header_encode_phrase (const unsigned char *in);
+char *camel_header_encode_phrase (const unsigned char *in);
/* decode an email date field into a GMT time, + optional offset */
-time_t header_decode_date (const char *in, int *saveoffset);
-char *header_format_date (time_t time, int offset);
+time_t camel_header_decode_date (const char *in, int *saveoffset);
+char *camel_header_format_date (time_t time, int offset);
/* decode a message id */
-char *header_msgid_decode (const char *in);
-char *header_contentid_decode (const char *in);
+char *camel_header_msgid_decode (const char *in);
+char *camel_header_contentid_decode (const char *in);
/* generate msg id */
-char *header_msgid_generate (void);
+char *camel_header_msgid_generate (void);
/* decode a References or In-Reply-To header */
-struct _header_references *header_references_inreplyto_decode (const char *in);
-struct _header_references *header_references_decode(const char *in);
-void header_references_list_clear(struct _header_references **list);
-void header_references_list_append_asis(struct _header_references **list, char *ref);
-int header_references_list_size(struct _header_references **list);
-struct _header_references *header_references_dup(const struct _header_references *list);
+struct _camel_header_references *camel_header_references_inreplyto_decode (const char *in);
+struct _camel_header_references *camel_header_references_decode (const char *in);
+void camel_header_references_list_clear (struct _camel_header_references **list);
+void camel_header_references_list_append_asis (struct _camel_header_references **list, char *ref);
+int camel_header_references_list_size (struct _camel_header_references **list);
+struct _camel_header_references *camel_header_references_dup (const struct _camel_header_references *list);
/* decode content-location */
-char *header_location_decode(const char *in);
+char *camel_header_location_decode (const char *in);
/* decode the mime-type header */
-void header_mime_decode(const char *in, int *maj, int *min);
+void camel_header_mime_decode (const char *in, int *maj, int *min);
/* do incremental base64/quoted-printable (de/en)coding */
-size_t base64_decode_step(unsigned char *in, size_t len, unsigned char *out, int *state, unsigned int *save);
+size_t base64_decode_step (unsigned char *in, size_t len, unsigned char *out, int *state, unsigned int *save);
-size_t base64_encode_step(unsigned char *in, size_t len, gboolean break_lines, unsigned char *out, int *state, int *save);
-size_t base64_encode_close(unsigned char *in, size_t len, gboolean break_lines, unsigned char *out, int *state, int *save);
+size_t base64_encode_step (unsigned char *in, size_t len, gboolean break_lines, unsigned char *out, int *state, int *save);
+size_t base64_encode_close (unsigned char *in, size_t len, gboolean break_lines, unsigned char *out, int *state, int *save);
size_t uudecode_step (unsigned char *in, size_t len, unsigned char *out, int *state, guint32 *save);
@@ -228,10 +228,10 @@ size_t uuencode_step (unsigned char *in, size_t len, unsigned char *out, unsigne
size_t uuencode_close (unsigned char *in, size_t len, unsigned char *out, unsigned char *uubuf, int *state,
guint32 *save);
-size_t quoted_decode_step(unsigned char *in, size_t len, unsigned char *out, int *savestate, int *saveme);
+size_t quoted_decode_step (unsigned char *in, size_t len, unsigned char *out, int *savestate, int *saveme);
-size_t quoted_encode_step(unsigned char *in, size_t len, unsigned char *out, int *state, int *save);
-size_t quoted_encode_close(unsigned char *in, size_t len, unsigned char *out, int *state, int *save);
+size_t quoted_encode_step (unsigned char *in, size_t len, unsigned char *out, int *state, int *save);
+size_t quoted_encode_close (unsigned char *in, size_t len, unsigned char *out, int *state, int *save);
char *base64_encode_simple (const char *data, size_t len);
size_t base64_decode_simple (char *data, size_t len);
diff --git a/camel/camel-movemail.c b/camel/camel-movemail.c
index b5a287cfa6..70807195e5 100644
--- a/camel/camel-movemail.c
+++ b/camel/camel-movemail.c
@@ -402,7 +402,7 @@ camel_movemail_copy_filter(int fromfd, int tofd, off_t start, size_t bytes, Came
/* write the headers back out again, but not he Content-Length header, because we dont
want to maintain it! */
static int
-solaris_header_write(int fd, struct _header_raw *header)
+solaris_header_write(int fd, struct _camel_header_raw *header)
{
struct iovec iv[4];
int outlen = 0, len;
@@ -473,10 +473,10 @@ camel_movemail_solaris (int oldsfd, int dfd, CamelException *ex)
ffrom = camel_mime_filter_from_new();
- while (camel_mime_parser_step(mp, &buffer, &len) == HSCAN_FROM) {
+ while (camel_mime_parser_step(mp, &buffer, &len) == CAMEL_MIME_PARSER_STATE_FROM) {
g_assert(camel_mime_parser_from_line(mp));
from = g_strdup(camel_mime_parser_from_line(mp));
- if (camel_mime_parser_step(mp, &buffer, &len) != HSCAN_FROM_END) {
+ if (camel_mime_parser_step(mp, &buffer, &len) != CAMEL_MIME_PARSER_STATE_FROM_END) {
const char *cl;
int length;
int start, body;
diff --git a/camel/camel-multipart-encrypted.c b/camel/camel-multipart-encrypted.c
index d44d712322..90866a9a20 100644
--- a/camel/camel-multipart-encrypted.c
+++ b/camel/camel-multipart-encrypted.c
@@ -107,7 +107,7 @@ set_mime_type_field (CamelDataWrapper *data_wrapper, CamelContentType *mime_type
if (mime_type) {
const char *protocol;
- protocol = header_content_type_param (mime_type, "protocol");
+ protocol = camel_content_type_param (mime_type, "protocol");
g_free (mpe->protocol);
mpe->protocol = g_strdup (protocol);
}
@@ -215,10 +215,10 @@ camel_multipart_encrypted_encrypt (CamelMultipartEncrypted *mpe, CamelMimePart *
mpe->decrypted = content;
/* set the content-type params for this multipart/encrypted part */
- mime_type = header_content_type_new ("multipart", "encrypted");
- header_content_type_set_param (mime_type, "protocol", cipher->encrypt_protocol);
+ mime_type = camel_content_type_new ("multipart", "encrypted");
+ camel_content_type_set_param (mime_type, "protocol", cipher->encrypt_protocol);
camel_data_wrapper_set_mime_type_field (CAMEL_DATA_WRAPPER (mpe), mime_type);
- header_content_type_unref (mime_type);
+ camel_content_type_unref (mime_type);
camel_multipart_set_boundary ((CamelMultipart *) mpe, NULL);
return 0;
@@ -282,7 +282,7 @@ camel_multipart_encrypted_decrypt (CamelMultipartEncrypted *mpe,
/* get the encrypted part (second part) */
encrypted_part = camel_multipart_get_part (CAMEL_MULTIPART (mpe), CAMEL_MULTIPART_ENCRYPTED_CONTENT);
mime_type = camel_mime_part_get_content_type (encrypted_part);
- if (!header_content_type_is (mime_type, "application", "octet-stream")) {
+ if (!camel_content_type_is (mime_type, "application", "octet-stream")) {
camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
_("Failed to decrypt MIME part: invalid structure"));
return NULL;
diff --git a/camel/camel-multipart-signed.c b/camel/camel-multipart-signed.c
index 5b776d7f9d..63c48a5b98 100644
--- a/camel/camel-multipart-signed.c
+++ b/camel/camel-multipart-signed.c
@@ -159,7 +159,7 @@ camel_multipart_signed_get_type (void)
* set the mime_type appropriately to match the data uses, so
* that the multiple parts my be extracted.
*
- * Use construct_from_parser. The parser MUST be in the HSCAN_HEADER
+ * Use construct_from_parser. The parser MUST be in the CAMEL_MIME_PARSER_STATE_HEADER
* state, and the current content_type MUST be "multipart/signed" with
* the appropriate boundary and it SHOULD include the appropriate protocol
* and hash specifiers.
@@ -279,11 +279,11 @@ set_mime_type_field(CamelDataWrapper *data_wrapper, CamelContentType *mime_type)
if (mime_type) {
const char *micalg, *protocol;
- protocol = header_content_type_param(mime_type, "protocol");
+ protocol = camel_content_type_param(mime_type, "protocol");
g_free(mps->protocol);
mps->protocol = g_strdup(protocol);
- micalg = header_content_type_param(mime_type, "micalg");
+ micalg = camel_content_type_param(mime_type, "micalg");
g_free(mps->micalg);
mps->micalg = g_strdup(micalg);
}
@@ -432,7 +432,7 @@ static int
signed_construct_from_parser(CamelMultipart *multipart, struct _CamelMimeParser *mp)
{
int err;
- struct _header_content_type *content_type;
+ CamelContentType *content_type;
CamelMultipartSigned *mps = (CamelMultipartSigned *)multipart;
char *buf;
size_t len;
@@ -440,14 +440,14 @@ signed_construct_from_parser(CamelMultipart *multipart, struct _CamelMimeParser
/* we *must not* be in multipart state, otherwise the mime parser will
parse the headers which is a no no @#$@# stupid multipart/signed spec */
- g_assert(camel_mime_parser_state(mp) == HSCAN_HEADER);
+ g_assert(camel_mime_parser_state(mp) == CAMEL_MIME_PARSER_STATE_HEADER);
/* All we do is copy it to a memstream */
content_type = camel_mime_parser_content_type(mp);
- camel_multipart_set_boundary(multipart, header_content_type_param(content_type, "boundary"));
+ camel_multipart_set_boundary(multipart, camel_content_type_param(content_type, "boundary"));
mem = camel_stream_mem_new();
- while (camel_mime_parser_step(mp, &buf, &len) != HSCAN_BODY_END)
+ while (camel_mime_parser_step(mp, &buf, &len) != CAMEL_MIME_PARSER_STATE_BODY_END)
camel_stream_write(mem, buf, len);
set_stream(mps, mem);
@@ -646,11 +646,11 @@ camel_multipart_signed_sign(CamelMultipartSigned *mps, CamelCipherContext *conte
camel_mime_part_set_description(signature, _("This is a digitally signed message part"));
/* setup our mime type and boundary */
- mime_type = header_content_type_new("multipart", "signed");
- header_content_type_set_param(mime_type, "micalg", camel_cipher_hash_to_id(context, hash));
- header_content_type_set_param(mime_type, "protocol", context->sign_protocol);
+ mime_type = camel_content_type_new("multipart", "signed");
+ camel_content_type_set_param(mime_type, "micalg", camel_cipher_hash_to_id(context, hash));
+ camel_content_type_set_param(mime_type, "protocol", context->sign_protocol);
camel_data_wrapper_set_mime_type_field(CAMEL_DATA_WRAPPER (mps), mime_type);
- header_content_type_unref(mime_type);
+ camel_content_type_unref(mime_type);
camel_multipart_set_boundary((CamelMultipart *)mps, NULL);
/* just keep the whole raw content. We dont *really* need to do this because
diff --git a/camel/camel-multipart.c b/camel/camel-multipart.c
index 0d5148e890..1ec771103d 100644
--- a/camel/camel-multipart.c
+++ b/camel/camel-multipart.c
@@ -374,7 +374,7 @@ set_boundary (CamelMultipart *multipart, const char *boundary)
boundary = bbuf;
}
- header_content_type_set_param (cdw->mime_type, "boundary", boundary);
+ camel_content_type_set_param (cdw->mime_type, "boundary", boundary);
}
/**
@@ -402,7 +402,7 @@ get_boundary (CamelMultipart *multipart)
CamelDataWrapper *cdw = CAMEL_DATA_WRAPPER (multipart);
g_return_val_if_fail (cdw->mime_type != NULL, NULL);
- return header_content_type_param (cdw->mime_type, "boundary");
+ return camel_content_type_param (cdw->mime_type, "boundary");
}
/**
@@ -546,21 +546,21 @@ static int
construct_from_parser(CamelMultipart *multipart, struct _CamelMimeParser *mp)
{
int err;
- struct _header_content_type *content_type;
+ CamelContentType *content_type;
CamelMimePart *bodypart;
char *buf;
size_t len;
- g_assert(camel_mime_parser_state(mp) == HSCAN_MULTIPART);
+ g_assert(camel_mime_parser_state(mp) == CAMEL_MIME_PARSER_STATE_MULTIPART);
/* FIXME: we should use a came-mime-mutlipart, not jsut a camel-multipart, but who cares */
d(printf("Creating multi-part\n"));
content_type = camel_mime_parser_content_type(mp);
camel_multipart_set_boundary(multipart,
- header_content_type_param(content_type, "boundary"));
+ camel_content_type_param(content_type, "boundary"));
- while (camel_mime_parser_step(mp, &buf, &len) != HSCAN_MULTIPART_END) {
+ while (camel_mime_parser_step(mp, &buf, &len) != CAMEL_MIME_PARSER_STATE_MULTIPART_END) {
camel_mime_parser_unstep(mp);
bodypart = camel_mime_part_new();
camel_mime_part_construct_from_parser(bodypart, mp);
diff --git a/camel/camel-search-private.c b/camel/camel-search-private.c
index 7cadbd525a..2ba908bea3 100644
--- a/camel/camel-search-private.c
+++ b/camel/camel-search-private.c
@@ -408,7 +408,7 @@ camel_search_header_match (const char *value, const char *match, camel_search_ma
switch(type) {
case CAMEL_SEARCH_TYPE_ENCODED:
- v = header_decode_string(value, default_charset); /* FIXME: Find header charset */
+ v = camel_header_decode_string(value, default_charset); /* FIXME: Find header charset */
truth = header_match(v, match, how);
g_free(v);
break;
@@ -449,8 +449,8 @@ camel_search_header_match (const char *value, const char *match, camel_search_ma
for (i=0; !truth && camel_internet_address_get(cia, i, &name, &addr);i++)
truth = (name && header_match(name, match, how)) || (addr && header_match(addr, match, how));
-
- camel_object_unref((CamelObject *)cia);
+
+ camel_object_unref (cia);
break;
}
@@ -482,14 +482,14 @@ camel_search_message_body_contains (CamelDataWrapper *object, regex_t *pattern)
} else if (CAMEL_IS_MIME_MESSAGE (containee)) {
/* for messages we only look at its contents */
truth = camel_search_message_body_contains ((CamelDataWrapper *)containee, pattern);
- } else if (header_content_type_is(CAMEL_DATA_WRAPPER (containee)->mime_type, "text", "*")) {
+ } else if (camel_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 ();
camel_data_wrapper_write_to_stream (containee, CAMEL_STREAM (mem));
camel_stream_write (CAMEL_STREAM (mem), "", 1);
truth = regexec (pattern, mem->buffer->data, 0, NULL, 0) == 0;
- camel_object_unref (CAMEL_OBJECT (mem));
+ camel_object_unref (mem);
}
return truth;
diff --git a/camel/camel-search-private.h b/camel/camel-search-private.h
index 7cc30b687f..8e83f7aed3 100644
--- a/camel/camel-search-private.h
+++ b/camel/camel-search-private.h
@@ -52,7 +52,7 @@ int camel_search_build_match_regex(regex_t *pattern, camel_search_flags_t type,
gboolean camel_search_message_body_contains(CamelDataWrapper *object, regex_t *pattern);
gboolean camel_search_header_match(const char *value, const char *match, camel_search_match_t how, camel_search_t type, const char *default_charset);
-gboolean camel_search_header_soundex(const char *header, const char *match);
+gboolean camel_search_camel_header_soundex(const char *header, const char *match);
/* TODO: replace with a real search function */
const char *camel_ustrstrcase(const char *haystack, const char *needle);
diff --git a/camel/camel-types.h b/camel/camel-types.h
index 20790cd6f4..8345bbf206 100644
--- a/camel/camel-types.h
+++ b/camel/camel-types.h
@@ -24,10 +24,9 @@
#ifdef __cplusplus
extern "C" {
#pragma }
-#endif /* __cplusplus }*/
+#endif /* __cplusplus */
typedef struct _CamelAddress CamelAddress;
-typedef struct _header_content_type CamelContentType;
typedef struct _CamelDigestFolder CamelDigestFolder;
typedef struct _CamelDigestStore CamelDigestStore;
typedef struct _CamelDiscoDiary CamelDiscoDiary;
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index be3e29f16b..4db0c7a43f 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -1673,7 +1673,7 @@ content_info_get_part_spec (CamelMessageContentInfo *ci)
CamelMessageContentInfo *child;
/* FIXME: is this only supposed to apply if 'node' is a multipart? */
- if (node->parent->parent && header_content_type_is (node->parent->type, "message", "*")) {
+ if (node->parent->parent && camel_content_type_is (node->parent->type, "message", "*")) {
node = node->parent;
continue;
}
@@ -1721,7 +1721,7 @@ get_content (CamelImapFolder *imap_folder, const char *uid,
part_spec = content_info_get_part_spec (ci);
/* There are three cases: multipart/signed, multipart, message/rfc822, and "other" */
- if (header_content_type_is (ci->type, "multipart", "signed")) {
+ if (camel_content_type_is (ci->type, "multipart", "signed")) {
CamelMultipartSigned *body_mp;
char *spec;
int ret;
@@ -1749,12 +1749,12 @@ get_content (CamelImapFolder *imap_folder, const char *uid,
}
return (CamelDataWrapper *) body_mp;
- } else if (header_content_type_is (ci->type, "multipart", "*")) {
+ } else if (camel_content_type_is (ci->type, "multipart", "*")) {
CamelMultipart *body_mp;
char *child_spec;
int speclen, num;
- if (header_content_type_is (ci->type, "multipart", "encrypted"))
+ if (camel_content_type_is (ci->type, "multipart", "encrypted"))
body_mp = (CamelMultipart *) camel_multipart_encrypted_new ();
else
body_mp = camel_multipart_new ();
@@ -1808,7 +1808,7 @@ get_content (CamelImapFolder *imap_folder, const char *uid,
g_free (child_spec);
return (CamelDataWrapper *) body_mp;
- } else if (header_content_type_is (ci->type, "message", "rfc822")) {
+ } else if (camel_content_type_is (ci->type, "message", "rfc822")) {
content = (CamelDataWrapper *) get_message (imap_folder, uid, part_spec, ci->childs, ex);
g_free (part_spec);
return content;
diff --git a/camel/providers/imap/camel-imap-store-summary.c b/camel/providers/imap/camel-imap-store-summary.c
index d08fd9b66d..32530d3c3f 100644
--- a/camel/providers/imap/camel-imap-store-summary.c
+++ b/camel/providers/imap/camel-imap-store-summary.c
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2002 Ximian Inc.
*
diff --git a/camel/providers/imap/camel-imap-utils.c b/camel/providers/imap/camel-imap-utils.c
index 26a085739f..00115203f5 100644
--- a/camel/providers/imap/camel-imap-utils.c
+++ b/camel/providers/imap/camel-imap-utils.c
@@ -751,7 +751,7 @@ parse_params (const char **parms_p, CamelContentType *type)
value = imap_parse_nstring (&parms, &len);
if (name && value)
- header_content_type_set_param (type, name, value);
+ camel_content_type_set_param (type, name, value);
g_free (name);
g_free (value);
@@ -814,11 +814,11 @@ imap_body_decode (const char **in, CamelMessageContentInfo *ci, CamelFolder *fol
inptr += 3;
}
- ctype = header_content_type_new ("multipart", subtype ? subtype : "mixed");
+ ctype = camel_content_type_new ("multipart", subtype ? subtype : "mixed");
g_free (subtype);
if (*inptr++ != ')') {
- header_content_type_unref (ctype);
+ camel_content_type_unref (ctype);
return NULL;
}
@@ -855,7 +855,7 @@ imap_body_decode (const char **in, CamelMessageContentInfo *ci, CamelFolder *fol
camel_strdown (type);
camel_strdown (subtype);
- ctype = header_content_type_new (type, subtype);
+ ctype = camel_content_type_new (type, subtype);
g_free (subtype);
g_free (type);
@@ -906,7 +906,7 @@ imap_body_decode (const char **in, CamelMessageContentInfo *ci, CamelFolder *fol
size = strtoul ((const char *) inptr, &p, 10);
inptr = (const unsigned char *) p;
- if (header_content_type_is (ctype, "message", "rfc822")) {
+ if (camel_content_type_is (ctype, "message", "rfc822")) {
/* body_type_msg */
if (*inptr++ != ' ')
goto exception;
@@ -928,7 +928,7 @@ imap_body_decode (const char **in, CamelMessageContentInfo *ci, CamelFolder *fol
/* lines */
strtoul ((const char *) inptr, &p, 10);
inptr = (const unsigned char *) p;
- } else if (header_content_type_is (ctype, "text", "*")) {
+ } else if (camel_content_type_is (ctype, "text", "*")) {
if (*inptr++ != ' ')
goto exception;
@@ -956,7 +956,7 @@ imap_body_decode (const char **in, CamelMessageContentInfo *ci, CamelFolder *fol
exception:
- header_content_type_unref (ctype);
+ camel_content_type_unref (ctype);
g_free (id);
g_free (description);
g_free (encoding);
diff --git a/camel/providers/imapp/camel-imapp-utils.c b/camel/providers/imapp/camel-imapp-utils.c
index 57935a81e8..dcbc362554 100644
--- a/camel/providers/imapp/camel-imapp-utils.c
+++ b/camel/providers/imapp/camel-imapp-utils.c
@@ -318,7 +318,7 @@ media_text ::= <"> "TEXT" <"> SPACE media_subtype
/*
struct _body_fields {
- struct _header_content_type *ct;
+ CamelContentType *ct;
char *msgid, *desc;
CamelMimePartEncodingType encoding;
guint32 size;
@@ -337,7 +337,7 @@ imap_free_body(struct _CamelMessageContentInfo *cinfo)
}
if (cinfo->type)
- header_content_type_unref(cinfo->type);
+ camel_content_type_unref(cinfo->type);
g_free(cinfo->id);
g_free(cinfo->description);
g_free(cinfo->encoding);
@@ -345,7 +345,7 @@ imap_free_body(struct _CamelMessageContentInfo *cinfo)
}
void
-imap_parse_param_list(CamelIMAPPStream *is, struct _header_param **plist)
+imap_parse_param_list(CamelIMAPPStream *is, struct _camel_header_param **plist)
{
int tok, len;
unsigned char *token, *param;
@@ -365,17 +365,17 @@ imap_parse_param_list(CamelIMAPPStream *is, struct _header_param **plist)
param = alloca(strlen(token)+1);
strcpy(param, token);
camel_imapp_stream_astring(is, &token);
- header_set_param(plist, param, token);
+ camel_header_set_param(plist, param, token);
}
} /* else check nil? no need */
}
-struct _CamelMimeDisposition *
+struct _CamelContentDisposition *
imap_parse_ext_optional(CamelIMAPPStream *is)
{
int tok, len;
unsigned char *token;
- struct _CamelMimeDisposition * volatile dinfo = NULL;
+ struct _CamelContentDisposition * volatile dinfo = NULL;
/* this parses both extension types, from the body_fld_dsp onwards */
/* although the grammars are different, they can be parsed the same way */
@@ -448,7 +448,7 @@ imap_parse_ext_optional(CamelIMAPPStream *is)
}
} CAMEL_CATCH(ex) {
if (dinfo)
- header_disposition_unref(dinfo);
+ camel_content_disposition_unref(dinfo);
camel_exception_throw_ex(ex);
} CAMEL_DONE;
@@ -475,7 +475,7 @@ imap_parse_body_fields(CamelIMAPPStream *is)
type = alloca(strlen(token)+1);
strcpy(type, token);
camel_imapp_stream_astring(is, &token);
- cinfo->type = header_content_type_new(type, token);
+ cinfo->type = camel_content_type_new(type, token);
imap_parse_param_list(is, &cinfo->type->params);
/* body_fld_id ::= nstring */
@@ -501,13 +501,13 @@ imap_parse_body_fields(CamelIMAPPStream *is)
return cinfo;
}
-struct _header_address *
+struct _camel_header_address *
imap_parse_address_list(CamelIMAPPStream *is)
/* throws PARSE,IO exception */
{
int tok, len;
unsigned char *token, *host, *mbox;
- struct _header_address *list = NULL;
+ struct _camel_header_address *list = NULL;
/* "(" 1*address ")" / nil */
@@ -515,7 +515,7 @@ imap_parse_address_list(CamelIMAPPStream *is)
tok = camel_imapp_stream_token(is, &token, &len);
if (tok == '(') {
while (1) {
- struct _header_address *addr, *group = NULL;
+ struct _camel_header_address *addr, *group = NULL;
/* address ::= "(" addr_name SPACE addr_adl SPACE addr_mailbox
SPACE addr_host ")" */
@@ -525,7 +525,7 @@ imap_parse_address_list(CamelIMAPPStream *is)
if (tok != '(')
camel_exception_throw(1, "missing '(' for address");
- addr = header_address_new();
+ addr = camel_header_address_new();
addr->type = HEADER_ADDRESS_NAME;
tok = camel_imapp_stream_nstring(is, &token);
addr->name = g_strdup(token);
@@ -551,7 +551,7 @@ imap_parse_address_list(CamelIMAPPStream *is)
g_free(addr->name);
addr->name = mbox;
addr->type = HEADER_ADDRESS_GROUP;
- header_address_list_append(&list, addr);
+ camel_header_address_list_append(&list, addr);
group = addr;
}
} else {
@@ -559,9 +559,9 @@ imap_parse_address_list(CamelIMAPPStream *is)
g_free(mbox);
d(printf("adding address '%s'\n", addr->v.addr));
if (group != NULL)
- header_address_add_member(group, addr);
+ camel_header_address_add_member(group, addr);
else
- header_address_list_append(&list, addr);
+ camel_header_address_list_append(&list, addr);
}
do {
tok = camel_imapp_stream_token(is, &token, &len);
@@ -571,7 +571,7 @@ imap_parse_address_list(CamelIMAPPStream *is)
d(printf("empty, nil '%s'\n", token));
}
} CAMEL_CATCH(ex) {
- header_address_list_clear(&list);
+ camel_header_address_list_clear(&list);
camel_exception_throw_ex(ex);
} CAMEL_DONE;
@@ -583,7 +583,7 @@ imap_parse_envelope(CamelIMAPPStream *is)
{
int tok, len;
unsigned char *token;
- struct _header_address *addr, *addr_from;
+ struct _camel_header_address *addr, *addr_from;
char *addrstr;
struct _CamelMessageInfo *minfo;
@@ -603,7 +603,7 @@ imap_parse_envelope(CamelIMAPPStream *is)
/* env_date ::= nstring */
camel_imapp_stream_nstring(is, &token);
- minfo->date_sent = header_decode_date(token, NULL);
+ minfo->date_sent = camel_header_decode_date(token, NULL);
/* env_subject ::= nstring */
tok = camel_imapp_stream_nstring(is, &token);
@@ -618,10 +618,10 @@ imap_parse_envelope(CamelIMAPPStream *is)
/* env_sender ::= "(" 1*address ")" / nil */
addr = imap_parse_address_list(is);
if (addr_from) {
- header_address_list_clear(&addr);
+ camel_header_address_list_clear(&addr);
#if 0
if (addr)
- header_address_list_append_list(&addr_from, &addr);
+ camel_header_address_list_append_list(&addr_from, &addr);
#endif
} else {
if (addr)
@@ -629,38 +629,38 @@ imap_parse_envelope(CamelIMAPPStream *is)
}
if (addr_from) {
- addrstr = header_address_list_format(addr_from);
+ addrstr = camel_header_address_list_format(addr_from);
camel_message_info_set_from(minfo, addrstr);
- header_address_list_clear(&addr_from);
+ camel_header_address_list_clear(&addr_from);
}
/* we dont keep reply_to */
/* env_reply_to ::= "(" 1*address ")" / nil */
addr = imap_parse_address_list(is);
- header_address_list_clear(&addr);
+ camel_header_address_list_clear(&addr);
/* env_to ::= "(" 1*address ")" / nil */
addr = imap_parse_address_list(is);
if (addr) {
- addrstr = header_address_list_format(addr);
+ addrstr = camel_header_address_list_format(addr);
camel_message_info_set_to(minfo, addrstr);
- header_address_list_clear(&addr);
+ camel_header_address_list_clear(&addr);
}
/* env_cc ::= "(" 1*address ")" / nil */
addr = imap_parse_address_list(is);
if (addr) {
- addrstr = header_address_list_format(addr);
+ addrstr = camel_header_address_list_format(addr);
camel_message_info_set_cc(minfo, addrstr);
- header_address_list_clear(&addr);
+ camel_header_address_list_clear(&addr);
}
/* we dont keep bcc either */
/* env_bcc ::= "(" 1*address ")" / nil */
addr = imap_parse_address_list(is);
- header_address_list_clear(&addr);
+ camel_header_address_list_clear(&addr);
/* FIXME: need to put in-reply-to into references hash list */
@@ -690,7 +690,7 @@ imap_parse_body(CamelIMAPPStream *is)
unsigned char *token;
struct _CamelMessageContentInfo * volatile cinfo = NULL;
struct _CamelMessageContentInfo *subinfo, *last;
- struct _CamelMimeDisposition * volatile dinfo = NULL;
+ struct _CamelContentDisposition * volatile dinfo = NULL;
struct _CamelMessageInfo * volatile minfo = NULL;
/* body ::= "(" body_type_1part / body_type_mpart ")" */
@@ -723,7 +723,7 @@ imap_parse_body(CamelIMAPPStream *is)
d(printf("media_subtype\n"));
camel_imapp_stream_astring(is, &token);
- cinfo->type = header_content_type_new("multipart", token);
+ cinfo->type = camel_content_type_new("multipart", token);
/* body_ext_mpart ::= body_fld_param
[SPACE body_fld_dsp SPACE body_fld_lang
@@ -822,7 +822,7 @@ imap_parse_body(CamelIMAPPStream *is)
if (cinfo)
imap_free_body(cinfo);
if (dinfo)
- header_disposition_unref(dinfo);
+ camel_content_disposition_unref(dinfo);
if (minfo)
camel_message_info_free(minfo);
camel_exception_throw_ex(ex);
@@ -830,7 +830,7 @@ imap_parse_body(CamelIMAPPStream *is)
/* FIXME: do something with the disposition, currently we have no way to pass it out? */
if (dinfo)
- header_disposition_unref(dinfo);
+ camel_content_disposition_unref(dinfo);
return cinfo;
}
diff --git a/camel/providers/imapp/camel-imapp-utils.h b/camel/providers/imapp/camel-imapp-utils.h
index 76ec178b63..e0974bdc96 100644
--- a/camel/providers/imapp/camel-imapp-utils.h
+++ b/camel/providers/imapp/camel-imapp-utils.h
@@ -48,10 +48,10 @@ void imap_parse_flags(CamelIMAPPStream *stream, guint32 *flagsp) /* IO,PARSE */;
void imap_write_flags(CamelStream *stream, guint32 flags) /* IO */;
/* ********************************************************************** */
-void imap_parse_param_list(CamelIMAPPStream *is, struct _header_param **plist) /* IO,PARSE */;
-struct _CamelMimeDisposition *imap_parse_ext_optional(CamelIMAPPStream *is) /* IO,PARSE */;
+void imap_parse_param_list(CamelIMAPPStream *is, struct _camel_header_param **plist) /* IO,PARSE */;
+struct _CamelContentDisposition *imap_parse_ext_optional(CamelIMAPPStream *is) /* IO,PARSE */;
struct _CamelMessageContentInfo *imap_parse_body_fields(CamelIMAPPStream *is) /* IO,PARSE */;
-struct _header_address *imap_parse_address_list(CamelIMAPPStream *is) /* IO,PARSE */;
+struct _camel_header_address *imap_parse_address_list(CamelIMAPPStream *is) /* IO,PARSE */;
struct _CamelMessageInfo *imap_parse_envelope(CamelIMAPPStream *is) /* IO, PARSE */;
struct _CamelMessageContentInfo *imap_parse_body(CamelIMAPPStream *is) /* IO,PARSE */;
char *imap_parse_section(CamelIMAPPStream *is) /* IO,PARSE */;
diff --git a/camel/providers/local/camel-local-summary.c b/camel/providers/local/camel-local-summary.c
index 807b04e4b0..42534b361d 100644
--- a/camel/providers/local/camel-local-summary.c
+++ b/camel/providers/local/camel-local-summary.c
@@ -41,7 +41,7 @@
#define CAMEL_LOCAL_SUMMARY_VERSION (0x200)
-static CamelMessageInfo * message_info_new (CamelFolderSummary *, struct _header_raw *);
+static CamelMessageInfo * message_info_new (CamelFolderSummary *, struct _camel_header_raw *);
static int local_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelMessageInfo *mi);
static char *local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo *mi);
@@ -192,8 +192,8 @@ do_stat_ci(CamelLocalSummary *cls, struct _stat_info *info, CamelMessageContentI
if (ci->encoding)
info->citotal += strlen(ci->encoding) + 4;
if (ci->type) {
- struct _header_content_type *ct = ci->type;
- struct _header_param *param;
+ CamelContentType *ct = ci->type;
+ struct _camel_header_param *param;
info->citotal += sizeof(*ct) + 4;
if (ct->type)
@@ -308,7 +308,7 @@ camel_local_summary_add(CamelLocalSummary *cls, CamelMimeMessage *msg, const Cam
* Return value: -1 on error, otherwise the number of bytes written.
**/
int
-camel_local_summary_write_headers(int fd, struct _header_raw *header, const char *xevline, const char *status, const char *xstatus)
+camel_local_summary_write_headers(int fd, struct _camel_header_raw *header, const char *xevline, const char *status, const char *xstatus)
{
int outlen = 0, len;
int newfd;
@@ -463,7 +463,7 @@ static char *
local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo *mi)
{
GString *out = g_string_new("");
- struct _header_param *params = NULL;
+ struct _camel_header_param *params = NULL;
GString *val = g_string_new("");
CamelFlag *flag = mi->user_flags;
CamelTag *tag = mi->user_tags;
@@ -492,7 +492,7 @@ local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo
g_string_append_c (val, ',');
flag = flag->next;
}
- header_set_param (&params, "flags", val->str);
+ camel_header_set_param (&params, "flags", val->str);
g_string_truncate (val, 0);
}
if (tag) {
@@ -504,11 +504,11 @@ local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo
g_string_append_c (val, ',');
tag = tag->next;
}
- header_set_param (&params, "tags", val->str);
+ camel_header_set_param (&params, "tags", val->str);
}
g_string_free (val, TRUE);
- header_param_list_format_append (out, params);
- header_param_list_free (params);
+ camel_header_param_list_format_append (out, params);
+ camel_header_param_list_free (params);
}
ret = out->str;
g_string_free (out, FALSE);
@@ -519,13 +519,13 @@ local_summary_encode_x_evolution(CamelLocalSummary *cls, const CamelMessageInfo
static int
local_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelMessageInfo *mi)
{
- struct _header_param *params, *scan;
+ struct _camel_header_param *params, *scan;
guint32 uid, flags;
char *header;
int i;
/* check for uid/flags */
- header = header_token_decode(xev);
+ header = camel_header_token_decode(xev);
if (header && strlen(header) == strlen("00000000-0000")
&& sscanf(header, "%08x-%04x", &uid, &flags) == 2) {
char uidstr[20];
@@ -546,7 +546,7 @@ local_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelM
/* check for additional data */
header = strchr(xev, ';');
if (header) {
- params = header_param_list_decode(header+1);
+ params = camel_header_param_list_decode(header+1);
scan = params;
while (scan) {
if (!strcasecmp(scan->name, "flags")) {
@@ -572,13 +572,13 @@ local_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelM
}
scan = scan->next;
}
- header_param_list_free(params);
+ camel_header_param_list_free(params);
}
return 0;
}
static CamelMessageInfo *
-message_info_new(CamelFolderSummary *s, struct _header_raw *h)
+message_info_new(CamelFolderSummary *s, struct _camel_header_raw *h)
{
CamelMessageInfo *mi;
CamelLocalSummary *cls = (CamelLocalSummary *)s;
@@ -588,7 +588,7 @@ message_info_new(CamelFolderSummary *s, struct _header_raw *h)
const char *xev;
int doindex = FALSE;
- xev = header_raw_find(&h, "X-Evolution", NULL);
+ xev = camel_header_raw_find(&h, "X-Evolution", NULL);
if (xev==NULL || camel_local_summary_decode_x_evolution(cls, xev, mi) == -1) {
/* to indicate it has no xev header */
mi->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED | CAMEL_MESSAGE_FOLDER_NOXEV;
diff --git a/camel/providers/local/camel-local-summary.h b/camel/providers/local/camel-local-summary.h
index 0995331ab1..25d77e62c3 100644
--- a/camel/providers/local/camel-local-summary.h
+++ b/camel/providers/local/camel-local-summary.h
@@ -82,7 +82,7 @@ char *camel_local_summary_encode_x_evolution(CamelLocalSummary *cls, const Camel
int camel_local_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelMessageInfo *info);
/* utility functions - write headers to a file with optional X-Evolution header and/or status header */
-int camel_local_summary_write_headers(int fd, struct _header_raw *header, const char *xevline, const char *status, const char *xstatus);
+int camel_local_summary_write_headers(int fd, struct _camel_header_raw *header, const char *xevline, const char *status, const char *xstatus);
#endif /* ! _CAMEL_LOCAL_SUMMARY_H */
diff --git a/camel/providers/local/camel-maildir-summary.c b/camel/providers/local/camel-maildir-summary.c
index 2075694f63..37e1ac2ce7 100644
--- a/camel/providers/local/camel-maildir-summary.c
+++ b/camel/providers/local/camel-maildir-summary.c
@@ -48,7 +48,7 @@
#define CAMEL_MAILDIR_SUMMARY_VERSION (0x2000)
static CamelMessageInfo *message_info_load(CamelFolderSummary *s, FILE *in);
-static CamelMessageInfo *message_info_new(CamelFolderSummary *, struct _header_raw *);
+static CamelMessageInfo *message_info_new(CamelFolderSummary *, struct _camel_header_raw *);
static void message_info_free(CamelFolderSummary *, CamelMessageInfo *mi);
static int maildir_summary_load(CamelLocalSummary *cls, int forceindex, CamelException *ex);
@@ -256,7 +256,7 @@ static CamelMessageInfo *maildir_summary_add(CamelLocalSummary *cls, CamelMimeMe
return mi;
}
-static CamelMessageInfo *message_info_new(CamelFolderSummary * s, struct _header_raw *h)
+static CamelMessageInfo *message_info_new(CamelFolderSummary * s, struct _camel_header_raw *h)
{
CamelMessageInfo *mi, *info;
CamelMaildirSummary *mds = (CamelMaildirSummary *)s;
diff --git a/camel/providers/local/camel-mbox-folder.c b/camel/providers/local/camel-mbox-folder.c
index 3d8b040519..b2a74ef2b8 100644
--- a/camel/providers/local/camel-mbox-folder.c
+++ b/camel/providers/local/camel-mbox-folder.c
@@ -448,7 +448,7 @@ retry:
camel_mime_parser_scan_from(parser, TRUE);
camel_mime_parser_seek(parser, frompos, SEEK_SET);
- if (camel_mime_parser_step(parser, NULL, NULL) != HSCAN_FROM
+ if (camel_mime_parser_step(parser, NULL, NULL) != CAMEL_MIME_PARSER_STATE_FROM
|| camel_mime_parser_tell_start_from(parser) != frompos) {
g_warning("Summary doesn't match the folder contents! eek!\n"
diff --git a/camel/providers/local/camel-mbox-summary.c b/camel/providers/local/camel-mbox-summary.c
index 88d2a3e9a7..4018fc93c9 100644
--- a/camel/providers/local/camel-mbox-summary.c
+++ b/camel/providers/local/camel-mbox-summary.c
@@ -49,7 +49,7 @@
static int summary_header_load (CamelFolderSummary *, FILE *);
static int summary_header_save (CamelFolderSummary *, FILE *);
-static CamelMessageInfo * message_info_new (CamelFolderSummary *, struct _header_raw *);
+static CamelMessageInfo * message_info_new (CamelFolderSummary *, struct _camel_header_raw *);
static CamelMessageInfo * message_info_new_from_parser (CamelFolderSummary *, CamelMimeParser *);
static CamelMessageInfo * message_info_load (CamelFolderSummary *, FILE *);
static int message_info_save (CamelFolderSummary *, FILE *, CamelMessageInfo *);
@@ -187,7 +187,7 @@ summary_header_save(CamelFolderSummary *s, FILE *out)
}
static CamelMessageInfo *
-message_info_new(CamelFolderSummary *s, struct _header_raw *h)
+message_info_new(CamelFolderSummary *s, struct _camel_header_raw *h)
{
CamelMessageInfo *mi;
CamelMboxSummary *mbs = (CamelMboxSummary *)s;
@@ -204,16 +204,16 @@ message_info_new(CamelFolderSummary *s, struct _header_raw *h)
if (mbs->xstatus) {
/* check for existance of status & x-status headers */
- status = header_raw_find(&h, "Status", NULL);
+ status = camel_header_raw_find(&h, "Status", NULL);
if (status)
flags = decode_status(status);
- xstatus = header_raw_find(&h, "X-Status", NULL);
+ xstatus = camel_header_raw_find(&h, "X-Status", NULL);
if (xstatus)
flags |= decode_status(xstatus);
}
#endif
/* if we have an xev header, use it, else assign a new one */
- xev = header_raw_find(&h, "X-Evolution", NULL);
+ xev = camel_header_raw_find(&h, "X-Evolution", NULL);
if (xev != NULL
&& camel_local_summary_decode_x_evolution((CamelLocalSummary *)s, xev, mi) == 0) {
uid = camel_message_info_uid(mi);
@@ -355,7 +355,7 @@ summary_update(CamelLocalSummary *cls, off_t offset, CamelFolderChangeInfo *chan
camel_mime_parser_seek(mp, offset, SEEK_SET);
if (offset > 0) {
- if (camel_mime_parser_step(mp, NULL, NULL) == HSCAN_FROM
+ if (camel_mime_parser_step(mp, NULL, NULL) == CAMEL_MIME_PARSER_STATE_FROM
&& camel_mime_parser_tell_start_from(mp) == offset) {
camel_mime_parser_unstep(mp);
} else {
@@ -380,7 +380,7 @@ summary_update(CamelLocalSummary *cls, off_t offset, CamelFolderChangeInfo *chan
}
mbs->changes = changeinfo;
- while (camel_mime_parser_step(mp, NULL, NULL) == HSCAN_FROM) {
+ while (camel_mime_parser_step(mp, NULL, NULL) == CAMEL_MIME_PARSER_STATE_FROM) {
CamelMessageInfo *info;
off_t pc = camel_mime_parser_tell_start_from (mp) + 1;
@@ -394,7 +394,7 @@ summary_update(CamelLocalSummary *cls, off_t offset, CamelFolderChangeInfo *chan
break;
}
- g_assert(camel_mime_parser_step(mp, NULL, NULL) == HSCAN_FROM_END);
+ g_assert(camel_mime_parser_step(mp, NULL, NULL) == CAMEL_MIME_PARSER_STATE_FROM_END);
}
camel_object_unref(CAMEL_OBJECT (mp));
@@ -638,7 +638,7 @@ mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChan
camel_mime_parser_seek(mp, info->frompos, SEEK_SET);
- if (camel_mime_parser_step(mp, 0, 0) != HSCAN_FROM) {
+ if (camel_mime_parser_step(mp, 0, 0) != CAMEL_MIME_PARSER_STATE_FROM) {
g_warning("Expected a From line here, didn't get it");
camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
_("Summary and folder mismatch, even after a sync"));
@@ -653,7 +653,7 @@ mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChan
goto error;
}
- if (camel_mime_parser_step(mp, 0, 0) == HSCAN_FROM_END) {
+ if (camel_mime_parser_step(mp, 0, 0) == CAMEL_MIME_PARSER_STATE_FROM_END) {
g_warning("camel_mime_parser_step failed (2)");
goto error;
}
@@ -667,7 +667,7 @@ mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChan
/* SIGH: encode_param_list is about the only function which folds headers by itself.
This should be fixed somehow differently (either parser doesn't fold headers,
or param_list doesn't, or something */
- xevtmp = header_unfold(xevnew);
+ xevtmp = camel_header_unfold(xevnew);
/* the raw header contains a leading ' ', so (dis)count that too */
if (strlen(xev)-1 != strlen(xevtmp)) {
printf ("strlen(xev)-1 = %d; strlen(xevtmp) = %d\n", strlen(xev)-1, strlen(xevtmp));
@@ -839,7 +839,7 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
camel_mime_parser_seek(mp, info->frompos, SEEK_SET);
}
- if (camel_mime_parser_step(mp, &buffer, &len) != HSCAN_FROM) {
+ if (camel_mime_parser_step(mp, &buffer, &len) != CAMEL_MIME_PARSER_STATE_FROM) {
g_warning("Expected a From line here, didn't get it");
camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
_("Summary and folder mismatch, even after a sync"));
@@ -885,7 +885,7 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
if (info && info->info.flags & (CAMEL_MESSAGE_FOLDER_NOXEV | CAMEL_MESSAGE_FOLDER_FLAGGED)) {
d(printf("Updating header for %s flags = %08x\n", camel_message_info_uid(info), info->info.flags));
- if (camel_mime_parser_step(mp, &buffer, &len) == HSCAN_FROM_END) {
+ if (camel_mime_parser_step(mp, &buffer, &len) == CAMEL_MIME_PARSER_STATE_FROM_END) {
g_warning("camel_mime_parser_step failed (2)");
goto error;
}
@@ -918,7 +918,7 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
camel_mime_parser_drop_step(mp);
if (info) {
d(printf("looking for message content to copy across from %d\n", (int)camel_mime_parser_tell(mp)));
- while (camel_mime_parser_step(mp, &buffer, &len) == HSCAN_PRE_FROM) {
+ while (camel_mime_parser_step(mp, &buffer, &len) == CAMEL_MIME_PARSER_STATE_PRE_FROM) {
/*d(printf("copying mbox contents to tmp: '%.*s'\n", len, buffer));*/
if (write(fdout, buffer, len) != len) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
diff --git a/camel/providers/local/camel-mh-summary.c b/camel/providers/local/camel-mh-summary.c
index 25794fa258..5dd26ac9ba 100644
--- a/camel/providers/local/camel-mh-summary.c
+++ b/camel/providers/local/camel-mh-summary.c
@@ -314,7 +314,7 @@ mh_summary_sync_message(CamelLocalSummary *cls, CamelMessageInfo *info, CamelExc
mp = camel_mime_parser_new();
camel_mime_parser_init_with_fd(mp, fd);
- if (camel_mime_parser_step(mp, 0, 0) != HSCAN_EOF) {
+ if (camel_mime_parser_step(mp, 0, 0) != CAMEL_MIME_PARSER_STATE_EOF) {
xev = camel_mime_parser_header(mp, "X-Evolution", &xevoffset);
d(printf("xev = '%s'\n", xev));
xevnew = camel_local_summary_encode_x_evolution(cls, info);
diff --git a/camel/providers/local/camel-spool-summary.h b/camel/providers/local/camel-spool-summary.h
index 7813243a69..b72aeda527 100644
--- a/camel/providers/local/camel-spool-summary.h
+++ b/camel/providers/local/camel-spool-summary.h
@@ -63,7 +63,7 @@ char *camel_spool_summary_encode_x_evolution(CamelSpoolSummary *cls, const Camel
int camel_spool_summary_decode_x_evolution(CamelSpoolSummary *cls, const char *xev, CamelMessageInfo *info);
/* utility functions - write headers to a file with optional X-Evolution header */
-int camel_spool_summary_write_headers(int fd, struct _header_raw *header, char *xevline);
+int camel_spool_summary_write_headers(int fd, struct _camel_header_raw *header, char *xevline);
#endif /* ! _CAMEL_SPOOL_SUMMARY_H */
diff --git a/camel/providers/nntp/camel-nntp-summary.c b/camel/providers/nntp/camel-nntp-summary.c
index 9f6ff5f095..2a9669d697 100644
--- a/camel/providers/nntp/camel-nntp-summary.c
+++ b/camel/providers/nntp/camel-nntp-summary.c
@@ -77,7 +77,7 @@ struct _CamelNNTPSummaryPrivate {
#define _PRIVATE(o) (((CamelNNTPSummary *)(o))->priv)
-static CamelMessageInfo * message_info_new (CamelFolderSummary *, struct _header_raw *);
+static CamelMessageInfo * message_info_new (CamelFolderSummary *, struct _camel_header_raw *);
static int summary_header_load(CamelFolderSummary *, FILE *);
static int summary_header_save(CamelFolderSummary *, FILE *);
@@ -165,7 +165,7 @@ camel_nntp_summary_new(CamelNNTPFolder *folder)
}
static CamelMessageInfo *
-message_info_new(CamelFolderSummary *s, struct _header_raw *h)
+message_info_new(CamelFolderSummary *s, struct _camel_header_raw *h)
{
CamelMessageInfo *mi;
CamelNNTPSummary *cns = (CamelNNTPSummary *)s;
@@ -186,7 +186,8 @@ message_info_new(CamelFolderSummary *s, struct _header_raw *h)
return mi;
}
-static int summary_header_load(CamelFolderSummary *s, FILE *in)
+static int
+summary_header_load(CamelFolderSummary *s, FILE *in)
{
CamelNNTPSummary *cns = CAMEL_NNTP_SUMMARY(s);
@@ -198,7 +199,8 @@ static int summary_header_load(CamelFolderSummary *s, FILE *in)
return 0;
}
-static int summary_header_save(CamelFolderSummary *s, FILE *out)
+static int
+summary_header_save(CamelFolderSummary *s, FILE *out)
{
CamelNNTPSummary *cns = CAMEL_NNTP_SUMMARY(s);
@@ -211,7 +213,8 @@ static int summary_header_save(CamelFolderSummary *s, FILE *out)
}
/* Assumes we have the stream */
-int camel_nntp_summary_check(CamelNNTPSummary *cns, CamelFolderChangeInfo *changes, CamelException *ex)
+int
+camel_nntp_summary_check(CamelNNTPSummary *cns, CamelFolderChangeInfo *changes, CamelException *ex)
{
CamelNNTPStore *store;
CamelFolder *folder;
@@ -390,7 +393,7 @@ add_range_xover(CamelNNTPSummary *cns, unsigned int high, unsigned int low, Came
CamelFolder *folder;
CamelFolderSummary *s;
CamelMessageInfo *mi;
- struct _header_raw *headers = NULL;
+ struct _camel_header_raw *headers = NULL;
char *line, *tab;
int len, ret;
unsigned int n, count, total, size;
@@ -433,7 +436,7 @@ add_range_xover(CamelNNTPSummary *cns, unsigned int high, unsigned int low, Came
if (xover->name) {
line += xover->skip;
if (line < tab) {
- header_raw_append(&headers, xover->name, line, -1);
+ camel_header_raw_append(&headers, xover->name, line, -1);
switch(xover->type) {
case XOVER_STRING:
break;
@@ -468,7 +471,7 @@ add_range_xover(CamelNNTPSummary *cns, unsigned int high, unsigned int low, Came
cns->priv->uid = NULL;
}
- header_raw_clear(&headers);
+ camel_header_raw_clear(&headers);
now = time(0);
if (last + 2 < now) {
@@ -533,7 +536,7 @@ add_range_head(CamelNNTPSummary *cns, unsigned int high, unsigned int low, Camel
if (camel_mime_parser_init_with_stream(mp, (CamelStream *)store->stream) == -1)
goto error;
mi = camel_folder_summary_add_from_parser(s, mp);
- while (camel_mime_parser_step(mp, NULL, NULL) != HSCAN_EOF)
+ while (camel_mime_parser_step(mp, NULL, NULL) != CAMEL_MIME_PARSER_STATE_EOF)
;
if (mi == NULL) {
goto error;
diff --git a/camel/providers/nntp/camel-nntp-utils.c b/camel/providers/nntp/camel-nntp-utils.c
index 5f26d7100f..d8000a85ee 100644
--- a/camel/providers/nntp/camel-nntp-utils.c
+++ b/camel/providers/nntp/camel-nntp-utils.c
@@ -94,7 +94,7 @@ get_XOVER_headers(CamelNNTPStore *nntp_store, CamelFolder *folder,
camel_message_info_set_to(new_info, g_strdup(folder->name));
camel_message_info_set_uid(new_info, uid);
- new_info->date_sent = header_decode_date(date, NULL);
+ new_info->date_sent = camel_header_decode_date(date, NULL);
#if 0
/* XXX do we need to fill in both dates? */
new_info->headers.date_received = g_strdup(date);
@@ -176,9 +176,8 @@ get_HEAD_headers(CamelNNTPStore *nntp_store, CamelFolder *folder,
}
/* create a stream from which to parse the headers */
- header_stream = camel_stream_mem_new_with_buffer(buf,
- buf_len,
- CAMEL_STREAM_MEM_READ);
+ header_stream = camel_stream_mem_new_with_buffer (buf, buf_len,
+ CAMEL_STREAM_MEM_READ);
header_array = get_header_array_from_stream (header_stream);
@@ -197,7 +196,7 @@ get_HEAD_headers(CamelNNTPStore *nntp_store, CamelFolder *folder,
new_info->message_id = g_strdup(header->value);
}
else if (!g_strcasecmp(header->name, "Date")) {
- new_info->date_sent = header_decode_date (header->value);
+ new_info->date_sent = camel_header_decode_date (header->value);
#if 0
new_info->date_sent = g_strdup(header->value);
new_info->date_received = g_strdup(header->value);
diff --git a/camel/providers/pop3/camel-pop3-folder.c b/camel/providers/pop3/camel-pop3-folder.c
index a0d4ea661f..0df4fcf5c5 100644
--- a/camel/providers/pop3/camel-pop3-folder.c
+++ b/camel/providers/pop3/camel-pop3-folder.c
@@ -145,7 +145,7 @@ cmd_builduid(CamelPOP3Engine *pe, CamelPOP3Stream *stream, void *data)
CamelPOP3FolderInfo *fi = data;
MD5Context md5;
unsigned char digest[16];
- struct _header_raw *h;
+ struct _camel_header_raw *h;
CamelMimeParser *mp;
/* TODO; somehow work out the limit and use that for proper progress reporting
@@ -156,9 +156,9 @@ cmd_builduid(CamelPOP3Engine *pe, CamelPOP3Stream *stream, void *data)
mp = camel_mime_parser_new();
camel_mime_parser_init_with_stream(mp, (CamelStream *)stream);
switch (camel_mime_parser_step(mp, NULL, NULL)) {
- case HSCAN_HEADER:
- case HSCAN_MESSAGE:
- case HSCAN_MULTIPART:
+ case CAMEL_MIME_PARSER_STATE_HEADER:
+ case CAMEL_MIME_PARSER_STATE_MESSAGE:
+ case CAMEL_MIME_PARSER_STATE_MULTIPART:
h = camel_mime_parser_headers_raw(mp);
while (h) {
if (strcasecmp(h->name, "status") != 0
diff --git a/camel/providers/sendmail/camel-sendmail-transport.c b/camel/providers/sendmail/camel-sendmail-transport.c
index 863daf1bca..fbf6f08a6b 100644
--- a/camel/providers/sendmail/camel-sendmail-transport.c
+++ b/camel/providers/sendmail/camel-sendmail-transport.c
@@ -87,7 +87,7 @@ sendmail_send_to (CamelTransport *transport, CamelMimeMessage *message,
CamelAddress *from, CamelAddress *recipients,
CamelException *ex)
{
- struct _header_raw *header, *savedbcc, *n, *tail;
+ struct _camel_header_raw *header, *savedbcc, *n, *tail;
const char *from_addr, *addr, **argv;
int i, len, fd[2], nullfd, wstat;
CamelStreamFilter *filter;
@@ -122,9 +122,9 @@ sendmail_send_to (CamelTransport *transport, CamelMimeMessage *message,
/* unlink the bcc headers */
savedbcc = NULL;
- tail = (struct _header_raw *) &savedbcc;
+ tail = (struct _camel_header_raw *) &savedbcc;
- header = (struct _header_raw *) &CAMEL_MIME_PART (message)->headers;
+ header = (struct _camel_header_raw *) &CAMEL_MIME_PART (message)->headers;
n = header->next;
while (n != NULL) {
if (!strcasecmp (n->name, "Bcc")) {
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index 0cb9594c25..e2e1fccf5c 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -1223,7 +1223,7 @@ static gboolean
smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, CamelException *ex)
{
CamelBestencEncoding enctype = CAMEL_BESTENC_8BIT;
- struct _header_raw *header, *savedbcc, *n, *tail;
+ struct _camel_header_raw *header, *savedbcc, *n, *tail;
char *cmdbuf, *respbuf = NULL;
CamelStreamFilter *filtered_stream;
CamelMimeFilter *crlffilter;
@@ -1282,9 +1282,9 @@ smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, CamelExcept
/* unlink the bcc headers */
savedbcc = NULL;
- tail = (struct _header_raw *) &savedbcc;
+ tail = (struct _camel_header_raw *) &savedbcc;
- header = (struct _header_raw *) &CAMEL_MIME_PART (message)->headers;
+ header = (struct _camel_header_raw *) &CAMEL_MIME_PART (message)->headers;
n = header->next;
while (n != NULL) {
if (!strcasecmp (n->name, "Bcc")) {