diff options
author | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-10-04 00:28:54 +0200 |
---|---|---|
committer | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-10-04 00:28:54 +0200 |
commit | b185e964945cf4bb58606a154922e5e7f079b0c0 (patch) | |
tree | 695d3fe07f5a925151eba327f9c1c8f7632fbf72 | |
parent | 724366c038777122e292091b729e7d1e9d52c5cc (diff) | |
download | vicious-legacy-b185e964945cf4bb58606a154922e5e7f079b0c0.tar.xz |
mbox: don't hide when there is no mail
-rw-r--r-- | mbox.lua | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -17,17 +17,15 @@ module("vicious.mbox") -- {{{ Mailbox widget type local function worker(format, mbox) - local f = io.open(mbox) -- mbox could be huge, get a 15kb chunk from EOF -- * attachments could be much bigger than this + local f = io.open(mbox) f:seek("end", -15360) - local text = f:read("*all") + local txt = f:read("*all") f:close() - for match in string.gfind(text, "Subject: ([^\n]*)") do - subject = match - end - + -- Find all Subject lines + for s in string.gfind(txt, "Subject: ([^\n]*)") do subject = s end if subject then -- Spam sanitize only the last subject subject = helpers.escape(subject) @@ -36,6 +34,8 @@ local function worker(format, mbox) subject = helpers.truncate(subject, 22) return {subject} + else + return {"N/A"} end end -- }}} |