mirror of https://github.com/lcpz/lain.git
imap: asynchronous
This commit is contained in:
parent
6f988d8eb7
commit
763805f5ad
|
@ -21,13 +21,11 @@ local setmetatable = setmetatable
|
|||
-- lain.widgets.imap
|
||||
|
||||
local function worker(args )
|
||||
local imap = {}
|
||||
local imap = helpers.make_widget_textbox()
|
||||
local args = args or {}
|
||||
|
||||
local server = args.server
|
||||
local mail = args.mail
|
||||
local password = args.password
|
||||
|
||||
local port = args.port or 993
|
||||
local timeout = args.timeout or 60
|
||||
local is_plain = args.is_plain or false
|
||||
|
@ -40,11 +38,9 @@ local function worker(args)
|
|||
helpers.set_map(mail, 0)
|
||||
|
||||
if not is_plain then
|
||||
password = helpers.read_pipe(password):gsub("\n", "")
|
||||
helpers.async(password, function(f) password = f:gsub("\n", "") end)
|
||||
end
|
||||
|
||||
imap.widget = wibox.widget.textbox('')
|
||||
|
||||
function update()
|
||||
mail_notification_preset = {
|
||||
icon = helpers.icons_dir .. "mail.png",
|
||||
|
@ -78,7 +74,7 @@ local function worker(args)
|
|||
|
||||
end
|
||||
|
||||
helpers.newtimer(mail, timeout, update, true)
|
||||
helpers.newtimer(mail, timeout, update)
|
||||
|
||||
return setmetatable(imap, { __index = imap.widget })
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue