Now takes a url argument.
authorJeffrey Stedfast <fejj@ximian.com>
Tue, 12 Mar 2002 20:36:08 +0000 (20:36 +0000)
committerJeffrey Stedfast <fejj@src.gnome.org>
Tue, 12 Mar 2002 20:36:08 +0000 (20:36 +0000)
2002-03-12  Jeffrey Stedfast  <fejj@ximian.com>

* camel-digest-store.c (camel_digest_store_new): Now takes a url
argument.

* camel-digest-folder.c (digest_add_multipart): Fixed some memory
corruption and also modified to use CAMEL_IS_MIME_MESSAGE() rather
than comparing content-type strings.
(digest_get_message): Fixed a logic blooper.

* camel-folder-summary.c (camel_message_info_new_from_header): Set
the date fields of the CamelMessageInfo as well. This may even fix
some filter-related bugs where the user was trying to compare
dates.

camel/ChangeLog
camel/camel-digest-folder.c
camel/camel-digest-store.c
camel/camel-digest-store.h
camel/camel-folder-summary.c
camel/camel-session.c

index 4612685..febd54b 100644 (file)
@@ -1,3 +1,18 @@
+2002-03-12  Jeffrey Stedfast  <fejj@ximian.com>
+
+       * camel-digest-store.c (camel_digest_store_new): Now takes a url
+       argument.
+
+       * camel-digest-folder.c (digest_add_multipart): Fixed some memory
+       corruption and also modified to use CAMEL_IS_MIME_MESSAGE() rather
+       than comparing content-type strings.
+       (digest_get_message): Fixed a logic blooper.
+
+       * camel-folder-summary.c (camel_message_info_new_from_header): Set
+       the date fields of the CamelMessageInfo as well. This may even fix
+       some filter-related bugs where the user was trying to compare
+       dates.
+
 2002-03-11  Jeffrey Stedfast  <fejj@ximian.com>
 
        * camel-digest-store.c: A pretty empty store implementation to be
index 41c0fbd..a1f058e 100644 (file)
@@ -160,7 +160,7 @@ multipart_contains_message_parts (CamelMultipart *multipart)
                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;
                }
        }
@@ -179,8 +179,8 @@ camel_digest_folder_new (CamelStore *parent_store, CamelMimeMessage *message)
        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;
        }
@@ -215,37 +215,36 @@ digest_expunge (CamelFolder *folder, CamelException *ex)
 }
 
 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);
@@ -270,7 +269,7 @@ digest_get_uids (CamelFolder *folder)
        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;
@@ -326,25 +325,26 @@ digest_get_message (CamelFolder *folder, const char *uid, CamelException *ex)
        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;
index b082ac0..3e28334 100644 (file)
@@ -105,15 +105,24 @@ camel_digest_store_finalise (CamelObject *obj)
 
 /**
  * camel_digest_store_new:
+ * @url:
  *
  * Create a new CamelDigestStore object.
  * 
  * Return value: A new CamelDigestStore widget.
  **/
 CamelStore *
-camel_digest_store_new (void)
+camel_digest_store_new (const char *url)
 {
-       CamelStore *store = CAMEL_STORE (camel_object_new (camel_digest_store_get_type ()));
+       CamelStore *store;
+       CamelURL *uri;
+       
+       uri = camel_url_new (url, NULL);
+       if (!uri)
+               return NULL;
+       
+       store = CAMEL_STORE (camel_object_new (camel_digest_store_get_type ()));
+       CAMEL_SERVICE (store)->url = uri;
        
        return store;
 }
index 53f896e..90e802f 100644 (file)
@@ -50,7 +50,7 @@ struct _CamelDigestStoreClass {
 
 CamelType camel_digest_store_get_type (void);
 
-CamelStore *camel_digest_store_new (void);
+CamelStore *camel_digest_store_new (const char *url);
 
 #ifdef __cplusplus
 }
index 89fdc3c..44ca09f 100644 (file)
@@ -2447,7 +2447,7 @@ CamelMessageInfo *
 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;
 
@@ -2463,6 +2463,7 @@ camel_message_info_new_from_header (struct _header_raw *header)
        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)
@@ -2475,7 +2476,10 @@ camel_message_info_new_from_header (struct _header_raw *header)
        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;
 }
 
index 93e6fea..e8240db 100644 (file)
@@ -69,7 +69,7 @@ static int session_thread_queue(CamelSession *session, CamelSessionThreadMsg *ms
 static void session_thread_wait(CamelSession *session, int id);
 #endif
 
-/* The vfolder provider is always avilable */
+/* The vfolder provider is always available */
 static CamelProvider vee_provider = {
        "vfolder",
        N_("Virtual folder email provider"),