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 16:06:33 +0200 |
commit | 49bddbf558ebbf638275819587477eb0b95d135f (patch) | |
tree | 93cd7febb52e8136eceea197dae62ab438e55bea /mdir.lua | |
parent | c55614d449217c9478f37de91c64148c6d56dc35 (diff) | |
download | vicious-legacy-49bddbf558ebbf638275819587477eb0b95d135f.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 -- }}} |