moltenbar/mod/newmail
fbt 0088e0ecd1 newmail fix
Signed-off-by: fbt <fbt@fleshless.org>
2016-11-21 13:40:38 +03:00

28 lines
501 B
Ruby

# vim: ft=ruby
class NewMail < Worker
def mainloop()
while true do
if unread_mail?
self.write "%{F#{@my_config['crit_colour']}}#{@my_config['crit_message']}%{F-}"
else
self.write "%{F#{@my_config['ok_colour']}}#{@my_config['ok_message']}%{F-}"
end
sleep(3)
end
end
def unread_mail?
@my_config['maildirs'].each do |dir|
if not (Dir.entries(dir + "/new") - [ '.', '..' ]).empty?
return true
end
end
return false
end
end
Modules.add("newmail", "NewMail")