mblaze

Unix utilities to deal with Maildir - my mirror
git clone https://pi.duncano.de/git/mblaze.git
Log | Files | Refs | README | COPYING

commit 79d5047cdedc2979f6d36fed66cc9c5d77922724
parent 4088f9f70bce8ef8c67fcc05f6a63b1a8dff99bd
Author: Duncaen <mail@duncano.de>
Date:   Wed, 29 Mar 2017 20:20:44 +0200

mpick: open mail file only if necessary

Diffstat:
mpick.c | 13+++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/mpick.c b/mpick.c @@ -761,6 +761,9 @@ msg_date(struct mailinfo *m) if (m->date) return m->date; + if (!m->msg) + m->msg = blaze822(m->fpath); + char *b; if (m->msg && (b = blaze822_hdr(m->msg, "date"))) return (m->date = blaze822_date(b)); @@ -774,6 +777,9 @@ msg_subject(struct mailinfo *m) if (!m->subject) return m->subject; + if (!m->msg) + m->msg = blaze822(m->fpath); + char *b; if (!m->msg || !(b = blaze822_hdr(m->msg, "subject"))) return ""; @@ -785,6 +791,9 @@ msg_subject(struct mailinfo *m) char * msg_addr(struct mailinfo *m, char *h, int t) { + if (!m->msg) + m->msg = blaze822(m->fpath); + char *b; if (m->msg == 0 || (b = blaze822_chdr(m->msg, h)) == 0) return ""; @@ -949,10 +958,6 @@ mailfile(char *file) return m; } - m->msg = blaze822(m->fpath); - if (!m->msg) - return m; - if ((e = strrchr(m->fpath, '/') - 1) && (e - m->fpath) >= 2 && *e-- == 'w' && *e-- == 'e' && *e-- == 'n') m->flags |= FLAG_NEW;