]> git.madduck.net Git - etc/awesome.git/blob - imap.md

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

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.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Destroyed brigthness (markdown)
[etc/awesome.git] / imap.md
1 [<- widgets](https://github.com/copycat-killer/lain/wiki/Widgets)
2
3 Shows mail count in a textbox fetching over IMAP.
4
5         myimapcheck = lain.widgets.imap(args)
6
7 New mails are notified like this:
8
9         +--------------------------------------------+
10         | +---+                                      |
11         | |\ /| donald@disney.org has 3 new messages |
12         | +---+                                      |
13         +--------------------------------------------+
14
15 The function takes a table as argument. Required table parameters are:
16
17 Variable | Meaning | Type
18 --- | --- | ---
19 `server` | Mail server | string
20 `mail` | User mail | string
21 `password` | User password | string
22
23 while the optional are:
24
25 Variable | Meaning | Type | Default
26 --- | --- | --- | ---
27 `port` | IMAP port | int | 993
28 `timeout` | Refresh timeout seconds | int | 60
29 `is_plain` | Define whether `password` is a plain password (true) or a function that retrieves it (false) | boolean | false
30 `settings` | User settings | function
31
32 Let's focus better on `is_plain`.
33
34 You can just set your password like this:
35
36     args.is_plain = false
37     args.password = "mypassword"
38
39 and you'll have the same security provided by `~/.netrc`.
40
41 **Or** you can use a keyring, like [python keyring](https://pypi.python.org/pypi/keyring):
42
43     args.password = "keyring get password"
44
45 When `is_plain == false`, it *executes* `password` before using it, so you can also use whatever password fetching solution you want.
46
47 `settings` can use the value `mailcount`, an integer greater or equal to zero, and can modify `mail_notification_preset` table, which will be the preset for the naughty notifications. Check [here](http://awesome.naquadah.org/doc/api/modules/naughty.html#notify) for the list of variables it can contain. 
48
49 Default definition:
50
51     mail_notification _preset = {
52        icon = lain/icons/mail.png,
53        position = "top_left"
54     }
55
56 Note that `mailcount` is 0 either if there are no new mails or credentials are invalid, so make sure you get the right settings.
57
58 ### output 
59
60 A textbox.