#include <errno.h>
#include <string.h>
+static void maildir_parse_flags(HEADER *h)
+{
+ char *p;
+
+ h->flagged = 0;
+ h->read = 0;
+ h->replied = 0;
+
+ if ((p = strchr (h->path, ':')) != NULL && strncmp (p + 1, "2,", 2) == 0)
+ {
+ p += 3;
+ while (*p)
+ {
+ switch (*p)
+ {
+ case 'F':
+
+ h->flagged = 1;
+ break;
+
+ case 'S': /* seen */
+
+ h->read = 1;
+ break;
+
+ case 'R': /* replied */
+
+ h->replied = 1;
+ break;
+ }
+ p++;
+ }
+ }
+}
+
+
void mh_parse_message (CONTEXT *ctx,
const char *subdir,
const char *fname,
int isOld)
{
char path[_POSIX_PATH_MAX];
- char *p;
FILE *f;
HEADER *h;
struct stat st;
*/
h->old = isOld;
-
- if ((p = strchr (h->path, ':')) != NULL && strncmp (p + 1, "2,", 2) == 0)
- {
- p += 3;
- while (*p)
- {
- switch (*p)
- {
- case 'F':
-
- h->flagged = 1;
- break;
-
- case 'S': /* seen */
-
- h->read = 1;
- break;
-
- case 'R': /* replied */
-
- h->replied = 1;
- break;
- }
- p++;
- }
- }
+ maildir_parse_flags(h);
}
-
/* set flags and update context info */
mx_update_context (ctx);
}
Sort = old_sort;
}
- /* save the old headers */
- old_msgcount = ctx->msgcount;
- old_hdrs = ctx->hdrs;
-
+ old_hdrs = NULL;
+ old_msgcount = 0;
+
/* simulate a close */
hash_destroy (&ctx->id_hash, NULL);
hash_destroy (&ctx->subj_hash, NULL);
{
for (i = 0; i < ctx->msgcount; i++)
mutt_free_header (&(ctx->hdrs[i])); /* nothing to do! */
- safe_free ((void **) &ctx->hdrs);
+ safe_free ((void **) &ctx->hdrs);
}
else
+ {
+ /* save the old headers */
+ old_msgcount = ctx->msgcount;
+ old_hdrs = ctx->hdrs;
ctx->hdrs = NULL;
+ }
ctx->hdrmax = 0; /* force allocation of new headers */
ctx->msgcount = 0;