fixed folder stats update after incorporation
authorChristoph Hohmann <reboot@gmx.ch>
Sun, 15 Jul 2001 01:30:58 +0000 (01:30 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Sun, 15 Jul 2001 01:30:58 +0000 (01:30 +0000)
ChangeLog.claws
src/procmsg.c

index 5a1809b980e8e2ee0113f307792b1ff6b93830e6..26a3b67ce9f3e0dcb95d971e2f2eaa4216a518af 100644 (file)
@@ -1,3 +1,8 @@
+2001-07-15 [christoph]
+
+       * src/procmsg.c
+               fixed folder stats update after incorporation
+
 2001-07-15 [alfons]
 
        * src/summaryview.c
index 3a3b0e32b693f680b3a6ff16a60b9f6ec78a9051..f2631852ca7db434b46074b960e496d9e39231f6 100644 (file)
@@ -22,6 +22,7 @@
 #include <glib.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <sys/stat.h>
 
 #include "intl.h"
 #include "main.h"
@@ -433,6 +434,8 @@ static GHashTable *procmsg_read_mark_file(const gchar *folder)
        GHashTable *mark_table = NULL;
        gint num;
        MsgFlags flags;
+       gchar *msgfile;
+       struct stat s;
 
        if ((fp = procmsg_open_mark_file(folder, FALSE)) == NULL)
                return NULL;
@@ -441,11 +444,16 @@ static GHashTable *procmsg_read_mark_file(const gchar *folder)
 
        while (fread(&num, sizeof(num), 1, fp) == 1) {
                if (fread(&flags, sizeof(flags), 1, fp) != 1) break;
-               MSG_SET_FLAGS(flags, MSG_CACHED);
 
-               g_hash_table_insert(mark_table,
-                                   GUINT_TO_POINTER(num),
-                                   GUINT_TO_POINTER(flags));
+               msgfile = g_strdup_printf("%s%c%d", folder, G_DIR_SEPARATOR, num);
+               if(stat(msgfile, &s) == 0 && S_ISREG(s.st_mode)) {
+                   MSG_SET_FLAGS(flags, MSG_CACHED);
+
+                   g_hash_table_insert(mark_table,
+                                       GUINT_TO_POINTER(num),
+                                       GUINT_TO_POINTER(flags));
+               }
+               free(msgfile);
        }
 
        fclose(fp);