1
0
Fork 0
mirror of https://git.code.sf.net/p/archivemail/code synced 2024-12-22 07:42:55 +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
* Fixed a bug where an exception was thrown if a message was dated exactly
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'
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*'

View file

@ -1,5 +1,5 @@
VERSION=0.4.9
VERSION=0.5.0
VERSION_TAG=v$(subst .,_,$(VERSION))
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
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?

View file

@ -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

View file

@ -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/",