diff options
author | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-08-27 02:16:51 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-08-27 02:16:51 +0800 |
commit | 04b9ec51d45f2efb3b8118eef99c7592ba269792 (patch) | |
tree | 2ed61b2ef50a2f74fcc4911b1145367514d721e7 /camel/camel-folder-summary.c | |
parent | 173fc4ff4c7f267cefeeeed0a7a93a7f1f245c62 (diff) | |
download | gsoc2013-evolution-04b9ec51d45f2efb3b8118eef99c7592ba269792.tar.gz gsoc2013-evolution-04b9ec51d45f2efb3b8118eef99c7592ba269792.tar.zst gsoc2013-evolution-04b9ec51d45f2efb3b8118eef99c7592ba269792.zip |
temporarily reverting my camel namespace patches until after we merge in some of the other branches
svn path=/trunk/; revision=22373
Diffstat (limited to 'camel/camel-folder-summary.c')
-rw-r--r-- | camel/camel-folder-summary.c | 152 |
1 files changed, 76 insertions, 76 deletions
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c index d7c08219c5..5efc369cb5 100644 --- a/camel/camel-folder-summary.c +++ b/camel/camel-folder-summary.c @@ -90,14 +90,14 @@ static int my_list_size(struct _node **list); static int summary_header_load(CamelFolderSummary *, FILE *); static int summary_header_save(CamelFolderSummary *, FILE *); -static CamelMessageInfo * message_info_new(CamelFolderSummary *, struct _camel_header_raw *); +static CamelMessageInfo * message_info_new(CamelFolderSummary *, struct _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 _camel_header_raw *); +static CamelMessageContentInfo * content_info_new(CamelFolderSummary *, struct _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 _camel_header_raw *h) +CamelMessageInfo *camel_folder_summary_add_from_header(CamelFolderSummary *s, struct _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 _camel_header_raw *h) +CamelMessageInfo *camel_folder_summary_info_new_from_header(CamelFolderSummary *s, struct _header_raw *h) { return ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s))) -> message_info_new(s, h); } @@ -907,7 +907,7 @@ CamelMessageInfo *camel_folder_summary_info_new_from_parser(CamelFolderSummary * /* should this check the parser is in the right state, or assume it is?? */ start = camel_mime_parser_tell(mp); - if (camel_mime_parser_step(mp, &buffer, &len) != CAMEL_MIME_PARSER_STATE_EOF) { + if (camel_mime_parser_step(mp, &buffer, &len) != HSCAN_EOF) { info = ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->message_info_new_from_parser(s, mp); camel_mime_parser_unstep(mp); @@ -1452,9 +1452,9 @@ static CamelMessageInfo * message_info_new_from_parser(CamelFolderSummary *s, Ca state = camel_mime_parser_state(mp); switch (state) { - case CAMEL_MIME_PARSER_STATE_HEADER: - case CAMEL_MIME_PARSER_STATE_MESSAGE: - case CAMEL_MIME_PARSER_STATE_MULTIPART: + case HSCAN_HEADER: + case HSCAN_MESSAGE: + case HSCAN_MULTIPART: mi = ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->message_info_new(s, camel_mime_parser_headers_raw(mp)); break; default: @@ -1469,13 +1469,13 @@ static CamelMessageContentInfo * content_info_new_from_parser(CamelFolderSummary CamelMessageContentInfo *ci = NULL; switch (camel_mime_parser_state(mp)) { - case CAMEL_MIME_PARSER_STATE_HEADER: - case CAMEL_MIME_PARSER_STATE_MESSAGE: - case CAMEL_MIME_PARSER_STATE_MULTIPART: + case HSCAN_HEADER: + case HSCAN_MESSAGE: + case HSCAN_MULTIPART: ci = ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->content_info_new(s, camel_mime_parser_headers_raw(mp)); if (ci) { ci->type = camel_mime_parser_content_type(mp); - camel_content_type_ref(ci->type); + header_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 _camel_header_raw *h, const char *name, const char *charset) +summary_format_address(struct _header_raw *h, const char *name, const char *charset) { - struct _camel_header_address *addr; + struct _header_address *addr; const char *text; char *ret; - text = camel_header_raw_find (&h, name, NULL); - addr = camel_header_address_decode (text, charset); + text = header_raw_find (&h, name, NULL); + addr = header_address_decode (text, charset); if (addr) { - ret = camel_header_address_list_format (addr); - camel_header_address_list_clear (&addr); + ret = header_address_list_format (addr); + header_address_list_clear (&addr); } else { ret = g_strdup (text); } @@ -1523,15 +1523,15 @@ summary_format_address(struct _camel_header_raw *h, const char *name, const char } static char * -summary_format_string (struct _camel_header_raw *h, const char *name, const char *charset) +summary_format_string (struct _header_raw *h, const char *name, const char *charset) { const char *text; - text = camel_header_raw_find (&h, name, NULL); + text = header_raw_find (&h, name, NULL); if (text) { while (isspace ((unsigned) *text)) text++; - return camel_header_decode_string (text, charset); + return 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 _camel_header_raw *h) +message_info_new(CamelFolderSummary *s, struct _header_raw *h) { CamelMessageInfo *mi; const char *received; guchar digest[16]; - struct _camel_header_references *refs, *irt, *scan; + struct _header_references *refs, *irt, *scan; char *msgid; int count; char *subject, *from, *to, *cc, *mlist; - CamelContentType *ct = NULL; + struct _header_content_type *ct = NULL; const char *content, *charset = NULL; mi = camel_folder_summary_info_new(s); - if ((content = camel_header_raw_find(&h, "Content-Type", NULL)) - && (ct = camel_content_type_decode(content)) - && (charset = camel_content_type_param(ct, "charset")) + if ((content = header_raw_find(&h, "Content-Type", NULL)) + && (ct = header_content_type_decode(content)) + && (charset = header_content_type_param(ct, "charset")) && (strcasecmp(charset, "us-ascii") == 0)) charset = NULL; @@ -1619,10 +1619,10 @@ message_info_new(CamelFolderSummary *s, struct _camel_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 = camel_header_raw_check_mailing_list(&h); + mlist = header_raw_check_mailing_list(&h); if (ct) - camel_content_type_unref(ct); + header_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 _camel_header_raw *h) mi->user_flags = NULL; mi->user_tags = NULL; - mi->date_sent = camel_header_decode_date(camel_header_raw_find(&h, "date", NULL), NULL); - received = camel_header_raw_find(&h, "received", NULL); + mi->date_sent = header_decode_date(header_raw_find(&h, "date", NULL), NULL); + received = header_raw_find(&h, "received", NULL); if (received) received = strrchr(received, ';'); if (received) - mi->date_received = camel_header_decode_date(received + 1, NULL); + mi->date_received = header_decode_date(received + 1, NULL); else mi->date_received = 0; - msgid = camel_header_msgid_decode(camel_header_raw_find(&h, "message-id", NULL)); + msgid = header_msgid_decode(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 _camel_header_raw *h) } /* decode our references and in-reply-to headers */ - 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)); + refs = header_references_decode (header_raw_find (&h, "references", NULL)); + irt = header_references_inreplyto_decode (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 _camel_header_raw *h) refs = irt; } - count = camel_header_references_list_size(&refs); + count = 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 _camel_header_raw *h) scan = scan->next; } mi->references->size = count; - camel_header_references_list_clear(&refs); + 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 _camel_header_raw *h) +content_info_new (CamelFolderSummary *s, struct _header_raw *h) { CamelMessageContentInfo *ci; const char *charset; @@ -1875,9 +1875,9 @@ content_info_new (CamelFolderSummary *s, struct _camel_header_raw *h) ci = camel_folder_summary_content_info_new (s); charset = e_iconv_locale_charset (); - 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)); + 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)); return ci; } @@ -1888,7 +1888,7 @@ content_info_load(CamelFolderSummary *s, FILE *in) CamelMessageContentInfo *ci; char *type, *subtype; guint32 count, i; - CamelContentType *ct; + struct _header_content_type *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 = camel_content_type_new(type, subtype); + ct = header_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; - camel_content_type_set_param(ct, name, value); + header_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) { - CamelContentType *ct; - struct _camel_header_param *hp; + struct _header_content_type *ct; + struct _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) { - camel_content_type_unref(ci->type); + header_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; - CamelContentType *ct; + struct _header_content_type *ct; int body; int enc_id = -1, chr_id = -1, html_id = -1, idx_id = -1; struct _CamelFolderSummaryPrivate *p = _PRIVATE(s); @@ -2009,20 +2009,20 @@ summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, Cam info = ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->content_info_new_from_parser(s, mp); switch(state) { - case CAMEL_MIME_PARSER_STATE_HEADER: + case HSCAN_HEADER: /* check content type for indexing, then read body */ ct = camel_mime_parser_content_type(mp); /* update attachments flag as we go */ - if (!camel_content_type_is(ct, "text", "*")) + if (!header_content_type_is(ct, "text", "*")) msginfo->flags |= CAMEL_MESSAGE_ATTACHMENTS; - if (p->index && camel_content_type_is(ct, "text", "*")) { + if (p->index && header_content_type_is(ct, "text", "*")) { char *encoding; const char *charset; d(printf("generating index:\n")); - encoding = camel_header_content_encoding_decode(camel_mime_parser_header(mp, "content-transfer-encoding", NULL)); + encoding = 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 = camel_content_type_param(ct, "charset"); + charset = header_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 (camel_content_type_is(ct, "text", "html")) { + if (header_content_type_is(ct, "text", "html")) { if (p->filter_html == NULL) p->filter_html = camel_mime_filter_html_new(); else @@ -2085,7 +2085,7 @@ summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, Cam idx_id = camel_mime_parser_filter_add(mp, (CamelMimeFilter *)p->filter_index); } /* and scan/index everything */ - while (camel_mime_parser_step(mp, &buffer, &len) != CAMEL_MIME_PARSER_STATE_BODY_END) + while (camel_mime_parser_step(mp, &buffer, &len) != HSCAN_BODY_END) ; /* and remove the filters */ camel_mime_parser_filter_remove(mp, enc_id); @@ -2093,14 +2093,14 @@ summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, Cam camel_mime_parser_filter_remove(mp, html_id); camel_mime_parser_filter_remove(mp, idx_id); break; - case CAMEL_MIME_PARSER_STATE_MULTIPART: + case HSCAN_MULTIPART: d(printf("Summarising multipart\n")); /* update attachments flag as we go */ ct = camel_mime_parser_content_type(mp); - if (camel_content_type_is(ct, "multipart", "mixed")) + if (header_content_type_is(ct, "multipart", "mixed")) msginfo->flags |= CAMEL_MESSAGE_ATTACHMENTS; - while (camel_mime_parser_step(mp, &buffer, &len) != CAMEL_MIME_PARSER_STATE_MULTIPART_END) { + while (camel_mime_parser_step(mp, &buffer, &len) != HSCAN_MULTIPART_END) { camel_mime_parser_unstep(mp); part = summary_build_content_info(s, msginfo, mp); if (part) { @@ -2109,7 +2109,7 @@ summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, Cam } } break; - case CAMEL_MIME_PARSER_STATE_MESSAGE: + case HSCAN_MESSAGE: d(printf("Summarising message\n")); /* update attachments flag as we go */ msginfo->flags |= CAMEL_MESSAGE_ATTACHMENTS; @@ -2120,7 +2120,7 @@ summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, Cam my_list_append((struct _node **)&info->childs, (struct _node *)part); } state = camel_mime_parser_step(mp, &buffer, &len); - if (state != CAMEL_MIME_PARSER_STATE_MESSAGE_END) { + if (state != HSCAN_MESSAGE_END) { g_error("Bad parser state: Expecing MESSAGE_END or MESSAGE_EOF, got: %d", state); camel_mime_parser_unstep(mp); } @@ -2154,10 +2154,10 @@ summary_build_content_info_message(CamelFolderSummary *s, CamelMessageInfo *msgi add a reference, probably need fixing for multithreading */ /* check for attachments */ - if (camel_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "multipart", "*")) { - if (camel_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "multipart", "mixed")) + if (header_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "multipart", "*")) { + if (header_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "multipart", "mixed")) msginfo->flags |= CAMEL_MESSAGE_ATTACHMENTS; - } else if (!camel_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "text", "*")) + } else if (!header_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "text", "*")) msginfo->flags |= CAMEL_MESSAGE_ATTACHMENTS; /* using the object types is more accurate than using the mime/types */ @@ -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 - && camel_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "text", "*")) { + && header_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 (camel_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "text", "html")) { + if (header_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 _camel_header_raw *header) +camel_message_info_new_from_header (struct _header_raw *header) { CamelMessageInfo *info; char *subject, *from, *to, *cc, *mlist; - CamelContentType *ct = NULL; + struct _header_content_type *ct = NULL; const char *content, *date, *charset = NULL; - if ((content = camel_header_raw_find(&header, "Content-Type", NULL)) - && (ct = camel_content_type_decode(content)) - && (charset = camel_content_type_param(ct, "charset")) + if ((content = header_raw_find(&header, "Content-Type", NULL)) + && (ct = header_content_type_decode(content)) + && (charset = header_content_type_param(ct, "charset")) && (strcasecmp(charset, "us-ascii") == 0)) charset = NULL; @@ -2607,11 +2607,11 @@ camel_message_info_new_from_header (struct _camel_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 = camel_header_raw_find(&header, "date", NULL); - mlist = camel_header_raw_check_mailing_list(&header); + date = header_raw_find(&header, "date", NULL); + mlist = header_raw_check_mailing_list(&header); if (ct) - camel_content_type_unref(ct); + header_content_type_unref(ct); info = camel_message_info_new(); @@ -2622,16 +2622,16 @@ camel_message_info_new_from_header (struct _camel_header_raw *header) camel_message_info_set_mlist(info, mlist); if (date) - info->date_sent = camel_header_decode_date (date, NULL); + info->date_sent = header_decode_date (date, NULL); else info->date_sent = time (NULL); - date = camel_header_raw_find (&header, "received", NULL); + date = header_raw_find (&header, "received", NULL); if (date && (date = strrchr (date, ';'))) date++; if (date) - info->date_received = camel_header_decode_date (date, NULL); + info->date_received = header_decode_date (date, NULL); else info->date_received = time (NULL); |