diff options
author | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-10-05 00:11:44 +0200 |
---|---|---|
committer | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-10-05 00:11:44 +0200 |
commit | c84f515690b58f8c99bef145a61c3fec69bd5305 (patch) | |
tree | ac435ed4b0d3638a754d20a3b499cc267f607a5f /mbox.lua | |
parent | 4602ca2fa5e8e2e408713f72ae7e4cd14480bc01 (diff) | |
download | vicious-legacy-c84f515690b58f8c99bef145a61c3fec69bd5305.tar.xz |
mbox: read a 30kb chunk by default
Diffstat (limited to 'mbox.lua')
-rw-r--r-- | mbox.lua | 26 |
1 files changed, 14 insertions, 12 deletions
@@ -17,26 +17,28 @@ module("vicious.mbox") -- {{{ Mailbox widget type local function worker(format, mbox) - -- mbox could be huge, get a 15kb chunk from EOF + -- mbox could be huge, get a 30kb chunk from EOF -- * attachments could be much bigger than this local f = io.open(mbox) - f:seek("end", -15360) + f:seek("end", -30720) local txt = f:read("*all") f:close() + -- Default value + local subject = "N/A" + -- 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) + for i in string.gfind(txt, "Subject: ([^\n]*)") do + subject = i + end - -- Don't abuse the wibox, truncate - subject = helpers.truncate(subject, 22) + -- Spam sanitize only the last subject + subject = helpers.escape(subject) - return {subject} - else - return {"N/A"} - end + -- Don't abuse the wibox, truncate + subject = helpers.truncate(subject, 22) + + return {subject} end -- }}} |