]> 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:

Updated Utilities (markdown)
[etc/awesome.git] / imap.md
1 [<- widgets](https://github.com/copycat-killer/lain/wiki/Widgets)
2
3 **Please be warned**: as for now, this works fine in normal link situations, but is discouraged to use it if your connection is sobbing, since it may cause some short freezes due to timeout issues. I am working on socket libraries to solve this.
4
5 If you're a Python programmer, feel free to lend a hand.
6
7 ---
8
9 Shows mail status in a textbox over IMAP protocol.
10
11 New mails are notified through a notification like this:
12
13         +---------------------------------------------------+
14         | +---+                                             |
15         | |\ /| donald@disney.org has 3 new messages        |
16         | +---+                                             |
17         |       Latest From: Mickey Mouse <boss@disney.org> |
18     |       Subject: Re: pay raise                      |
19     |                                                   |
20     |       Not after what you did yesterday.           |
21     |       Daisy told me everything [...]              |
22         |                                                   |
23         +---------------------------------------------------+
24
25 Text will be cut if the mail is too long.
26
27         myimapcheck = lain.widgets.imap(args)
28
29 The function takes a table as argument. Required table parameters are:
30
31 Variable | Meaning | Type
32 --- | --- | ---
33 `server` | Mail server | string
34 `mail` | User mail | string
35 `password` | User password | string
36
37 while the optional are:
38
39 Variable | Meaning | Type | Default
40 --- | --- | --- | ---
41 `port` | IMAP port | int | 993
42 `timeout` | Refresh timeout seconds | int | 60
43 `encoding` | Mail character encoding | string | autodetected
44 `maxlen` | Maximum chars to display in notification | int | 200
45 `is_plain` | Define whether `password` is a plain password (true) or a function that retrieves it (false) | boolean | false
46 `settings` | User settings | function
47
48 Let's focus better on `is_plain`.
49
50 You can just set your password like this:
51
52     args.is_plain = false
53     args.password = "mypassword"
54
55 and you'll have the same security provided by `~/.netrc`.
56
57 **Or** you can use a keyring, like [python keyring](https://pypi.python.org/pypi/keyring):
58
59     args.password = "keyring get password"
60
61 When `is_plain == false`, it *executes* `password` before using it, so you can also use whatever password fetching solution you want.
62
63 `settings` can use the string `mailcount`, whose possible values are:
64
65 - "0"
66 - "invalid credentials"
67 - string number
68
69 and can modify `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. Default definition:
70
71     notification _preset = {
72        icon = lain/icons/mail.png,
73        timeout = 8,
74        position = "top_left"
75     }
76
77 ### output 
78
79 A textbox.