Namespaced.
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=22355
This commit is contained in:

committed by
Jeffrey Stedfast

parent
0357dde828
commit
e74d9ca1cc
103
camel/ChangeLog
103
camel/ChangeLog
@ -1,3 +1,106 @@
|
||||
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-08-25 Jeffrey Stedfast <fejj@ximian.com>
|
||||
|
||||
* camel-filter-driver.c (pipe_to_system): Added some more error
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -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) {
|
||||
|
@ -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>
|
||||
*
|
||||
@ -855,7 +856,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 ();
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
@ -1475,7 +1475,7 @@ static CamelMessageContentInfo * content_info_new_from_parser(CamelFolderSummary
|
||||
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);
|
||||
@ -2013,16 +2013,16 @@ summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, Cam
|
||||
/* 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
|
||||
@ -2097,7 +2097,7 @@ summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, Cam
|
||||
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) {
|
||||
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
@ -290,23 +290,23 @@ http_get_headers (CamelHttpStream *http)
|
||||
case HSCAN_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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
@ -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",
|
||||
|
@ -253,9 +253,9 @@ struct _header_scan_stack {
|
||||
#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 */
|
||||
@ -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);
|
||||
@ -607,7 +607,7 @@ 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.
|
||||
@ -622,15 +622,16 @@ camel_mime_parser_init_with_stream(CamelMimeParser *m, CamelStream *stream)
|
||||
* 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
|
||||
@ -638,15 +639,16 @@ camel_mime_parser_scan_from(CamelMimeParser *m, int scan_from)
|
||||
* state HSCAN_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,9 +699,10 @@ 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);
|
||||
@ -705,7 +710,7 @@ void camel_mime_parser_drop_step(CamelMimeParser *m)
|
||||
|
||||
/**
|
||||
* 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.
|
||||
@ -729,9 +734,9 @@ void camel_mime_parser_drop_step(CamelMimeParser *m)
|
||||
* is returned.
|
||||
**/
|
||||
enum _header_state
|
||||
camel_mime_parser_step(CamelMimeParser *m, char **databuffer, size_t *datalength)
|
||||
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,7 +811,7 @@ 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.
|
||||
@ -824,16 +829,17 @@ camel_mime_parser_read(CamelMimeParser *m, const char **databuffer, int len)
|
||||
*
|
||||
* 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 _header_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,16 +950,19 @@ 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;
|
||||
}
|
||||
@ -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;
|
||||
|
||||
@ -1663,11 +1680,11 @@ tail_recurse:
|
||||
/* 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))) {
|
||||
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;
|
||||
@ -1675,10 +1692,10 @@ tail_recurse:
|
||||
sprintf(h->boundary, "--%s--", bound);
|
||||
type = HSCAN_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")) {
|
||||
@ -1691,14 +1708,14 @@ tail_recurse:
|
||||
} 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");
|
||||
&& camel_content_type_is(s->parts->content_type, "multipart", "digest"))) {
|
||||
ct = camel_content_type_decode("message/rfc822");
|
||||
type = HSCAN_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;
|
||||
@ -1895,7 +1912,7 @@ int main(int argc, char **argv)
|
||||
switch (s->state) {
|
||||
case HSCAN_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");
|
||||
|
@ -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>
|
||||
*
|
||||
@ -75,70 +75,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);
|
||||
|
||||
/* 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 _header_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 _header_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
|
||||
}
|
||||
|
@ -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:
|
||||
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 {
|
||||
@ -109,9 +109,9 @@ camel_mime_part_construct_content_from_parser (CamelMimePart *dw, CamelMimeParse
|
||||
break;
|
||||
case HSCAN_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 ();
|
||||
|
@ -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;
|
||||
@ -787,15 +789,15 @@ construct_from_parser (CamelMimePart *mime_part, CamelMimeParser *mp)
|
||||
case HSCAN_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");
|
||||
camel_content_type_unref (dw->mime_type);
|
||||
dw->mime_type = camel_content_type_decode ("message/rfc822");
|
||||
case HSCAN_HEADER:
|
||||
case HSCAN_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);
|
||||
|
||||
|
@ -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;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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 _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 _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_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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
@ -444,7 +444,7 @@ signed_construct_from_parser(CamelMultipart *multipart, struct _CamelMimeParser
|
||||
|
||||
/* 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)
|
||||
@ -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
|
||||
|
@ -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,7 +546,7 @@ 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;
|
||||
@ -558,7 +558,7 @@ construct_from_parser(CamelMultipart *multipart, struct _CamelMimeParser *mp)
|
||||
|
||||
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) {
|
||||
camel_mime_parser_unstep(mp);
|
||||
|
@ -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;
|
||||
@ -450,7 +450,7 @@ 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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* Copyright (C) 2002 Ximian Inc.
|
||||
*
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 */;
|
||||
|
@ -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 (¶ms, "flags", val->str);
|
||||
camel_header_set_param (¶ms, "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 (¶ms, "tags", val->str);
|
||||
camel_header_set_param (¶ms, "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;
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
@ -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));
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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,8 +176,7 @@ 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,
|
||||
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);
|
||||
|
@ -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
|
||||
|
@ -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")) {
|
||||
|
@ -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")) {
|
||||
|
Reference in New Issue
Block a user