mirror of https://github.com/lcpz/lain.git
#52 fix + multiple imap widgets feature added
This commit is contained in:
parent
7acc7293fb
commit
0f5ce4dd76
|
@ -14,9 +14,9 @@ local setmetatable = setmetatable
|
||||||
|
|
||||||
-- Basic template for custom widgets
|
-- Basic template for custom widgets
|
||||||
-- lain.widgets.base
|
-- lain.widgets.base
|
||||||
local base = {}
|
|
||||||
|
|
||||||
local function worker(args)
|
local function worker(args)
|
||||||
|
local base = {}
|
||||||
local args = args or {}
|
local args = args or {}
|
||||||
local timeout = args.timeout or 5
|
local timeout = args.timeout or 5
|
||||||
local cmd = args.cmd or ""
|
local cmd = args.cmd or ""
|
||||||
|
@ -37,4 +37,4 @@ local function worker(args)
|
||||||
return setmetatable(base, { __index = base.widget })
|
return setmetatable(base, { __index = base.widget })
|
||||||
end
|
end
|
||||||
|
|
||||||
return setmetatable(base, { __call = function(_, ...) return worker(...) end })
|
return setmetatable({}, { __call = function(_, ...) return worker(...) end })
|
||||||
|
|
|
@ -20,9 +20,9 @@ local setmetatable = setmetatable
|
||||||
|
|
||||||
-- Mail IMAP check
|
-- Mail IMAP check
|
||||||
-- lain.widgets.imap
|
-- lain.widgets.imap
|
||||||
local imap = {}
|
|
||||||
|
|
||||||
local function worker(args)
|
local function worker(args)
|
||||||
|
local imap = {}
|
||||||
local args = args or {}
|
local args = args or {}
|
||||||
|
|
||||||
local server = args.server
|
local server = args.server
|
||||||
|
@ -81,7 +81,7 @@ local function worker(args)
|
||||||
end
|
end
|
||||||
|
|
||||||
helpers.newtimer(mail, timeout, update, true)
|
helpers.newtimer(mail, timeout, update, true)
|
||||||
return imap.widget
|
return setmetatable(imap, { __index = imap.widget })
|
||||||
end
|
end
|
||||||
|
|
||||||
return setmetatable(imap, { __call = function(_, ...) return worker(...) end })
|
return setmetatable({}, { __call = function(_, ...) return worker(...) end })
|
||||||
|
|
Loading…
Reference in New Issue