aboutsummaryrefslogtreecommitdiffstats
path: root/archivemail.py
diff options
context:
space:
mode:
authorPeter Poeml <poeml@suse.de>2006-06-27 04:40:24 +0000
committerPeter Poeml <poeml@suse.de>2006-06-27 04:40:24 +0000
commite00581acb29d772a987e3b5497bd9d0ac52cb269 (patch)
tree0772f6f0905d4888e4f747d937443cdfda92f0f9 /archivemail.py
parentadfb7a63d7ba05152d630fb1a505b95dcde38038 (diff)
downloadarchivemail-e00581acb29d772a987e3b5497bd9d0ac52cb269.tar.gz
archivemail-e00581acb29d772a987e3b5497bd9d0ac52cb269.tar.bz2
archivemail-e00581acb29d772a987e3b5497bd9d0ac52cb269.zip
new command line option: -F, --filter-append=STRING append arbitrary string to the IMAP filter string
Diffstat (limited to 'archivemail.py')
-rwxr-xr-xarchivemail.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/archivemail.py b/archivemail.py
index 3d42b86..bf6ab85 100755
--- a/archivemail.py
+++ b/archivemail.py
@@ -143,6 +143,7 @@ class Options:
date_old_max = None
delete_old_mail = 0
dry_run = 0
+ filter_append = None
include_flagged = 0
lockfile_attempts = 5
lockfile_extension = ".lock"
@@ -171,10 +172,10 @@ class Options:
"""
try:
- opts, args = getopt.getopt(args, '?D:S:Vd:hno:P:qs:uv',
+ opts, args = getopt.getopt(args, '?D:S:Vd:hno:F:P:qs:uv',
["date=", "days=", "delete", "dry-run", "help",
"include-flagged", "no-compress", "output-dir=",
- "pwfile",
+ "filter-append", "pwfile",
"preserve-unread", "quiet", "size=", "suffix=",
"verbose", "version", "warn-duplicate"])
except getopt.error, msg:
@@ -205,6 +206,8 @@ class Options:
self.output_dir = a
if o in ('-P', '--pwfile'):
self.pwfile = a
+ if o in ('-F', '--filter-append'):
+ self.filter_append = a
if o in ('-h', '-?', '--help'):
print usage
sys.exit(0)
@@ -591,6 +594,7 @@ Options are as follows:
-D, --date=DATE archive messages older than DATE
-o, --output-dir=DIR directory to store archives (default: same as original)
-P, --pwfile=FILE file to read imap password from (default: None)
+ -F, --filter-append=STRING append arbitrary string to the IMAP filter string
-s, --suffix=NAME suffix for archive filename (default: '%s')
-S, --size=NUM only archive messages NUM bytes or larger
-n, --dry-run don't write to anything - just show what would be done
@@ -977,6 +981,9 @@ def build_imap_filter():
if options.preserve_unread:
filter.append("SEEN")
+ if options.filter_append:
+ filter.append(options.filter_append)
+
return '(' + string.join(filter, ' ') + ')'
############### mailbox operations ###############