From 5056f224040f3b34d439eddcb3d49a7c9c8c5bb6 Mon Sep 17 00:00:00 2001 From: enkore Date: Mon, 30 Sep 2013 22:02:00 +0200 Subject: [PATCH] mail.IMAP: add mailbox parameter --- README.md | 5 +++-- i3pystatus/mail/imap.py | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b908ce2..8a4b538 100644 --- a/README.md +++ b/README.md @@ -294,7 +294,7 @@ __Settings:__ * `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!`) * `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) > * `password` — (required) > * `ssl` — (default: `True`) +> * `mailbox` — (default: `INBOX`) > > > @@ -479,7 +480,7 @@ __Settings:__ * `host` — (default: `localhost`) * `port` — MPD port (default: `6600`) * `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': '◾'}`) diff --git a/i3pystatus/mail/imap.py b/i3pystatus/mail/imap.py index d804192..632f5d3 100644 --- a/i3pystatus/mail/imap.py +++ b/i3pystatus/mail/imap.py @@ -16,12 +16,14 @@ class IMAP(Backend): settings = ( "host", "port", "username", "password", - "ssl" + "ssl", + "mailbox", ) required = ("host", "username", "password") port = 993 ssl = True + mailbox = "INBOX" imap_class = imaplib.IMAP4 connection = None @@ -35,7 +37,7 @@ class IMAP(Backend): try: self.connection = self.imap_class(self.host, self.port) self.connection.login(self.username, self.password) - self.connection.select() + self.connection.select(self.mailbox) except Exception: self.connection = None