All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
4 Licensed under GNU General Public License v2
5 * (c) 2013, Luke Bonham
9 local helpers = require("lain.helpers")
10 local async = require("lain.asyncshell")
12 local naughty = require("naughty")
13 local wibox = require("wibox")
18 >>>>>>> upstream/master
19 local string = { format = string.format,
21 local tonumber = tonumber
23 local setmetatable = setmetatable
28 local function worker(args)
31 local args = args or {}
33 local server = args.server
34 local mail = args.mail
35 local password = args.password
37 local port = args.port or 993
38 local timeout = args.timeout or 60
39 local is_plain = args.is_plain or false
40 local settings = args.settings or function() end
43 local args = args or {}
45 local server = args.server
46 local mail = args.mail
47 local password = args.password
49 local port = args.port or 993
50 local timeout = args.timeout or 60
51 local is_plain = args.is_plain or false
52 local followmouse = args.followmouse or false
53 local settings = args.settings or function() end
54 >>>>>>> upstream/master
56 local head_command = "curl --connect-timeout 3 -fsm 3"
57 local request = "-X 'SEARCH (UNSEEN)'"
59 helpers.set_map(mail, 0)
64 local f = io.popen(password)
65 password = f:read("*a"):gsub("\n", "")
68 password = helpers.read_pipe(password):gsub("\n", "")
69 >>>>>>> upstream/master
72 imap.widget = wibox.widget.textbox('')
75 mail_notification_preset = {
76 icon = helpers.icons_dir .. "mail.png",
83 mail_notification_preset.screen = mouse.screen
86 >>>>>>> upstream/master
87 curl = string.format("%s --url imaps://%s:%s/INBOX -u %s:%q %s -k",
88 head_command, server, port, mail, password, request)
90 async.request(curl, function(f)
95 _, mailcount = string.gsub(ws, "%d+", "")
97 _, mailcount = string.gsub(f, "%d+", "")
98 >>>>>>> upstream/master
104 if mailcount >= 1 and mailcount > helpers.get_map(mail)
106 if mailcount == 1 then
107 nt = mail .. " has one new message"
109 nt = mail .. " has <b>" .. mailcount .. "</b> new messages"
112 preset = mail_notification_preset,
117 >>>>>>> upstream/master
121 helpers.set_map(mail, mailcount)
126 helpers.newtimer(mail, timeout, update, true)
128 return setmetatable(imap, { __index = imap.widget })
131 return setmetatable({}, { __call = function(_, ...) return worker(...) end })