summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-08-03 20:09:21 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-08-03 20:09:21 +0100
commit6c3f6f84fc9a05f0512f83770fb9d12e2848a3d3 (patch)
tree24b12e1add44ff19b4121a5a6216c083d87fd7aa
parent90c83a2e762943e0c8180b65b1426dfe1b6301bf (diff)
downloadpykolab-6c3f6f84fc9a05f0512f83770fb9d12e2848a3d3.tar.gz
Add a command-line option to specify a specific server
-rw-r--r--pykolab/cli/cmd_list_mailboxes.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/pykolab/cli/cmd_list_mailboxes.py b/pykolab/cli/cmd_list_mailboxes.py
index 4640bc5..ebfefb7 100644
--- a/pykolab/cli/cmd_list_mailboxes.py
+++ b/pykolab/cli/cmd_list_mailboxes.py
@@ -44,6 +44,13 @@ def cli_options():
default = False,
help = _("Display raw IMAP UTF-7 folder names"))
+ my_option_group.add_option( '--server',
+ dest = "connect_server",
+ action = "store",
+ default = None,
+ metavar = "SERVER",
+ help = _("List mailboxes on server SERVER only."))
+
def execute(*args, **kw):
"""
List mailboxes
@@ -68,7 +75,11 @@ def execute(*args, **kw):
searches = [ '' ]
imap = IMAP()
- imap.connect()
+
+ if not conf.connect_server == None:
+ imap.connect(server=conf.connect_server)
+ else:
+ imap.connect()
folders = []
@@ -77,4 +88,7 @@ def execute(*args, **kw):
folders.extend(imap.lm(search))
for folder in folders:
- print imap_utf7.decode(folder)
+ if not conf.raw:
+ print imap_utf7.decode(folder)
+ else:
+ print folder