diff options
author | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-10-04 00:31:12 +0200 |
---|---|---|
committer | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-10-04 00:31:12 +0200 |
commit | b65d5093803ec81f89f286c90807a44fa219c733 (patch) | |
tree | aec5114ef7a8dfdc6c67c8aaebe6d308fa741f28 /mdir.lua | |
parent | b185e964945cf4bb58606a154922e5e7f079b0c0 (diff) | |
download | vicious-legacy-b65d5093803ec81f89f286c90807a44fa219c733.tar.xz |
Reworked counters in mboxc, mdir, org
Diffstat (limited to 'mdir.lua')
-rw-r--r-- | mdir.lua | 21 |
1 files changed, 8 insertions, 13 deletions
@@ -17,24 +17,19 @@ module("vicious.mdir") -- {{{ Maildir widget type local function worker(format, mdir) -- Initialise counters - local newcount = 0 - local curcount = 0 + local count = { new = 0, cur = 0 } -- Recursively find new messages - local fnew = io.popen("find " .. mdir .. " -type f -wholename '*/new/*'") - for line in fnew:lines() do - newcount = newcount + 1 - end - fnew:close() + local f = io.popen("find " .. mdir .. " -type f -wholename '*/new/*'") + for line in f:lines() do count.new = count.new + 1 end + f:close() -- Recursively find "old" messages lacking the Seen flag - local fcur = io.popen("find " .. mdir .. " -type f -regex '.*/cur/.*2,[^S]*$'") - for line in fcur:lines() do - curcount = curcount + 1 - end - fcur:close() + local f = io.popen("find " .. mdir .. " -type f -regex '.*/cur/.*2,[^S]*$'") + for line in f:lines() do count.cur = count.cur + 1 end + f:close() - return {newcount, curcount} + return {count.new, count.cur} end -- }}} |