changeset 4:ce84c480ffec

Added a folder option.
author Brian Neal <bgneal@gmail.com>
date Sat, 19 May 2012 13:34:24 -0500
parents e0a6a02b3213
children 2c88867c4875
files weighmail/config.py weighmail/main.py
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/weighmail/config.py	Fri May 18 20:32:21 2012 -0500
+++ b/weighmail/config.py	Sat May 19 13:34:24 2012 -0500
@@ -4,6 +4,7 @@
 
 
 DEFAULTS = dict(
+    folder='[Gmail]/All Mail',
     user=None,
     password=None,
     host='imap.gmail.com',
@@ -24,8 +25,9 @@
         parser.readfp(fp)
 
     # Build a list of label named tuples
+    ignore_sections = ['options', 'auth', 'connection']
 
-    sections = [s for s in parser.sections() if s not in ('auth', 'connection')]
+    sections = [s for s in parser.sections() if s not in ignore_sections]
 
     labels = [make_label(sec,
                          parser.get(sec, 'min'),
@@ -34,6 +36,7 @@
     # Build an options object and return it
 
     opts = dict(
+        folder=parser.get('options', 'folder'),
         user=parser.get('auth', 'user'),
         password=parser.get('auth', 'password'),
         host=parser.get('connection', 'host'),
--- a/weighmail/main.py	Fri May 18 20:32:21 2012 -0500
+++ b/weighmail/main.py	Sat May 19 13:34:24 2012 -0500
@@ -33,6 +33,7 @@
         epilog="Command-line arguments override config file settings.")
 
     parser.add_argument('-c', '--config', help="path to configuration file")
+    parser.add_argument('-f', '--folder', help="mail folder to search")
     parser.add_argument('-u', '--user', help="user name")
     parser.add_argument('-p', '--password', help="password")
     parser.add_argument('-H', '--host', help="server name")