Skip checking mailboxes if they don't exist
This commit is contained in:
parent
3446c32bdb
commit
a3ecc8fd97
1 changed files with 12 additions and 6 deletions
|
@ -22,19 +22,25 @@ local maildir_base = os.getenv("HOME") .. "/documents/mail/"
|
||||||
|
|
||||||
function new_mail(maildir)
|
function new_mail(maildir)
|
||||||
local count = 0
|
local count = 0
|
||||||
|
local newmaildir = maildir_base .. maildir .. "/new"
|
||||||
|
local curmaildir = maildir_base .. maildir .. "/cur"
|
||||||
|
|
||||||
for file in lfs.dir(maildir_base .. maildir .. "/new") do
|
if posix.access(newmaildir) then
|
||||||
|
for file in lfs.dir(newmaildir) do
|
||||||
if file ~= "." and file ~= ".." then
|
if file ~= "." and file ~= ".." then
|
||||||
count = count + 1
|
count = count + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
for file in lfs.dir(maildir_base .. maildir .. "/cur") do
|
if posix.access(curmaildir) then
|
||||||
|
for file in lfs.dir(curmaildir) do
|
||||||
if string.sub(file, -1) ~= "S" and file ~= "."
|
if string.sub(file, -1) ~= "S" and file ~= "."
|
||||||
and file ~= ".." then
|
and file ~= ".." then
|
||||||
count = count + 1
|
count = count + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return count
|
return count
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue