X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/763805f5add904469b12167ef594e1890dc304dd..d9877c4bedca550478507f268f43e137e4454c24:/widgets/imap.lua diff --git a/widgets/imap.lua b/widgets/imap.lua index 1e86738..5896ae1 100644 --- a/widgets/imap.lua +++ b/widgets/imap.lua @@ -7,14 +7,11 @@ --]] local helpers = require("lain.helpers") - local naughty = require("naughty") local wibox = require("wibox") - local string = { format = string.format, gsub = string.gsub } local tonumber = tonumber - local setmetatable = setmetatable -- Mail IMAP check @@ -35,6 +32,8 @@ local function worker(args ) local head_command = "curl --connect-timeout 3 -fsm 3" local request = "-X 'SEARCH (UNSEEN)'" + if not server or not mail or not password then return end + helpers.set_map(mail, 0) if not is_plain then @@ -56,6 +55,7 @@ local function worker(args ) helpers.async(curl, function(f) _, mailcount = string.gsub(f, "%d+", "") + _ = nil widget = imap.widget settings() @@ -74,7 +74,7 @@ local function worker(args ) end - helpers.newtimer(mail, timeout, update) + imap.timer = helpers.newtimer(mail, timeout, update, true, true) return setmetatable(imap, { __index = imap.widget }) end