1
0
Fork 0
mirror of https://git.code.sf.net/p/archivemail/code synced 2024-12-22 15:56:27 +00:00

Fixed a bug where mailbox locking would fail under Solaris, also fixed

a bug where archiving maildir mailboxes without a 'Received Date' or
'From' header would fail.
Removed another assert() statement that would crash on the unix epoch.
This commit is contained in:
Paul Rodger 2002-09-15 06:14:57 +00:00
parent 5264ab35cd
commit 3939c48518
6 changed files with 42 additions and 19 deletions

View file

@ -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 Version 0.4.9 - 18 August 2002
* Fixed a bug where an exception was thrown if a message was dated exactly * Fixed a bug where an exception was thrown if a message was dated exactly
on the Unix epoch. on the Unix epoch.

9
FAQ
View file

@ -5,3 +5,12 @@
I am quite happy to add bzip2 support to archivemail as soon as a 'bzip2' 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. module (similar to the gzip module) is available for python.
[ Hint hint ;) ] [ 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*'

View file

@ -1,5 +1,5 @@
VERSION=0.4.9 VERSION=0.5.0
VERSION_TAG=v$(subst .,_,$(VERSION)) VERSION_TAG=v$(subst .,_,$(VERSION))
TARFILE=archivemail-$(VERSION).tar.gz TARFILE=archivemail-$(VERSION).tar.gz

6
TODO
View file

@ -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 * 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. run. Better to fail gracefully and keep going.
@ -21,7 +21,3 @@ Longer Term goals:
- is this a good idea? - is this a good idea?
* Add option to archive depending on number of messages * Add option to archive depending on number of messages
- is this a good idea? - is this a good idea?
* Test for missing compression programs
- is this a waste of time?
* IMAP support
- is this outside our scope?

View file

@ -22,7 +22,7 @@ Website: http://archivemail.sourceforge.net/
""" """
# global administrivia # global administrivia
__version__ = "archivemail v0.4.9" __version__ = "archivemail v0.5.0"
__cvs_id__ = "$Id$" __cvs_id__ = "$Id$"
__copyright__ = """Copyright (C) 2002 Paul Rodger <paul@paulrodger.com> __copyright__ = """Copyright (C) 2002 Paul Rodger <paul@paulrodger.com>
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
@ -51,6 +51,7 @@ import getopt
import gzip import gzip
import mailbox import mailbox
import os import os
import pwd
import re import re
import rfc822 import rfc822
import shutil import shutil
@ -274,13 +275,13 @@ class Mbox(mailbox.UnixMailbox):
original_mode = None # file permissions to preserve original_mode = None # file permissions to preserve
starting_size = None # file size of mailbox on open 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. """Constructor for opening an existing 'mbox' mailbox.
Extends constructor for mailbox.UnixMailbox() Extends constructor for mailbox.UnixMailbox()
Named Arguments: Named Arguments:
path -- file name of the 'mbox' file to be opened 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) assert(path)
@ -653,22 +654,32 @@ def make_mbox_from(message):
""" """
assert(message) assert(message)
address_header = message.get('Return-path') address = guess_return_path(message)
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)
time_message = guess_delivery_time(message) time_message = guess_delivery_time(message)
assert(time_message)
gm_date = time.gmtime(time_message) gm_date = time.gmtime(time_message)
assert(gm_date) assert(gm_date)
date_string = time.asctime(gm_date) date_string = time.asctime(gm_date)
mbox_from = "From %s %s\n" % (address, date_string) mbox_from = "From %s %s\n" % (address, date_string)
return mbox_from 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): def guess_delivery_time(message):
"""Return a guess at the delivery date of an rfc822 message""" """Return a guess at the delivery date of an rfc822 message"""
assert(message) assert(message)
@ -691,7 +702,6 @@ def guess_delivery_time(message):
if date: if date:
try: try:
time_message = time.mktime(date) time_message = time.mktime(date)
assert(time_message)
vprint("using valid time found from unix 'From_' header") vprint("using valid time found from unix 'From_' header")
return time_message return time_message
except (ValueError, OverflowError): pass except (ValueError, OverflowError): pass

View file

@ -19,7 +19,7 @@ check_python_version() # define & run this early - 'distutils.core' is new
from distutils.core import setup from distutils.core import setup
setup(name="archivemail", setup(name="archivemail",
version="0.4.9", version="0.5.0",
description="archive and compress old email", description="archive and compress old email",
license="GNU GPL", license="GNU GPL",
url="http://archivemail.sourceforge.net/", url="http://archivemail.sourceforge.net/",