aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2017-03-29 20:20:44 +0200
committerDuncaen <mail@duncano.de>2017-03-30 17:07:28 +0200
commit79d5047cdedc2979f6d36fed66cc9c5d77922724 (patch)
treec7ba07ed99b63588c7a40e68fb37fc0ec5fc9e0f
parent4088f9f70bce8ef8c67fcc05f6a63b1a8dff99bd (diff)
downloadmblaze-79d5047cdedc2979f6d36fed66cc9c5d77922724.tar.gz
mpick: open mail file only if necessary
-rw-r--r--mpick.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/mpick.c b/mpick.c
index b0e15cd..b44d221 100644
--- 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;