wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part));
if (CAMEL_IS_MULTIPART (wrapper)) {
has_message_parts = multipart_contains_message_parts (CAMEL_MULTIPART (wrapper));
- } else if (header_content_type_is (part->content_type, "message", "rfc822")) {
+ } else if (CAMEL_IS_MIME_MESSAGE (wrapper)) {
has_message_parts = TRUE;
}
}
if (!wrapper || !CAMEL_IS_MULTIPART (wrapper))
return NULL;
+ /* Make sure we have a multipart/digest subpart or at least some message/rfc822 attachments... */
if (!header_content_type_is (CAMEL_MIME_PART (message)->content_type, "multipart", "digest")) {
- /* Make sure we have a multipart/digest subpart or at least some message/rfc822 attachments... */
if (!multipart_contains_message_parts (CAMEL_MULTIPART (wrapper)))
return NULL;
}
}
static void
-digest_add_multipart (CamelDigestFolder *digest, CamelMultipart *multipart,
- GPtrArray *summary, GPtrArray *uids, GHashTable *info_hash,
+digest_add_multipart (CamelMultipart *multipart, GPtrArray *summary,
+ GPtrArray *uids, GHashTable *info_hash,
const char *preuid)
{
+ CamelDataWrapper *wrapper;
+ CamelMessageInfo *info;
+ CamelMimePart *part;
int parts, i;
+ char *uid;
parts = camel_multipart_get_number (multipart);
for (i = 0; i < parts; i++) {
- CamelDataWrapper *wrapper;
- CamelMessageInfo *info;
- CamelMimePart *part;
- char *uid;
-
part = camel_multipart_get_part (multipart, i);
wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part));
if (CAMEL_IS_MULTIPART (wrapper)) {
uid = g_strdup_printf ("%s%d.", preuid, i);
- digest_add_multipart (digest, CAMEL_MULTIPART (wrapper),
+ digest_add_multipart (CAMEL_MULTIPART (wrapper),
summary, uids, info_hash, uid);
g_free (uid);
continue;
- } else if (!header_content_type_is (part->content_type, "message", "rfc822")) {
+ } else if (!CAMEL_IS_MIME_MESSAGE (wrapper)) {
continue;
}
- info = camel_message_info_new_from_header (part->headers);
+ info = camel_message_info_new_from_header (CAMEL_MIME_PART (wrapper)->headers);
uid = g_strdup_printf ("%s%d", preuid, i);
- camel_message_info_set_uid (info, uid);
+ camel_message_info_set_uid (info, g_strdup (uid));
g_ptr_array_add (uids, uid);
g_ptr_array_add (summary, info);
info_hash = digest_folder->priv->info_hash;
wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (digest_folder->priv->message));
- digest_add_multipart (digest_folder, CAMEL_MULTIPART (wrapper), summary, uids, info_hash, "");
+ digest_add_multipart (CAMEL_MULTIPART (wrapper), summary, uids, info_hash, "");
digest_folder->priv->uids = uids;
digest_folder->priv->summary = summary;
CamelDataWrapper *wrapper;
CamelMimeMessage *message;
CamelMimePart *part;
- char *subuid = "";
+ char *subuid;
int id;
part = CAMEL_MIME_PART (digest->priv->message);
+ wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part));
do {
id = strtoul (uid, &subuid, 10);
- wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part));
if (!CAMEL_IS_MULTIPART (wrapper))
return NULL;
part = camel_multipart_get_part (CAMEL_MULTIPART (wrapper), id);
- uid = subuid++;
- } while (*uid == '.');
+ wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part));
+ uid = subuid + 1;
+ } while (*subuid == '.');
- if (!CAMEL_IS_MIME_MESSAGE (part))
+ if (!CAMEL_IS_MIME_MESSAGE (wrapper))
return NULL;
- message = CAMEL_MIME_MESSAGE (part);
+ message = CAMEL_MIME_MESSAGE (wrapper);
camel_object_ref (CAMEL_OBJECT (message));
return message;
camel_message_info_new_from_header (struct _header_raw *header)
{
CamelMessageInfo *info;
- char *subject, *from, *to, *cc, *mlist;
+ char *subject, *from, *to, *cc, *date, *mlist;
struct _header_content_type *ct = NULL;
const char *content, *charset = NULL;
from = summary_format_address(header, "from");
to = summary_format_address(header, "to");
cc = summary_format_address(header, "cc");
+ date = header_raw_find (&header, "Date", NULL);
mlist = header_raw_check_mailing_list(&header);
if (ct)
camel_message_info_set_to(info, to);
camel_message_info_set_cc(info, cc);
camel_message_info_set_mlist(info, mlist);
-
+
+ info->date_sent = header_decode_date (date, NULL);
+ info->date_received = header_decode_date (date, NULL);
+
return info;
}