2007-08-09 [colin] 2.10.0cvs109
[claws.git] / src / folder.c
index 4e3eb253ba1a04d36e90bfb554d6ba2873765efa..8e06c7a6a34aa5b7ae48b6ceabd006d4748a4fee 100644 (file)
@@ -2688,10 +2688,27 @@ static gint folder_item_get_msg_num_by_file(FolderItem *dest, const gchar *file)
 
        if ((folder_has_parent_of_type(dest, F_QUEUE)) || 
            (folder_has_parent_of_type(dest, F_DRAFT)))
-               while (fgets(buf, sizeof(buf), fp) != NULL)
+               while (fgets(buf, sizeof(buf), fp) != NULL) {
+                       /* new way */
+                       if ((!strncmp(buf, "X-Claws-End-Special-Headers: 1",
+                               strlen("X-Claws-End-Special-Headers:"))) ||
+                           (!strncmp(buf, "X-Sylpheed-End-Special-Headers: 1",
+                               strlen("X-Sylpheed-End-Special-Headers:"))))
+                               break;
+                       /* old way */
                        if (buf[0] == '\r' || buf[0] == '\n') break;
+                       /* from other mailers */
+                       if (!strncmp(buf, "Date: ", 6)
+                       ||  !strncmp(buf, "To: ", 4)
+                       ||  !strncmp(buf, "From: ", 6)
+                       ||  !strncmp(buf, "Subject: ", 9)) {
+                               rewind(fp);
+                               break;
+                       }
+               }
 
        procheader_get_header_fields(fp, hentry);
+       debug_print("looking for %s\n", hentry[0].body);
        if (hentry[0].body) {
                extract_parenthesis(hentry[0].body, '<', '>');
                remove_space(hentry[0].body);
@@ -2881,6 +2898,7 @@ gint folder_item_add_msgs(FolderItem *dest, GSList *file_list,
                                        folderscan = TRUE;
                                }
                                num = folder_item_get_msg_num_by_file(dest, fileinfo->file);
+                               debug_print("got num %d\n", num);
                        }
 
                        if (num > lastnum)
@@ -3559,7 +3577,12 @@ static gchar *folder_item_get_tags_file(FolderItem *item)
 
        identifier = folder_item_get_identifier(item);
        g_return_val_if_fail(identifier != NULL, NULL);
-       
+
+#ifdef G_OS_WIN32
+       while (strchr(identifier, '/'))
+               *strchr(identifier, '/') = '\\';
+#endif
+
        path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
                           "tagsdb", G_DIR_SEPARATOR_S,
                           identifier, NULL);