newmail
Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
parent
e4c91e3991
commit
685d0a04d2
27
mod/newmail
Normal file
27
mod/newmail
Normal file
|
@ -0,0 +1,27 @@
|
|||
# vim: ft=ruby
|
||||
|
||||
class NewMail < Worker
|
||||
def mainloop()
|
||||
while true do
|
||||
if unread_mail?
|
||||
self.write "%{F#{@my_config['ok_colour']}}#{@my_config['ok_message']}%{F-}"
|
||||
else
|
||||
self.write "%{F#{@my_config['crit_colour']}}#{@my_config['crit_message']}%{F-}"
|
||||
end
|
||||
|
||||
sleep(3)
|
||||
end
|
||||
end
|
||||
|
||||
def unread_mail?
|
||||
@my_config['maildirs'].each do |dir|
|
||||
if (Dir.entries(dir + "/new") - [ '.', '..' ]).empty?
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
Modules.add("newmail", "NewMail")
|
Loading…
Reference in New Issue
Block a user