Commit Graph

137 Commits

Author SHA1 Message Date
Nikolaus Schulz 255a475978 Use a wrapper around rfc822.Message.fp to find the filename for Maildir/MH
emails.  Python 2.5 broke backward compatibility for Maildirs. :-/
Closes: #1670422
2007-10-22 22:03:44 +00:00
Nikolaus Schulz 8abd70093f Expand tilde in argument of long option --output-dir, the shell doesn't. 2006-11-14 22:20:37 +00:00
Nikolaus Schulz faa68b2048 Bumped version to 0.7.0 2006-11-02 06:43:09 +00:00
Nikolaus Schulz 8de4715e5c Renamed __cvs_id__ to __svn_id__. 2006-11-02 06:40:31 +00:00
Nikolaus Schulz 46f9aa44a9 Split the final stats message in two lines, because it might otherwise linewrap. 2006-11-02 05:36:17 +00:00
Nikolaus Schulz 810dea1bf5 Made IMAP password prompt a tad bit more verbose. 2006-11-01 21:05:10 +00:00
Nikolaus Schulz 3d8a1bda89 Don't prompt for the IMAP password if in quiet mode or if not running
interactively (stdin is not a terminal).
2006-11-01 20:57:58 +00:00
Nikolaus Schulz 89e6683334 Improved IMAP error handling: pass error messages from the server on to the
user, and check if deleting the messages was successful.
2006-11-01 20:35:53 +00:00
Nikolaus Schulz c7d074abde Streamlined verbose IMAP messages a bit. 2006-11-01 20:25:09 +00:00
Nikolaus Schulz d79da0ae99 Removed redundant check if imap login was succesful, since IMAP4.login then
raises an exception.
2006-11-01 20:23:44 +00:00
Nikolaus Schulz c5f194f3ec Tightened some blanket exception handlers. 2006-11-01 19:49:47 +00:00
Nikolaus Schulz e872f2211e Changed misleading references to 'message ids' in the IMAP code to the
technically correct 'message sequence number'.
2006-11-01 06:11:55 +00:00
Nikolaus Schulz bea6ef6390 Optimized IMAP code: just invert the message list from the SEARCH response
instead of querying the server another time with an inverted search filter.
Gather RFC822.SIZE in one big run.
2006-11-01 05:27:30 +00:00
Nikolaus Schulz 86f1fec50d Renamed variable 'filter' to prevent conflicts with the builtin function. 2006-11-01 00:40:26 +00:00
Nikolaus Schulz b3dc8a006e Always sanity-check each archive destination directory, not only when it's
specified with --output-dir.
2006-10-31 04:09:31 +00:00
Nikolaus Schulz dcd37f6466 Make stats report size totals for the mailboxes and the archived messages, and
while at it, make stats work with IMAP.
2006-10-31 03:07:02 +00:00
Nikolaus Schulz 9549c3e29d Minor code cleanup in build_imap_filter(). 2006-10-31 00:35:19 +00:00
Nikolaus Schulz a221f62f52 Shortened new option name "--dont-mangle-from" to "--dont-mangle". 2006-10-30 19:34:39 +00:00
Nikolaus Schulz 697c22daac Rewrote Mbox.procmail_lock() to fix locking race condition. Should now also be
NFS-safe.
2006-10-30 19:29:15 +00:00
Nikolaus Schulz 99cfab1f4e Don't run clean_up() by means of atexit, but use a plain finally clause in the
main archive() function.  This is simpler, and it works better with the
testsuite calling archive() directly, where the atexit handler isn't triggered.
2006-10-29 03:10:45 +00:00
Nikolaus Schulz 2dbd3c1940 Preparing per-testcase cleanup: made StaleFiles.clean() remember what it
deleted, so it's idempotent and e.g. doesn't stomp over someone else's files if
invoked twice and running as root.  Currently I don't see how this could happen,
but it will with a per-testcase cleanup.
2006-10-29 00:04:09 +00:00
Nikolaus Schulz 5eb4cf3cf6 Replaced all tempfile.mktemp() calls with mkstemp()/mkdtemp().
Should just serve as a last security fallback, since we operate in a safe
temporary directory and everything should be okay anyway, but that may be less
obvious. :-)
2006-10-27 03:23:16 +00:00
Nikolaus Schulz 3c0939a3ef When writing messages to mboxes, append os.linesep and mangle From_ only if the
message source is not an mbox-format folder.  
Attempts to fix broken mbox-formatted input are only asking for trouble, and
that's not our job anyway.
2006-10-18 01:20:05 +00:00
Nikolaus Schulz f4c6017d32 IMAPS and IMAP4.login_cram_md5() are new in Python 2.3; bump Python dependency
check to version 2.3.
2006-10-14 23:22:25 +00:00
Nikolaus Schulz 334d1ef9f1 Updated archivemail.__copyright__ 2006-10-14 22:45:25 +00:00
Nikolaus Schulz d631079250 Added maintainer entry in setup.py.
Updated copyright notices in archivemail.py and test_archivemail.py.
2006-10-12 23:02:03 +00:00
Nikolaus Schulz b682b26398 Added new option --dont-mangle-from to turn off From_ mangling. 2006-10-12 21:14:04 +00:00
Nikolaus Schulz 6198341eef Made From_ mangling work reliably with large messages, too. 2006-10-12 19:28:30 +00:00
Nikolaus Schulz 88ef628f20 Mangle From_ in message bodies. 2006-10-12 18:19:01 +00:00
Nikolaus Schulz a0994e6a57 Terminate each message in newly written mbox with an empty line. 2006-10-12 17:35:37 +00:00
Nikolaus Schulz 539894ced4 Implemented --dry-run and --delete for IMAP, both do no not download messages.
Stats are still missing.
2006-10-12 01:02:35 +00:00
Nikolaus Schulz 800a957b59 Preparing the implementation of IMAP --delete:
if not dry-running, delete messages whether we archived them or not.
2006-10-11 19:56:50 +00:00
Nikolaus Schulz 27ca6547c5 Kindly shutdown IMAP connection when doing a --dry-run, too. 2006-10-11 19:28:36 +00:00
Nikolaus Schulz b8b64804c9 _archive_imap(): deleted unused variable. 2006-10-11 19:18:43 +00:00
Nikolaus Schulz ab28001c84 Fixed invalid IMAP filter string for large messages (--size option).
Closes: #863813
2006-10-02 00:22:58 +00:00
Nikolaus Schulz 140596178c Convert on-the-wire CRLF to native EOL when saving messages from an IMAP folder. 2006-09-28 23:31:47 +00:00
Nikolaus Schulz 8d5b36dc3a Fixed IMAP authentication/URL parsing. Require username encoded in URL, but be
flexible with the password: handle both --pwfile and URL-encoded password, and
fallback to querying the user if neither is present.
2006-09-28 23:26:58 +00:00
Nikolaus Schulz dc023db895 Fixed guess_return_path() to actually extract 'Return-path' and 'From' headers. 2006-09-28 22:26:07 +00:00
Nikolaus Schulz 8f47290956 Fixed long options --filter-append and --pwfile to accept their arguments. 2006-09-28 22:19:12 +00:00
Peter Poeml 933aa18259 bump version to 0.6.2 2006-06-27 04:44:28 +00:00
Peter Poeml e00581acb2 new command line option: -F, --filter-append=STRING append arbitrary string to the IMAP filter string 2006-06-27 04:40:24 +00:00
Peter Poeml adfb7a63d7 don't delete more than a certain number of messages at a time. The max command len is limited. Fixes bug 942403 (Archiving large IMAP folders fails) 2006-06-18 11:36:57 +00:00
Peter Poeml 07aca153f6 - fix last patch: don't fail if server URL doesn't contain username of password; try plain as well as cram-md5 login 2006-06-16 09:22:47 +00:00
Peter Poeml a91b2064cb - add SSL support per imaps URL (after patch by Tobias Gruetzmacher)
- add -P/--pwfile option to supply the IMAP password, so it does not end up in the shell history
2006-06-16 08:34:22 +00:00
Peter Poeml 05c599028e fix SyntaxWarning: assignment to None (bug #843890) 2006-04-25 21:13:53 +00:00
Paul Rodger 64d87da307 Use the archive cut-off date rather than the current time with the
--suffix option.
2002-11-21 22:57:13 +00:00
Paul Rodger 60f119d64a Don't assume that root's grpid is '0' -- on solaris it can be different. 2002-11-07 22:54:03 +00:00
Paul Rodger 799f4affcd Removed a test rule that says we can confidently archive messages
older than the unix epoch. (New versions of python return OverFlow
error instead)
2002-10-30 23:51:08 +00:00
Paul Rodger 6a91347b88 Added IMAP support. 2002-10-03 06:27:08 +00:00
Paul Rodger 485b7f882a Opps - forgot to commit the new version number changes (0.5.1) 2002-09-19 00:10:06 +00:00
Paul Rodger baeb03abd4 If we are running as root we setuid() to the user who owns the mailbox. But I
forgot to make sure we create our temporary container directory as that user
too.
2002-09-16 11:35:03 +00:00
Paul Rodger 3939c48518 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.
2002-09-15 06:14:57 +00:00
Paul Rodger 5264ab35cd Fixed a bug where we would throw an exception if a message was dated
exactly on the unix epoch. Also fixed a bug where trailing slashes
were being passed to the archive file name.
2002-08-18 12:17:56 +00:00
Paul Rodger 518654df61 We now call mkdir() to create a temporary directory to store any generated
tempfiles. This should be a lot more secure.
2002-05-20 06:14:54 +00:00
Paul Rodger 7c8b58dea3 Fixed a bug where archivemail would abort if it got a date header
with a completely blank value.
2002-05-07 12:14:29 +00:00
Paul Rodger e4adb7b222 Fixed a bug where the os.rename() calls could fail if we are moving files
between partitions.
2002-05-06 03:06:40 +00:00
Paul Rodger dcff0c0c85 Added a --size option to only archive messages over a certain byte size. 2002-04-29 12:20:45 +00:00
Paul Rodger 15be93bd0d Fixed a bug where if you use the '--delete' option to completely clean
an mbox mailbox you would get a python error.
2002-04-28 04:00:11 +00:00
Paul Rodger bc41b68389 Fixed a bug where the long --suffix option was not working (although the
short option, '-s' was).

Added time-based format directives to the --suffix option, so that you
can do things like specify --suffix='%B%Y' to create archives named
after the current month and year.

Added some more tests to test_archivemail.py
2002-04-27 06:08:45 +00:00
Paul Rodger 9736dff04d Fixed bugs where archivemail would refuse to work on python version less than
2.2.
2002-04-26 03:04:02 +00:00
Paul Rodger 14d58baee1 Added a lot more system tests.
Hopefully I haven't gone too overboard with 957 lines of testing code for
a 1100 line program :)
2002-04-24 07:44:59 +00:00
Paul Rodger a79e730127 Complain if the mailbox to be read does not look like a valid mbox-format
mailbox when it is a singular file.
2002-04-23 04:30:42 +00:00
Paul Rodger 2bfde528cd Added the ability to archive messages older than a given absolute date with
the new option '--date' and fixed a bug where archivemail would complain about
messages older than 1970.
2002-04-23 03:01:26 +00:00
Paul Rodger 623f3ba4be Getting ready for release of version 0.4.1 2002-04-21 01:14:54 +00:00
Paul Rodger e07cdd7a2b Let's use the UnixMailbox class instead of PortableUnixMailbox to read
mbox messages. PortableUnixMailbox gets confused with messages that have
'From ' in the message body unquoted.
2002-04-20 11:52:51 +00:00
Paul Rodger 0cee3de4e7 Complain if an mbox file being read changes sizes. (Nobody should be writing
to these files - we have locked them)
2002-04-19 00:19:44 +00:00
Paul Rodger 04c22934f1 Fixed a bug where when archiving messages from maildir mailboxes, we were
not preserving the status information contained in the filename suffix to
Status and X-Status mbox headers. This means we forgot if we had read or
replied to the message.
2002-04-18 12:02:33 +00:00
Paul Rodger 80b2b99194 Made sure that we don't archive messages flagged important unless we are
given the --include-flagged option.
2002-04-17 13:15:04 +00:00
Paul Rodger ee9757de78 Added an option '--no-compress' if you don't want gzipped archives.
Added an option '--preserve-unread' to always preserved (don't archive)
unread messages.
2002-04-17 06:26:31 +00:00
Paul Rodger ba5426db3f Added a lot more documentation, fixed up usage messages and expanded a lot
on the man page.
2002-04-13 11:36:32 +00:00
Paul Rodger 9e534977ef Stopped calling gzip externally and started using the 'gzip' module
directly. Removed bzip2 and compress support since they were complicating
things and you don't really need them much anyway.
2002-04-12 05:31:59 +00:00
Paul Rodger 29e21fddc0 Changed '_options' to 'options' since it makes more sense when using
archivemail from a library. Yeah, I know -- I'm a spoon.
2002-04-09 12:59:26 +00:00
Paul Rodger 35a9f14982 We now preserve the last-accessed and last-modified timestamps correctly.
Fixed a bug where lockfiles were being created that were not
world-readable.

Made archivemail work better when used as a python module so it can
integrate better with unittest.

Renamed unittest script 'test_archivemail' instead of 'archivemail_test'
and added about 20 more tests.
2002-04-08 13:39:03 +00:00
Paul Rodger 92e86986e5 Updated documentation and version number to reflect new version: 0.2.1 2002-04-04 11:19:29 +00:00
Paul Rodger 4ac9643118 Fixed a bug where if you ran: 'archivemail.py foo/mbox' it would create
the archive file in the current directory instead of the directory 'foo'.
2002-04-04 11:14:00 +00:00
Paul Rodger 81c82ddaf5 check to see if we are running as root -- if so, change our effective
userid and groupid to that of the owner of the original mailbox
2002-04-04 07:40:13 +00:00
Paul Rodger 1ed695b748 Since we might not have a parse-able 'Date-Received' or 'Date' field,
use 5 different ways to guess the date of a message.
2002-04-04 02:41:37 +00:00
Paul Rodger 16999ce35b Don't assume we will always have a Delivery-Date header when constructing
the 'From_' line from a 'maildir' folder. Use the 'Date' header when we
dont.
2002-04-03 11:12:25 +00:00
Paul Rodger 842cda8a37 Complain if we are creating temporary files in world-writable
directories.
2002-04-03 10:51:26 +00:00
Paul Rodger f90bd01a74 Added MH mailbox support. 2002-04-02 13:37:49 +00:00
Paul Rodger 57ed36ea53 Check the python version before we do an 'import atexit', because that
could fail on older versions.
2002-03-31 05:32:14 +00:00
Paul Rodger 17bb56d33c Complain earlier if the output directory does not exist. 2002-03-31 05:01:22 +00:00
Paul Rodger 23e6f58c91 Print a friendlier message when an uncompressed archive already exists.
Make maildir message deletion more robust.
2002-03-31 04:32:31 +00:00
Paul Rodger 3911a2f381 I was not honouring absolute 'output-dir' requests. Fixed. 2002-03-31 03:56:04 +00:00
Paul Rodger 4fdde09fc4 Do not warn about duplicate Message-IDs by default. 2002-03-31 03:46:59 +00:00
Paul Rodger 1b7ab09f24 Added maildir support, cache message-Ids, and lots of other stuff. 2002-03-31 01:31:11 +00:00
Paul Rodger 902a81b4bc Initial revision 2002-03-26 03:53:09 +00:00