X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-mx%2Fmh.c;h=5e889d6b97ba2bf2a9f7b0595961672556dddfb9;hp=23d21fe7a0f9ff06c00be111fd95c14393912db9;hb=8297f3a57ccff9c0663551658cdd5d3bf166249d;hpb=799c3f5aec72b8230f9c3c284e2b2e9d67ecf366 diff --git a/lib-mx/mh.c b/lib-mx/mh.c index 23d21fe..5e889d6 100644 --- a/lib-mx/mh.c +++ b/lib-mx/mh.c @@ -922,7 +922,24 @@ static int maildir_open_new_message (MESSAGE * msg, CONTEXT * dest, HEADER * hdr return 0; } +static int maildir_open_message(MESSAGE *msg, CONTEXT *ctx, int msgno) +{ + HEADER *cur = ctx->hdrs[msgno]; + char path[_POSIX_PATH_MAX]; + + snprintf (path, sizeof (path), "%s/%s", ctx->path, cur->path); + if ((msg->fp = fopen(path, "r")) == NULL + && errno == ENOENT && ctx->magic == M_MAILDIR) { + msg->fp = maildir_open_find_message (ctx->path, cur->path); + } + + if (msg->fp == NULL) { + mutt_perror (path); + return -1; + } + return 0; +} /* * Commit a message to a maildir folder. @@ -1812,6 +1829,7 @@ mx_t const maildir_mx = { access, maildir_read_dir, maildir_open_new_message, + maildir_open_message, NULL, maildir_check_mailbox, NULL, @@ -1827,6 +1845,7 @@ mx_t const mh_mx = { access, mh_read_dir, mh_open_new_message, + maildir_open_message, NULL, mh_check_mailbox, NULL,