aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Rodger <paul@paulrodger.com>2002-11-21 22:57:13 +0000
committerPaul Rodger <paul@paulrodger.com>2002-11-21 22:57:13 +0000
commit64d87da3071c6c991e379c2c2221c264cb17fbdb (patch)
tree14defb3290ee7fcb7e5597ebfa71886f894b3668
parent60f119d64a855895fc1309e3756568727293faef (diff)
downloadarchivemail-64d87da3071c6c991e379c2c2221c264cb17fbdb.tar.gz
archivemail-64d87da3071c6c991e379c2c2221c264cb17fbdb.tar.bz2
archivemail-64d87da3071c6c991e379c2c2221c264cb17fbdb.zip
Use the archive cut-off date rather than the current time with the
--suffix option.
-rw-r--r--CHANGELOG4
-rw-r--r--TODO2
-rwxr-xr-xarchivemail.py7
-rw-r--r--archivemail.sgml6
4 files changed, 15 insertions, 4 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 80c0aa8..eeb6657 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,8 @@
+Version 0.6.2 - ???
+ * Use the archive cut date rather than the actual time with the --suffix
+ option. (Thanks Manuel Estrada Sainz)
+
Version 0.6.1 - 31 October 2002
* Removed a test rule that we could archive messages older than the
Unix epoch. Newer versions of python now give an overflow error calling
diff --git a/TODO b/TODO
index 7f9ab70..476564a 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,7 @@
.archivemailrc support
+Specify an option to not seteuid() when run as root?
+
When you get a file-not-found in the 6th mailbox of 10, it aborts the whole
run. Better to fail gracefully and keep going.
diff --git a/archivemail.py b/archivemail.py
index e8f3aab..87fc33b 100755
--- a/archivemail.py
+++ b/archivemail.py
@@ -993,8 +993,13 @@ def archive(mailbox_name):
os.umask(077) # saves setting permissions on mailboxes/tempfiles
# allow the user to embed time formats such as '%B' in the suffix string
+ if options.date_old_max == None:
+ parsed_suffix_time = time.time() - options.days_old_max*24*60*60
+ else:
+ parsed_suffix_time = options.date_old_max
+
parsed_suffix = time.strftime(options.archive_suffix,
- time.localtime(time.time()))
+ time.localtime(parsed_suffix_time))
if mailbox_name[:7].lower() == 'imap://':
final_archive_name = mailbox_name.split('/')[-1] + parsed_suffix
diff --git a/archivemail.sgml b/archivemail.sgml
index 1807c2f..43b5d4a 100644
--- a/archivemail.sgml
+++ b/archivemail.sgml
@@ -135,8 +135,8 @@ with the filename <filename>exsouthrock_archive.gz</filename>.
<Para>
<Replaceable/NAME/ is run through the &python; <application/time.strftime()/
function, which means that you can specify any of the following special
-directives in <Replaceable/NAME/ to make archives named after the current
-date:
+directives in <Replaceable/NAME/ to make archives named after the archive
+cut-off date:
<itemizedlist mark='none'>
<listitem><para><option>%a</option>
@@ -369,7 +369,7 @@ are older than 180 days to a compressed mailbox called
<Para>
To archive all messages in the mailbox <filename>debian-user</filename> that
are older than 180 days to a compressed mailbox called
-<filename>debian-user_April_2002.gz</filename> (where the current month and
+<filename>debian-user_October_2001.gz</filename> (where the current month and
year is April, 2002) in the current directory:
<screen>
<prompt>bash$ </prompt><userinput>archivemail --suffix '_%B_%Y' debian-user</userinput>