mail.IMAP: add mailbox parameter

This commit is contained in:
enkore 2013-09-30 22:02:00 +02:00
parent 2a8196a3b2
commit 5056f22404
2 changed files with 7 additions and 4 deletions

View File

@ -294,7 +294,7 @@ __Settings:__
* `alert_format_title` — The title of the notification, all formatters can be used (default: `Low battery`) * `alert_format_title` — The title of the notification, all formatters can be used (default: `Low battery`)
* `alert_format_body` — The body text of the notification, all formatters can be used (default: `Battery {battery_ident} has only {percentage:.2f}% ({remaining_hm}) remaining!`) * `alert_format_body` — The body text of the notification, all formatters can be used (default: `Battery {battery_ident} has only {percentage:.2f}% ({remaining_hm}) remaining!`)
* `path` — Override the default-generated path (default: `None`) * `path` — Override the default-generated path (default: `None`)
* `status` — A dictionary mapping ('DIS', 'CHR', 'FULL') to alternative names (default: `{'CHR': 'CHR', 'DIS': 'DIS', 'FULL': 'FULL'}`) * `status` — A dictionary mapping ('DIS', 'CHR', 'FULL') to alternative names (default: `{'FULL': 'FULL', 'CHR': 'CHR', 'DIS': 'DIS'}`)
@ -403,6 +403,7 @@ __Settings:__
> * `username` — (required) > * `username` — (required)
> * `password` — (required) > * `password` — (required)
> * `ssl` — (default: `True`) > * `ssl` — (default: `True`)
> * `mailbox` — (default: `INBOX`)
> >
> >
> >
@ -479,7 +480,7 @@ __Settings:__
* `host` — (default: `localhost`) * `host` — (default: `localhost`)
* `port` — MPD port (default: `6600`) * `port` — MPD port (default: `6600`)
* `format` — formatp string (default: `{title} {status}`) * `format` — formatp string (default: `{title} {status}`)
* `status` — Dictionary mapping pause, play and stop to output (default: `{'play': '▶', 'stop': '◾', 'pause': '▷'}`) * `status` — Dictionary mapping pause, play and stop to output (default: `{'play': '▶', 'pause': '▷', 'stop': '◾'}`)

View File

@ -16,12 +16,14 @@ class IMAP(Backend):
settings = ( settings = (
"host", "port", "host", "port",
"username", "password", "username", "password",
"ssl" "ssl",
"mailbox",
) )
required = ("host", "username", "password") required = ("host", "username", "password")
port = 993 port = 993
ssl = True ssl = True
mailbox = "INBOX"
imap_class = imaplib.IMAP4 imap_class = imaplib.IMAP4
connection = None connection = None
@ -35,7 +37,7 @@ class IMAP(Backend):
try: try:
self.connection = self.imap_class(self.host, self.port) self.connection = self.imap_class(self.host, self.port)
self.connection.login(self.username, self.password) self.connection.login(self.username, self.password)
self.connection.select() self.connection.select(self.mailbox)
except Exception: except Exception:
self.connection = None self.connection = None