aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG8
-rw-r--r--FAQ9
-rw-r--r--Makefile2
-rw-r--r--TODO6
-rwxr-xr-xarchivemail.py34
-rwxr-xr-xsetup.py2
6 files changed, 42 insertions, 19 deletions
diff --git a/CHANGELOG b/CHANGELOG
index a0cc2c0..2325de0 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,11 @@
+
+Version 0.5.0 - 15 September 2002
+ * Fixed a bug where mailbox locking would fail under Solaris. (Thanks Mark
+ Sheller)
+ * Fixed a bug where archiving maildir mailboxes without a 'Received Date' or
+ 'From' header would fail. (Thanks Hugo van der Merwe)
+ * Removed yet another bug where messages dated on the Unix epoch would fail.
+
Version 0.4.9 - 18 August 2002
* Fixed a bug where an exception was thrown if a message was dated exactly
on the Unix epoch.
diff --git a/FAQ b/FAQ
index 8708be0..a2e5648 100644
--- a/FAQ
+++ b/FAQ
@@ -5,3 +5,12 @@
I am quite happy to add bzip2 support to archivemail as soon as a 'bzip2'
module (similar to the gzip module) is available for python.
[ Hint hint ;) ]
+
+
+2. Can you add a switch to archive mailboxes greater than a certain size?
+-------------------------------------------------------------------------
+
+If you are using mbox format mailboxes instead, use the find(1) command instead, it is more flexible:
+
+ find $HOME/Mail -type f ! -name '*archive*'
+
diff --git a/Makefile b/Makefile
index a57b86d..5665421 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-VERSION=0.4.9
+VERSION=0.5.0
VERSION_TAG=v$(subst .,_,$(VERSION))
TARFILE=archivemail-$(VERSION).tar.gz
diff --git a/TODO b/TODO
index 2f3dc0a..6c0e386 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,5 @@
-Goals for next minor release (0.5.0):
+Goals for next minor release (0.5.1):
-------------------------------------
* 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.
@@ -21,7 +21,3 @@ Longer Term goals:
- is this a good idea?
* Add option to archive depending on number of messages
- is this a good idea?
-* Test for missing compression programs
- - is this a waste of time?
-* IMAP support
- - is this outside our scope?
diff --git a/archivemail.py b/archivemail.py
index a9c882a..ea7c5e5 100755
--- a/archivemail.py
+++ b/archivemail.py
@@ -22,7 +22,7 @@ Website: http://archivemail.sourceforge.net/
"""
# global administrivia
-__version__ = "archivemail v0.4.9"
+__version__ = "archivemail v0.5.0"
__cvs_id__ = "$Id$"
__copyright__ = """Copyright (C) 2002 Paul Rodger <paul@paulrodger.com>
This is free software; see the source for copying conditions. There is NO
@@ -51,6 +51,7 @@ import getopt
import gzip
import mailbox
import os
+import pwd
import re
import rfc822
import shutil
@@ -274,13 +275,13 @@ class Mbox(mailbox.UnixMailbox):
original_mode = None # file permissions to preserve
starting_size = None # file size of mailbox on open
- def __init__(self, path, mode="r"):
+ def __init__(self, path, mode="r+"):
"""Constructor for opening an existing 'mbox' mailbox.
Extends constructor for mailbox.UnixMailbox()
Named Arguments:
path -- file name of the 'mbox' file to be opened
- mode -- mode to open the file in (default is read-only)
+ mode -- mode to open the file in (default is read-write)
"""
assert(path)
@@ -653,22 +654,32 @@ def make_mbox_from(message):
"""
assert(message)
- address_header = message.get('Return-path')
- if not address_header:
- vprint("make_mbox_from: no Return-path -- using 'From:' instead!")
- address_header = message.get('From')
- (name, address) = rfc822.parseaddr(address_header)
-
+ address = guess_return_path(message)
time_message = guess_delivery_time(message)
- assert(time_message)
gm_date = time.gmtime(time_message)
assert(gm_date)
date_string = time.asctime(gm_date)
-
mbox_from = "From %s %s\n" % (address, date_string)
return mbox_from
+def guess_return_path(message):
+ """Return a guess at the Return Path address of an rfc822 message"""
+ assert(message)
+
+ for header in ('Return-path', 'From'):
+ address_header = message.get('header')
+ if address_header:
+ (name, address) = rfc822.parseaddr(address_header)
+ if address:
+ return address
+ # argh, we can't find any valid 'Return-path' guesses - just
+ # just use the current unix username like mutt does
+ login = pwd.getpwuid(os.getuid())[0]
+ assert(login)
+ return login
+
+
def guess_delivery_time(message):
"""Return a guess at the delivery date of an rfc822 message"""
assert(message)
@@ -691,7 +702,6 @@ def guess_delivery_time(message):
if date:
try:
time_message = time.mktime(date)
- assert(time_message)
vprint("using valid time found from unix 'From_' header")
return time_message
except (ValueError, OverflowError): pass
diff --git a/setup.py b/setup.py
index 913c7a3..e2730d7 100755
--- a/setup.py
+++ b/setup.py
@@ -19,7 +19,7 @@ check_python_version() # define & run this early - 'distutils.core' is new
from distutils.core import setup
setup(name="archivemail",
- version="0.4.9",
+ version="0.5.0",
description="archive and compress old email",
license="GNU GPL",
url="http://archivemail.sourceforge.net/",