r834 - in packages: . libmail-box-perl libmail-box-perl/branches libmail-box-perl/branches/upstream libmail-box-perl/branches/upstream/current libmail-box-perl/branches/upstream/current/examples libmail-box-perl/branches/upstream/current/lib libmail-box-perl/branches/upstream/current/lib/Mail libmail-box-perl/branches/upstream/current/lib/Mail/Box libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dbx libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dir libmail-box-perl/branches/upstream/current/lib/Mail/Box/File libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4 libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH libmail-box-perl/branches/upstream/current/lib/Mail/Box/Maildir libmail-box-perl/branches/upstream/current/lib/Mail/Box/Mbox libmail-box-perl/branches/upstream/current/lib/Mail/Box/Message libmail-box-perl/branches/upstream/current/lib/Mail/Box/Net libmail-box-perl/branches/upstream/current/lib/Mail/Box/POP3 libmail-box-perl/branches/upstream/current/lib/Mail/Box/Parser libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search libmail-box-perl/branches/upstream/current/lib/Mail/Box/Thread libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie libmail-box-perl/branches/upstream/current/lib/Mail/Message libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head libmail-box-perl/branches/upstream/current/lib/Mail/Message/Replace libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc libmail-box-perl/branches/upstream/current/lib/Mail/Message/Wrapper libmail-box-perl/branches/upstream/current/lib/Mail/Transport libmail-box-perl/branches/upstream/current/scripts libmail-box-perl/branches/upstream/current/tests libmail-box-perl/branches/upstream/current/tests/01platform libmail-box-perl/branches/upstream/current/tests/10report libmail-box-perl/branches/upstream/current/tests/11field libmail-box-perl/branches/upstream/current/tests/12head libmail-box-perl/branches/upstream/current/tests/13body libmail-box-perl/branches/upstream/current/tests/14fieldu libmail-box-perl/branches/upstream/current/tests/20pparser libmail-box-perl/branches/upstream/current/tests/30encode libmail-box-perl/branches/upstream/current/tests/31fgroups libmail-box-perl/branches/upstream/current/tests/40mbox libmail-box-perl/branches/upstream/current/tests/41mh libmail-box-perl/branches/upstream/current/tests/42maildir libmail-box-perl/branches/upstream/current/tests/43pop3 libmail-box-perl/branches/upstream/current/tests/43pop3/original libmail-box-perl/branches/upstream/current/tests/44imap libmail-box-perl/branches/upstream/current/tests/45dbx libmail-box-perl/branches/upstream/current/tests/50message libmail-box-perl/branches/upstream/current/tests/51folder libmail-box-perl/branches/upstream/current/tests/52manager libmail-box-perl/branches/upstream/current/tests/53threads libmail-box-perl/branches/upstream/current/tests/54search libmail-box-perl/branches/upstream/current/tests/55locking libmail-box-perl/branches/upstream/current/tests/80msgconv libmail-box-perl/branches/upstream/current/tests/81bodyconv libmail-box-perl/branches/upstream/current/tests/folders

Gunnar Wolf gwolf at costa.debian.org
Sun Jul 17 08:08:59 UTC 2005


Author: gwolf
Date: 2005-03-30 17:25:22 +0000 (Wed, 30 Mar 2005)
New Revision: 834

Added:
   packages/libmail-box-perl/
   packages/libmail-box-perl/branches/
   packages/libmail-box-perl/branches/upstream/
   packages/libmail-box-perl/branches/upstream/current/
   packages/libmail-box-perl/branches/upstream/current/ChangeLog
   packages/libmail-box-perl/branches/upstream/current/INSTALL
   packages/libmail-box-perl/branches/upstream/current/LICENSE
   packages/libmail-box-perl/branches/upstream/current/MANIFEST
   packages/libmail-box-perl/branches/upstream/current/META.yml
   packages/libmail-box-perl/branches/upstream/current/Makefile.PL
   packages/libmail-box-perl/branches/upstream/current/README
   packages/libmail-box-perl/branches/upstream/current/README.FAQ
   packages/libmail-box-perl/branches/upstream/current/README.todo
   packages/libmail-box-perl/branches/upstream/current/TODO.v2
   packages/libmail-box-perl/branches/upstream/current/examples/
   packages/libmail-box-perl/branches/upstream/current/examples/build.pl
   packages/libmail-box-perl/branches/upstream/current/examples/grep.pl
   packages/libmail-box-perl/branches/upstream/current/examples/multipart.pl
   packages/libmail-box-perl/branches/upstream/current/examples/open.pl
   packages/libmail-box-perl/branches/upstream/current/examples/reply.pl
   packages/libmail-box-perl/branches/upstream/current/examples/send.pl
   packages/libmail-box-perl/branches/upstream/current/examples/smaller.pl
   packages/libmail-box-perl/branches/upstream/current/examples/strip-attachments.pl
   packages/libmail-box-perl/branches/upstream/current/examples/takelarge.pl
   packages/libmail-box-perl/branches/upstream/current/lib/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box-Cookbook.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box-Index.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box-Overview.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dbx.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dbx.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dbx/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dbx/Message.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dbx/Message.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dir.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dir.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dir/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dir/Message.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dir/Message.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/FastScalar.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/FastScalar.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/File.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/File.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/File/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/File/Message.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/File/Message.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4/Head.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4/Head.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4/Message.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4/Message.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/DotLock.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/DotLock.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/Flock.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/Flock.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/Multi.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/Multi.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/NFS.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/NFS.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/POSIX.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/POSIX.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH/Index.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH/Index.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH/Labels.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH/Labels.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH/Message.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH/Message.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Maildir.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Maildir.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Maildir/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Maildir/Message.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Maildir/Message.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Manager.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Manager.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Mbox.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Mbox.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Mbox/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Mbox/Message.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Mbox/Message.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Message.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Message.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Message/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Message/Destructed.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Message/Destructed.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Net.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Net.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Net/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Net/Message.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Net/Message.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/POP3.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/POP3.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/POP3/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/POP3/Message.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/POP3/Message.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Parser.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Parser.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Parser/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Parser/Perl.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Parser/Perl.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search/Grep.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search/Grep.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search/IMAP.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search/IMAP.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search/SpamAssassin.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search/SpamAssassin.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Thread/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Thread/Manager.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Thread/Manager.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Thread/Node.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Thread/Node.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie/ARRAY.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie/ARRAY.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie/HASH.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie/HASH.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Makefile.PL
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Construct.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Construct.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Delayed.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Delayed.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Encode.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Encode.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/File.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/File.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Lines.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Lines.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Multipart.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Multipart.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Nested.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Nested.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/String.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/String.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Bounce.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Bounce.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Build.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Build.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Forward.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Forward.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Read.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Read.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Rebuild.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Rebuild.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Reply.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Reply.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Text.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Text.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/Html.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/Html.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/HtmlFormatPS.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/HtmlFormatPS.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/HtmlFormatText.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/HtmlFormatText.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/MailInternet.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/MailInternet.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/MimeEntity.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/MimeEntity.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/TextAutoformat.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/TextAutoformat.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Dummy.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Dummy.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/AddrGroup.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/AddrGroup.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Address.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Address.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Addresses.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Addresses.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Attribute.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Attribute.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Fast.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Fast.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Flex.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Flex.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Full.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Full.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Structured.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Structured.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/URIs.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/URIs.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Unstructured.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Unstructured.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Complete.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Complete.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Delayed.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Delayed.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/FieldGroup.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/FieldGroup.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/ListGroup.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/ListGroup.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Partial.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Partial.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/ResentGroup.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/ResentGroup.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/SpamGroup.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/SpamGroup.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Subset.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Subset.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Part.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Part.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Replace/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Replace/MailHeader.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Replace/MailHeader.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Replace/MailInternet.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Replace/MailInternet.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/Base64.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/Base64.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/Binary.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/Binary.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/EightBit.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/EightBit.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/QuotedPrint.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/QuotedPrint.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/SevenBit.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/SevenBit.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Wrapper/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Wrapper/SpamAssassin.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Wrapper/SpamAssassin.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Reporter.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Reporter.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Exim.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Exim.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/IMAP4.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/IMAP4.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Mailx.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Mailx.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/POP3.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/POP3.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Qmail.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Qmail.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Receive.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Receive.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/SMTP.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/SMTP.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Send.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Send.pod
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Sendmail.pm
   packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Sendmail.pod
   packages/libmail-box-perl/branches/upstream/current/scripts/
   packages/libmail-box-perl/branches/upstream/current/scripts/lsmail
   packages/libmail-box-perl/branches/upstream/current/scripts/mailbox2html
   packages/libmail-box-perl/branches/upstream/current/scripts/takemail
   packages/libmail-box-perl/branches/upstream/current/test.pl
   packages/libmail-box-perl/branches/upstream/current/tests/
   packages/libmail-box-perl/branches/upstream/current/tests/01platform/
   packages/libmail-box-perl/branches/upstream/current/tests/01platform/10crlf.t
   packages/libmail-box-perl/branches/upstream/current/tests/01platform/Definition.pm
   packages/libmail-box-perl/branches/upstream/current/tests/10report/
   packages/libmail-box-perl/branches/upstream/current/tests/10report/10errors.t
   packages/libmail-box-perl/branches/upstream/current/tests/10report/Definition.pm
   packages/libmail-box-perl/branches/upstream/current/tests/11field/
   packages/libmail-box-perl/branches/upstream/current/tests/11field/10cfws.t
   packages/libmail-box-perl/branches/upstream/current/tests/11field/20fast.t
   packages/libmail-box-perl/branches/upstream/current/tests/11field/30flex.t
   packages/libmail-box-perl/branches/upstream/current/tests/11field/Definition.pm
   packages/libmail-box-perl/branches/upstream/current/tests/12head/
   packages/libmail-box-perl/branches/upstream/current/tests/12head/10create.t
   packages/libmail-box-perl/branches/upstream/current/tests/12head/30partial.t
   packages/libmail-box-perl/branches/upstream/current/tests/12head/Definition.pm
   packages/libmail-box-perl/branches/upstream/current/tests/13body/
   packages/libmail-box-perl/branches/upstream/current/tests/13body/10string.t
   packages/libmail-box-perl/branches/upstream/current/tests/13body/20lines.t
   packages/libmail-box-perl/branches/upstream/current/tests/13body/30file.t
   packages/libmail-box-perl/branches/upstream/current/tests/13body/40multip.t
   packages/libmail-box-perl/branches/upstream/current/tests/13body/Definition.pm
   packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/
   packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/10full.t
   packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/20attr.t
   packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/30unstr.t
   packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/40parse.t
   packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/50userid.t
   packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/51addr.t
   packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/52uri.t
   packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/Definition.pm
   packages/libmail-box-perl/branches/upstream/current/tests/20pparser/
   packages/libmail-box-perl/branches/upstream/current/tests/20pparser/10field.t
   packages/libmail-box-perl/branches/upstream/current/tests/20pparser/20head.t
   packages/libmail-box-perl/branches/upstream/current/tests/20pparser/30bodys.t
   packages/libmail-box-perl/branches/upstream/current/tests/20pparser/31bodyl.t
   packages/libmail-box-perl/branches/upstream/current/tests/20pparser/32bodyd.t
   packages/libmail-box-perl/branches/upstream/current/tests/20pparser/33bodyf.t
   packages/libmail-box-perl/branches/upstream/current/tests/20pparser/34bodymp.t
   packages/libmail-box-perl/branches/upstream/current/tests/20pparser/40readmp.t
   packages/libmail-box-perl/branches/upstream/current/tests/20pparser/50nested.t
   packages/libmail-box-perl/branches/upstream/current/tests/20pparser/Definition.pm
   packages/libmail-box-perl/branches/upstream/current/tests/30encode/
   packages/libmail-box-perl/branches/upstream/current/tests/30encode/10base64.t
   packages/libmail-box-perl/branches/upstream/current/tests/30encode/20eight.t
   packages/libmail-box-perl/branches/upstream/current/tests/30encode/30quoted.t
   packages/libmail-box-perl/branches/upstream/current/tests/30encode/40seven.t
   packages/libmail-box-perl/branches/upstream/current/tests/30encode/90body.t
   packages/libmail-box-perl/branches/upstream/current/tests/30encode/Definition.pm
   packages/libmail-box-perl/branches/upstream/current/tests/31fgroups/
   packages/libmail-box-perl/branches/upstream/current/tests/31fgroups/10resent.t
   packages/libmail-box-perl/branches/upstream/current/tests/31fgroups/20list.t
   packages/libmail-box-perl/branches/upstream/current/tests/31fgroups/30spam.t
   packages/libmail-box-perl/branches/upstream/current/tests/31fgroups/Definition.pm
   packages/libmail-box-perl/branches/upstream/current/tests/31fgroups/mlfolder
   packages/libmail-box-perl/branches/upstream/current/tests/31fgroups/sgfolder
   packages/libmail-box-perl/branches/upstream/current/tests/40mbox/
   packages/libmail-box-perl/branches/upstream/current/tests/40mbox/10read.t
   packages/libmail-box-perl/branches/upstream/current/tests/40mbox/20write.t
   packages/libmail-box-perl/branches/upstream/current/tests/40mbox/30delay.t
   packages/libmail-box-perl/branches/upstream/current/tests/40mbox/40append.t
   packages/libmail-box-perl/branches/upstream/current/tests/40mbox/50create.t
   packages/libmail-box-perl/branches/upstream/current/tests/40mbox/60thread.t
   packages/libmail-box-perl/branches/upstream/current/tests/40mbox/70inplace.t
   packages/libmail-box-perl/branches/upstream/current/tests/40mbox/80update.t
   packages/libmail-box-perl/branches/upstream/current/tests/40mbox/Definition.pm
   packages/libmail-box-perl/branches/upstream/current/tests/41mh/
   packages/libmail-box-perl/branches/upstream/current/tests/41mh/10read.t
   packages/libmail-box-perl/branches/upstream/current/tests/41mh/20write.t
   packages/libmail-box-perl/branches/upstream/current/tests/41mh/30append.t
   packages/libmail-box-perl/branches/upstream/current/tests/41mh/50create.t
   packages/libmail-box-perl/branches/upstream/current/tests/41mh/60thread.t
   packages/libmail-box-perl/branches/upstream/current/tests/41mh/70seqs.t
   packages/libmail-box-perl/branches/upstream/current/tests/41mh/Definition.pm
   packages/libmail-box-perl/branches/upstream/current/tests/42maildir/
   packages/libmail-box-perl/branches/upstream/current/tests/42maildir/10read.t
   packages/libmail-box-perl/branches/upstream/current/tests/42maildir/20write.t
   packages/libmail-box-perl/branches/upstream/current/tests/42maildir/30append.t
   packages/libmail-box-perl/branches/upstream/current/tests/42maildir/Definition.pm
   packages/libmail-box-perl/branches/upstream/current/tests/43pop3/
   packages/libmail-box-perl/branches/upstream/current/tests/43pop3/01basic.t
   packages/libmail-box-perl/branches/upstream/current/tests/43pop3/02break.t
   packages/libmail-box-perl/branches/upstream/current/tests/43pop3/03minimal.t
   packages/libmail-box-perl/branches/upstream/current/tests/43pop3/04autodelete.t
   packages/libmail-box-perl/branches/upstream/current/tests/43pop3/Definition.pm
   packages/libmail-box-perl/branches/upstream/current/tests/43pop3/original/
   packages/libmail-box-perl/branches/upstream/current/tests/43pop3/original/0001
   packages/libmail-box-perl/branches/upstream/current/tests/43pop3/original/0002
   packages/libmail-box-perl/branches/upstream/current/tests/43pop3/original/0003
   packages/libmail-box-perl/branches/upstream/current/tests/43pop3/original/0004
   packages/libmail-box-perl/branches/upstream/current/tests/43pop3/server
   packages/libmail-box-perl/branches/upstream/current/tests/44imap/
   packages/libmail-box-perl/branches/upstream/current/tests/44imap/10read.t
   packages/libmail-box-perl/branches/upstream/current/tests/44imap/20write.t
   packages/libmail-box-perl/branches/upstream/current/tests/44imap/Definition.pm
   packages/libmail-box-perl/branches/upstream/current/tests/45dbx/
   packages/libmail-box-perl/branches/upstream/current/tests/45dbx/10read.t
   packages/libmail-box-perl/branches/upstream/current/tests/45dbx/Definition.pm
   packages/libmail-box-perl/branches/upstream/current/tests/50message/
   packages/libmail-box-perl/branches/upstream/current/tests/50message/10stripsig.t
   packages/libmail-box-perl/branches/upstream/current/tests/50message/20replsubj.t
   packages/libmail-box-perl/branches/upstream/current/tests/50message/21reply.t
   packages/libmail-box-perl/branches/upstream/current/tests/50message/30bounce.t
   packages/libmail-box-perl/branches/upstream/current/tests/50message/40forwsubj.t
   packages/libmail-box-perl/branches/upstream/current/tests/50message/41forward.t
   packages/libmail-box-perl/branches/upstream/current/tests/50message/50rebuild.t
   packages/libmail-box-perl/branches/upstream/current/tests/50message/58clone.t
   packages/libmail-box-perl/branches/upstream/current/tests/50message/60destruct.t
   packages/libmail-box-perl/branches/upstream/current/tests/50message/Definition.pm
   packages/libmail-box-perl/branches/upstream/current/tests/51folder/
   packages/libmail-box-perl/branches/upstream/current/tests/51folder/10copyto.t
   packages/libmail-box-perl/branches/upstream/current/tests/51folder/20tieary.t
   packages/libmail-box-perl/branches/upstream/current/tests/51folder/21tiehash.t
   packages/libmail-box-perl/branches/upstream/current/tests/51folder/Definition.pm
   packages/libmail-box-perl/branches/upstream/current/tests/52manager/
   packages/libmail-box-perl/branches/upstream/current/tests/52manager/10open.t
   packages/libmail-box-perl/branches/upstream/current/tests/52manager/11urlopen.t
   packages/libmail-box-perl/branches/upstream/current/tests/52manager/Definition.pm
   packages/libmail-box-perl/branches/upstream/current/tests/53threads/
   packages/libmail-box-perl/branches/upstream/current/tests/53threads/10single.t
   packages/libmail-box-perl/branches/upstream/current/tests/53threads/Definition.pm
   packages/libmail-box-perl/branches/upstream/current/tests/54search/
   packages/libmail-box-perl/branches/upstream/current/tests/54search/10grep.t
   packages/libmail-box-perl/branches/upstream/current/tests/54search/Definition.pm
   packages/libmail-box-perl/branches/upstream/current/tests/55locking/
   packages/libmail-box-perl/branches/upstream/current/tests/55locking/10dotlock.t
   packages/libmail-box-perl/branches/upstream/current/tests/55locking/20flock.t
   packages/libmail-box-perl/branches/upstream/current/tests/55locking/30nfslock.t
   packages/libmail-box-perl/branches/upstream/current/tests/55locking/40posix.t
   packages/libmail-box-perl/branches/upstream/current/tests/55locking/90multi.t
   packages/libmail-box-perl/branches/upstream/current/tests/55locking/Definition.pm
   packages/libmail-box-perl/branches/upstream/current/tests/80msgconv/
   packages/libmail-box-perl/branches/upstream/current/tests/80msgconv/10mailint.t
   packages/libmail-box-perl/branches/upstream/current/tests/80msgconv/20mimeent.t
   packages/libmail-box-perl/branches/upstream/current/tests/80msgconv/Definition.pm
   packages/libmail-box-perl/branches/upstream/current/tests/81bodyconv/
   packages/libmail-box-perl/branches/upstream/current/tests/81bodyconv/10textaf.t
   packages/libmail-box-perl/branches/upstream/current/tests/81bodyconv/20html.t
   packages/libmail-box-perl/branches/upstream/current/tests/81bodyconv/30htmlps.t
   packages/libmail-box-perl/branches/upstream/current/tests/81bodyconv/31htmltxt.t
   packages/libmail-box-perl/branches/upstream/current/tests/81bodyconv/Definition.pm
   packages/libmail-box-perl/branches/upstream/current/tests/Tools.pm
   packages/libmail-box-perl/branches/upstream/current/tests/folders/
   packages/libmail-box-perl/branches/upstream/current/tests/folders/mbox.cpy
   packages/libmail-box-perl/branches/upstream/current/tests/folders/mbox.src
   packages/libmail-box-perl/tags/
Log:
[svn-inject] Installing original source of libmail-box-perl

Added: packages/libmail-box-perl/branches/upstream/current/ChangeLog
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/ChangeLog	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/ChangeLog	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,2328 @@
+CHANGELOG of Mail::Box version 2
+
+All changes were made by Mark Overmeer <mark at overmeer.net>, unless
+specified differently.
+
+NOTE: The number of changes and fixes for each release seem large, but
+      usually limited to areas which are under development.  Mail::Box
+      is a huge module, so there is always a lot of activity.
+
+wat als appendMessage faalt?
+filehandle als bron folder?
+MH index in append mode niet lezen.
+gebruik Return-Path voor reply()
+flock() op flock(): zelfde process op AIX en Solaris
+
+version 2.055: Sun May 16 15:41:59 CEST 2004
+
+	Fixes:
+
+	- [Simon Sozens] reported that IMAPClient was always installed,
+	  although claiming that it was optional.  Now it is really
+	  optional.
+
+	- [Josh Miller] showed Mail::Message::Construct::Reply::replyPrelude
+	  failed the default situation of no explictly stated destination.
+
+	- [Yuval Kogman] suggested to use $CRLF from Socket.pm in Mail::
+	  Transport::POP3, because it correctly set the content for many
+	  platforms.
+
+	- [Timur I. Bakeyev] spam-flag tested for "yes", but should be
+	  "^yes\b", by reason of a possible "bayes" name in the same line.
+
+	- [Timur I. Bakeyev] ::FieldGroup->attach was broken since 2.051.
+
+	- [Timur I. Bakeyev] ::FieldGroup doc improvements.
+
+	- [Daniel P. Berrange] found a circular reference which kept
+	  folders to stay open too long in some circumstances.
+
+	- [Roderick A. Anderson] saw complaints about fileLocation() being
+	  called on message parts.  Something is fixed, which may be the
+	  cause.
+
+	- [Miah Gregory] destruct()ing messages in Maildir should not
+	  delete the message.  No message will be automatically flagged
+	  for deleting when destructed.
+
+	- [Paul Makepeace] $msg->send(via) always used sendmail, without
+	  looking at the value passed with via.
+
+	- [Roderick A. Anderson] hit a bug in ::Body::Nested::fileLocation
+
+	- [Kees Dekker] Mail::Box::update logged number of new messages,
+	  although it did not receive that info from updateMessages.  Log
+	  message removed.
+
+	- [Kees Dekker] discovered a race-condition when writing a
+	  replacement folder in Mail::Box::File.
+
+	- The probably hundredth attempt to get $msg->send to work smoothly.
+
+	- [Gilles] discovered that the charset setting of a body did not
+	  survive encode().  Content-type fields with text/* mime-types will
+	  not get charset=us-ascii added automatically.
+
+	- [Blair Zajac] typo in Makefile.PL text, and removal of stutters
+          in the documentation.
+
+	Improvements:
+
+	- [Trond Michelsen] needed a way to specify the body type for
+	  messages which where read with Mail::Message->read.
+
+	- You now can add your own spam-fighter fields to the detector
+	  of Mail::Message::Head::SpamGroup.  See method 'fighter'.
+
+	- [Roderick A. Anderson] showed that the result value of
+	  $msg->timestamp needed some more explanation.
+
+	- [Kees Dekker] Doc improvements in Mail::Box::Locker
+
+	- Easier to start multi-lockers with selection when opening
+	  a folder:
+	     $f = $mgr->open($name, lock_type => ['DOTLOCK','FLOCK'])
+
+	- [David A Golden] suggested to remove $msg->date, in favor
+	  of $msg->head->date, which is consistent.  When the need arises,
+	  maybe a new method $msg->date will appear returning some nice
+	  date object (like a DateTime).  But probably that is never
+	  needed, since there is a $msg->timestamp.
+
+version 2.054: Fri Feb  6 21:52:54 CET 2004
+
+	Fixes:
+
+	- Reverted the change made in 2.049, which automatically added
+	  a new-line to a body... a Mail::Message::Body object may
+	  contain binary data!
+
+	- [Phil Hagen] found a typo in Mail::Transport::Qmail, causing
+	  the display of undisclosed fields (Bcc) when using qmail.
+
+	- [Brett Dikeman] showed that $mgr->open sometimes complained
+	  with a warning when no folderdir was specified.
+
+	- [Erik A Johnson] patched Mail::Box->coerce(message) to work
+	  better with foreign messages.
+
+	- [Erik A Johnson] found that Mail::Internet objects where converted
+	  by the MIME::Entity converter and vice-versa.  This does usually
+	  not cause too many problems because MIME::Entity extends
+	  Mail::Internet.
+
+	- [David Phillips] got an undef warning in POP3 after delete(). Fixed
+
+	- [Mike J. Vincelette] reported error in $folder->messages(0, 20)
+	  The bounds were not checked correctly and slicing with 1..20
+	  behaves unexpectedly in subroutine scalar context.
+
+	Improvements:
+
+	- $msg->size returns a value which may be a few percent off the
+	  real value (depends on the action which follows).  The warning
+	  in the documentation about this has been strengthened after some
+	  discussion with [Mike Mimic]
+
+	- Mail::Transport::Exim takes exim4 binary with preference over
+	  usual exim MTA, on request by [Mike Mimic]
+
+version 2.053: Thu Dec  4 00:13:50 CET 2003
+
+	Fixes:
+
+	- Installation problem with Mail::IMAPClient.
+
+version 2.052: Wed Dec  3 21:04:45 CET 2003
+
+        Fixes:
+
+        - Mail::Transport::Send did not pass the options to the various
+          trySend() methods.  Now $msg->send(to => ...) will be respected.
+
+        - [Tim Sellar] fixed the message type default where the Content-Type
+          field is empty.
+
+        - Corrected some typos in Mail::Box-index, and added reference to
+          HTML::FromMail
+
+        - 'use' line reshuffling in all test scripts, because Test::Harness
+          changed behavior.
+
+        - [Matthew Darwin] found double 'Content-Type' fields after build()
+          From now on, you can overrule the content-type of the constructed
+          message, for instance to 'multipart/alternative' without problems.
+
+        - A list of sorted threads could not handle threads starting at the
+          same time: only one was listed.
+
+        - Reply on a message which lists multiple reply-to addresses
+          confused replyPrelude(). Spotted by [Nick Ing-Simmons]
+
+        - Mail::Transport::SMTP could not handle illegal sender address.
+          Discovered by [Matthew Darwin] 
+
+        - Mail::Message->build with data => '' failed: contains no lines
+          at all, which was not correctly handled. Reported by
+          [Matthew Darwin].
+
+        - $msg->coerce() does not clear the deleted flag anymore.
+
+        Improvements:
+
+        - Basic IMAP4 implementation.  Included for testing purpose only.
+
+        - 'delete' is changed into a full-class label, not a special
+          case.  This simplified the code on many places.  The delete(),
+          isDeleted(), and deleted() methods on a message are now
+          simply short-cuts for $msg->label(deleted)
+
+        - Removed most use of File::Spec from Mail::Box::MH and
+          Mail::Box::Maildir, because it consumed considerable time:
+          [Anthony D. Urso] reported 20%)
+          doing things not required to perform correctly on Unix or
+          Windows.
+
+        - Ignore sending messages with SMTP when no addresses are specified
+          to send the message to.
+
+        - Warnings about lacking optional modules is nicer in Makefile.PL
+
+        - Added large warning to Makefile.PL when people have the perl
+          version (not the XS version) of Scalar::Util installed on their
+          system.  That breaks everything! The correct version can not
+          automatically be reinstalled because the version numbers are the
+          same.
+
+        - Recent changes (bugs) in Test::Harness required an update of
+          the test process.
+
+        - test.pl reports the version of some installed modules, to help
+          responding to error reports.
+
+        - [Anthony D. Urso] supplied a patch to use the Received headers
+          to provide a message time-stamp.  Mail::Message::Head::Complete
+          now contains a ::timestamp() to get the user supplied date (which
+          is untrustable in case of spam) and ::recvstamp() which uses other
+          means.  The Mail::Message::timestamp() will, from now on, prefer
+          the date provided by ::recvstamp and use ::timestamp as fallback.
+
+          There are other sources to get a good stamp from, for instance
+          the MBOX "From " line, but that is not implemented (yet)
+
+        - [asta] used $msg->parts, but the doc of the method was ignoring
+          the facts that the message/rfc822 and multipart "wrappers" of
+          the parts are not returned.
+
+        - $folder->current made lazy, so only calculated when used.  When
+          no message is labeled 'current', then the first not seen is
+          returned.
+          
+        - New method $folder->findFirstLabeled.
+
+        - New option Mail::Box::Manager->new(autodetect) limits the set of
+          default folder-types in the folder type autodetection attempt.
+          Requested by [Nick Ing-Simmons]
+
+        - The HTML manual now also indexes NOTICE log messages.  Not all
+          NOTICE messages are described yet.
+
+version 2.051: Mon Nov  3 16:16:09 CET 2003
+
+        Fixes:
+
+        - [Tim Sellar] example/build.pl omission: ::Body->new(type =>
+          should be ::Body->new(mime_type =>
+
+        - [Lutz Gehlen] bumped into a mistake in the (not finished)
+          ::Field::Full code: the class of unstructured fields was
+          composed improperly.
+
+        - study()ing multi-line fields produced an improper field
+          names.
+
+        Improvements:
+
+        - [Matthew Walker] added the distiction between CommuniGatePro
+          and CommunGate software to the Mail::Message::Head::ListGroup 
+          mailinglist detector.
+
+        - [Tim Sellar] suggested to ignore undef values in build(),
+          which will simplify the code of the user.
+
+        - Added detector for MailScanner spam groups.
+
+        - new Mail::Message::Head::SpamGroup::spamDetected() and
+              Mail::Message::Head::Complete::spamDetected()
+
+        - Mail::Message::Replace::MailInternet::read() distinguishes
+          between Mail::Message->read() and $mailinternet_object->read
+
+version 2.050: Tue Sep 30 18:27:11 CEST 2003
+
+        Fixes:
+
+        - An (unintended) change of behaviour in Text::MagicTemplate
+          (which is used to produce the POD and HTML) made all produced
+          manuals exactly the same.
+
+        Improvements:
+
+        - [Matthew Walker] contributed various improvements to the ListGroup
+          detection and documentation.  Detection for Listserv software
+          was added, and rfc2918 should have been rfc2919.
+
+        - [Matthew Walker] made test/Tools::copy_dir() skip directories.
+
+        - Implementation of Mail::Message::Replace::MailInternet and
+          ::MailHeader, as drop-in replacements for Mail::Internet and
+          Mail::Header.  Very alpha! not tested yet!
+
+version 2.049: Mon Sep 29 13:32:47 CEST 2003
+
+        Fixes:
+
+        - [Liz Mattijsen] Makefile.PL requires IO::Handle in some
+          environments.
+
+        - [Terrence Brennon] found a doc and a code mistake in
+          example/strip-attachement.pl
+
+        - [Ron Savage] showed that the Text::Autoformat module produces
+          different output on different machines, caused by breaking
+          words.  Breaking now disabled the for the tests, so test
+          should result in the same everywhere.
+
+        - Some Mail::Transport::* senders did not pass-on the Bcc field
+          to their application.  Reported by [Phil Hagen].
+
+        - [Stefan Wolfsheimer] and [Mark Scarton] report a missing $ in
+          ::ResentGroup, which broke the "delivered-to" field in resent
+          groups.
+
+        - [Jason Woodward] reported that there were still some problems
+          with $msg->forward().  Hope to have fixed them, this time.
+
+        - $msg->send now really has a default which will be loaded
+          automatically as well.
+
+        - When you try to open the same folder twice, using the manager
+          (as you should), the second time will fail.  This is needed,
+          because there are too many complications, like locking.
+
+        Improvements:
+
+        - Mail::Box::Parser::Perl used $sep =~ m/^From / to recognize the
+          MBOX separator.  Now it uses $sep eq 'From ', which is faster.
+
+        - Mail::Message::Body::new(data) now corrects scalars values
+          which do not end on a "\n".  Convinced by [Mike Mimic]
+
+        - Object::Realize::Later v0.14 required
+
+        - Mail::Box::File::updateMessages() implemented, for instance for
+          $mbox->update calls.  Test in tests/40mbox/80update.t
+
+        - Maildir subfolder names can start with a dot, as reported by
+          [Paul Simons].
+
+        - Ability to add options to the command-line of sendmail when
+          started as MTU.  Saw this need in a script of [Adam Augustine]
+
+        - Test-script of MIME::Entity conversion purges the M::E objects
+          after being used, otherwise trashing files are left in the tests
+          directory.
+
+        - Added Mail::Message::Body(::Encode)::dispositionFilename and
+          Mail::Message::Body::write() which will help to export data
+          found in a message(-part) to the file-system.
+
+version 2.048: Tue Aug 26 19:50:06 CEST 2003
+
+        Fixes:
+
+        - [Jason Woodward] reported that reply on multiparts (with only
+          one part) failed.  For this release, forward() has been rewritten.
+          reply() may be the victim for the next release.
+
+        - [Joe Junkin] reported a problem to send messages where the
+          body is not in a temporary file via SMTP.
+
+        - Added required Mail::Message::Wrapper::SpamAssassin method
+          get_pristine_header()
+
+        - [Simon Cozens] demonstrated that converting MIME::Entity objects
+          into Mail::Message's lost content related headers.  This required
+          a small redesign on when data is copied from header to body and
+          vice versa.
+
+        - Mail::Message::Body::Multipart;;stripSignature stripped all
+          but signatures :(
+
+        - requires Test::Harness which defines _run_test_scripts, so
+          increased the required VERSION. [Liz Mattijsen]
+
+        - [Steven Benson] found-out that manager objects where kept
+          alive too long.
+
+        - [Rob Holland] reports that a '=' is valid in a Maildir filename,
+          and supplied a patch.
+
+        - [Joe Junkin] found another spot where <$body> was used on a
+          non-GLOB.  In Mail::Transport::SMTP, this time.
+
+        Improvements:
+
+        - Added Mail::Message::Head::FieldGroup as base class for
+          Mail::Message::Head::(List|Spam|Resent)Group.
+
+        - Reimplemented Mail::Message::Head::ResentGroup to be based on
+          a MMH::FieldGroup.
+
+        - Added Mail::Message::Head::SpamGroup to detect/produce/remove
+          sets of header fields which relate to spam detection software.
+          Tests in tests/31fgroups/30spam.t
+
+        - Moved detection of mailinglist type in Mail::Message::Head::Listgroup
+          from method type() to from().
+
+        - Added Mail::Report::addReport, to merge reports from one object
+          into an other, require by [Matthew Lockner]
+
+        - [Matthew Lockner] wished to able to get parser errors back on
+          Mail::Message->read.  These errors are now copied from the parser
+          object into the message.
+
+        - Added Habeas-SWE (Sender Warranted E-mail) as abbreviation in field
+          names which is always in caps, on request by [Ronnie Paskin]
+
+        - Moved 20resent.t and 40list.t from tests/12head to tests/31fgroups.
+
+        - New methods Mail::Message::Head::Complete::removeContentInfo(),
+          Mail::Message::Body::contentInfoFrom(head) and ...To(head)
+
+        - As result of an extended discussion with [Simon Cozens], it
+          seems that object-by-object conversion between MIME::Entity
+          and Mail::Message objects will keep on producing problems.
+          Therefore a stringify-reparse strategy is used from now on.
+          Mail::Message::Convert::MimeEntity is very straight-forward
+          now, but a less efficient.
+
+        - [Jason Woodward] convinced me to implement
+          Mail::Message::forward(include => 'ENCAPSULATE'), which adds
+          the source message as message/rfc822.  The whole forward
+          implementation has been re-implemented and re-documented.
+
+        - [Kees Dekker] was (understandably) confused by the explanation
+          of $folder->isModified()  This has been improved.
+
+version 2.047: Thu Aug  7 23:59:53 CEST 2003
+
+        Fixes:
+
+        - For MBOX and POP3, delayed header will be read before labels()
+          or label() return the values, because only reading will cause
+          the [X-]Status fields to be parsed into labels.
+
+        - Tests are now suitable for perl5.8.1
+
+        - [Kees Dekker] with Solaris and perl5.8.1 showed me that
+          Mail::Box::Locker::POSIX was so broken that its tests worked
+          on other versions :(
+
+        Improvements:
+
+        - Moved all questions about optional modules from test.pl to
+          Makefile.PL.  Hope for a cleaner installation.
+
+        - On request by [Jason Woodward], POP3 received messages will
+          get their Status and X-Status fields processed.  POP3 has no
+          other means to pass-on status information, although not all
+          servers support these fields.
+
+        - The library should now be taint-safe: all test-scripts now run
+          in taint mode!
+
+        - The POP3 test-scripts now share common code in Tools.pm
+
+        - New release for Mail::Box::Parser::C (as separate package)
+          which ignores message lines starting with 'From ' as
+          separators in broken MBOX folders (like mutt produces).
+
+        - Added Mail::box::Parser::C to the list of optional modules.
+
+        - Refolding and Mail::Message::Field::AddrGroup will produce
+          the address strings in alphabetic order, to get a reproduceable
+          result (required for 5.8.1)
+
+        - Disabled detection of folder "changed during access", until
+          all folder types support 'update()'.
+
+version 2.046: Thu Jul 31 12:25:47 CEST 2003
+
+        Fixes:
+
+        - [Kees Dekker] found that HPUX mangles %z int textual timezone,
+          so Mail::Message::Field::toDate() has changed again.  Quite
+          complex now.
+
+        - [Kees Dekker] fixed a missed test for undef in
+          Mail::Message::Head::ListGroup::display().
+
+        - [Kees Dekker] reported a problem in tests/42maildir/20write
+          which was caused by a missing $folder->close;
+
+        - [Blair Zajac] & [Kees Dekker] signalled that User::Identity
+          and URI are prerequisits now.
+
+        - [Kingpin] Wrong quotes in warnings and a typo, in
+          Mail/Message/Body/Encoding.pm
+
+        - $msg->send was showing lines not to be disclosed by default,
+          which is wrong.
+
+        - [Jan Stapel] reported prints of "GLOB()"s where text was
+          expected.  This was a new bug in Mail::Message::Body::File
+
+        Improvements:
+
+        - [David Coppit] has a short list of improvements in handling
+          blank lines at the end of messages and message parts, which
+          will decrease the differences between a message read and then
+          printed.
+
+version 2.045: Tue Jul 29 20:23:30 CEST 2003
+
+        Fixes:
+
+        - A lot of files were missing from the distribution because OODoc
+          had a bug.
+
+        Improvements:
+
+        - Object::Realize::Later documentation is now part of MailBox's
+          html output too.  Join the club!
+
+version 2.044: Tue Jul 29 13:52:32 CEST 2003
+
+        Interface changes!!
+
+        - Mail::Message::rebuild() tags where inconsequently named.  Now
+          remove_html_alternative_to_text => removeHtmlAlternativeToText
+          text_alternative_for_html => textAlternativeForHtml
+
+        - [Anthony D. Urso] hinted that opening a Maildir folder should
+          not automatically move messages from 'new' to 'cur'.  Added a
+          label 'accepted' to control this.
+          See Maildir::new(accept_new) which must be set to get the
+          same behavior as before.
+
+        - Mail::Box::Maildir::updateMessages was incorrect: inconsistent
+          behavior with other updateMessages().  Removed for now.
+
+        Fixes:
+
+        - Some print()s did not distriguish between GLOBs and IO::Files
+
+        - [Martin Thurn] detected a problem with the call of
+          Mail::Box::FastScalar in Mail::Box::POP3
+
+        - [Yuval Kojman] fixed Field::toDate() on systems without glibc.
+
+        Improvements:
+
+        - Mail::Message::new(labels) did not work, but was not described
+          either.
+
+        - Moved all modules to lib/, which removes the need for a nested
+          Makefile.PL, improperly handled by new gnu-make/ExtUtils::MakeMaker
+          combinations.
+
+        - added UserIdentity to the HTML documentation tree.
+
+        - added list detector Mail::Message::Head::ListGroup based on
+          information collected in Mail::ListDetector.
+          Tests in 12head/40list.t
+
+        - added Mail::Messsage::Head::Complete::listGroup()
+                Mail::Messsage::Head::Complete::addListGroup()
+                Mail::Messsage::Head::Complete::removeListGroup()
+                Mail::Messsage::Head::Partial::removeListGroup()
+
+        - added example 'smaller.pl' to demonstrate how to get rit
+          of selected headers (and how much you gain by it)
+
+        - added description how to reduce the size of headers by removing
+          groups of fields.
+
+        - added method $folder->size which estimated a folder size, but
+          may be slow.
+
+        - debugged and tested Mail::Message::Field::Addresses,
+          Mail::Message::Field::Address, and Mail::Message::Field::AddrGroup,
+          with tests in tests/14fieldu/51addr.t
+
+        - Added Mail::Message::Field::URIs with tests in
+          tests/14fieldu/52uris.
+
+        - MailBox now depends on the URI distribution
+
+        - Move Mail::Box::Message::shortString and ::shortSize to
+          Mail::Message.
+
+        - Simplified Mail::Message::sender().
+
+        - Rewrote Mail::Message::Head::createReceived to work on headers
+          which are not inside a message.
+
+        - "make test" will produce some more text, and permits skipping
+          all tests for fast installation.
+
+version 2.043: Thu Jul 10 10:18:51 CEST 2003
+
+        Fixes:
+
+        - [Greg Matheson] small doc-fix for Mail::Message::Body::Construct
+          foreachLine().
+
+        - [Wiggins d'Anconia] time generated by strftime left %z on non-gnu
+          systems.  On those systems, a work-around is made using
+          Date::Format.
+
+        - appendMessage in Mail::Box::File coerces message into the
+          correct sub-class.
+
+        - Mail::Message::Head::Delayed is not empty.
+
+        - Mail::Message->read will strip the status fields from the header
+          by default, for security considerations.
+
+        - Mail::Message->bounce will not interpret status fields.
+
+        Improvements:
+
+        - labelsToStatus and statusToLabels are now only implemented for
+          file based folder types, like mbox.
+
+        - Implemented Mail::Box::Message::Destructed with a
+          Mail::Box::Message::destruct(), Mail::Message::destruct(), and
+          Mail::Message::Part::destruct(), tests/50mesage/60destruct.t
+          to forcefully free-up most memory used by a message.
+
+        - Added Mail::Box-Index, the documentation index.
+
+        - Extended documentation about
+          . various ways to access header field data
+          . message labels (flags)
+          . various class relations
+
+        - Now requires Object::Realize::Later version 0.12
+
+        - [Todd Richmond] contributed Mail::Box::FastScalar, which is
+          a replacement of IO::Scalar... but faster.  It should be a
+          separate module, but for now it has a place.
+          FastScalar is faster and does not leak, as its brother.
+
+        - Removed last uses of IO::ScalarArray, because it seeks awfully
+          slow.
+
+        - Added Mail::Message::study()
+                Mail::Message::Head::study()
+          but it is not usuable yet.
+
+version 2.042: Tue May 20 14:32:05 CEST 2003
+
+        Fixes:
+
+        - Added message-id to the wrong side of the Reference field
+          in reply() and forward().  Fix by [Mike Mimic]
+
+        - [Tassilo v Parseval] reported an error when HTML::FormatText
+          was not installed.
+
+        - [Alex Liberman] found that searching nested messages failed,
+          because they were treated as multiparts.
+
+        - [Todd Richmond] demonstrated that multiparts contained circular
+          references, which increased memory consumption.  Not hard too
+          fix.
+
+        Improvements:
+
+        - Implemented Mail::Box::Dbx to read Outlook Express files.  Tests
+          in tests/45dbx/*
+
+        - Implemented Mail::Message::Head::Partial, which will contain
+          a subset of headers without knowing where to find the rest
+          of it.  ::Subset knows where to get the rest.  Tests in
+          tests/12head/30partial.t
+
+        - $head->removeFields(), $head->removeFieldsExcept() and
+          $head->removeResentGroups to free up memory. This "upgrades" a
+          complete header into a partial header.
+
+version 2.041: Thu May  8 14:05:32 CEST 2003
+
+        Fixes:
+
+        - [Supriya Jagadeesh] showed that reply(include => NO) did not
+          work. Apparently, no-one used it before.
+
+        - [Shagren] showed a patch to avoid an locale based date field
+          to be produced, where rfc2822 requires an English format.
+          As change, the locale based parts of strftime are avoided.
+
+        - sendmail and started with extra -i flag, to avoid stop at lines
+          in message which only contain a dot.  Spotted by [Tim Sellar]
+
+        - [Bill Moseley] detected that examples/reply.pl called an
+          non-existing quotePrelude(), which should have been replyPrelude().
+
+        - [Dimitris Glynos] Mail::Message::Field::Full:_decoder() should
+          decode, not encode :(
+
+        - [Dimitris Glynos] Mail::Message::Construct::reply() did not
+          use the subject of the sender to create a new answer.
+
+        Improvements:
+
+        - Translated all docs to use OODoc.  Many small fixes in the docs
+          were the result.
+
+        - Removed $folder->clone, because it implemented the same as
+          $folder->openRelatedFolder, which has a much better name to
+          describe the action performed.
+
+        - Rewrote documentation for Mail::Box::scanFromMessages().  It now
+          also accepts a timespan as value.
+
+        - Documented all available overloading (which is quite important).
+
+        - Mail::Message::Construct has been taken apart in multiple
+          Mail::Message::Construct::* packages because it grew too
+          large and it simplifies including examples.
+
+        - Added Mail::Message::Construct::Rebuild, which can modify
+          existing messages.  Very slick!
+
+        - Mail::Message::Part's get an empty header by default.
+
+version 2.040: Mon Apr 14 15:48:54 CEST 2003
+
+        Fixes:
+
+        - Mail::Transport::Exim could not find destinations().  Move that
+          method from MT::SMTP to MT::Send.  Thanks to [Greg Matheson].
+
+        - [Dimitris Glynos] fixed one more place where a failed login
+          for POP3 caused Mail::Box to hick-up.
+
+        - [Dimitris Glynos] made Mail::Box care about succesfull reading
+          of messages.
+
+        - [Shagren] reported that the CRLF changes on POP3 did break
+          POP3 under Windows.  The problem is that the IO::* modules
+          (like IO::Socket) do not implement BINMODE: you can not set
+          them in 'raw' mode.  Implemented a work-around.
+
+        - [Steve Lewis] explained why information about a body was not
+          preserved over a clone().  He provided a patch.
+
+        - [Todd Richmond] found-out that Content-Type lines sometimes
+          doubled.  The reason behind this was that header and body
+          shared the same field structures, which blocked the auto-
+          destruction of header lines which were obsoleted: the old
+          Content-Type line in the header was kept alive by the body.
+
+        - [Michael D Richards] reported another corruption in construction
+          of binary attachments.  Fixed that as well.
+
+        Improvements:
+
+        - [Alexander Bauer] reported a very slow Mail::Message->read
+          for large messages.  This was due to IO::ScalarArray (being
+          extremely slow in seeks), which now is replaced by IO::Scalar.
+
+        - Do not use eval{binmode $fh}, but carefully check whether the
+          $fh can handle binmode before calling it in the parser.
+
+        - Remove newlines from header field data which is passed as
+          objects.  When they stringify with newlines included, this
+          disturbes folding.
+
+        - Added comments on how (not) to change the body of a bounced
+          message.  Do never do it, but if you have to then...
+
+        - Mail::Message::Construct::reply handles nested messages and
+          binary files better to construct an answer.
+
+version 2.039: Sun Mar 30 17:34:43 CEST 2003
+
+        Fixes:
+
+        - [Phil Holden] supplied a patch to Mail::Transport::POP3 to
+          send CRLF line terminations, and improvements on handling
+          the welcome message.
+
+        - [Mike Cudmore] found a bug which caused a call to parts() on
+          lazy nested messages.
+
+        - [delepine at u-picardie.fr] patched conversion of Mail::Message
+          to Mail::Header in Mail::Message::Convert::MailInternet.
+
+        - [Sebastian Willert] showed that multipart/anythings were
+          always changed into multipart/mixed things after an
+          operation on them, like attach.
+
+        - [Dimitris Glynos] found that a log-in failure for POP3 tried
+          to establish the connection twice.
+
+        - [Michael D Richards] reported corruption in construction of
+          binary attachments, which was caused by buildFromBody always
+          converting CRLF -> LF (on Unix).  Removed this.
+
+        - [Christoph Dahl] reported that header field attributes with
+          blanks around the '=' where not detected.  Some flexibility
+          added.
+
+        - [Eugene Eric Kim] reported the problem where incorrect in-reply-to
+          or References fields could cause thread cycles which where not
+          usuable.  Cycles will be ignored.
+
+        Improvements:
+
+        - [Marty Pauley] supplied a patch to use MIME::QuotedPrint for
+          Mail::Message::TransferEnc::QuotedPrint.  Originally, the
+          module implemented en/decoding by itself in Perl, however
+          since MIME::QP is a code module, the advantages disappeared.
+
+        - Mail::Message::Body::Multipart's preamble and epilogue now
+          accepts strings, so you so not have to create a body for them
+          explicitly.
+
+version 2.038: Wed Feb 26 16:20:03 CET 2003
+
+        Fixes:
+
+        - It was not possible to remove POP3 messages with $msg->delete
+          noticed [Jason Woodward]
+
+        - An empty header field could still be a cause of problems.  They
+          were removed from the header, with a warning.  Now changed the
+          warning into a notice message, and the fields are kept.  A fix
+          and test by [Marty Pauley]
+
+        - POP3 messages where not readible when the server does not support
+          UIDLs.  Silly bug, solved by [Andreas Fitzner].
+ 
+version 2.037: Sun Feb 23 14:53:50 CET 2003
+
+        Fixes:
+
+        - MBOX write policy INPLACE contained serious bugs.  Upgrade
+          adviced if you use it (not the default) reported by [Michael Reece],
+          but by [Greg Matheson] before.
+
+        - Mail::Box::Manager::decodeFolderURL() return ref hash instead of
+          hash values.  Patched by [Benjamin Pineau]
+
+        - MB::Mbox::Message::print() did not encapsulate 'From ' lines.
+          Behavior has changed: print() will only simply print head and
+          body, and write() will encapsulate a message as required for the
+          folder.  Problem detected by [Nik Clayton]
+
+        - For retreival of addresses, the whole field contents of an
+          address field is used, not only till the first semi-colon.
+
+        - [Melvyn Sopacua] reported an accidental call to 'confess', which
+          was a left-over of the debugging process.  It triggered for an
+          MH index, when a field was requested which was not defined.
+
+        Improvements:
+
+        - Many warning and error message have changed a little to be
+          more consistent or (in most cases) much clearer about the
+          meaning.
+
+        - added isModified() methods as alternative to modified(), which is
+          more consistent with other method names.
+
+        - added isDeleted() methods as alternative to deleted(), which is
+          more consistent with other method names.
+
+        - [Benjamin Pineau] found the cause of an enormous slow-down while
+          parsing large messages: tell() and seek() in IO::ScalarArray
+          objects.   With a small patch, everything goes smooth and fast:
+          use getpos() and setpos()....
+
+        - Translated Mail::Message:TransferEnc::Base64 to use MIME::Base64,
+          now MIME::Base64 is a core module for 5.8.0.  The old algorithm
+          was not able to handle too long encoded lines, as [Chris
+          Kungfoohampster] discovered.
+
+        - Testfile 40mbox/30delete.t should renamed to 40mbox/30delay.t
+          Testfile 40mbox/70inline.t should renamed to 40mbox/70inplace.t
+
+version 2.036: Thu Feb 13 18:18:29 CET 2003
+
+        Fixes:
+
+        - More attempts to protect $_ against eval's which apparently
+          change it in ./test.pl.  Hope the installation is smooth now.
+
+        - CPAN::install can come back to a different file-system location
+          when installation is completed.  Try to restore that in test.pl.
+          
+        - [Tom Allison] discovered that a folder opened for 'a' does
+          not work with addMessage(): the messages where not read.
+
+        - [Simon Cozens] found two problems in $msg->parts($coderef) and
+          $msg->parts('ACTIVE'|'DELETED') on non-folder messages.
+
+        - [James Sanford] found that conversion to MIME::Entity did not
+          work for nested multiparts.  Mail::Message::Construct::lines()
+          was not context sensitive (now returns ref-array in scalar context),
+          and detection of multipart was wrong in case of nested multiparts.
+
+        - [Karen Craven], [Tom Allison] and [Michael D Richards] where right
+          with their explanation why message-ids were created incorrectly.
+
+        Improvements:
+
+        - Mail::Transport now also supports 'postfix' as alias for
+          'sendmail', thanks to a question by [Tom Allison].
+
+        - Tests for unicode fields are moved to their own directory,
+          tests/14fieldu, which is not considered critical on failure.
+
+        - Copyright set to 2001-2003
+
+        - [Todd Richmond] requested to keep the folding of fields when they
+          are added to a header.  Field::setWrapLength() has been changed not
+          to re-fold already folded fields.
+
+        - As explained by [Eric Wheeler], spam and virus filters do not like
+          the message parser to stop on broken headers.  Therefore, a new
+          option Mail::Box::new(fix_headers) is created.  This option progresses
+          into a few other classes, and should be usable with all folder types.
+
+version 2.035: Fri Jan 24 20:41:23 CET 2003
+
+        Fixes:
+
+        - Mail::Reporter::defaultTrace() now accepts names as well.
+          Recieved a fix by [David A Golden]
+
+        - Mail::Message::Field::attribute() now returns (undef) when
+          the attribute is not defined.  Patched by [Marty Pauley]
+
+        - [Jost Krieger] found that getline() in ::Base64 does catch
+          the read line in $_, which could be expected reading its doc.
+
+        - message/rfc822 within delayed multiparts are now triggered
+          correctly.
+
+        - [Beirne Konarski] found out that eval{} in test.pl sometimes
+          modified $_, which broke installations.
+
+        - Headers from body where lost in multipart. Reported by [Nik Clayton].
+
+        Improvements:
+
+        - {Greg Matheson] contributed Mail::Transport::Exim, to send
+          email using an external exim client.
+
+        - Added Mail::Transport::new(executable) which offers you a
+          way to explicitly specify where the transfer agent is located.
+
+        - Changed Mail::Transport::SMTP::init(debug) option into
+          smtp_debug, to show that it is not Mail::Box which is being
+          traced, but the low level SMTP drivers only.
+
+        - Added some example options to examples/send.pl, which showed
+          some inconveniences of Mail::Message::send(), which have been
+          solved.
+
+        - [David A Golden] wrote Mail::Classification based on Mail::Box,
+          which is a learning spam filter.  References added to README.FAQ
+
+        - Doc-fix in Mail::Message::from/to/cc/bcc() by [Greg Matheson].
+
+        - Renamed Mail::Message::Field*::folded_body() and ::unfolded_body()
+          to ::foldedBody() and ::unfoldedBody(), to be consequent with
+          the method naming of Mail::Box.
+
+        - Mail::Message::TransferEnc::Base64::_decode_from_lines() does
+          not warn anymore in case of a line which only contains padding.
+          Found by [David A Golden]
+
+        - Mail::Messsage::Field::stripCFWS() now understands escaped quotes
+          and parenthesis.  Parenthesis within quotes are not seen as comment
+          anymore.
+
+        - Implemented Mail::Message::Field::Full with many tests in
+          tests/11field/40full.t.  Implements RFC2047.
+
+        - Implemented Mail::Message::Field::Attribute with many tests in
+          tests/11field/41attr.t   It implements field attribute understanding
+          as defined in RFC2822 and RFC2045, with the extensions about
+          parameter encoding and continuations as defined in RFC2231.
+
+        - Implemented Mail::Message::Field::Unstructured, as first
+          category of fields.  Tests in test/11field/42unstr.t
+
+        - Added Maildir quotas to the long wishlist.  Suggested by
+          [Brian Grossman]
+
+        - On request by [David A Golden], Mail::Reporter now returns
+          Scalar::Util::dualvar values where the use may wish to know
+          the numeric value as well as the string representation of an
+          error level.  Tests added in tests/10report/10errors.
+
+        - Modified examples/grep.pl you unix-grep syntax
+
+        - Mail::Box::Search now takes nested messages under the flag of
+          multiparts (search or not to search, that's the question)
+
+        - Mail::Message->build and buildFromBody now accept a pre-filled
+          header.
+
+        - Mail::Message->build accepts a new option 'files', which is
+          an abbreviation for multiple 'file' options.
+
+        - Mail::Message::TransferEnc::decode() now als decodes chars above
+          127 and tab.  Escape characters are still not decoded for safety
+          reasons.  On request by [Marty Pauley]
+
+version 2.034: Thu Jan  2 15:08:56 CET 2003
+
+        Fixes:
+
+        - When a message is added to a folder, it shall be flagged as
+          modified, otherwise the message is not written when the folder
+          closes.  Problem discovered by [Greg Matheson].
+
+        - Mail::Message->read() did not inspect the status fields.
+          Spotted by [Simon von Janowsky]
+
+        - When an empty field is folded, at least a new-line must be
+          produced.
+
+        - Mail::Box::File::appendMessage() doesn't need to open the folder
+          locked: appending should be a safe action. Reported by [Greg Matheson].
+
+        - multipart->lines accidentally did not include the headers of the
+          parts.  Spotted by [Constantin Khatsckevich]
+
+        Enhancements:
+
+        - Resent Groups in the header now also support Delivered-To.
+
+        - Renamed some toString() methods to the more consistent name string(),
+          without breaking backwards compatibility.
+
+version 2.033: Thu Dec 12 11:23:42 CET 2002
+
+        Fixes:
+
+        - [Greg Matheson] found a truncate() difference between Windows and
+          UNIX: fewer errors for the Windows test.
+
+        - [Greg Matheson] solved problem with mbox write-replace related to
+          \n -> CRLF translations vice versa.  The number of problems for
+          Mail::Box on Windows decreased even furter.
+
+        - Some improvements of the tests.pl scripts, related to the
+          installation of optional modules when Term::ReadKey is not
+          installed.
+
+        - Mail::Message::Part::parent() 4th try to solve... on some places,
+          the body was returned, in other places the surrounding message.
+          This was partially caused by the confusion created by the name
+          of the method.  Therefore, the method is renamed to "container"
+          which returns a Mail::Message::Body::Multipart or ::Nested.
+
+        - appendMessage requires access => 'a' to the folder. [Greg Matheson]
+
+        - Parts of multiparts which do not contain any header lines were
+          stopping the parser to look for more parts: all the rest was put
+          in the epilogue of the multipart.  Detected by [Melvyn Sopacua]
+
+        - Mail::Message::Part's can contain empty bodies.  Spotted by
+          [Melvyn Sopacua]
+
+        - Hopefully, the installation of option modules has smoothened
+          a little.
+
+        - Mail::Box::File::appendMessage() didn't check success for
+          opening a folder. Reported by [Melvyn Sopacua]
+
+        - default for $mgr->appendMessage was to create an MH, not an mbox
+          folder.
+
+        Improvements:
+
+        - tests/55locking/20flock excluded for Windows: no flock implemented.
+
+        - Added examples/strip-attachments.pl by [Pjotr Prins]
+
+        - Mail::Reporter::AUTOLOAD will produce a class name in the error
+          message if a class method failed...  The blank is not very
+          informative.
+
+        - "create" is now a valid option for Mail::Box::(Mbox|MH|Maildir)::new,
+          which required some changes in the Mail::Box::Manager as well.
+
+version 2.032: Fri Nov 29 19:59:47 CET 2002
+
+        Fixes:
+
+        - Enforce Text::FormatPS version 2.01, because the output format
+          has changed.  Scripts adapted to the new layout.  [Blair Zajac]
+
+        - Required Term::ReadKey for installation. [Greg Matheson]
+
+        - Silly problem with lock-filenames... detected by [Blair Zajac]
+
+        - $part->toplevel did not return a message, but a body.  Detected
+          by [Pjotr Prins]
+
+        - $part->delete did not seem to have an effect... silly bug caused
+          this problem, which was spotted by [Pjotr Prins].
+
+        Improvements:
+
+        - Removed dependency from Term::ReadKey.
+
+        - $msg->printStructure shows parts which are flagged to be deleted.
+
+version 2.031: Mon Nov 25 14:50:23 CET 2002
+
+        Fixes:
+
+        - Mail::Box::Locker::new(file) has now comparible meaning for DotLock
+          and flock locking methods.
+
+        - Removed Mail::Box::Locker::POSIX from Windows options: not all fcntls
+          present.
+
+        Improvements:
+
+        - MBOX handling of the parser much simplified.
+
+        - [Blair Zajac] is still nitpicking about close()...
+
+        - $Mail::Message::crlf_platform added as central resource for all
+          modules which have to know.
+
+        - Mail::Message::Body::File::size() compensates for "superfluous" CRs
+          in the file's line-endings.
+
+        - Messages in test-scripts are compared by a special function which
+          permits differences in Content-Length for platforms with CRLF
+          (Windows)
+        
+        - Message sizes in thread-dumps within test-scripts are ignored by
+          a special function, but only on CRLF platforms like Windows.
+
+        - Some code has moved from Mail::Box::Parser::Perl into
+          Mail::Box::Parser Cannot break existing code.
+
+        - Quite some code has moved from Mail::Box::File to Mail::Box::Mbox.
+          Cannot break existing code.
+
+        - Added Mail::Box::Search::IMAP as place-holder for a dedicated (remote)
+          search implementation using the IMAP protocol features.
+
+        - Added Mail::Transport::IMAP, Mail::Box::IMAP, and
+          Mail::Box::IMAP::Message with some pseudo-code how IMAP folders
+          could be handled.
+
+        - Improved the docs on ::POP3
+
+        - Mail::Box::POP3 now refuses addMessage() and addMessages() with nice
+          errors.   When someone implements the writing extensions to POP3, this
+          may change.  update() still has to be implemented
+
+        - Multipart message will also have a Content-Length in the header.
+
+        - Mail::Message::Convert::MailInternet requires Mail::Message
+          [Adam Byrtek 'alpha']
+
+        - New version of tests/POP3/server, which can be used to test
+          the POP3 client against some weird POP3 servers. [Liz Mattijsen]
+
+        - Upgraded Mail::Box::write() to allow mid-life writes of files.
+
+        - Removed option Mail::Box::write(keep_deleted), because it is
+          unsafe.
+
+        - Replaced all uses of FileHandle by IO::File.
+
+        - test scripts ask for optional packages to be installed.  The user
+          will be asked per package... more info about it has been added,
+          for instance the option Mail::SpamAssassin.
+
+version 2.029: Mon Nov  4 21:06:30 CET 2002
+
+        Fixes:
+
+        - Empty header lines where printed without trailing new-line.  This
+          was spotted by [Blair Zajac] soon after the release which broke
+          it: do not use 2.028
+
+        - Some extra checks for the return-code of close(), added as wished
+          for by [Blair Zajac]
+
+version 2.028: Mon Nov 4 15:08:57 CET 2002
+
+        Fixes:
+
+        - [Greg Matheson] decovered a small bug in the 10field test-script.
+          After being corrected, it showed a mistake in MM::Field with folding
+          very long words in field bodies. This bug was corrected.
+
+        - Fixed a parser bug in MBOX, which showed an error when closing
+          a folder without explicit write before it.  Reported by
+          [David A Golden]
+
+        - [Blair Zajac] reported that the multipart boundary was not
+          added to the Content-Type field.
+
+        - [Sebastian Krahmer] adviced me to put a very strong warning against
+          the use of mailx (Mail::Transport::Mailx), which is accepted because
+          the funarability has been proven: mailx is exploitable insecure.
+
+        - [Shagren] hit a POP3 server which does not add a blank at the end
+          of each message.  The last line of his message body was removed
+          because Mail::Transport::POP3 did not anticipate that.
+
+        Improvements:
+
+        - In joint forces with [Greg Matheson], some small improvements have
+          been made in the mailbox parser for Windows...  But it is still
+          far from perfect.
+
+version 2.027: Sat Oct 26 08:52:32 CEST 2002
+
+        Fixes:
+
+        - Lazy Mail::Box::Dir::Message::print() (mbox and mh messages)
+          used File::Copy's copy(), which cannot handle IO::Lines file
+          objects as destination.  Replaced by own implementation.
+          [Tony Bowden] reported this problem, and fix my patch as well.
+
+        - Mail::Box::find() was not able to get the id of the first
+          lazy-loaded message.
+
+        - The empty line which preceeds a separator in mbox folders
+          was accidenitally included in the body of the message before
+          it (this was quite hard to fix) [Albert Schueller]
+
+        - Mail::Message::Body::Multipart::foreachComponent(), used by many
+          multipart methods, created Mail::Message i.s.o. Mail::Message::Part
+          objects.  This is not right: especially encode() and decode()
+          where frustrated by it.   Same for nested messages.  Signalled by
+          [Mike Cudmore]
+
+        Improvement:
+
+        - Mail::Transfer::POP3 implemented by [Liz Mattijsen].
+
+        - [Shagren] found the first reason to modify Mail::Transfer::POP3
+          a little.
+
+        - Mail::Box::POP3 and Mail::Box::POP3::Message should be working
+          now.  Mo Tests are included.
+
+        - Reorganized the tests.  This is needed, because the number of
+          testscripts grew too long for Windows!  Besides, I need more
+          control over installation of optional packages.
+
+        - All folder-types now have a type() method.
+
+        - All folder-types now have a url() method, which result van be
+          used to specify a complex folder name to the Mail::Box::Manager.
+
+        - [David Favor] asked to show the filename when an illegal header
+          is detected by the parser.
+
+        - Rewrote Mail::Box::scanForMessage() in search of a bug reported
+          by [Shagren] concerning Mail::Box::find()  But it was not the
+          cause.  Still, the method has improved.
+
+        - Changed  split /(?<=\n)/  into  split /^/  everywhere.
+
+version 2.026: Mon Oct  7 23:39:07 CEST 2002
+
+        Fixes:
+
+        - Default package for $msg->send was broken.  Reported by
+         [Jeremy Banks]
+
+        Improvements:
+
+        - Mail::Message::Field::wellformedName() produces better results,
+          thanks to [Emmet Cailfield]
+
+        - Many more tests are succeeding under Windows, since
+          [Greg Matheson] sent me the output of the tests based
+          on Test::More.  Thanks Greg!
+
+        - Mail::Transport::SMTP warns when send(To => $to) is used where
+          send(to => $to) is needed.  [Jeremy Banks]
+
+        - Mail::Message::Head::ResentGroup::set(field)       added
+          Mail::Message::Head::ResentGroup::createReceived() added
+          Mail::Message::Head::ResentGroup::destinations()   added
+
+        - Mail::Message::Construct::bounce() now adds Resent-* lines
+          to the first Received line, if available.
+
+        - Mail::Message::Head::ResentGroup::new() creates a received
+          field if not defined.
+
+        - Mail::Message::Head::Clone uses $head->addNoRealize i.s.o add(),
+          and thereby does not re-fold the headers anymore.
+
+        - Deleting or resetting a non-existing field in the header will
+          not flag the message to be 'modified'.
+
+        - Implemented Mail::Box::Search::SpamAssassin, a spam filter
+
+        - Implemented Mail::Message::Wrapper::SpamAssassin, a wrapper
+          used in the new spam filter.
+
+        - Implemented authorization for SMTP, based in work by
+          [Michael de Beer]
+
+        - X-Spam-* headers are not disclosed for transmission.
+
+version 2.025: Mon Sep 23 13:11:57 CEST 2002
+
+        Fixes:
+
+        - Accidentally left debug-printstatements in Mail::Transport::SMTP
+
+        - Fixed "from" address used in Mail::Transport::SMTP.
+
+        Improvements:
+
+        - MIME-Version header line automatically added to constructed
+          messages (rfc 2045). [Matthew Darwin]
+
+version 2.024: Sun Sep 22 23:06:55 CEST 2002
+
+        Fixes:
+
+        - SMTP sending accidentally only included the headers *not* to
+          be disclosed :(  The check has the correct negation in
+          Mail::Message::Field::toDisclose() now.
+          Reported by [Matthew Darwin]
+
+        - Generated messages without message-id must get one assigned.
+          Reported by [Matthew Darwin]
+
+        Improvements:
+
+        - All tests converted to use Test::More, which produces better
+          feedback on failures. Hopefully, failures on Windows will
+          start disappearing now.
+
+        - Mail::Box::Dir::Message's take their size from the real
+          file (unless they are modified)
+
+        - Mail::Box::Mbox now derived from new Mail::Box::File
+
+        - Mail::Box::Mbox::Message now derived from new
+          Mail::Box::File::Message.
+
+        - Set the shape of the message-id with
+          Mail::Message::Head::messageIdPrefix()
+
+        - A message constructed without data will be an empty text
+          message, not an empty multipart :(
+
+        - Mail::Message::Construct::build() now calls buildFromBody()
+          to prepare the whole message, instead of doing it itself.
+          You can also specify field objects to buld() now.
+
+        - From and To fields are no longer required to construct a
+          message.  They may be filled-in later.
+
+        - Mail::Message::Construct::bounce() now uses the
+          MM::Head::ResentGroup object, which much improved outcome.
+
+        - Made a start with Mail::Box::Search::SpamAssassin.
+
+version 2.023: Sat Sep 14 11:11:03 CEST 2002
+
+        Fixes:
+
+        - t/65search.t failed for some Perl versions, dependent on the
+          hash implementation.  Mail::Box::Search::Grep::inHead did
+          not use MM::Head::orderedFields() yet. Discovered by
+          [Blair & Liz & Greg & Conrad Heiney]
+
+        - Mail::Box::Mbox includes IO::File with () to avoid colission
+          between constant definitions in IO::File and POSIX.  Fixed
+          by [Marcel Gruenauer]
+
+version 2.022: Mon Sep  9 18:55:01 CEST 2002
+
+        Detailed checks against RFC2822 is in progress, which means that
+        some changes have to be made.  The API had to be changed on some
+        places, but on most places could be kept unchanged.
+
+        Application breakers:
+
+        - $msg->from now returns a list fo addresses!  Mind the context!
+          required by the RFC.
+
+        - stringified $body->type returns whole Content-Type body.  Use
+          $body->mimeType!  Example:
+             if($msg->type eq 'text/html')     # breaks now
+             if($msg->mimeType eq 'text/html') # works as always
+
+        - a header field stringifies to "body; comment", not only
+          the body.
+
+        Fixes:
+
+        - Messages which of unknown Content-Type (unknown by MIME::Types)
+          could cause segmentation violates.  Solved by [Darrell Fuhriman]
+
+        - In Mail::Box::Manager, the method foldertypes() was called, which
+          should have been folderTypes(). [Swapnil Khabiya]
+
+        - Mail::Message::Construct::replyPrelude produced warning when
+          from address of originating message dit not defined a user's
+          name.  Now it has a fallback. Reported by [Jon Thomason]
+
+        Improvements:
+
+        - new method Mail::Box::Message::moveTo()
+
+        - new method Mail::Message::sender()
+
+        - Mail::Message::Convert::selectedFields() retuns fields now
+          (in the right order), not field names.
+
+        - Mail::Reporter::log() now also as class method.
+
+        - Mail::Reporter::defaultTrace() to set program global defaults
+          for logging and tracing.
+
+        - New class Mail::Message::Head::ResentGroup with tests in
+          t/12head1r.t
+
+        - Mali::Message::Construct::printStructure now accepts a filehandle.
+
+        - reply() takes return address from: Reply-To || Sender || From
+          (Sender added)
+
+        I have re-read specification rfc2822, and reimplemented the three
+        Mail::Message::Field* objects.  The next changes are made to
+        these objects:
+
+        - field data is only stored in folded form to improve performance
+          during parsing and reduce memory consumption (which is quite
+          high for headers) but also to be able to handle structured fields
+          better.  This introduced two new methods:
+            folded_body()
+            unfolded_body()
+          The body(), comment(), and content() are quite different now,
+          although return the same results.
+
+        - toDate() without argument returns an rfc2822 valid date
+           representing the current local time.
+
+        - new() accepts attributes.  The OPTIONS are only available
+           for ::Flex fields.                                    
+
+        - attributes handle escapes of quotes in quoted strings.
+
+        - new method length() which returns the total field length.
+
+        - new method toDisclose() which tells
+          Mail::Message::Head::printUndisclosed whether the header should
+          be visible for extenal receivers.
+
+        - new method stripCFWS() removes comments and folding white space from
+          header lines.  This should only be used on structured header
+          fields.  Tests in t/11cfws.t
+
+        - new method dateToTimestamp converts a date in RFC2822 spec into
+          a timestamp.
+
+        Also Mail::Message::Head got revisited.  The order of the fields
+        is protected stronger.
+
+        - new method orderedFields()
+
+        - new method addResentGroup()
+
+        - new method resentGroups()
+
+        - new method removeField($field)
+
+version 2.021: Tue Aug 20 17:42:24 CEST 2002
+
+        Fixes:
+
+        - Requires HTML::TreeBuilder release 3.13 or newer, if you want to
+          use Mail::Message::Convert::HtmlFormat*.pm, because 3.12 contains
+          a serious bug.  Resolved by [Blair Zajac]
+
+        - A mistake in the previous release could cause that parts of
+          multiparts where lazy.  This is not correct: all parts must be
+          extracted at once.  Detected by [Jost Krieger]
+
+        - Another bug introduced with the previous release was the
+          removal of automatic body-to-messagepart coercion.
+
+        - When a nested body was checked on encoding, it accidentally returned
+          its nested content, in stead of itself.  Detected by [Blair Zajac]
+
+        - Mail::Message::isMultipart triggered the body, which is not needed
+          because the info is in the header as well.
+
+        - pod2html translators are terrible.  Put more sofistication in
+          my html-polisher.
+
+        Improvements:
+
+        - Carp is stringifying objects, which is terrible in combination with
+          overloading stringification on message headers and bodies.  Therefore,
+          a special exception for stringification is added to return a
+          different result to Carp.
+
+        - The Mail::Box::determineBodyType is simplified.
+
+        - Multiparts and Nested (rcf822) message are now also delayed when
+          their size is not known (often the case) or too large.
+
+        - Implemented Mail::Message::Part::buildFromBody() to assist the
+          improved Mail::Message::Part::coerce()
+
+        - Testing cloning of complex messages in t/58clone.t
+
+version 2.019: Thu Aug 15 09:46:42 CEST 2002
+
+        Fixes:
+
+        - Parsing messages could destroy $_ and IN/OUT file-handles from
+          the user's program.  Found a few places in Mail/Message/Body/*.pm
+          Problem spotted by [Jerrad Pierce]
+
+        - Mail::Message::Head::Delayed extends a Mail::Message::Head, not
+          a Mail::Reporter.
+
+        - Using an Index with MH folders caused each message header to be
+          triggered: a considerable slowdown.
+
+        Improvements:
+
+        - [Blair Zajac] donated a large set of documentation fixes.
+          Even some hidden bugs got fixed this way.
+
+        - Implemented Mail::Message::Body::Multipart::file(), because
+          it is required for Mail::Transport::SMTP.  Spotted by
+          [Marty J. Riley]
+
+        - Mail::Box::Tie::ARRAY and ::HASH simulate real arrays and hashes
+          better with respect to deleted items.
+
+        - Mail::Box::Message::Dummy is renamed into Mail::Message::Dummy,
+          which inherit from Mail::Message, not Mail::Box::Message.
+
+        - Mail::Message::Dummy's now follow the standard pattern of
+          Mail::Message.
+
+        - The Mail::Box::Thread::Manager is now also an extension of a
+          Mail::Reporter.
+
+        - The Mail::Box::Thread::Node is now also extends Mail::Reporter.
+
+        - Added extra doc to MH::Message to avoid confusion between seqnr
+          and filename (which is a number as well).  Needed by
+          [Jerrad Pierce]
+
+        - Mail::Message::Part::clone is not a special case of clone at all.
+          Removed.
+
+        - Mail::Message::Part::coerce() was much too complicated: most work
+          is already done in Mail::Message::coerce()
+
+        - The documentation and sometimes also the location of code in
+          Mail::Message::Head* packages has been improved.
+
+        - Improvements in text of Mail::Box-Overview.
+
+version 2.018: Wed Jul 10 23:03:08 CEST 2002
+
+        Fixes:
+
+        - Parser will immediately study multipart en nested messages,
+          because otherwise it will get stuck in nasty multi-level
+          situations.  Discovered by [Francois Petillon]
+
+        - More picky with quotes in header field attributes...  Continuing
+          story with weird multipart boundary strings.  This time,
+          [Blair Zajac] forced some improvements.
+
+        - Empty headers were not properly skipped.  Usually this went
+          undetected...  however not in a very rare case [Blair Zajac]
+
+        - For read-only folders, the manager always complained about
+          "closing changed folders".  Reported by [Blair Zajac] and fixed.
+
+        - [Greg Matheson] tries to get Mail::Box running on the Cygwin
+          platform, which will benefit everyone, because it is stricter
+          than UNIX in some cases.... for instance, the Perl parser 
+          objects left the file-handle open....
+
+        - [Blair Zajac] detected that double messages in a read-only
+          folder cause "Changes not written to read-only folder"
+          messages.  Not anymore: the doubles will not be flagged for
+          deletion.
+
+        Improvements:
+
+        - Filenames sometime contained double /'s between folderdir and
+          foldername.  Removed.
+
+        - Foldernames can be specified like this:
+             pop3://username:password@host:port/folder
+          which is broken into separate arguments in a very early stage.
+          This is especially useful when the name is passed in $ENV{MAIL}
+
+        - Start of implementation for Mail::Transport::POP3.
+
+        - To make space for ::POP3, which is a message receiver, the
+          message senders are now derived from Mail::Transport::Send.
+          New options are added which certainly improve the interface.
+          New packages:
+             Mail::Transport::Send
+             Mail::Transport::Receive
+             Mail::Transport::POP3
+          
+        - Foldernames via $mgr->open() may be specified as URL, for instance
+             $mgr->open('mbox:/tmp/inbox')
+             $mgr->open('pop3://me:secret@pop3.server.com:120')
+
+        - $mgr->close($folder) and ->closeAllFolders() accept the
+          normal options for $folder->close(OPTIONS).
+
+        - $folder->appendMessage($msg) now returns the coerced message.
+
+        - Mail::Box::Dir::messageId() should not trigger headers to
+          find unparsed headers with the id: that's the task of
+          Mail::Box::find().  The code was not consistent with the docs.
+
+        - Removed Mail::Box::Dir::readAllHeaders()... it contained a
+          bug, so was apperently never used.  And that's a good thing.
+
+        - Small set of additions to Mail::Box::Net and Mail::Box::POP3
+          Still in the early stages of development.
+
+        - The parser will complain about files which were modified while
+          it was working with it.  Some cases where the parser accidentally
+          stayed open were closed to resolve the complaints for the tests.
+
+version 2.017: Fri Jul  5 17:06:08 CEST 2002
+
+        Fixes:
+
+        - Thanks to [Liz Mattijsen] for the detection of some flaws in
+          the QuotedPrintable encoding.  Fixed it.
+
+        - Nested (rfc822) message clone() did not work.  Detected by
+          [Blair Zajac]
+
+        - [Greg Matheson] is fixing the test suite for Windows.  Very good
+          work.  Changes made in t/65search.t
+
+        Improvements:
+
+        - Deleted parts will not be returned in $multipart_body->lines
+
+        - Deleted parts will not be counted in $multipart_body->nrLines
+          and ->size
+
+        - Deleted parts will not be cloned.
+
+        - For efficiency reasons, $multipart_body->foreachComponent
+          will skip deleted parts as well.
+
+        - Mail::Box::messages() accepts
+             range:       $folder->messages(3, 100)
+             non-deleted: $folder->messages('ACTIVE')
+             deleted:     $folder->messages('DELETED')
+             labeled:     $folder->messages('seen')
+             labeled:     $folder->messages('!seen')
+             code:        $folder->messages( sub {$_[0]->size > 10000} )
+          limiting the default result being all messages.
+
+        - Mail::Message::parts() accepts
+             non-deleted: $msg->parts('ACTIVE')
+             deleted:     $msg->parts('DELETED')
+             nested:      $msg->parts('RECURSE');
+             code:        $msg->parts( sub {$_[0]->size > 10000)} )
+
+        - Mail::Message::Body::Multipart::parts accepts
+             non-deleted: $body->parts('ACTIVE')
+             deleted:     $body->parts('DELETED')
+             nested:      $body->parts('RECURSE');
+             code:        $body->parts( sub {$_[0]->size > 10000)} )
+
+        - Mail::Box::allMessageIds() renamed to messageIds(), but old
+          name still available.
+
+        - Add suggestion to close() without writing changes.
+
+        - Avoid testing of maildir folders for Windows.  They are not
+          supported, because maildir uses characters in filenames which
+          are not acceptabled for the Windows file-systyem. [Greg Matheson]
+
+        - Added Mail::Box::POP3, Mail::Box::POP3::Message
+          Mail::Box::Net, and Mail::Box::Net::Message as first steps to
+          a POP3 implementation.
+
+version 2.016: Tue Jun 25 16:24:54 CEST 2002
+
+        Fixes:
+
+        - [Edward Wildgoose] was very persist in pushing me to test
+          return codes in Mail::Transport::SMTP.  Late transport failures
+          are reported back now.
+
+        - [Jeff Squyres] attributes in header fields must be matched
+          case-insensitive.
+
+        - $folder->writeable --> $folder->writable, but old method
+          kept for backwards compatibility.
+
+        - [Andreas Piper] AIX also requires r+ on a file to get locking
+          via FLOCK to work.  I made the detection 'compile-time'.
+
+        - The folder to be locked was optional, but used in error messages.
+          Now if is not optional anymore, thanks to [Andreas Piper]
+
+        - Simulated sub-folders in Mbox were not correctly automagically
+          created.
+
+        Improvements:
+
+        - Document fixes in Mail/Transport/SMTP.pm by [Liz Mattijsen]
+
+        - Recursive copying of whole folders, which may include
+          conversions with Mail::Box::copyTo() with tests in t/66copyto.t
+
+        - Interface change:
+            $mgr->addMessages,   $folder->addMessage,
+            $mgr->appendMessage, $folder->appendMessage,
+            $mgr->moveMessage,   $folder->copyMessage,
+            $message->copyTo
+          now all return the coerced message(s), because that is much
+          more useful than the message which are passed into the
+          method call, the folder, or the class.
+
+        - Mail::Box::Manager::open() is rewritten, and a such much improved.
+
+        - Much stricter handling of folder closing and folder deletion:
+          when a manager is used, folders are removed before global
+          cleamup commences.
+
+        - Mail::Box::Manager::registerType is not requiring all known
+          folder types anymore.  This means that adding folder types
+          is without cost now: they are compiled only when used.
+
+version 2.015: Tue Jun 18 19:41:45 CEST 2002
+
+        Fixes:
+
+        - Duplicated messages without subject or to fields will
+          not produce errors anymore.
+
+        - Duplicated messages produce NOTICE now, not WARNINGS.  Same
+          for empty fields and other minor things the parser detects.
+
+        - Multiparts where not correctly processed when read from STDIN:
+          the body type was '::Lines' only. Bug reported by [Evan Borgstrom]
+
+        - Bogus message-IDs  <>  caused problems, but these situations are
+          avoided now.  Problem found by [Jost Krieger]
+
+        Improvements:
+
+        - message/rfc822 messages are handled now via a
+          Mail::Message::Body::Nested.pm, Tests in t/21p9rfc.t
+          This all because [Max Poduhoroff] asked for it  ;-)
+
+        - Removed all tests for Inline::C parser....
+
+        - Mail::Message::Body::AUTOLOAD handles errors better, which
+          should provide nicer error-messages.
+
+        - Updates on MH/Maildir messages will first be created in an
+          'invisible' name, to avoid accidental access to partially
+          written messages Mail::Box::Dir::Message::create()
+
+        - Mail::Message::Parts can be deleted (ignored for printing and
+          sending).  $part->deleted, $part->deleted(0), if($part->deleted)
+
+        - timestamp() prefers time from last Received field over first
+          [Jost Krieger]
+
+        - Mail::Transport::SMTP:
+            contactServer()  --> contactAnyServer()
+            new method tryConnectTo($host, @options);
+
+        - $msg->printStructure for debugging purposes
+          (see Mail::Message::Construct)
+
+        - Now requires MIME::Types v1.001
+
+        - Mail::Message $msg   implemented $msg->string, ->lines, ->file
+        
+version 2.014: Tue Jun 11 16:26:13 CEST 2002
+
+        Fixes:
+
+        - Forgot to implement the 'delete' method for a header field.  The
+          'reset' method was available to achieve it, but harder to discover
+          for unexperienced programmers.  Now 'delete' simply calls 'reset'.
+          Spotted by [Mark Weiler]
+
+        - A coerce() from Mail::Message to Mail::Box::Message has to clear
+          the deleted flag (to avoid errors).  At the same time, the
+          modified flag is cleared.  Detected by [Max Maischein]
+
+        - create option to Maildir's works now.
+
+        - Signature separator '--'  ==> '-- '
+
+        - [Gilles Darold] found that  m!(['"]?)([^\1])\1!  doesn't work.
+          apparently, [^\1] is not working.  Temporarily fixed with [^'"]
+          in Mail::Message::Field.
+
+        Improvements:
+
+        - Mail::Transport::SMTP is working now.
+
+        - The 'clone' operation on a message will return a Mail::Message
+          object, which avoids complications with copying message between
+          different kinds of folders.
+
+        - Maildir messages are moved from 'new' to 'cur' with the new
+          method 'accept'.
+
+        - Mbox, MH, pure Perl parser, and modules status "Released" 
+         (was "beta")
+
+        - Maildir status "Alpha" (was "under development")
+
+        - Added some docs to Mail::Transport about receiving messages
+          via POP3.  This code may appear in the near future.
+
+        - Implemented Mail::Message::Convert::TextAutoformat, t/90textaf.t
+
+        - Implemented Mail::Message::Convert::HtmlFormatText, t/90htmlft.t
+
+        - Implemented Mail::Message::Convert::HtmlFormatPS, t/90htmlfps.t
+
+        - Initial coding of Mail::Message::Convert::Html, t/90html.t
+
+        - Mail::Message::Head::grepNames() now accepts regexes as well.
+
+        - Mail::Message::Field::wellformedName method added which returns
+          preferred capitization of a field's name.  The name() method
+          returns the lower-cased name.  Tests in t/11field1.t
+
+        - Mail::Message::Field::content returns both body and comment
+          part of the message header line.
+
+        - added Mail::Message::Body::charset() to simplify code.
+
+        - removed useless Mail::Message::printUndisclosed().
+
+version 2.013: Thu May 23 11:30:35 CEST 2002
+
+        Fixes:
+
+        - Create MH directories when asked to. [Greg Matheson] reported
+          the problem.
+
+        - Mail::Box::Locker::new "timeout" and "wait" options where too
+          confusing to be implemented correctly.  So they didn't work
+          as described.  Now, they are called "expire" and "timeout".
+          Thanks to [John B Batzel] for pointing-out the problems.
+
+        - Messages with empty bodies where not accepted at all.  This
+          combined with a mistake in treating these errors in Mbox
+          folders gave <undef>s when asked for a body.
+
+        Improvements:
+
+        - Maildir implementation runs all its tests.  Still there are
+          some support functions lacking.  Reports are that sub-folders
+          are to be implemented differently.
+
+version 2.012: Mon Apr 22 15:53:05 CEST 2002
+
+        Fixes:
+
+        - [alex] found-out that remove_when_empty and save_on_exit
+          could not be set to false for Mail::Box'es.
+
+        - [Cory Johns] examples/reply.pl closed the folder but
+          later still used one of its messages.  This is not
+          permitted, but may be allowed later.
+
+        - [Robin Berjon] multiple improvements to the Maildir
+          implementation.  Not finalized yet.
+
+        - Mail::Message::Construct->build
+          called          Body->new(filename =>
+          which must be   Body->new(file =>
+
+        - Two fixes in Base64 encoding....  Problem reported by
+          [Bernd Patolla]
+
+        - Forgot to use File::Copy in Mail::Message::Body::File.
+          reported by [Andre Schultze]
+
+        Improvements:
+
+        - Creation of new message-files for Mail::Box::Dir::Message
+          extensions implemented by a create($filename) method which
+          tries to be very smart.
+
+        - [Mark Ethan Trostler] Mail::Message::Field::attribute
+          with value of <undef> gave complaints.  For now, these
+          calls with <undef> will be ingnored.  In the close future
+          they will remove the attribute.
+
+        - Removed references to HTML.pm from all files...
+
+version 2.011: Sun Mar  3 23:51:41 CET 2002
+
+        Improvements:    -- one day of rapid development ;)
+
+        - Mail::Message::read was confusing many users.  Therefore, it
+          has been renamed to readFromParser.
+
+        - Now read() became unused, it is used to implement
+          my $msg = Mail::Message->read(\*STDIN);
+          Please use it sparsely.
+
+        - Implemented Mail::Box::Maildir->writeMessages and
+          Mail::Box::Maildir->appendMessages.  Tests in t/44mdir*.t
+          Still small things to fix.
+
+        - Mail::Message::clone() includes labels now.
+
+version 2.010: Sun Mar  3 16:05:16 CET 2002
+
+        Fixes:
+
+        - Fixed serious mis-calculation for delayed bodies in MH folders.
+          The 'fail-safe' approach did safe the programs till now, but
+          it is much better now: correct 'Content-Length' headers will
+          safe you time now.
+
+        - Improved quite some doc-issues in Mail::Box::MH::(Label|Index).pm
+
+        - Prototype of Mail::Message::Body::_data_from_lines was @_, which
+          is a silly typo checked by bleadperl... [Marcel Gruenauer]
+
+        - Mail::Box::Parser::Perl line 87, binmode without filehandle...
+          reported by [Marcel Gruenauer]  But now it is causing problems
+          with perlio in 5.7.2 ...
+
+        - Minor changes to scripts/takemail by [Tassilo v Parseval]
+
+        - Mistakes in the docs of Mail::Box::Search::Grep, found by
+          [Tassilo v Parseval]
+
+        - Accidentally took only non-delayed messages in Grep: wrong
+          default.  Detected by [Tassilo v Parseval]
+
+        - The METHOD INDEXes ended with a list of links to related
+          manual-pages which where not expanded correctly by pod.
+          Therefor is was changed: now the INDEX starts with the
+          man-pages which will have correct links this time.
+
+        Improvements:
+
+        - Changed encoders/decoders status from ALPHA to BETA.
+
+        - Removed organization option to new() for Mail::Boxes: it is
+          not modifyable.  The method which shows whether the folder
+          is DIRECTORY or FILE organized will stay.
+
+        - *PARTIAL* implementation of Maildir folders, which did have large
+          implications for the MH implementation.  The maildir implementation
+          is NOT READY yet.
+
+          New class structure:
+
+            Mail::Box::MH
+            is a Mail::Box::Dir            <-- new
+            is a Mail::Box
+
+            Mail::Box::MH::Message
+            is a Mail::Box::Dir::Message   <-- new
+            is a Mail::Box::Message
+            is a Mail::Message
+
+            Mail::Box::Maildir             <-- new
+            is a Mail::Box::Dir            <-- new
+            is a Mail::Box
+
+            Mail::Box::Maildir::Message    <-- new
+            is a Mail::Box::Dir::Message   <-- new
+            is a Mail::Box::Message
+
+        - Massive changes in label management, required to facilitate
+          Maildir labels which are in the filename.
+
+        - Added /usr/lib to the safe_directories are searched by
+          Mail::Transport for binaries [Slaven Rezic]
+
+        - Any Mail::Box type may implement an 'updateMessages'.  When
+          $mailbox->update is called and 'updateMessages' exists, the
+          folder tries to figure-out changes in the folder which were
+          made by external programs.  External programs may add messages
+          to the end of the folder without applying a lock, which is
+          dangerous.
+
+version 2.009: Wed Feb 20 09:03:56 CET 2002
+
+        Fixes:
+
+        - Forgot to update METHOD INDEX
+
+        - t/65search1g.t tests Mail::Box::Search::Grep, which found
+          some problems in the implementation which are fixed now.
+
+        Improvements:
+
+        - Mail::Box::Manager::threads() now also works when the folders
+          are not used as named parameter:
+             $mgr->threads(folders => [$inbox, $outbox]);  # was
+             $mgr->threads($inbox, $outbox);               # added
+
+        - Default output file-handle changed from STDOUT to the selected
+          file-handle (see perldoc -f select)... usually this will
+          return STDOUT.
+
+version 2.008: Mon Feb 18 16:11:52 CET 2002
+
+        Fixes:
+
+        - [Alan Kelm] proved me that the other perl modules are wrong,
+          wrapping the header-lines more often than the RFC permits.  So,
+          wrapping on ';' and '.' is removed.  Wrapped headers are always
+          accepted, so there is no difference when reading a folder.
+
+        - Added 'use Mail::Address' to Mail::Message::Field
+          [Walery Studennikov]
+
+        - [Andreas Marcel Riechert] Added -I flag for {net|open}bsd with
+          mailx in Mail::Transport::Mailx
+
+        - The parent of a Multipart body after reading accidentally was
+          a body, not a message.  Fixed in Mail::Message::Body::Multipart.
+
+        Improvements:
+
+        - New modules Mail::Box::Search and Mail::Box::Search::Grep, however
+          they still need testing.  De docs have to be updated too.
+          Mail::Box::Search::Spam must be a piece of cake now.
+          Example in examples/grep.pl
+
+        - Replaced -w flag in test-scripts by 'use warnings'
+
+        - Centralized definition of folder-files in t/Tools.pm to
+          simplify implementation on Windows.
+
+        - t/00windows.t to convert t/mbox.src to t/mbox.win with CRLF
+          line-terminations.
+
+        - moved Mail::Message::Body::Encode::eol to
+          Mail::Message::Body::eol because is always needed and
+          hence triggered the parsing of Encode..
+
+        - Mail::Message::Body::eol option NATIVE will be translated into
+          LF, CR or CRLF.
+
+        - Mail::Message::Body::*::size will return the size of the
+          message as stored in the file, so taking care of \n which
+          becomes CRLF on some systems.
+
+        - Croak when $mgr->copyTo/moveTo is used with a message which
+          is not part of a folder yet: appendMessage should be used instead.
+
+        - Mail::Box::Thread::Node::threadMessages() collects all messages
+          which are in a thread.
+
+version 2.007: Mon Jan 14 10:07:09 CET 2002
+
+        Fixes:
+
+        - [Alan Kelm] found a mistake in Mail::Box::Locker::DotLock::_try_lock
+
+        - [Alan Kelm] updated some docs about locking.
+
+        - [Alan Kelm] folder->new keep_dups option.
+
+        - [Alan Kelm] fixed a stupid bug: messages printed to MBOX folders
+          did not get an empty line after them (before the from-line).
+          changed  print('') into print("\n") in Mail::Box::Mbox::Messages.pm
+          Mail::Box doesn't need that line, but other mail-agents might.
+
+        Improvements:
+
+        - Avoid colissions between two messages which falsily share
+          messageID.  One will get a new number.
+
+        - Start implementing understanding of CRLF / CR and foreign
+          line-endings
+
+        - Implemented stricter checks.  When a body is created, it is
+          not trusted until the data is checked.  This is lazy again ;)
+          Specify the checked option for the body is you are sure the
+          data is correct.  Also for the folders: when they are `trusted',
+          all bodies will be created `checked', which boosts performance
+          when used with the Perl parser.
+
+version 2.006: Wed Jan  2 08:27:21 CET 2002
+
+        Fixes:
+
+        - Accidentally typed   (@_)  as prototype of some methods.  Found
+          by [Jeffrey Friedl]
+
+version 2.005: Sun Dec 30 14:25:22 CET 2001
+
+        Fixes:
+
+        - Because of a bug related to weak references in the 5.6.0
+          Perl core, 5.6.1 is required now...
+
+        Improvements:
+
+        - Rewrote Mail::Box::Parser::Perl, to avoid use of unget_line.
+          At the same time, the detection of the folder's line mode is
+          simplified.  However, not seek is sparsely used... maybe as
+          next improvement this could be avoided as well.
+
+        - The performance is improved considerably when the folder
+          is trusted.  However, a little slowdown can be experienced
+          for untrusted folders, because better CRLF handling.
+
+        - $mboxmsg->fileLocation returns only begin message in scalar
+          context.
+
+        - readHeader returns ref-array for each field i.s.o. four
+          elements in a list.
+
+        - Mail::Box::Parser::inDosmode is now called
+          Mail::Box::Parser::lineSeparator.  Although a start has been
+          made to support Windows and non-native folders, it is not
+          fully implemented yet.
+
+        - Updated the Mail::Box::Parser manual-page.
+
+version 2.004: Sun Dec 16 22:53:06 CET 2001
+
+        Fixes:
+
+        - I didn't know yet, but you can do things like:
+            $reply->head->add(To => $orig->head->get('From'));
+          because of stringification ;)
+
+        - $message->from also may return the content of the Sender header.
+
+        - Mail::Message::Construct::quotePrelude renamed to
+          ::replyPrelude, which is more consequent.
+
+        New:
+
+        - Added Mail::Message::Construct::forward() and ::forwardSubject.
+          With tests in t/57*
+
+        - Replies are even more flexible now.
+
+version 2.003: Sat Dec 15 00:47:50 CET 2001
+
+        Fixes:
+
+        - Moved stuff from Mail::Message::Head::read to
+          Mail::Box::Parser::readHeader to improve parser indepency and
+          speed.
+
+        - [Marcel de Boer] showed me that labels were not treated
+          right in Mail::Box v2.  Moved from Mail::Box::Message to
+          Mail::Message and Mail::Message::Head.
+
+        - [Marcel de Boer] also found a problem with cloning of multi-
+          parts which got solved: a Mail::Message::Part is cloned to
+          be a Mail::Message!
+
+        - Quite a speed improvement too.
+
+        - Changed version policy
+
+version 2.002: Fri Dec 13 17:46:01 CET 2001
+
+        Fixes:
+
+        - Better (less complaining) recovery of bad header parsing.
+
+        - Removed a back-reference from a locker object to the folder,
+          by which the folders where kept alive although out of scope.
+          "circular reference".  According the errors I got when
+          removing this one, there should be no strong refs left.
+
+        - replaced many "warn"s by "$self->log(WARNING =>"s in
+          Mail::Box::Manager.
+
+        - Improved handling and creating folders in the Mail::Box::Manager.
+
+        - A header may be empty, but then it will be 'false'.  This is
+          needed to correctly recover corrupted mbox folders.
+
+        New:
+
+        - Mail::Message::Field::Fast implements a fast but dirty way to
+          store the header information.  Tested in t/11field1.t
+          It saves about 10% memory and 7% performance.
+
+        - Mail::Message::Field::Flex implements an extendible but slower
+          way to manage the data.  Tested in t/11field2.t
+
+version 2.00_19: Wed Dec 12 22:13:56 CET 2001
+
+        Most work about sending messages.  Slight extension of the
+        interface for some other packages.
+
+        Fixes:
+
+        - Removed Tassilo's header parser optimization in favor of
+          split again, because it breaks on empty fields.
+
+        - [Tassilo v Parseval] added some 'binmode OUT' lines to
+          make 98% of the tests succeed on Windows!!  But I am not
+          sure that is the right answer.  More on that later.
+
+        New:
+
+        - Added to/from/cc/bcc/subject methods to Mail::Message, to
+          hide Resent- header lines which overrule these fields in the
+          header.  Required for correct rfc822 support.
+
+        - Added destinations() to Mail::Message.
+
+        - Added isResent() to Mail::Message::Field.
+
+        - Added addresses() to Mail::Message::Field, which returns a list
+          of addresses as specified by the header line.
+
+        - Added pod reference to Mail::Message's service methods on header
+          lines.
+
+        - Added Mail::Message::Head::Complete::printUndisclosed() and
+          Mail::Message::printUndisclosed() which is the same as print()
+          but leaving the Cc and Bcc headers out.
+
+        - Added Mail::Transport::putContent($message)
+
+        - Added Mail::Transport::SMTP shaped after Net/SMTP, but much more
+          facilities and real Perl 5 code!  Not ready yet.
+
+version 2.00_18: Mon Dec 10 22:19:44 CET 2001
+
+        - Added some requires for package FileHandle.
+
+        - Added Mail::Transport::Qmail (cannot test it, but expect it
+          to work)
+
+        - Reorganized (and improved the docs) on all Transport modules.
+
+        - Added POSIX fcntl locking.
+
+        - [Tassilo v Parseval] demonstrated the fastest way to split
+          a header, determined by benchmarking 6 variations on the theme.
+          Used in Mail::Box::Parser::Perl.pm
+
+version 2.00_17: Sat Dec  8 23:10:06 CET 2001
+
+        - Moved scripts/web/* to scripts/
+
+        - Header line options in Mail::Message::Construct::reply start
+          with capitals too.
+
+        - Added Mail::Message::Body::Multipart::stripSignature
+
+        - Simplified Mail::Message::Construct::reply a little
+
+        - Fixed problem with the resulting body-types where delayed bodies
+          where used to be encoded and decoded.
+
+        - Extra checks for From-line in mbox folders, to help incorrectly
+          formatted folders.
+
+        - [Tassilo v Parseval] discovered the problematic recovery for
+          erroneous headers.  Some recovery is tried.
+
+version 2.00_16:  Sat Dec  8 16:56:53 CET 2001
+
+        First beta of Mail::Box version 2
+
+        Most import changes:
+
+        * Replaced all use of MIME::Parser, Mail::Internet, and MIME::Entity,
+          althought the foreign message types are still useable in some
+          places.
+
+        * All code has been changed.  Simple things, like opening a folder,
+          reading messages and such are the same.  However handling of
+          messages is really different from the MIME::Entity/Mail::Internet
+          implementation.  Your message handling must be body-oriented ;)
+          tranforming a body into a new body, into a new body, and
+          finally create a new message from it.  See Mail::Box-Cookbook.
+
+        * Moved code to use 5.6.0 features, so no support for 5.005
+          anymore.  This is required for Inline::C and Unicode support.
+          Mail::Box releases below 2 will be supported for some time
+          for people with `old' perl.
+
+        * Parsing in Inline::C or plain Perl
+
+        * folder->open(take_headers) removed
+          folder->open(extract) replaces folder->open(lazy_extract) to
+          avoid double negation in your program.
+          listFolders became listSubFolders
+          allMessages became messages(); so $folder->messages always
+          returns all.
+
+        * Unfolding of headers considered stupid: headers which are
+          structured (check Mail::Message::Field::isStructured) may always
+          be multi-lined. Just specify the right options when you scan
+          through the line with regular expressions.
+
+        * All packages is separate files.
+
+        * Many more test, a few example files, Mail::Box-Overview and
+          Mail::Box-Cookbook.
+
+Before this, we had Mail::Box-1.xyz which also has a Changelog.  Most of
+that information is not really useful because version >=2.0 is a really,
+really major change, although there is strike for compibility.
+
+However, some of the bugfixes contributed for Mail::Box v1 are
+still present in Mail::Box v2.

Added: packages/libmail-box-perl/branches/upstream/current/INSTALL
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/INSTALL	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/INSTALL	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,43 @@
+
+INSTALL  Mail::Box
+
+Usually, you install any perl module simply by calling
+
+  #   perl -MCPAN -e 'install Mail::Box'
+
+but if you want to do it manually, then execute the following.
+First unpack the archive:
+
+  #   tar xzf Mail-Box-2*.tar.gz
+  #   cd  Mail-Box-2.*[0-9]
+
+Then
+  #   perl Makefile.PL
+  #   make test
+  #   make install
+
+=== Dependencies
+
+Some modules are not obligatory to Mail::Box, but can improve the
+functionality.  Obligatory are
+
+  Date::Parse         used to parse date info in the header
+  File::Spec          to copy files and construct paths
+  IO::Scalar          only required to run the tests
+  Errno               Mail/Box/Locker/File
+  Scalar::Util        to weaken references
+  Object::Realize::Later implements delay loading
+  Mail::Address       mail address parsing.  Will be replaced later
+  MIME::Types         to find required encoding on data-types.
+
+Optionally, you may want to install
+
+  Net::SMTP           to transport mail without external programs
+  Mail::Internet      when you want to link to packages which require it.
+  MIME::Entity         "
+  HTML::FormatText    to convert HTML to plain text
+  HTML::FormatPS      to convert HTML to PostScript
+
+=== Support
+
+  Mark Overmeer <mailbox at overmeer.net>

Added: packages/libmail-box-perl/branches/upstream/current/LICENSE
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/LICENSE	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/LICENSE	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,377 @@
+Terms of Perl itself
+
+a) the GNU General Public License as published by the Free
+   Software Foundation; either version 1, or (at your option) any
+   later version, or
+b) the "Artistic License"
+
+----------------------------------------------------------------------------
+
+The General Public License (GPL)
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave,
+Cambridge, MA 02139, USA. Everyone is permitted to copy and distribute
+verbatim copies of this license document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to share
+and change it. By contrast, the GNU General Public License is intended to
+guarantee your freedom to share and change free software--to make sure the
+software is free for all its users. This General Public License applies to most of
+the Free Software Foundation's software and to any other program whose
+authors commit to using it. (Some other Free Software Foundation software is
+covered by the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our
+General Public Licenses are designed to make sure that you have the freedom
+to distribute copies of free software (and charge for this service if you wish), that
+you receive source code or can get it if you want it, that you can change the
+software or use pieces of it in new free programs; and that you know you can do
+these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to deny
+you these rights or to ask you to surrender the rights. These restrictions
+translate to certain responsibilities for you if you distribute copies of the
+software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or for a
+fee, you must give the recipients all the rights that you have. You must make
+sure that they, too, receive or can get the source code. And you must show
+them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2) offer
+you this license which gives you legal permission to copy, distribute and/or
+modify the software.
+
+Also, for each author's protection and ours, we want to make certain that
+everyone understands that there is no warranty for this free software. If the
+software is modified by someone else and passed on, we want its recipients to
+know that what they have is not the original, so that any problems introduced by
+others will not reflect on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software patents. We wish
+to avoid the danger that redistributors of a free program will individually obtain
+patent licenses, in effect making the program proprietary. To prevent this, we
+have made it clear that any patent must be licensed for everyone's free use or
+not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification
+follow.
+
+GNU GENERAL PUBLIC LICENSE
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
+MODIFICATION
+
+0. This License applies to any program or other work which contains a notice
+placed by the copyright holder saying it may be distributed under the terms of
+this General Public License. The "Program", below, refers to any such program
+or work, and a "work based on the Program" means either the Program or any
+derivative work under copyright law: that is to say, a work containing the
+Program or a portion of it, either verbatim or with modifications and/or translated
+into another language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not covered by
+this License; they are outside its scope. The act of running the Program is not
+restricted, and the output from the Program is covered only if its contents
+constitute a work based on the Program (independent of having been made by
+running the Program). Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's source code as
+you receive it, in any medium, provided that you conspicuously and appropriately
+publish on each copy an appropriate copyright notice and disclaimer of warranty;
+keep intact all the notices that refer to this License and to the absence of any
+warranty; and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and you may at
+your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion of it, thus
+forming a work based on the Program, and copy and distribute such
+modifications or work under the terms of Section 1 above, provided that you also
+meet all of these conditions:
+
+a) You must cause the modified files to carry prominent notices stating that you
+changed the files and the date of any change.
+
+b) You must cause any work that you distribute or publish, that in whole or in
+part contains or is derived from the Program or any part thereof, to be licensed
+as a whole at no charge to all third parties under the terms of this License.
+
+c) If the modified program normally reads commands interactively when run, you
+must cause it, when started running for such interactive use in the most ordinary
+way, to print or display an announcement including an appropriate copyright
+notice and a notice that there is no warranty (or else, saying that you provide a
+warranty) and that users may redistribute the program under these conditions,
+and telling the user how to view a copy of this License. (Exception: if the
+Program itself is interactive but does not normally print such an announcement,
+your work based on the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If identifiable
+sections of that work are not derived from the Program, and can be reasonably
+considered independent and separate works in themselves, then this License,
+and its terms, do not apply to those sections when you distribute them as
+separate works. But when you distribute the same sections as part of a whole
+which is a work based on the Program, the distribution of the whole must be on
+the terms of this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your rights to
+work written entirely by you; rather, the intent is to exercise the right to control
+the distribution of derivative or collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program with the
+Program (or with a work based on the Program) on a volume of a storage or
+distribution medium does not bring the other work under the scope of this
+License.
+
+3. You may copy and distribute the Program (or a work based on it, under
+Section 2) in object code or executable form under the terms of Sections 1 and 2
+above provided that you also do one of the following:
+
+a) Accompany it with the complete corresponding machine-readable source
+code, which must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange; or,
+
+b) Accompany it with a written offer, valid for at least three years, to give any
+third party, for a charge no more than your cost of physically performing source
+distribution, a complete machine-readable copy of the corresponding source
+code, to be distributed under the terms of Sections 1 and 2 above on a medium
+customarily used for software interchange; or,
+
+c) Accompany it with the information you received as to the offer to distribute
+corresponding source code. (This alternative is allowed only for noncommercial
+distribution and only if you received the program in object code or executable
+form with such an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for making
+modifications to it. For an executable work, complete source code means all the
+source code for all modules it contains, plus any associated interface definition
+files, plus the scripts used to control compilation and installation of the
+executable. However, as a special exception, the source code distributed need
+not include anything that is normally distributed (in either source or binary form)
+with the major components (compiler, kernel, and so on) of the operating system
+on which the executable runs, unless that component itself accompanies the
+executable.
+
+If distribution of executable or object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the source
+code from the same place counts as distribution of the source code, even though
+third parties are not compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program except as
+expressly provided under this License. Any attempt otherwise to copy, modify,
+sublicense or distribute the Program is void, and will automatically terminate
+your rights under this License. However, parties who have received copies, or
+rights, from you under this License will not have their licenses terminated so long
+as such parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not signed it.
+However, nothing else grants you permission to modify or distribute the Program
+or its derivative works. These actions are prohibited by law if you do not accept
+this License. Therefore, by modifying or distributing the Program (or any work
+based on the Program), you indicate your acceptance of this License to do so,
+and all its terms and conditions for copying, distributing or modifying the
+Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the Program),
+the recipient automatically receives a license from the original licensor to copy,
+distribute or modify the Program subject to these terms and conditions. You
+may not impose any further restrictions on the recipients' exercise of the rights
+granted herein. You are not responsible for enforcing compliance by third parties
+to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent infringement
+or for any other reason (not limited to patent issues), conditions are imposed on
+you (whether by court order, agreement or otherwise) that contradict the
+conditions of this License, they do not excuse you from the conditions of this
+License. If you cannot distribute so as to satisfy simultaneously your obligations
+under this License and any other pertinent obligations, then as a consequence
+you may not distribute the Program at all. For example, if a patent license would
+not permit royalty-free redistribution of the Program by all those who receive
+copies directly or indirectly through you, then the only way you could satisfy
+both it and this License would be to refrain entirely from distribution of the
+Program.
+
+If any portion of this section is held invalid or unenforceable under any particular
+circumstance, the balance of the section is intended to apply and the section as
+a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or other
+property right claims or to contest validity of any such claims; this section has
+the sole purpose of protecting the integrity of the free software distribution
+system, which is implemented by public license practices. Many people have
+made generous contributions to the wide range of software distributed through
+that system in reliance on consistent application of that system; it is up to the
+author/donor to decide if he or she is willing to distribute software through any
+other system and a licensee cannot impose that choice.
+
+This section is intended to make thoroughly clear what is believed to be a
+consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in certain countries
+either by patents or by copyrighted interfaces, the original copyright holder who
+places the Program under this License may add an explicit geographical
+distribution limitation excluding those countries, so that distribution is permitted
+only in or among countries not thus excluded. In such case, this License
+incorporates the limitation as if written in the body of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions of the
+General Public License from time to time. Such new versions will be similar in
+spirit to the present version, but may differ in detail to address new problems or
+concerns.
+
+Each version is given a distinguishing version number. If the Program specifies a
+version number of this License which applies to it and "any later version", you
+have the option of following the terms and conditions either of that version or of
+any later version published by the Free Software Foundation. If the Program does
+not specify a version number of this License, you may choose any version ever
+published by the Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free programs
+whose distribution conditions are different, write to the author to ask for
+permission. For software which is copyrighted by the Free Software Foundation,
+write to the Free Software Foundation; we sometimes make exceptions for this.
+Our decision will be guided by the two goals of preserving the free status of all
+derivatives of our free software and of promoting the sharing and reuse of
+software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS
+NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE
+COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM
+"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
+IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
+ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
+YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
+CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED
+TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY
+WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS
+PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
+ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM
+(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY
+OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS
+BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+
+----------------------------------------------------------------------------
+
+The Artistic License
+
+Preamble
+
+The intent of this document is to state the conditions under which a Package
+may be copied, such that the Copyright Holder maintains some semblance of
+artistic control over the development of the package, while giving the users of the
+package the right to use and distribute the Package in a more-or-less customary
+fashion, plus the right to make reasonable modifications.
+
+Definitions:
+
+-    "Package" refers to the collection of files distributed by the Copyright
+     Holder, and derivatives of that collection of files created through textual
+     modification. 
+-    "Standard Version" refers to such a Package if it has not been modified,
+     or has been modified in accordance with the wishes of the Copyright
+     Holder. 
+-    "Copyright Holder" is whoever is named in the copyright or copyrights for
+     the package. 
+-    "You" is you, if you're thinking about copying or distributing this Package.
+-    "Reasonable copying fee" is whatever you can justify on the basis of
+     media cost, duplication charges, time of people involved, and so on. (You
+     will not be required to justify it to the Copyright Holder, but only to the
+     computing community at large as a market that must bear the fee.) 
+-    "Freely Available" means that no fee is charged for the item itself, though
+     there may be fees involved in handling the item. It also means that
+     recipients of the item may redistribute it under the same conditions they
+     received it. 
+
+1. You may make and give away verbatim copies of the source form of the
+Standard Version of this Package without restriction, provided that you duplicate
+all of the original copyright notices and associated disclaimers.
+
+2. You may apply bug fixes, portability fixes and other modifications derived from
+the Public Domain or from the Copyright Holder. A Package modified in such a
+way shall still be considered the Standard Version.
+
+3. You may otherwise modify your copy of this Package in any way, provided
+that you insert a prominent notice in each changed file stating how and when
+you changed that file, and provided that you do at least ONE of the following:
+
+     a) place your modifications in the Public Domain or otherwise
+     make them Freely Available, such as by posting said modifications
+     to Usenet or an equivalent medium, or placing the modifications on
+     a major archive site such as ftp.uu.net, or by allowing the
+     Copyright Holder to include your modifications in the Standard
+     Version of the Package.
+
+     b) use the modified Package only within your corporation or
+     organization.
+
+     c) rename any non-standard executables so the names do not
+     conflict with standard executables, which must also be provided,
+     and provide a separate manual page for each non-standard
+     executable that clearly documents how it differs from the Standard
+     Version.
+
+     d) make other distribution arrangements with the Copyright Holder.
+
+4. You may distribute the programs of this Package in object code or executable
+form, provided that you do at least ONE of the following:
+
+     a) distribute a Standard Version of the executables and library
+     files, together with instructions (in the manual page or equivalent)
+     on where to get the Standard Version.
+
+     b) accompany the distribution with the machine-readable source of
+     the Package with your modifications.
+
+     c) accompany any non-standard executables with their
+     corresponding Standard Version executables, giving the
+     non-standard executables non-standard names, and clearly
+     documenting the differences in manual pages (or equivalent),
+     together with instructions on where to get the Standard Version.
+
+     d) make other distribution arrangements with the Copyright Holder.
+
+5. You may charge a reasonable copying fee for any distribution of this Package.
+You may charge any fee you choose for support of this Package. You may not
+charge a fee for this Package itself. However, you may distribute this Package in
+aggregate with other (possibly commercial) programs as part of a larger
+(possibly commercial) software distribution provided that you do not advertise
+this Package as a product of your own.
+
+6. The scripts and library files supplied as input to or produced as output from
+the programs of this Package do not automatically fall under the copyright of this
+Package, but belong to whomever generated them, and may be sold
+commercially, and may be aggregated with this Package.
+
+7. C or perl subroutines supplied by you and linked into this Package shall not
+be considered part of this Package.
+
+8. The name of the Copyright Holder may not be used to endorse or promote
+products derived from this software without specific prior written permission.
+
+9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.
+
+The End
+
+

Added: packages/libmail-box-perl/branches/upstream/current/MANIFEST
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/MANIFEST	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/MANIFEST	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,366 @@
+ChangeLog
+INSTALL
+LICENSE
+MANIFEST
+Makefile.PL
+README
+README.FAQ
+README.todo
+TODO.v2
+examples/build.pl
+examples/grep.pl
+examples/multipart.pl
+examples/open.pl
+examples/reply.pl
+examples/send.pl
+examples/smaller.pl
+examples/strip-attachments.pl
+examples/takelarge.pl
+lib/Mail/Box-Cookbook.pod
+lib/Mail/Box-Index.pod
+lib/Mail/Box-Overview.pod
+lib/Mail/Box.pm
+lib/Mail/Box.pod
+lib/Mail/Box/Dbx.pm
+lib/Mail/Box/Dbx.pod
+lib/Mail/Box/Dbx/Message.pm
+lib/Mail/Box/Dbx/Message.pod
+lib/Mail/Box/Dir.pm
+lib/Mail/Box/Dir.pod
+lib/Mail/Box/Dir/Message.pm
+lib/Mail/Box/Dir/Message.pod
+lib/Mail/Box/FastScalar.pm
+lib/Mail/Box/FastScalar.pod
+lib/Mail/Box/File.pm
+lib/Mail/Box/File.pod
+lib/Mail/Box/File/Message.pm
+lib/Mail/Box/File/Message.pod
+lib/Mail/Box/IMAP4.pm
+lib/Mail/Box/IMAP4.pod
+lib/Mail/Box/IMAP4/Head.pm
+lib/Mail/Box/IMAP4/Head.pod
+lib/Mail/Box/IMAP4/Message.pm
+lib/Mail/Box/IMAP4/Message.pod
+lib/Mail/Box/Locker.pm
+lib/Mail/Box/Locker.pod
+lib/Mail/Box/Locker/DotLock.pm
+lib/Mail/Box/Locker/DotLock.pod
+lib/Mail/Box/Locker/Flock.pm
+lib/Mail/Box/Locker/Flock.pod
+lib/Mail/Box/Locker/Multi.pm
+lib/Mail/Box/Locker/Multi.pod
+lib/Mail/Box/Locker/NFS.pm
+lib/Mail/Box/Locker/NFS.pod
+lib/Mail/Box/Locker/POSIX.pm
+lib/Mail/Box/Locker/POSIX.pod
+lib/Mail/Box/MH.pm
+lib/Mail/Box/MH.pod
+lib/Mail/Box/MH/Index.pm
+lib/Mail/Box/MH/Index.pod
+lib/Mail/Box/MH/Labels.pm
+lib/Mail/Box/MH/Labels.pod
+lib/Mail/Box/MH/Message.pm
+lib/Mail/Box/MH/Message.pod
+lib/Mail/Box/Maildir.pm
+lib/Mail/Box/Maildir.pod
+lib/Mail/Box/Maildir/Message.pm
+lib/Mail/Box/Maildir/Message.pod
+lib/Mail/Box/Manager.pm
+lib/Mail/Box/Manager.pod
+lib/Mail/Box/Mbox.pm
+lib/Mail/Box/Mbox.pod
+lib/Mail/Box/Mbox/Message.pm
+lib/Mail/Box/Mbox/Message.pod
+lib/Mail/Box/Message.pm
+lib/Mail/Box/Message.pod
+lib/Mail/Box/Message/Destructed.pm
+lib/Mail/Box/Message/Destructed.pod
+lib/Mail/Box/Net.pm
+lib/Mail/Box/Net.pod
+lib/Mail/Box/Net/Message.pm
+lib/Mail/Box/Net/Message.pod
+lib/Mail/Box/POP3.pm
+lib/Mail/Box/POP3.pod
+lib/Mail/Box/POP3/Message.pm
+lib/Mail/Box/POP3/Message.pod
+lib/Mail/Box/Parser.pm
+lib/Mail/Box/Parser.pod
+lib/Mail/Box/Parser/Perl.pm
+lib/Mail/Box/Parser/Perl.pod
+lib/Mail/Box/Search.pm
+lib/Mail/Box/Search.pod
+lib/Mail/Box/Search/Grep.pm
+lib/Mail/Box/Search/Grep.pod
+lib/Mail/Box/Search/IMAP.pm
+lib/Mail/Box/Search/IMAP.pod
+lib/Mail/Box/Search/SpamAssassin.pm
+lib/Mail/Box/Search/SpamAssassin.pod
+lib/Mail/Box/Thread/Manager.pm
+lib/Mail/Box/Thread/Manager.pod
+lib/Mail/Box/Thread/Node.pm
+lib/Mail/Box/Thread/Node.pod
+lib/Mail/Box/Tie.pm
+lib/Mail/Box/Tie.pod
+lib/Mail/Box/Tie/ARRAY.pm
+lib/Mail/Box/Tie/ARRAY.pod
+lib/Mail/Box/Tie/HASH.pm
+lib/Mail/Box/Tie/HASH.pod
+lib/Mail/Makefile.PL
+lib/Mail/Message.pm
+lib/Mail/Message.pod
+lib/Mail/Message/Body.pm
+lib/Mail/Message/Body.pod
+lib/Mail/Message/Body/Construct.pm
+lib/Mail/Message/Body/Construct.pod
+lib/Mail/Message/Body/Delayed.pm
+lib/Mail/Message/Body/Delayed.pod
+lib/Mail/Message/Body/Encode.pm
+lib/Mail/Message/Body/Encode.pod
+lib/Mail/Message/Body/File.pm
+lib/Mail/Message/Body/File.pod
+lib/Mail/Message/Body/Lines.pm
+lib/Mail/Message/Body/Lines.pod
+lib/Mail/Message/Body/Multipart.pm
+lib/Mail/Message/Body/Multipart.pod
+lib/Mail/Message/Body/Nested.pm
+lib/Mail/Message/Body/Nested.pod
+lib/Mail/Message/Body/String.pm
+lib/Mail/Message/Body/String.pod
+lib/Mail/Message/Construct.pm
+lib/Mail/Message/Construct.pod
+lib/Mail/Message/Construct/Bounce.pm
+lib/Mail/Message/Construct/Bounce.pod
+lib/Mail/Message/Construct/Build.pm
+lib/Mail/Message/Construct/Build.pod
+lib/Mail/Message/Construct/Forward.pm
+lib/Mail/Message/Construct/Forward.pod
+lib/Mail/Message/Construct/Read.pm
+lib/Mail/Message/Construct/Read.pod
+lib/Mail/Message/Construct/Rebuild.pm
+lib/Mail/Message/Construct/Rebuild.pod
+lib/Mail/Message/Construct/Reply.pm
+lib/Mail/Message/Construct/Reply.pod
+lib/Mail/Message/Construct/Text.pm
+lib/Mail/Message/Construct/Text.pod
+lib/Mail/Message/Convert.pm
+lib/Mail/Message/Convert.pod
+lib/Mail/Message/Convert/Html.pm
+lib/Mail/Message/Convert/Html.pod
+lib/Mail/Message/Convert/HtmlFormatPS.pm
+lib/Mail/Message/Convert/HtmlFormatPS.pod
+lib/Mail/Message/Convert/HtmlFormatText.pm
+lib/Mail/Message/Convert/HtmlFormatText.pod
+lib/Mail/Message/Convert/MailInternet.pm
+lib/Mail/Message/Convert/MailInternet.pod
+lib/Mail/Message/Convert/MimeEntity.pm
+lib/Mail/Message/Convert/MimeEntity.pod
+lib/Mail/Message/Convert/TextAutoformat.pm
+lib/Mail/Message/Convert/TextAutoformat.pod
+lib/Mail/Message/Dummy.pm
+lib/Mail/Message/Dummy.pod
+lib/Mail/Message/Field.pm
+lib/Mail/Message/Field.pod
+lib/Mail/Message/Field/AddrGroup.pm
+lib/Mail/Message/Field/AddrGroup.pod
+lib/Mail/Message/Field/Address.pm
+lib/Mail/Message/Field/Address.pod
+lib/Mail/Message/Field/Addresses.pm
+lib/Mail/Message/Field/Addresses.pod
+lib/Mail/Message/Field/Attribute.pm
+lib/Mail/Message/Field/Attribute.pod
+lib/Mail/Message/Field/Fast.pm
+lib/Mail/Message/Field/Fast.pod
+lib/Mail/Message/Field/Flex.pm
+lib/Mail/Message/Field/Flex.pod
+lib/Mail/Message/Field/Full.pm
+lib/Mail/Message/Field/Full.pod
+lib/Mail/Message/Field/Structured.pm
+lib/Mail/Message/Field/Structured.pod
+lib/Mail/Message/Field/URIs.pm
+lib/Mail/Message/Field/URIs.pod
+lib/Mail/Message/Field/Unstructured.pm
+lib/Mail/Message/Field/Unstructured.pod
+lib/Mail/Message/Head.pm
+lib/Mail/Message/Head.pod
+lib/Mail/Message/Head/Complete.pm
+lib/Mail/Message/Head/Complete.pod
+lib/Mail/Message/Head/Delayed.pm
+lib/Mail/Message/Head/Delayed.pod
+lib/Mail/Message/Head/FieldGroup.pm
+lib/Mail/Message/Head/FieldGroup.pod
+lib/Mail/Message/Head/ListGroup.pm
+lib/Mail/Message/Head/ListGroup.pod
+lib/Mail/Message/Head/Partial.pm
+lib/Mail/Message/Head/Partial.pod
+lib/Mail/Message/Head/ResentGroup.pm
+lib/Mail/Message/Head/ResentGroup.pod
+lib/Mail/Message/Head/SpamGroup.pm
+lib/Mail/Message/Head/SpamGroup.pod
+lib/Mail/Message/Head/Subset.pm
+lib/Mail/Message/Head/Subset.pod
+lib/Mail/Message/Part.pm
+lib/Mail/Message/Part.pod
+lib/Mail/Message/Replace/MailHeader.pm
+lib/Mail/Message/Replace/MailHeader.pod
+lib/Mail/Message/Replace/MailInternet.pm
+lib/Mail/Message/Replace/MailInternet.pod
+lib/Mail/Message/TransferEnc.pm
+lib/Mail/Message/TransferEnc.pod
+lib/Mail/Message/TransferEnc/Base64.pm
+lib/Mail/Message/TransferEnc/Base64.pod
+lib/Mail/Message/TransferEnc/Binary.pm
+lib/Mail/Message/TransferEnc/Binary.pod
+lib/Mail/Message/TransferEnc/EightBit.pm
+lib/Mail/Message/TransferEnc/EightBit.pod
+lib/Mail/Message/TransferEnc/QuotedPrint.pm
+lib/Mail/Message/TransferEnc/QuotedPrint.pod
+lib/Mail/Message/TransferEnc/SevenBit.pm
+lib/Mail/Message/TransferEnc/SevenBit.pod
+lib/Mail/Message/Wrapper/SpamAssassin.pm
+lib/Mail/Message/Wrapper/SpamAssassin.pod
+lib/Mail/Reporter.pm
+lib/Mail/Reporter.pod
+lib/Mail/Transport.pm
+lib/Mail/Transport.pod
+lib/Mail/Transport/Exim.pm
+lib/Mail/Transport/Exim.pod
+lib/Mail/Transport/IMAP4.pm
+lib/Mail/Transport/IMAP4.pod
+lib/Mail/Transport/Mailx.pm
+lib/Mail/Transport/Mailx.pod
+lib/Mail/Transport/POP3.pm
+lib/Mail/Transport/POP3.pod
+lib/Mail/Transport/Qmail.pm
+lib/Mail/Transport/Qmail.pod
+lib/Mail/Transport/Receive.pm
+lib/Mail/Transport/Receive.pod
+lib/Mail/Transport/SMTP.pm
+lib/Mail/Transport/SMTP.pod
+lib/Mail/Transport/Send.pm
+lib/Mail/Transport/Send.pod
+lib/Mail/Transport/Sendmail.pm
+lib/Mail/Transport/Sendmail.pod
+scripts/lsmail
+scripts/mailbox2html
+scripts/takemail
+test.pl
+tests/01platform/10crlf.t
+tests/01platform/Definition.pm
+tests/10report/10errors.t
+tests/10report/Definition.pm
+tests/11field/10cfws.t
+tests/11field/20fast.t
+tests/11field/30flex.t
+tests/11field/Definition.pm
+tests/12head/10create.t
+tests/12head/30partial.t
+tests/12head/Definition.pm
+tests/13body/10string.t
+tests/13body/20lines.t
+tests/13body/30file.t
+tests/13body/40multip.t
+tests/13body/Definition.pm
+tests/14fieldu/10full.t
+tests/14fieldu/20attr.t
+tests/14fieldu/30unstr.t
+tests/14fieldu/40parse.t
+tests/14fieldu/50userid.t
+tests/14fieldu/51addr.t
+tests/14fieldu/52uri.t
+tests/14fieldu/Definition.pm
+tests/20pparser/10field.t
+tests/20pparser/20head.t
+tests/20pparser/30bodys.t
+tests/20pparser/31bodyl.t
+tests/20pparser/32bodyd.t
+tests/20pparser/33bodyf.t
+tests/20pparser/34bodymp.t
+tests/20pparser/40readmp.t
+tests/20pparser/50nested.t
+tests/20pparser/Definition.pm
+tests/30encode/10base64.t
+tests/30encode/20eight.t
+tests/30encode/30quoted.t
+tests/30encode/40seven.t
+tests/30encode/90body.t
+tests/30encode/Definition.pm
+tests/31fgroups/10resent.t
+tests/31fgroups/20list.t
+tests/31fgroups/30spam.t
+tests/31fgroups/Definition.pm
+tests/31fgroups/mlfolder
+tests/31fgroups/sgfolder
+tests/40mbox/10read.t
+tests/40mbox/20write.t
+tests/40mbox/30delay.t
+tests/40mbox/40append.t
+tests/40mbox/50create.t
+tests/40mbox/60thread.t
+tests/40mbox/70inplace.t
+tests/40mbox/80update.t
+tests/40mbox/Definition.pm
+tests/41mh/10read.t
+tests/41mh/20write.t
+tests/41mh/30append.t
+tests/41mh/50create.t
+tests/41mh/60thread.t
+tests/41mh/70seqs.t
+tests/41mh/Definition.pm
+tests/42maildir/10read.t
+tests/42maildir/20write.t
+tests/42maildir/30append.t
+tests/42maildir/Definition.pm
+tests/43pop3/01basic.t
+tests/43pop3/02break.t
+tests/43pop3/03minimal.t
+tests/43pop3/04autodelete.t
+tests/43pop3/Definition.pm
+tests/43pop3/original/0001
+tests/43pop3/original/0002
+tests/43pop3/original/0003
+tests/43pop3/original/0004
+tests/43pop3/server
+tests/44imap/10read.t
+tests/44imap/20write.t
+tests/44imap/Definition.pm
+tests/45dbx/10read.t
+tests/45dbx/Definition.pm
+tests/50message/10stripsig.t
+tests/50message/20replsubj.t
+tests/50message/21reply.t
+tests/50message/30bounce.t
+tests/50message/40forwsubj.t
+tests/50message/41forward.t
+tests/50message/50rebuild.t
+tests/50message/58clone.t
+tests/50message/60destruct.t
+tests/50message/Definition.pm
+tests/51folder/10copyto.t
+tests/51folder/20tieary.t
+tests/51folder/21tiehash.t
+tests/51folder/Definition.pm
+tests/52manager/10open.t
+tests/52manager/11urlopen.t
+tests/52manager/Definition.pm
+tests/53threads/10single.t
+tests/53threads/Definition.pm
+tests/54search/10grep.t
+tests/54search/Definition.pm
+tests/55locking/10dotlock.t
+tests/55locking/20flock.t
+tests/55locking/30nfslock.t
+tests/55locking/40posix.t
+tests/55locking/90multi.t
+tests/55locking/Definition.pm
+tests/80msgconv/10mailint.t
+tests/80msgconv/20mimeent.t
+tests/80msgconv/Definition.pm
+tests/81bodyconv/10textaf.t
+tests/81bodyconv/20html.t
+tests/81bodyconv/30htmlps.t
+tests/81bodyconv/31htmltxt.t
+tests/81bodyconv/Definition.pm
+tests/Tools.pm
+tests/folders/mbox.cpy
+tests/folders/mbox.src
+META.yml                                 Module meta-data (added by MakeMaker)

Added: packages/libmail-box-perl/branches/upstream/current/META.yml
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/META.yml	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/META.yml	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,26 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
+name:         Mail-Box
+version:      2.055
+version_from: lib/Mail/Box.pm
+installdirs:  site
+requires:
+    Date::Parse:                   0
+    Digest::HMAC_MD5:              0
+    Errno:                         0
+    File::Spec:                    0.7
+    IO::Scalar:                    0
+    Mail::Address:                 0
+    MIME::Base64:                  0
+    MIME::Types:                   1.004
+    Object::Realize::Later:        0.14
+    Scalar::Util:                  1.13
+    Sys::Hostname:                 0
+    Test::Harness:                 1.38
+    Test::More:                    0.47
+    Time::Zone:                    0
+    URI:                           1.23
+    User::Identity:                0.07
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.17

Added: packages/libmail-box-perl/branches/upstream/current/Makefile.PL
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/Makefile.PL	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/Makefile.PL	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,275 @@
+use ExtUtils::MakeMaker;
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+
+require 5.006_001;
+
+use IO::Handle;
+
+# Usually, Scalar::Util is installed (in core since perl 5.8.0)
+# However, sometimes it is (incorrectly) installed without XS, but as
+# plain module.  In that case, Scalar::Util must be reinstalled.
+
+eval { require Scalar::Util };
+unless($@)
+{   eval "Scalar::Util->import('dualvar')";
+    if($@ =~ m/only.*XS/)
+    {   warn <<'WARN';
+
+!!!! WARNING !!!! On your system, the module Scalar::Util is installed
+!!!! WARNING !!!! without use of XS.  This means that critical functionality
+!!!! WARNING !!!! is missing.  Reinstall the module and be sure to get the
+!!!! WARNING !!!! correct installation.
+!!!! WARNING !!!!    perl -MCPAN -e 'shell'
+!!!! WARNING !!!!       > force install Scalar::Util
+
+WARN
+    }
+}
+
+my @optional =
+( 
+  [ Mail::Box::Parser::C => '3.001'
+  , reason => <<'REASON', warning => <<'WARN' ]
+Speeds-up reading mail folders, though most time is consumed by
+Perl's administration of the processed data.
+REASON
+This module contains XS code, so you need a C compiler.
+WARN
+
+, [ Encode => '1.86', requires => sub { $] >= 5.007_003 }
+  , reason  => <<'REASON', warning => <<'WARN' ]
+Conversions between character sets are done by Encode.  Many
+other Perl modules use Encode too.
+REASON
+Encode is a huge package, but not complicated to install.
+WARN
+
+, [ Mail::Transport::Dbx => '0.04', reason  => <<'REASON' ]
+The wrapper to the Outlook's dbx files consists of a c-library
+named libdbx (website http://sourceforge.net/project/ol2mbox/),
+and a wrapper which is distributed separately from Mail::Box.
+You get read-only access to the dbx folders.
+REASON
+
+, [ Mail::SpamAssassin => '2.00', reason  => <<'REASON', warning => <<'WARN' ]
+Searching for spam in a mail folder needs the popular spam killer.
+REASON
+This distr is large: installing will take quite a while. You
+can install it later.  When your CPAN cache is small, this may
+break your Mail::Box installing process.
+WARN
+
+, [ Mail::IMAPClient => '2.2.8', reason => <<'REASON' ]
+Required for IMAP4 support.
+REASON
+
+, [ Mail::Internet => '1.0', distr => 'MailTools', reason  => <<'REASON' ]
+Many existing e-mail applications use Mail::Internet objects.  If
+you want automatic conversions for compatibility, you need this.
+REASON
+
+, [ MIME::Entity => '3.0', distr  => 'MIME::Tools', reason  => <<'REASON' ]
+MIME::Entity extends Mail::Internet messages with multipart handling
+and composition.  Install this when you want compatibility with
+distrs which are based on this kind of messages.
+REASON
+
+, [ HTML::TreeBuilder => '3.13', reason => <<'REASON' ]
+     The tree builder is used by the HTML::Format* packages.
+     Version 3.12 is wrong, so you should install a newer version
+     if you want smart html conversions.
+REASON
+
+, [ HTML::FormatText => '2.01', distr => 'HTML::Format', reason => <<'REASON' ]
+Plug-in which converts HTML to Postscript or plain text.
+REASON
+);
+
+my %prereq =
+ ( Date::Parse    => 0.0
+ , File::Spec     => 0.7
+ , Errno          => 0.0
+ , Scalar::Util   => 1.13
+ , Object::Realize::Later => 0.14
+ , Mail::Address  => 0.0
+ , MIME::Types    => 1.004
+ , Sys::Hostname  => 0.0
+ , Test::More     => 0.47
+ , Test::Harness  => 1.38
+ , MIME::Base64   => 0.0
+ , URI            => 1.23
+ , IO::Scalar     => 0.0
+ , Digest::HMAC_MD5 => 0.0
+ , User::Identity => 0.07
+ , Time::Zone     => 0.0
+ );
+
+my $has_readkey;
+BEGIN
+{   eval "require Term::ReadKey";
+    $has_readkey = not length $@;
+}
+
+sub ask($$)
+{   my ($text, $default) = @_;
+    print "---> $text [$default] ";
+    my $key;
+
+    if(! -t STDIN) { $key = $default }
+    elsif($has_readkey)
+    {   Term::ReadKey->import;
+        ReadMode(3);   # cbreak mode
+        $key = ReadKey(0) until defined($key);
+        ReadMode(1);
+
+        $key = $default if $key =~ m/\n/;
+        print "$key\n";
+    }
+    else
+    {   # No Term::ReadKey
+        flush STDOUT;
+        my $line = <STDIN>;
+        $line    =~ m/(\S)/;
+        $key     = $1 || $default;
+    }
+
+    $key;
+}
+
+my $default_install_answer = $ENV{INSTALL_MAILBOX_OPTIONALS}
+    || (-t STDIN ? 'y' : 'n');
+
+print <<'INTRO';
+*
+**** Installing MailBox
+*
+INTRO
+
+print <<'REQUIRED';
+
+* First, I will check the sanity of all required modules... sometimes
+* they do not load, for instance if you have installed a new release
+* of Perl without upgrading the libraries.
+
+REQUIRED
+
+my @errors;
+while(my ($module, $version) = each %prereq)
+{   eval "require $module";
+    if($@ && $@ =~ m/^Can't locate /)
+    {   print "    $module is not yet installed\n" }
+    elsif($@)
+    {   print "    $module produced an error:\n$@";
+        push @errors, $module;
+    }
+    elsif($module->VERSION < $version)
+    {   print "    $module version ",$module->VERSION
+            , " is outdated; requires $version\n";
+    }
+    else
+    {   print "    $module version ",$module->VERSION
+            , " is ok (required is $version)\n";
+    }
+}
+
+if($errors)
+{   die <<'FIX';
+*** ERROR! You have to install @errors manually,
+*** before you can retry to install MailBox.
+FIX
+    exit 1;
+}
+
+print <<'OPTIONAL';
+
+* Now, let me ask you whether you want some optional modules to be
+* installed as well.  You can always install these modules later, by
+* hand, without a need to re-install MailBox.
+*
+OPTIONAL
+
+foreach my $optional (@optional)
+{   my ($module, $version, %args) = @$optional;
+    my $requirements = $args{requires} || sub {1};
+    next unless $requirements->();
+
+    print "\n";
+    eval "require $module";
+    if($@)
+    {   if($@ =~ m/^Can't locate /)
+             { print "**** Optional $module is not installed\n"        }
+        else { print "**** Optional $module compilation failed:\n$@\n" }
+    }
+    elsif($module->VERSION < $version )
+    {   print "**** Optional $module too old: requires $version but is ",
+            $module->VERSION,"\n";
+    }
+    else
+    {   my $v = $module->VERSION;
+        my $r = $v eq $version ? ''
+              : $version == 0  ? " (any version will do)"
+              :                  " (at least $version required)";
+
+        print "**** Found optional $module version $v$r\n";
+        next;
+    }
+
+    my $reason = $args{reason};
+    $reason =~ s/^/     /gm;
+    $reason =~ s/\A    /Use:/;
+    print $reason;
+
+    if(my $warn = $args{warning})
+    {   $warn =~ s/^/     /gm;
+        $warn =~ s/\A    /WARN/;
+        print $warn;
+    }
+    
+    my $install  = $default_install_answer;
+    my $key = ask "Do you want to install $module? yes/no/all", $install;
+
+    if($key eq 'a')
+    {   $default_install_answer = 'a';
+        $install = 'y';
+    }
+    else
+    {   $install = $key eq 'y' ? 'y' : 'n';
+    }
+
+    next unless $install eq 'y';
+
+    my $distr = $args{distr} || $module;
+
+    $prereq{$distr} = $version;
+    print "     Added $distr version $version to the requirements\n";
+}
+
+my $tests = ask "Do you want to run the (large set of) tests? yes/no", "yes";
+if($tests =~ m/n/i)
+{   open F, ">", "skiptests";
+    close F;
+}
+else
+{   unlink "skiptests";
+}
+
+print <<'MAKEFILE';
+
+**** Writing Makefile
+
+MAKEFILE
+
+WriteMakefile
+ ( NAME	 => 'Mail::Box'
+ , VERSION_FROM => 'lib/Mail/Box.pm'
+ , AUTHOR       => 'Mark Overmeer'
+ , ABSTRACT     => 'E-mail handling'
+ , PREREQ_PM    => \%prereq
+ );
+
+print <<'DONE';
+
+**** Done
+
+DONE

Added: packages/libmail-box-perl/branches/upstream/current/README
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/README	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/README	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,149 @@
+
+README   Mail::Box v2
+
+
+The Mail::Box folder is a modern mail-folder manager -- at least at
+the moment of this writing ;)  It is written to replace Mail::Folder,
+although it interface is different.
+
+The most important modules are Mail::Box::Manager, Mail::Box, and
+Mail::Message.  Their documentation explain the features in more
+detail than this document.  The Mail::Box-Overview page describe
+each set of modules in more detail.
+
+Other descriptive documents in this module:
+
+    README.FAQ           Frequently asked questions
+    README.todo          Thoughts about possible extensions
+
+Mail::Box version 1.xxx runs on perl 5.005 and up Mail::Box version
+2.xxx is much faster and more flexible, but only runs on perl 5.6.1
+and up. It is not fully compatible with previous versions, although
+conversion will usually not be too hard.
+
+===== Contributors
+
+A full list of contributors can be found in the Changelog, but a few
+people have to mentioned in special:
+
+* Mark Overmeer
+  - 99% of the code
+  - initial version of documentation
+* David Coppit
+  - massive corrections and additions in all documentation
+  - many valid suggestions to the design and parts of the implementation
+    -- and some invalid ones ;) --  you really must know what you are
+    talking about to convince stubborn Mark.
+* Tassilo von Parseval
+  - scripts/takemail
+  - contributions to the design
+* Liz Mattijsen for the POP3 implementation
+
+===== Status
+
+Although the implementation of Mail::Box is young, it already has a
+large number of features.
+
+See the file README.status to see what has been tested and what
+hasn't.  Version 1.300 contained 300 tests, but that is certainly not
+sufficient to call the module `well tested'.  Version 2.01 had over 500
+tests, which is quite ok.  Mail::Box version 2.014 contains close to 2500
+tests -much better- and over 9000 lines of pure code in 67 packages.
+
+===== Features
+
+= AUTOLOAD messages.
+
+The Mail::Box modules try to keep messages stored in the mailbox
+file(s) for as long as possible.  The message is read from file and
+parsed only if the user really needs the contents of the message.
+This is called 'delay loading'.
+
+Demand- or delayed-loading of messages is implemented using the
+standard AUTOLOAD mechanism, which means that it is not visible to
+the user of the folder!  This mechanism also reduces the memory
+footprint of the program enormously.
+
+For some folder types, not only the content (body) of the message is
+delayed, but even the header.  In those cases, the opening of a folder
+is just counting the messages: really fast.
+
+The implementation also avoids parsing and then unparsing mail messages.
+If you read from a folder, then use it and write to it to a different
+folder, unmodified messages are not reformatted from memory. Instead they
+are copied from the old folder into a new one byte-by-byte.  When you
+open a folder with 1000 messages, and modify two messages, only those
+two get parsed and recomposed.  All 998 other messages are simple
+byte-by-byte copied into the replacement file.
+
+= Support for various folder types
+
+Currently supported:
+
+* Mbox folders, see Mail::Box::Mbox
+  One file per folder, with many messages in each file.
+
+* MH folders, see Mail::Box::MH
+  One directory per folder, with each message in a separate file.
+
+See STATUS for my wishlist of supported folder types.
+
+= Support for message construction
+
+Create messages from data. Easily create replies, forwards, and bounces.
+Conversions between different message types (even foreign to Mail::Box)
+Transfer encoding and decoding without hassle.
+
+= Support for message thread construction
+
+The current implementation has a very basic message thread
+construction algorithm. At the moment, only the In-Reply-To and the
+References fields are taken into account.  This could be optimized,
+for instance by looking at the subject.  Read more about threading in
+Mail::Box::Threads.
+
+= Various kinds of locking
+
+There are three kinds of locking:
+* Locking via a .lock (dotlock) file.
+* Locking using flock (mbox folders only)
+* Locking via a .lock (dotlock) file which is NFS-safe.
+
+Read more about locking in Mail::Box::Locker.
+
+= Managing folders
+
+A special folder manager was designed to keep track of opened folders.
+This is the main object that most users will use. (Read its
+documentation Mail::Box::Manager before trying anything else.)
+
+= Tied access
+
+If you like, you can tie a folder to an array, and use it that way.
+See Mail::Box::Tie.
+
+
+===== Differences with Mail::Folder
+
+The popular Mail::Folder package has been around for many years.  It
+is written to use Mail::Internet, instead of the more powerful
+MIME::Entity messages.  But Mail::Message objects are even more
+flexible.
+
+Mail::Folder does not support discussion thread detection, nor
+autoloading of message data.  Therefore, it is much slower in
+accessing the folders.
+
+Another major difference is that the object structure of Mail::Folder
+is less clear than that of Mail::Box.  The supported mailbox types are
+separately implemented and share less code than they could.  The
+folders manage themselves instead of being managed by a separate
+folder manager object.
+
+======
+
+Website:     http://perl.overmeer.net/mailbox/
+
+Mailinglist: mailbox-subscribe at perl.overmeer.net
+
+Author:      Mark Overmeer   mark at overmeer.net

Added: packages/libmail-box-perl/branches/upstream/current/README.FAQ
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/README.FAQ	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/README.FAQ	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,51 @@
+
+Frequently Asked Questions  (FAQ)
+
+This page may give an answer to your questions.  I hope you have
+contributions
+
+ 1) Why should I use the Mail::Box::Manager?
+
+    You can process folders using the Mail::Box::Mbox and Mail::Box::MH
+    objects, without a Mail::Box::Manager.  However, using the manager, your
+    application will work for any kind of folder because the manager will
+    autodetect the type, and because all folder objects share the same
+    interface!
+
+    Besides, the manager protects you from opening the same folder
+    twice (which may cause `inconvenience'), and can create
+    message threads.
+
+ 2) What are threads?
+
+    Very confusing, the word `thread' in mail folders has nothing to
+    do with the threads of Perl and UNIX.  Some operating systems (and
+    Perl) have give one program the possibility to start multiple
+    sub-programs within itself.  These are called `process-threads',
+    or `threads' for short.
+
+    However, in our context, we speak about `message-threads', which
+    describe the relationships between messages.  Each message may
+    contain the message-id of a message it is in reply to.  Usually
+    they also contain a list of references to all messages with the
+    same subject and a logical follow-up.
+
+    Mail::Box is able to give simplified access to `message threads'
+    (`threads' for short) via the Mail::Box::Manager.
+
+ 3) How can it be that Mail::Box folders show less messages in the
+    folder than other applications do?
+
+    Because Mail::Box has support for reading e-mail per thread, it
+    keeps an index based on message-id.  Every message shall have
+    a unique message-id, so when the same id is found again, that
+    message considered to be a copy and ignored.
+
+    By the way: this may remove a lot of spam ;)
+
+ 4) How can I fight SPAM?
+
+    Mail::Classifier is a package based on Mail::Box, which can be
+    trained to recognize Spam.  SpamAssassin is a rule based spam filter,
+    and can be used via Mail::Box::Search::SpamAssassin
+    

Added: packages/libmail-box-perl/branches/upstream/current/README.todo
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/README.todo	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/README.todo	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,65 @@
+
+TODO:
+
+This program was originally written in December 2000.  Then a total
+redesign was made, which was released in December 2001.  Hence this module
+is quite recent, so please check for a new version: new programs often
+get many changes in their first months.
+
+The file TODO.v2 lists lacks of the current implementation, which must
+be resolved to declare the implementation as beta.  In this file, more
+long-term plans are listed.
+
+Plans for the (near?) future:
+* Thread lint
+  Currently, threads are only detected based on some fields in the
+  message header which are dedicated for this (the In-Reply-To and
+  the References field), however, there are many more ways to
+  try to correct things if these are not present.
+
+  If a message does not contain the two mentioned fields, then look
+  for a message which is at most a few days younger, whose sender is
+  in the recipient-list of the current message, and where parts of
+  the message are quoted (preceded by some symbols).
+
+* Persistent external files
+  Extracting large message-parts into persistent external files.
+  Mime::Entity puts attachments in external files during parsing.  When
+  the message is put in a folder again, the content is glued back into
+  the folder.  It should be nice to keep them external, such that the
+  folder-file is much smaller, and parsing done quickly.
+
+* Many more folder-types
+  I have a long wishlist of older-types.  However, my knowledge on how
+  they work is limited.  Furthermore, I do not have test-data on them.
+
+  - Exmh      (should be relatively simple, extends MH)
+  - IMAP      (using Mail::IMAPClient, looks not that hard)
+  - Emaul     (? for compatibly with Mail::Folder)
+  - News      NNTP
+  - Outlook   writting... (reading is already available in ::Dbx)
+  - Exchange
+  - Netscape
+  - Zip       Compressed folders
+  - Encrypt
+  - DBI       Database
+
+  Any more?
+  One of the main reasons that these are not implemented, is that my
+  knowledge on how they work is insufficient.
+
+* Make more autoloading (of perl-code, this time).
+  Mail::Box::MH, ::Mbox, could be made autoloading....
+  however, I didn't make work it yet.  All modules are designed to
+  minimize their dependency, so I should work well.
+
+  For the message-folders, only foundIn() should be kept outside the
+  loading mechanism.
+
+* Kill a message which is used to free-up memory in large folders.
+
+* Maildir quota
+
+* Cooperation with OpenPGP
+
+* MD5 checksums and more

Added: packages/libmail-box-perl/branches/upstream/current/TODO.v2
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/TODO.v2	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/TODO.v2	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,40 @@
+
+This file lists the things to do
+
+Obligatory:
+
+  Processing folders with non-platform-native line separators.
+  appendMessage opens folder, but not needed.
+
+Optional:
+
+  fix_header_errors option for Mail::Box::Parser::C
+
+  Body::* _data_from_*() may use $. in some cases.  This would speed-up
+  body creation.
+
+  Automatic detection of best body-type in Mail::Message::Body::new
+  can be done better.  For instance: use ::Body::Extern for binaries.
+
+  Mail::Message::Body::External
+  Mail::Message::Body::InFolder
+
+  Doc re-read.
+
+  examples/
+
+  Mail::Message::Head::Delayed::read()
+
+  guessBodySize in MH can be implemented without trigger
+
+  Mail::Message::Body::Scalar can get nrLines from read()
+
+  fromBody with nested multiparts at once.
+
+  updateMessages for Mail::Box::Mbox
+  updateMessages for Mail::Box::MH
+  demoting messages which stay when their folder closes.
+  concatenate within reply must shape after source message, not prelude
+  $body->beautify;
+
+  Maildir quota

Added: packages/libmail-box-perl/branches/upstream/current/examples/build.pl
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/examples/build.pl	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/examples/build.pl	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,76 @@
+#!/usr/bin/perl
+
+# Demonstration on how to use create complex messages from building
+# bricks.
+#
+# This code can be used and modified without restriction.
+# Mark Overmeer, <mailbox at overmeer.net>, 16 nov 2001
+
+use warnings;
+use strict;
+use lib '..', '.';
+use Mail::Box::Manager 2.00;
+
+# Not needed for the build method, which is demonstrated here, but
+# for the structures used to create the demonstration.
+use Mail::Message::Body;
+
+#
+# Get the command line arguments.
+#
+
+die "Usage: $0 outfile\n"
+    unless @ARGV == 1;
+
+my $outfile = shift @ARGV;
+
+#
+# There are many ways you can add data to new messages.  Below is
+# a example which uses files which may not be available on you machine.
+# Modify the names for your system.
+#
+
+my $anybody = Mail::Message::Body->new(data => <<'A_FEW_LINES');
+Just a few lines to show that you
+can add prepared bodies to the message
+which is built.
+A_FEW_LINES
+
+my $vcard = Mail::Message::Body->new
+ ( mime_type => 'text/x-vcard', data => <<'SIG');
+This is a signature.  It has a different type.
+SIG
+
+#
+# The next part is what I want to demonstrate
+#
+
+my $message = Mail::Message->build
+ ( From          => 'me at example.com'
+ , To            => 'you at demosite.net'
+ , 'In-Reply-To' => '<iwufd87.sfu76k>'
+
+ , data          => <<'FIRST_PART'
+This is the first part of the multi-part message which will be created.
+If only one source of data is specified, a single part message is
+produced.
+FIRST_PART
+
+ , file          => '/etc/passwd'
+ , file          => '/usr/src/linux/Documentation/logo.gif'
+ , attach        => $anybody
+ , attach        => $vcard
+ );
+
+#
+# The message is ready to be printed, transmitted, and/or added to
+# a folder.
+#
+
+die "Cannot create $outfile: $!\n"
+   unless open OUT, '>', $outfile;
+
+$message->print(\*OUT);
+
+# $message->send;
+# $folder->addMessage($message);

Added: packages/libmail-box-perl/branches/upstream/current/examples/grep.pl
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/examples/grep.pl	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/examples/grep.pl	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,45 @@
+#!/usr/bin/perl
+
+# Demonstration of a simple search.
+#
+# This code can be used and modified without restriction.
+# Mark Overmeer, <mailbox at overmeer.net>, 17 feb 2002
+# Updated 16 jan 2003 to work more like unix-grep syntax
+
+use warnings;
+use strict;
+use lib '..', '.';
+
+use Mail::Box::Manager 2.008;
+use Mail::Box::Search::Grep;
+
+#
+# Get the command line arguments.
+#
+
+die "Usage: $0 pattern mailboxes\n"
+    unless @ARGV >= 2;
+
+my ($pattern, @mailboxes) = @ARGV;
+
+my $mgr = Mail::Box::Manager->new;
+
+foreach my $mailbox (@mailboxes)
+{   my $folder = $mgr->open($mailbox);
+    unless(defined $folder)
+    {   warn "*** Cannot open folder $mailbox.\n";
+        next;
+    }
+
+    print "*** Scanning through $mailbox\n"
+       if @mailboxes > 1;
+
+    my $grep = Mail::Box::Search::Grep->new
+      ( in      => 'MESSAGE'
+      , match   => qr/$pattern/
+      , details => 'PRINT'
+      );
+
+    $grep->search($folder);
+    $folder->close;
+}

Added: packages/libmail-box-perl/branches/upstream/current/examples/multipart.pl
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/examples/multipart.pl	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/examples/multipart.pl	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,74 @@
+#!/usr/bin/perl
+
+# Print the types of messages in the folder.  Multi-part messages will
+# be shown with all their parts.
+#
+# This code can be used and modified without restriction.
+# Mark Overmeer, <mailbox at overmeer.net>, 9 nov 2001
+
+use warnings;
+use strict;
+use lib '..', '.';
+
+use Mail::Box::Manager 2.00;
+
+sub show_type($;$);
+
+#
+# Get the command line arguments.
+#
+
+die "Usage: $0 folderfile\n"
+    unless @ARGV==1;
+
+my $filename = shift @ARGV;
+
+#
+# Open the folder
+#
+
+my $mgr    = Mail::Box::Manager->new;
+
+my $folder = $mgr->open
+   ( $filename
+   , extract    => 'LAZY'   # never take the body unless needed
+   );                       #  which saves memory and time.
+
+die "Cannot open $filename: $!\n"
+    unless defined $folder;
+
+#
+# List all messages in this folder.
+#
+
+my @messages = $folder->messages;
+print "Mail folder $filename contains ", scalar @messages, " messages:\n";
+
+my $counter  = 1;
+foreach my $message (@messages)
+{   printf "%3d. ", $counter++;
+    print $message->get('Subject') || '<no subject>', "\n";
+
+    show_type $message;
+}
+
+sub show_type($;$)
+{   my $msg    = shift;
+    my $indent = (shift || '') . '    ';   # increase indentation
+
+    print $indent, " type=", $msg->get('Content-Type'), ', '
+      , $msg->size, " bytes\n";
+
+    if($msg->isMultipart)
+    {   foreach my $part ($msg->parts)
+        {   show_type $part, $indent;
+        }
+    }
+}
+
+#
+# Finish
+#
+
+$folder->close;
+

Added: packages/libmail-box-perl/branches/upstream/current/examples/open.pl
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/examples/open.pl	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/examples/open.pl	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,55 @@
+#!/usr/bin/perl
+
+# Demonstration on how to use the manager to open folders, and then
+# to print the headers of each message.
+#
+# This code can be used and modified without restriction.
+# Mark Overmeer, <mailbox at overmeer.net>, 9 nov 2001
+
+use warnings;
+use strict;
+use lib '..', '.';
+
+use Mail::Box::Manager 2.00;
+
+#
+# Get the command line arguments.
+#
+
+die "Usage: $0 folderfile\n"
+    unless @ARGV==1;
+
+my $filename = shift @ARGV;
+
+#
+# Open the folder
+#
+
+my $mgr    = Mail::Box::Manager->new;
+
+my $folder = $mgr->open
+   ( $filename
+   , extract => 'LAZY'   # never take the body unless needed
+   );                    #  which saves memory and time.
+
+die "Cannot open $filename: $!\n"
+    unless defined $folder;
+
+#
+# List all messages in this folder.
+#
+
+my @messages = $folder->messages;
+print "Mail folder $filename contains ", scalar @messages, " messages:\n";
+
+my $counter  = 1;
+foreach my $message (@messages)
+{   printf "%3d. ", $counter++;
+    print $message->get('Subject') || '<no subject>', "\n";
+}
+
+#
+# Finish
+#
+
+$folder->close;

Added: packages/libmail-box-perl/branches/upstream/current/examples/reply.pl
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/examples/reply.pl	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/examples/reply.pl	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,128 @@
+#!/usr/bin/perl
+
+# Demonstration on how to create a reply based on some message in
+# some folder.
+#
+# Usage:
+#      ./reply.pl folder messagenr [signaturefile]
+#
+# This code can be used and modified without restriction.
+# Mark Overmeer, <mailbox at overmeer.net>, 9 nov 2001
+
+use warnings;
+use strict;
+use lib '..', '.';
+
+use Mail::Box::Manager 2.00;
+use Mail::Message::Body::Lines;
+use Mail::Message::Construct;
+
+#
+# Get the command line arguments.
+#
+
+die "Usage: $0 folderfile messagenr [signaturefile]\n"
+    unless @ARGV==3 || @ARGV==2;
+
+my ($filename, $msgnr, $sigfile) = @ARGV;
+
+# You may create different kinds of objects to store body data, but
+# usually the ::Lines object is ok.  If you handle a body as 'reply'
+# does, you want fast access to the separate lines.  Preferably use
+# ::File when the data is binary, and ::String when it is to be
+# converted as a whole.  Each type will work, but the performance will
+# differ.
+
+my $bodytype = 'Mail::Message::Body::Lines';
+
+#
+# Open the folder
+#
+
+my $mgr    = Mail::Box::Manager->new;
+
+my $folder = $mgr->open
+   ( $filename
+   , extract => 'LAZY'   # never take the body unless needed
+   );                    #  which saves memory and time.
+
+die "Cannot open $filename: $!\n"
+    unless defined $folder;
+
+#
+# Get the message to reply to
+#
+
+die "There are only ",scalar $folder->messages, " messages in $filename.\n"
+   if $msgnr > $folder->messages;
+
+my $orig = $folder->message($msgnr);
+
+#
+# Create the reply prelude.
+# The default only produces the replyPrelude line, but we extend it
+# a little.
+#
+
+my $prelude = <<'PRELUDE';
+Dear friend,
+
+This automatically produced message is just a reply on yours.  Please
+do not be disturbed.  Best wishes, Me, myself, and I.
+
+PRELUDE
+
+$prelude .= $orig->replyPrelude($orig->get('From'));  # The usual quote line.
+
+#
+# The postlude is appended after the inlined source text.  It is
+# less visible than the prelude, because the quoted source text
+# may be very long.  However, when include is ATTACH on NO, the
+# body is turned into one line, so this will be neat.
+#
+
+my $postlude = <<'POST';
+
+Herewith, I reply to your message, and I intend to ignore it completely
+unless you plan to complain to my boss about that.
+
+ See you (hope not)
+
+POST
+
+#
+# Create a new signature
+#
+
+my $signature;
+if(defined $sigfile)
+{   $signature = $bodytype->new
+      ( mime_type => 'text/x-vCard'
+      , file      => $sigfile
+      );
+}
+else
+{   $signature = $bodytype->new(mime_type => 'text/x-vCard', data => <<'SIG');
+This is my signature.  It is attached, in case we create
+a multipart reply, and inlined otherwise.
+SIG
+}
+
+#
+# Create reply
+# The original signature is stripped, the message is quoted, and a
+# new signature is added.
+#
+
+my $reply = $orig->reply
+ ( prelude   => $prelude
+ , postlude  => $postlude
+ , signature => $signature
+ );
+
+
+# And now
+$reply->print;
+# or $reply->send;
+
+$folder->close;

Added: packages/libmail-box-perl/branches/upstream/current/examples/send.pl
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/examples/send.pl	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/examples/send.pl	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,55 @@
+#!/usr/bin/perl
+
+# Demonstration on sending simple messages.
+#
+# This code can be used and modified without restriction.
+# Mark Overmeer, <mailbox at overmeer.net>, 20 nov 2001
+# 16 jan 2003, added some options
+
+use warnings;
+use strict;
+use lib '..', '.';
+
+use Mail::Box;
+
+#
+# Get the command line arguments.
+#
+
+die "Usage: $0 email-address\n"
+    unless @ARGV==1;
+
+my $email = shift @ARGV;
+
+#
+# Create a simple message
+#
+
+my $message = Mail::Message->build
+  ( From    => 'me at localhost.com'
+  , To      => $email
+  , Subject => 'A sunny day'
+# , Cc      => 'NINJA <ninja>, Mark Overmeer <markov>'
+
+  , data => <<'TEXT'
+This is an automatically generated message.
+I hope you have a nice day.
+TEXT
+ );
+
+#
+# Transmit the message, leaving the decission how over to the
+# Mail::Transmit package.
+#
+
+warn "Sending returned error $!\n"
+   unless $message->send;
+
+$message->send
+  ( via        => 'sendmail'      # you can do even without this line
+# , trace      => 'NOTICE'
+# , executable => 'C:\lib\sendmail.exe'
+# , debug_smtp => 1
+# , timeout    => 300
+# , retry      => 5
+  );

Added: packages/libmail-box-perl/branches/upstream/current/examples/smaller.pl
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/examples/smaller.pl	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/examples/smaller.pl	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,88 @@
+#!/usr/bin/perl
+
+# Demonstration on reducing the size of a folder.
+#
+# This code can be used and modified without restriction.
+# Mark Overmeer, <mailbox at overmeer.net>, 12 jul 2003
+
+use warnings;
+use strict;
+use lib ('../lib', 'lib');
+
+use Mail::Box::Manager;
+use Mail::Message;
+use List::Util 'sum';
+
+my $for_real = 0;   # set to 'true' to make changes
+sub size($) { Mail::Message->shortSize($_[0]) }  # nice output of value
+
+#
+# Get the command line arguments.
+#
+
+die "Usage: $0 folder\n"
+    unless @ARGV==1;
+
+my $name   = shift @ARGV;
+my $mgr    = Mail::Box::Manager->new;
+
+my $folder = $mgr->open
+  ( $name
+  , access => ($for_real ? 'rw' : 'r')
+  );
+
+die "Cannot open folder $name" unless $folder;
+print "** Dry run: no changes made to $name\n" unless $for_real;
+
+my $msgs = $folder->messages;
+my $size = $folder->size;
+print "Folder contains $msgs messages at start, in total about ",
+    size($size), " bytes\n";
+
+foreach my $msg ($folder->messages)
+{   $msg->head->removeResentGroups;
+}
+
+my $newsize = $folder->size;
+print "After removal of resent groups, the folder is about ",
+    size($newsize), " bytes\n";
+my $resentsize = $size - $newsize;
+
+foreach my $msg ($folder->messages)
+{   $msg->head->removeListGroup;
+}
+
+my $newsize2 = $folder->size;
+print "After removal of list groups, the folder is only ",
+    size($newsize2), " bytes\n";
+my $listsize = $newsize - $newsize2;
+
+foreach my $msg ($folder->messages)
+{   $msg->head->removeSpamGroups;
+}
+my $finalsize = $folder->size;
+print "After removal of spam groups, the folder is only ",
+    size($finalsize), " bytes\n";
+my $spamsize = $newsize2 - $finalsize;
+
+# Final statistics
+sub percent($$)
+{   my ($part, $size) = @_;
+    sprintf "%4.1f%%  (%s)", ($part*100)/$size, size($part);
+}
+
+my $sizeheads = sum map {$_->head->size}
+                       map {$_->parts}
+		           $folder->messages;
+
+print '  resent headers were   ', percent($resentsize,$size), "\n",
+      '  list headers were     ', percent($listsize,$size), "\n",
+      '  spam headers were     ', percent($spamsize,$size), "\n",
+      '  remaining headers are ', percent($sizeheads, $size), "\n",
+      '  size of bodies is     ', percent($finalsize-$sizeheads, $size), "\n";
+
+# End
+if($for_real) { $folder->close }
+else          { $folder->close(write => 'NEVER') }
+
+exit 0;

Added: packages/libmail-box-perl/branches/upstream/current/examples/strip-attachments.pl
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/examples/strip-attachments.pl	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/examples/strip-attachments.pl	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,130 @@
+#!/usr/bin/perl
+#
+# $Id: strip-attachments.pl,v 1.4 2002/11/30 12:14:01 wrk Exp $
+#
+# Strip attachments using Mail::Box module.
+#
+# Usage:
+#
+#   perl strip-attachments.pl mbox
+#
+# This script reads a mailbox ($ARG1) and writes attachments larger than
+# 16K to a folder (./attachments/). Next it deletes the attachment from
+# the E-mail and writes it to a file named $ARG1.stripped.
+#
+# By Pjotr Prins <pjotr at pckassa.com>, $Date: 2002/11/30 12:14:01 $
+#
+# This code can be used and modified without restriction.
+# Code based on example by Mark Overmeer, <mailbox at overmeer.net>, 9 nov 2001
+
+# In this example, the stripped data is written to a different folder.
+# You may not need that (but please be careful: test your script well!)
+# Simply remove everything related to $outbox and $outfilename, and open
+# the source folder with access => 'rw'
+
+# You may want to have a look at Mail::Message::Convert::Rebuild, which
+# the provides the $msg->rebuild() method.
+
+# BE WARNED: when different messages specify the same filename for a part,
+# they will overwrite another... you may want a message sequency number in
+# the path of the output file.
+
+use warnings;
+use strict;
+use lib '..', '.';
+
+use Mail::Box::Manager;    # everything else will auto-compile when used
+
+use File::Basename 'basename';
+use File::Spec;
+
+my $attachments = 'attachments';
+
+#
+# Get the command line arguments.
+#
+
+die "Usage: $0 folderfile\n"
+    unless @ARGV==1;
+
+my $filename = shift @ARGV;
+
+#
+# Create Attachments directory if non existent
+#
+
+   -d $attachments
+or mkdir $attachments
+or die "Cannot create directory $attachments\n";
+
+#
+# Open the folders
+#
+
+my $mgr    = Mail::Box::Manager->new;
+my $folder = $mgr->open
+   ( $filename
+   , extract    => 'LAZY'   # never take the body unless needed
+   );                       #  which saves memory and time.
+
+die "Cannot open $filename: $!\n"
+    unless defined $folder;
+
+my $outfilename = "$filename.stripped";
+# die "File $outfilename exists!" if -e $outfilename;
+
+my $outbox = $mgr->open
+  ( $outfilename
+  , access   => 'a'        # append,
+  , create   => 1          # create if not existent
+  );
+
+die "Cannot open $outfilename to write: $!\n"
+    unless defined $outbox;
+
+my @messages = $folder->messages;
+print "Mail folder $filename contains ", scalar @messages, " messages:\n";
+
+my $counter  = 1;
+foreach my $message (@messages)
+{   printf "%3d. ", $counter++;
+    print $message->get('Subject') || '<no subject>', "\n";
+
+    $message->printStructure;
+    my $m = $message->clone;
+
+    unless($m->isMultipart)
+    {   $outbox->addMessage($m);
+        next;
+    }
+
+    foreach my $part ($m->parts)
+    {
+         # Strip attachments larger than 16K. Another example would be:
+         #   if ($part->body->mimeType ne 'text/plain')
+         next unless $part->body->size > 16384;
+
+         print "\n**** Stripping Attachment "; # ,$part->head,"\n";
+         my $disp     = $part->body->disposition;
+         my $name     = $disp->attribute('filename')
+                     || $disp->attribute('name');
+
+         # a major security hole if you accept any path!
+         $filename    = basename $name;
+
+         my $attachment = File::Spec->catfile($attachments, $filename);
+         print $attachment,"\n";
+
+         unless(-f $attachment)     #  Write attachment to file
+         {   open(FH, ">$attachment");
+             $part->decoded->print(\*FH);
+             close(FH);
+         }
+
+         $part->delete;
+    }
+
+    $outbox->addMessage($m);
+}
+
+$mgr->closeAllFolders;

Added: packages/libmail-box-perl/branches/upstream/current/examples/takelarge.pl
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/examples/takelarge.pl	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/examples/takelarge.pl	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,71 @@
+#!/usr/bin/perl
+
+# Demonstrates how to select some messages from one folder, and move
+# them to a different folder.  In this case, the first argument is
+# the existing folder, the second will contain the messages larger
+# than the specified size:
+#
+#       takelarge.pl infolder outfolder minsize
+
+# *******************************************************************
+# * WARNING: the content of infolder will be reduced!!! Don't do this
+# *          on your real folders.... it's only a demo
+# *******************************************************************
+
+# This code can be used and modified without restriction.
+# Mark Overmeer, <mailbox at overmeer.net>, 9 nov 2001
+
+use warnings;
+use strict;
+use lib '..', '.';
+
+use Mail::Box::Manager 2.00;
+
+#
+# Get the command line arguments.
+#
+
+die "Usage: $0 folder-from folder-to size\n"
+    unless @ARGV==3;
+
+my ($infile, $outfile, $size) = @ARGV;
+
+#
+# Open the folder
+#
+
+my $mgr    = Mail::Box::Manager->new;
+
+my $inbox  = $mgr->open
+  ( $infile
+  , access    => 'rw'      # to update deleted
+  , extract   => 'ALWAYS'  # read all bodies immediately: faster
+  );
+
+die "Cannot open $infile to read: $!\n"
+    unless defined $inbox;
+
+my $outbox = $mgr->open
+  ( $outfile
+  , access   => 'a'        # append,
+  , create   => 1          # create if not existent
+  );
+
+die "Cannot open $outfile to write: $!\n"
+    unless defined $outbox;
+
+foreach my $message ($inbox->messages)
+{   next if $message->size < $size;
+
+    $mgr->moveMessage($outbox, $message);
+    print 'Moved "',$message->get('Subject') || '<no subject>'
+       ,  '": ', $message->size, " bytes.\n";
+}
+
+#
+# Finish
+#
+
+#$inbox->close;
+#$outbox->close;
+$mgr->closeAllFolders;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dbx/Message.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dbx/Message.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dbx/Message.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,129 @@
+
+use strict;
+use warnings;
+
+package Mail::Box::Dbx::Message;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box::File::Message';
+
+use Carp;
+use File::Copy qw/move/;
+
+use Mail::Message::Body::String;
+use Mail::Message::Head::Partial;
+
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    my $dbx = $args->{dbx_record};
+    unless(defined $dbx)
+    {   $self->log(ERROR => 'Dbx record required to create the message.');
+        return;
+    }
+    push @{$args->{labels}}, (seen => $dbx->is_seen);
+
+    $self->SUPER::init($args);
+
+    $self->{MBDM_dbx}          = $dbx;
+    $self->{MBDM_account_name} = $args->{account_name} || $dbx->oe_account_name;
+    $self->{MBDM_account_nr}   = $args->{account_nr}   || $dbx->oe_account_num;
+    $self;
+}
+
+#-------------------------------------------
+
+sub loadHead()
+{   my $self     = shift;
+    my $head     = $self->head;
+    return $head unless $head->isDelayed;
+
+    $self->loadBody;
+    $self->head;
+}
+
+#-------------------------------------------
+
+sub loadBody()
+{   my $self     = shift;
+
+    my $body     = $self->body;
+    return $body unless $body->isDelayed;
+
+    my $dbx      = $self->dbxRecord or return;
+    unless(defined $dbx)
+    {   $self->log(ERROR => 'Unable to read delayed message.');
+        return;
+    }
+
+    my $head;
+    if(my $text = $dbx->as_string)
+    {   my $message = Mail::Message->read($text);
+        $head    = $message->head;
+        $head->modified(0);
+        $body    = $message->body;
+    }
+    else
+    {   # of course, it is not a complete head :(  probably, we need a
+        # new object...  put for now, make it simple.
+        $head     = Mail::Message::Head::Partial->new;
+        my $ff = 'Mail::Message::Field::Fast';
+
+        $head->addNoRealize($ff->new(Subject => $dbx->subject));
+        $head->addNoRealize($ff->new('Message-ID' => $dbx->msgid));
+        $head->addNoRealize($ff->new('X-Dbx-Account-Name'=>$self->accountName));
+        $head->addNoRealize($ff->new('X-Dbx-Account-Nr'=> $self->accountNr));
+
+        if(my $parents = $dbx->parents_ids)
+        {   $head->addNoRealize($ff->new(References => $parents));
+        }
+
+        # I know this is not the right date, but at least it is something.
+        $head->addNoRealize($ff->new(Date => $ff->toDate($dbx->rcvd_gmtime)));
+
+        if(my $send_addr = $dbx->sender_address)
+        {   my $sender = Mail::Address->new($dbx->sender_name, $send_addr);
+            # This should be stored in Sender, because From can have
+            # more than one address,.... however... this is Outlook.
+            $head->addNoRealize($ff->new(From => $send_addr));
+        }
+
+        if(my $to_addr = $dbx->recip_address)
+        {   my $to     =  Mail::Address->new($dbx->recip_name, $to_addr);
+            # Also not correct to put it in To: Delivered-To is the
+            # right choice.  But it is nice to have a To field...
+            $head->addNoRealize($ff->new(To => $to));
+        }
+
+        $body = Mail::Message::Body::String->new(data => << 'NOBODY');
+ * The contents of this message was not received
+
+NOBODY
+    }
+
+    $self->head($head);
+    $self->storeBody($body);
+
+    $self->log(PROGRESS => 'Loaded delayed message.');
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub dbxRecord() { shift->{MBDM_dbx} }
+
+#-------------------------------------------
+
+
+sub accountName() { shift->{MBDM_account_name} }
+
+#-------------------------------------------
+
+
+sub accountNr() { shift->{MBDM_account_nr} }
+
+#-------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dbx/Message.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dbx/Message.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dbx/Message.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,1004 @@
+
+=head1 NAME
+
+Mail::Box::Dbx::Message - one message in a Dbx folder
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Dbx::Message
+   is a Mail::Box::File::Message
+   is a Mail::Box::Message
+   is a Mail::Message
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my $folder = new Mail::Box::Dbx ...
+ my $message = $folder->message(10);
+
+
+=head1 DESCRIPTION
+
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message/"Constructors">
+
+=back
+
+Mail::Box::Dbx::Message-E<gt>B<coerce>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box::Message/"METHODS">
+
+=back
+
+Mail::Box::Dbx::Message-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option        Defined in       Default                                                       
+ account_name                   <from dbx_record>                                             
+ account_nr                     <from dbx_record>                                             
+ body          L<Mail::Message>  undef                                                         
+ body_type     L<Mail::Box::Message>  <from folder>                                                 
+ dbx_record                     <required>                                                    
+ deleted       L<Mail::Message>  <false>                                                       
+ field_type    L<Mail::Message>  undef                                                         
+ folder        L<Mail::Box::Message>  <required>                                                    
+ from_line     L<Mail::Box::File::Message>  undef                                                         
+ head          L<Mail::Message>  undef                                                         
+ head_type     L<Mail::Message>  L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>
+ labels        L<Mail::Message>  {}                                                            
+ log           L<Mail::Reporter>  C<'WARNINGS'>                                                 
+ messageId     L<Mail::Message>  undef                                                         
+ modified      L<Mail::Message>  <false>                                                       
+ seen                           <from dbx_record>                                             
+ size          L<Mail::Box::Message>  undef                                                         
+ trace         L<Mail::Reporter>  C<'WARNINGS'>                                                 
+ trusted       L<Mail::Message>  <false>                                                       
+
+. account_name STRING
+
+=over 4
+
+The string representation of the account which was used to retreive the
+message.
+
+=back
+
+. account_nr INTEGER
+
+=over 4
+
+The numeric representation of the account which was used to retrieve
+the message.
+
+=back
+
+. body OBJECT
+
+. body_type CODE|CLASS
+
+. dbx_record C<Mail::Transport::Dbx::Email>
+
+. deleted BOOLEAN
+
+. field_type CLASS
+
+. folder FOLDER
+
+. from_line STRING
+
+. head OBJECT
+
+. head_type CLASS
+
+. labels ARRAY|HASH
+
+. log LEVEL
+
+. messageId STRING
+
+. modified BOOLEAN
+
+. seen BOOLEAN
+
+=over 4
+
+A flag (see L<label()|Mail::Message/"Flags">) which tells wether this message has been read
+by the user.  If read, them message is I<old>, which is the same as
+I<seen>.  Folders store this flag in different ways.
+
+=back
+
+. size INTEGER
+
+. trace LEVEL
+
+. trusted BOOLEAN
+
+=back
+
+=head2 Constructing a message
+
+
+$obj-E<gt>B<bounce>([RG-OBJECT|OPTIONS])
+
+=over 4
+
+See L<Mail::Message::Construct::Bounce/"Constructing a message">
+
+=back
+
+Mail::Box::Dbx::Message-E<gt>B<build>([MESSAGE|BODY], CONTENT)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+Mail::Box::Dbx::Message-E<gt>B<buildFromBody>(BODY, [HEAD], HEADERS)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forward>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardAttach>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardEncapsulate>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardInline>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardNo>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPostlude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPrelude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardSubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+Mail::Box::Dbx::Message-E<gt>B<read>(FILEHANDLE|SCALAR|REF-SCALAR|ARRAY-OF-LINES, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Read/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<rebuild>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<reply>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replyPrelude>([STRING|FIELD|ADDRESS|ARRAY-OF-THINGS])
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replySubject>(STRING)
+
+Mail::Box::Dbx::Message-E<gt>B<replySubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+=head2 The Message
+
+
+$obj-E<gt>B<container>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isDummy>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isPart>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<messageId>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<send>([MAILER], OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<toplevel>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<write>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Box::File::Message/"METHODS">
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<bcc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<cc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<date>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<destinations>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<from>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<get>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<guessTimestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<head>([HEAD])
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<sender>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<study>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<subject>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<timestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<to>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+=head2 The body
+
+
+$obj-E<gt>B<body>([BODY])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<decoded>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<encode>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isNested>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<parts>(['ALL'|'ACTIVE'|'DELETED'|'RECURSE'|FILTER])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+=head2 Flags
+
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<deleted>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isDeleted>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<label>(LABEL|PAIRS)
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<labels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<labelsToStatus>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<statusToLabels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+=head2 The whole message as text
+
+
+$obj-E<gt>B<file>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<lines>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<printStructure>([FILEHANDLE][, INDENT])
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+=head2 The message
+
+
+$obj-E<gt>B<copyTo>(FOLDER)
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<dbxRecord>
+
+=over 4
+
+Returns the Mail::Transport::Dbx::Email record of the message.
+
+=back
+
+$obj-E<gt>B<folder>([FOLDER])
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<fromLine>([LINE])
+
+=over 4
+
+See L<Mail::Box::File::Message/"The message">
+
+=back
+
+$obj-E<gt>B<moveTo>(FOLDER)
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<seqnr>([INTEGER])
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<diskDelete>
+
+=over 4
+
+See L<Mail::Box::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<fileLocation>
+
+=over 4
+
+See L<Mail::Box::File::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<loadBody>
+
+=over 4
+
+See L<Mail::Box::File::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<moveLocation>(DISTANCE)
+
+=over 4
+
+See L<Mail::Box::File::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readBody>(PARSER, HEAD [, BODYTYPE])
+
+=over 4
+
+See L<Mail::Box::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readFromParser>(PARSER)
+
+=over 4
+
+See L<Mail::Box::File::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readHead>(PARSER [,CLASS])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<recursiveRebuildPart>(PART, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Internals">
+
+=back
+
+$obj-E<gt>B<storeBody>(BODY)
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<takeMessageId>([STRING])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Message::Construct/"METHODS">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Dbx::Message-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Dbx::Message-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Dbx::Message-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortSize>([VALUE])
+
+Mail::Box::Dbx::Message-E<gt>B<shortSize>([VALUE])
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortString>
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<destruct>
+
+=over 4
+
+See L<Mail::Box::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+=head2 The flags
+
+
+$obj-E<gt>B<accountName>
+
+=over 4
+
+Returns the Outlook Express account name which was used to retreive
+this message, represented as a string.  The L<accountNr()|Mail::Box::Dbx::Message/"The flags"> returns
+a numerical representation of the same fact.
+
+=back
+
+$obj-E<gt>B<accountNr>
+
+=over 4
+
+Returns the Outlook Express account name which was used to retreive
+this message, represented as a number.  The L<accountName()|Mail::Box::Dbx::Message/"The flags"> returns
+a string representation of the same fact.
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot include forward source as $include.
+
+Unknown alternative for the L<forward(include)|Mail::Message::Construct::Forward/"Constructing a message">.  Valid choices are
+C<NO>, C<INLINE>, C<ATTACH>, and C<ENCAPSULATE>.
+
+I<Error:> Cannot include reply source as $include.
+
+Unknown alternative for the C<include> option of L<reply()|Mail::Message::Construct::Reply/"Constructing a message">.  Valid
+choices are C<NO>, C<INLINE>, and C<ATTACH>.
+
+I<Error:> Dbx record required to create the message.
+
+
+I<Error:> No address to create forwarded to.
+
+If a forward message is created, a destination address must be specified.
+
+I<Error:> No default mailer found to send message.
+
+The message L<send()|Mail::Message/"The Message"> mechanism had not enough information to automatically
+find a mail transfer agent to sent this message.  Specify a mailer
+explicitly using the C<via> options.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Unable to read delayed body.
+
+
+I<Error:> forwardAttach requires a preamble object
+
+
+I<Error:> forwardEncapsulate requires a preamble object
+
+
+I<Error:> no rebuild rule $name defined.
+
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dbx.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dbx.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dbx.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,164 @@
+
+use strict;
+package Mail::Box::Dbx;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box::File';
+
+use Mail::Box::Dbx::Message;
+use Mail::Message::Head::Delayed;
+use Mail::Message::Body::Delayed;
+
+use Mail::Transport::Dbx 0.04;
+use File::Basename 'dirname';
+
+
+my $default_folder_dir    = '.';
+
+sub init($)
+{   my ($self, $args) = @_;
+    $args->{folder}     ||= '=Folders.dbx';
+    $args->{folderdir}  ||= $default_folder_dir;
+    $args->{lock_type}  ||= 'NONE';
+
+    $self->SUPER::init($args) or return;
+
+    $self->log(WARNING => "Dbx folders are read-only.")
+        if $self->writable;
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub create($@) {  shift->notImplemented }
+
+#-------------------------------------------
+
+
+sub foundIn($@)
+{   my $class = shift;
+    my $name  = @_ % 2 ? shift : undef;
+    my %args  = @_;
+
+    $name   ||= $args{folder} or return;
+    $name =~ m/\.dbx$/i;
+}
+
+#-------------------------------------------
+
+sub writeMessages($) { shift->notImplemented }
+sub appendMessages($) { shift->notImplemented }
+sub type() { 'dbx' }
+
+#-------------------------------------------
+
+sub readMessages()
+{   my ($self, %args) = @_;
+
+    my @log      =  $self->logSettings;
+    my @msgopts  =
+     ( @log
+     , folder     => $self
+     , head_type  => $args{head_type}
+     , field_type => $args{field_type}
+     , trusted    => $args{trusted}
+     );
+
+    my $parser    = $self->parser
+        or return;
+
+    my $head_type = $self->{MB_head_delayed_type};
+    my $body_type = $self->{MB_body_delayed_type};
+
+    foreach my $record ($parser->emails)
+    {   my $head    = $head_type->new(@log);
+
+        my $message = $args{message_type}->new
+          ( @msgopts
+          , dbx_record => $record
+          , head       => $head_type->new(@log)
+          ) or next;
+
+        $message->storeBody($body_type->new(@log, message => $message));
+        $self->storeMessage($message);
+    }
+
+    $self;
+}
+
+#-------------------------------------------
+
+sub updateMessages() { shift }
+
+#-------------------------------------------
+
+sub nameOfSubFolder($)
+{   my ($self, $name) = (shift, shift);
+    my $dirname = dirname $self->filename;
+    File::Spec->catfile($dirname, "$name.dbx");
+}
+
+#-------------------------------------------
+
+
+sub listSubFolders(@)
+{   my ($thingy, %args)  = @_;
+    my $self       = ref $thingy ? $thingy : $thingy->new;
+    my $skip_empty = $args{skip_empty} || 0;
+    my $check      = $args{check}      || 0;
+
+    my $parser     = $self->parser
+       or return;
+
+    my @subs       = map { $_->name } $parser->subfolders;
+
+    if($args{check})
+    {    my $dir   = dirname $self->filename;
+         @subs     = grep { -f File::Spec->catfile($dir, $_.'.dbx') } @subs;
+    }
+
+    return @subs unless $skip_empty;
+
+    my @filled;
+    foreach my $sub (@subs)
+    {   my $f = $self->openSubFolder($sub, lock_type => 'NONE');
+        push @filled, $f if defined $f && scalar($f->messages);
+    }
+    @filled;
+}
+
+#-------------------------------------------
+
+
+sub folderToFilename($$)
+{   my ($thingy, $name, $folderdir) = @_;
+    return $name if File::Spec->file_name_is_absolute($name);
+    $name     =~ s#^=#$folderdir/#;
+    $name;
+}
+
+#-------------------------------------------
+
+
+sub parser()
+{   my $self     = shift;
+    return $self->{MBD_parser}
+        if defined $self->{MBD_parser};
+
+    my $filename = $self->filename;
+    my $parser   = eval { Mail::Transport::Dbx->new($filename) };
+
+    unless(defined $parser)
+    {   $self->log(ERROR => "Cannot read dbx folder file $filename.");
+        return undef;
+    }
+
+    $self->{MBD_parser} = $parser;
+}
+
+#-------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dbx.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dbx.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dbx.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,908 @@
+
+=head1 NAME
+
+Mail::Box::Dbx - read Outlook Express folders
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Dbx
+   is a Mail::Box::File
+   is a Mail::Box
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ use Mail::Box::Dbx;
+ my $folder = Mail::Box::Dbx->new(...);
+
+
+=head1 DESCRIPTION
+
+This documentation describes how to read from Outlook Express (dbx)
+folders.  Even on Unix/Linux, you can access these folders to
+read the data, or copy it to a different format.  Modifying of
+xbd files is not supported.
+
+These dbx folders are accessed using Mail::Transport::Dbx which
+is distributed via CPAN as separate package.  This C<MAil::Transport::Dbx>
+module is based on the open source library named C<libdbx>, which can
+be found at L<http://sourceforge.net/project/ol2mbox/>.  The library does
+not support writing of dbx files, and therefore limits the possibilities
+of this package.
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+overload: B<@{}>
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+overload: B<cmp>
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<create>(FOLDERNAME, OPTIONS)
+
+Mail::Box::Dbx-E<gt>B<create>(FOLDERNAME, OPTIONS)
+
+=over 4
+
+Creation is not supported for dbx folders.
+
+ Option     Defined in    Default
+ folderdir  L<Mail::Box>  undef  
+
+. folderdir DIRECTORY
+
+=back
+
+Mail::Box::Dbx-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option             Defined in       Default                                                         
+ access             L<Mail::Box>     always C<'r'>                                                   
+ body_delayed_type  L<Mail::Box>     L<Mail::Message::Body::Delayed|Mail::Message::Body::Delayed>    
+ body_type          L<Mail::Box::File>  <see description>                                               
+ coerce_options     L<Mail::Box>     C<[]>                                                           
+ create             L<Mail::Box>     C<not implemented>                                              
+ extract            L<Mail::Box>     C<10240>                                                        
+ field_type         L<Mail::Box>     undef                                                           
+ fix_headers        L<Mail::Box>     <false>                                                         
+ folder             L<Mail::Box>     C<=Folders.dbx>                                                 
+ folderdir          L<Mail::Box>     C<.>                                                            
+ head_delayed_type  L<Mail::Box>     L<Mail::Message::Head::Delayed|Mail::Message::Head::Delayed>    
+ head_type          L<Mail::Box>     L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>  
+ keep_dups          L<Mail::Box>     <false>                                                         
+ lock_extension     L<Mail::Box::File>  C<'.lock'>                                                      
+ lock_file          L<Mail::Box>     <foldername>.<lock-extension>                                   
+ lock_timeout       L<Mail::Box>     1 hour                                                          
+ lock_type          L<Mail::Box>     C<'NONE'>                                                       
+ lock_wait          L<Mail::Box>     10 seconds                                                      
+ locker             L<Mail::Box>     undef                                                           
+ log                L<Mail::Reporter>  C<'WARNINGS'>                                                   
+ manager            L<Mail::Box>     undef                                                           
+ message_type       L<Mail::Box>     L<Mail::Box::Dbx::Message|Mail::Box::Dbx::Message>              
+ multipart_type     L<Mail::Box>     L<Mail::Message::Body::Multipart|Mail::Message::Body::Multipart>
+ remove_when_empty  L<Mail::Box>     C<not implemented>                                              
+ save_on_exit       L<Mail::Box>     C<not implemented>                                              
+ trace              L<Mail::Reporter>  C<'WARNINGS'>                                                   
+ trusted            L<Mail::Box>     <depends on folder location>                                    
+ write_policy       L<Mail::Box::File>  C<not implemented>                                              
+
+. access MODE
+
+. body_delayed_type CLASS
+
+. body_type CLASS|CODE
+
+. coerce_options ARRAY
+
+. create BOOLEAN
+
+. extract INTEGER | CODE | METHOD | 'LAZY'|'ALWAYS'
+
+. field_type CLASS
+
+. fix_headers BOOLEAN
+
+. folder FOLDERNAME
+
+. folderdir DIRECTORY
+
+. head_delayed_type CLASS
+
+. head_type CLASS
+
+. keep_dups BOOLEAN
+
+. lock_extension FILENAME|STRING
+
+. lock_file FILENAME
+
+. lock_timeout SECONDS
+
+. lock_type CLASS|STRING|ARRAY
+
+. lock_wait SECONDS
+
+. locker OBJECT
+
+. log LEVEL
+
+. manager MANAGER
+
+. message_type CLASS
+
+. multipart_type CLASS
+
+. remove_when_empty BOOLEAN
+
+. save_on_exit BOOLEAN
+
+. trace LEVEL
+
+. trusted BOOLEAN
+
+. write_policy 'REPLACE'|'INPLACE'|undef
+
+=back
+
+=head2 The folder
+
+
+$obj-E<gt>B<addMessage>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<addMessages>(MESSAGE [, MESSAGE, ...])
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+Mail::Box::Dbx-E<gt>B<appendMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box::File/"METHODS">
+
+=back
+
+$obj-E<gt>B<close>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<copyTo>(FOLDER, OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<filename>
+
+=over 4
+
+See L<Mail::Box::File/"The folder">
+
+=back
+
+$obj-E<gt>B<folderdir>([DIRECTORY])
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+Mail::Box::Dbx-E<gt>B<foundIn>([FOLDERNAME], [OPTIONS])
+
+=over 4
+
+If no FOLDERNAME is specified, then the value of the C<folder> option
+is taken.  A dbx folder is a file which name ends on C<.dbx> (case
+insensitive).
+
+ Option     Defined in       Default
+ folder                      undef  
+ folderdir  L<Mail::Box>     undef  
+
+. folder FOLDERNAME
+
+. folderdir DIRECTORY
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<organization>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<type>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<update>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<url>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+=head2 Folder flags
+
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+$obj-E<gt>B<writable>
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+=head2 The messages
+
+
+$obj-E<gt>B<current>([NUMBER|MESSAGE|MESSAGE-ID])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<find>(MESSAGE-ID)
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<findFirstLabeled>(LABEL, [BOOLEAN, [ARRAY-OF-MSGS]])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<message>(INDEX [,MESSAGE])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messageId>(MESSAGE-ID [,MESSAGE])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messageIds>
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messages>(['ALL',RANGE,'ACTIVE','DELETED',LABEL,!LABEL,FILTER])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<scanForMessages>(MESSAGE, MESSAGE-IDS, TIMESPAN, WINDOW)
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+=head2 Sub-folders
+
+
+$obj-E<gt>B<listSubFolders>(OPTIONS)
+
+Mail::Box::Dbx-E<gt>B<listSubFolders>(OPTIONS)
+
+=over 4
+
+It is adviced to set the C<check> flag, because dbx folder often list
+large amounts of folder names which do not really exist.  However, checking
+does consume some time.
+
+ Option      Defined in       Default      
+ check       L<Mail::Box>     <false>      
+ folder      L<Mail::Box>     <required>   
+ folderdir   L<Mail::Box>     <from folder>
+ skip_empty  L<Mail::Box>     <false>      
+
+. check BOOLEAN
+
+. folder FOLDERNAME
+
+. folderdir DIRECTORY
+
+. skip_empty BOOL
+
+=back
+
+$obj-E<gt>B<nameOfSubFolder>(NAME)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+$obj-E<gt>B<openRelatedFolder>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+$obj-E<gt>B<openSubFolder>(NAME, OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<coerce>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<determineBodyType>(MESSAGE, HEAD)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<folderToFilename>(FOLDERNAME, FOLDERDIR)
+
+Mail::Box::Dbx-E<gt>B<folderToFilename>(FOLDERNAME, FOLDERDIR)
+
+=over 4
+
+Translate a folder name into a filename, using the
+FOLDERDIR value to replace a leading C<=>.
+
+=back
+
+$obj-E<gt>B<lineSeparator>([STRING|'CR'|'LF'|'CRLF'])
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<locker>
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<messageCreateOptions>([TYPE, CONFIG])
+
+=over 4
+
+See L<Mail::Box::File/"Internals">
+
+=back
+
+$obj-E<gt>B<moveAwaySubFolder>(DIRECTORY, EXTENSION)
+
+=over 4
+
+See L<Mail::Box::File/"Internals">
+
+=back
+
+$obj-E<gt>B<parser>
+
+=over 4
+
+The parsing of messages is a combined job for the Mail::Transport::Dbx
+module (to get the right data) and L<read()|Mail::Box/"Internals">.  Asking for the parser
+will provide the transporter object.  If asked more than once, each time
+the same object will be returned.
+
+=back
+
+$obj-E<gt>B<read>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<readMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<storeMessage>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<toBeThreaded>(MESSAGES)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<toBeUnthreaded>(MESSAGES)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<updateMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box::File/"Internals">
+
+=back
+
+$obj-E<gt>B<write>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box::File/"Internals">
+
+=back
+
+$obj-E<gt>B<writeMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+=head3 File based folders
+
+
+=head2 Other methods
+
+
+$obj-E<gt>B<timespan2seconds>(TIME)
+
+Mail::Box::Dbx-E<gt>B<timespan2seconds>(TIME)
+
+=over 4
+
+See L<Mail::Box/"Other methods">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Dbx-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Dbx-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Dbx-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Box/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot append messages to folder file $filename: $!
+
+Appending messages to a not-opened file-organized folder may fail when the
+operating system does not allow write access to the file at hand.
+
+I<Error:> Cannot move away sub-folder $dir
+
+
+I<Error:> Cannot read dbx folder file $filename.
+
+
+I<Warning:> Cannot remove folder $name file $filename: $!
+
+Writing an empty folder will usually cause that folder to be removed,
+which fails for the indicated reason.  L<new(remove_when_empty)|Mail::Box/"Constructors">
+
+I<Warning:> Cannot remove folder $name file $filename: $!
+
+Writing an empty folder will usually cause that folder to be removed,
+which fails for the indicated reason.  L<new(remove_when_empty)|Mail::Box/"Constructors">
+controls whether the empty folder will removed; setting it to false
+(C<0>) may be needed to avoid this message.
+
+I<Error:> Cannot replace $filename by $tempname, to update folder $name: $!
+
+The replace policy wrote a new folder file to update the existing, but
+was unable to give the final touch: replacing the old version of the
+folder file for the indicated reason.
+
+I<Warning:> Changes not written to read-only folder $self.
+
+You have opened the folder read-only --which is the default set
+by L<new(access)|Mail::Box/"Constructors">--, made modifications, and now want to close it.
+Set L<close(force)|Mail::Box/"The folder"> if you want to overrule the access mode, or close
+the folder with L<close(write)|Mail::Box/"The folder"> set to C<NEVER>.
+
+I<Error:> Copying failed for one message.
+
+For some reason, for instance disc full, removed by external process, or
+read-protection, it is impossible to copy one of the messages.  Copying will
+proceed for the other messages.
+
+I<Warning:> Dbx folders are read-only.
+
+
+I<Error:> Destination folder $name is not writable.
+
+The folder where the messages are copied to is not opened with write
+access (see L<new(access)|Mail::Box/"Constructors">).  This has no relation with write permission
+to the folder which is controled by your operating system.
+
+I<Warning:> Different messages with id $msgid.
+
+The message id is discovered more than once within the same folder, but the
+content of the message seems to be different.  This should not be possible:
+each message must be unique.
+
+I<Error:> File too short to get write message $nr ($size, $need)
+
+Mail::Box is lazy: it tries to leave messages in the folders until they
+are used, which saves time and memory usage.  When this message appears,
+something is terribly wrong: some lazy message are needed for updating the
+folder, but they cannot be retreived from the original file anymore.  In
+this case, messages can be lost.
+
+This message does appear regularly on Windows systems when using the
+'replace' write policy.  Please help to find the cause, probably something
+to do with Windows incorrectly handling multiple filehandles open in the
+same file.
+
+I<Error:> Folder $name not deleted: not writable.
+
+The folder must be opened with write access via L<new(access)|Mail::Box/"Constructors">, otherwise
+removing it will be refused.  So, you may have write-access according to
+the operating system, but that will not automatically mean that this
+C<delete> method permits you to.  The reverse remark is valid as well.
+
+I<Error:> Invalid timespan '$timespan' specified.
+
+The string does not follow the strict rules of the time span syntax which
+is permitted as parameter.
+
+I<Warning:> Message-id '$msgid' does not contain a domain.
+
+According to the RFCs, message-ids need to contain a unique random part,
+then an C<@>, and then a domain name.  This is made to avoid the creation
+of two messages with the same id.  The warning emerges when the C<@> is
+missing from the string.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Unable to create subfolder $name of $folder.
+
+The copy includes the subfolders, but for some reason it was not possible
+to copy one of these.  Copying will proceed for all other sub-folders.
+
+I<Error:> Unable to update folder $self.
+
+When a folder is to be written, both replace and inplace write policies are
+tried,  If both fail, the whole update fails.  You may see other, related,
+error messages to indicate the real problem.
+
+
+=head1 DETAILS
+
+
+=head2 How DBX folders work
+
+DBX files are create by Outlook Express.  I can not tell you too much
+about it, because me (as author) never use Windows or MicroSoft tools.
+Still, it is possible to access some Outlook created folders from Unix.
+
+The folder structure for dbx starts with a single C<Folders.dbx>
+file.  This folder contains names of sub-folders.  Each folder can
+either contain messages, or contains sub-folders.  Combinations are
+not possible.
+
+=head2 This implementation
+
+The ol2mbox project (see L<http://sourceforge.net/project/ol2mbox/>)
+has created a C<libdbx> which can read dbx files using nearly any
+operating system.  You can simply transport a dbx file from Windows
+to Unix/Linux and the read all the messages from it.
+
+Tassilo von Parseval wrote a Perl wrapper around this C-library,
+and distributes it as Mail::Transport::Dbx.  Although it named in
+one the MailBox namespaces, it is a separate product, because it
+requires a C compiler.  Besides, the module will have its own life.
+
+=head2 Converting DBX folders to MBOX
+
+The title of this section is to attract your attension, but is does
+not describe anything special related to DBX or MBOX: you can convert
+any kind of mail folder into an other with the following code.
+
+I<Example:> converting folders
+
+
+ my $from = Mail::Box::Dbx->new(folder => 'Folder.dbx')
+    or exit;
+
+ my $to   = Mail::Box::Mbox->new(folder => '/tmp/mbox',
+    access => 'w', create => 1) or die;
+
+ $from->copyTo($to);
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dir/Message.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dir/Message.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dir/Message.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,214 @@
+
+use strict;
+use warnings;
+
+package Mail::Box::Dir::Message;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box::Message';
+
+use Carp;
+use File::Copy qw/move/;
+
+
+sub init($)
+{   my ($self, $args) = @_;
+    $self->SUPER::init($args);
+
+    $self->filename($args->{filename})
+        if $args->{filename};
+
+    $self->{MBDM_fix_header} = $args->{fix_header};
+    $self;
+}
+
+#-------------------------------------------
+
+
+#-------------------------------------------
+
+sub print(;$)
+{   my $self     = shift;
+    my $out      = shift || select;
+
+    return $self->SUPER::print($out)
+        if $self->isModified;
+
+    my $filename = $self->filename;
+    if($filename && -r $filename)
+    {   if(open my $in, '<', $filename)
+        {    local $_;
+             print $out $_ while <$in>;
+             close $in;
+             return $self;
+        }
+    }
+
+    $self->SUPER::print($out);
+
+    1;
+}
+
+#-------------------------------------------
+
+BEGIN { *write = \&print }  # simply alias
+
+#-------------------------------------------
+
+
+sub filename(;$)
+{   my $self = shift;
+    @_ ? $self->{MBDM_filename} = shift : $self->{MBDM_filename};
+}
+
+#-------------------------------------------
+
+
+# Asking the filesystem for the size is faster counting (in
+# many situations.  It even may be lazy.
+
+sub size()
+{   my $self = shift;
+
+    unless($self->isModified)
+    {   my $filename = $self->filename;
+        if(defined $filename)
+        {   my $size = -s $filename;
+            return $size if defined $size;
+        }
+    }
+
+    $self->SUPER::size;
+}
+
+#-------------------------------------------
+
+sub diskDelete()
+{   my $self = shift;
+    $self->SUPER::diskDelete;
+
+    my $filename = $self->filename;
+    unlink $filename if $filename;
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub parser()
+{   my $self   = shift;
+
+    my $parser = Mail::Box::Parser->new
+      ( filename => $self->{MBDM_filename}
+      , mode     => 'r'
+      , fix_header_errors => $self->{MBDM_fix_header}
+      , $self->logSettings
+      );
+
+    unless($parser)
+    {   $self->log(ERROR => "Cannot create parser for $self->{MBDM_filename}.");
+        return;
+    }
+
+    $parser;
+}
+
+#-------------------------------------------
+
+
+sub loadHead()
+{   my $self     = shift;
+    my $head     = $self->head;
+    return $head unless $head->isDelayed;
+
+    my $folder   = $self->folder;
+    $folder->lazyPermitted(1);
+
+    my $parser   = $self->parser or return;
+    $self->readFromParser($parser);
+    $parser->stop;
+
+    $folder->lazyPermitted(0);
+
+    $self->log(PROGRESS => 'Loaded delayed head.');
+    $self->head;
+}
+
+#-------------------------------------------
+
+
+sub loadBody()
+{   my $self     = shift;
+
+    my $body     = $self->body;
+    return $body unless $body->isDelayed;
+
+    my $head     = $self->head;
+    my $parser   = $self->parser or return;
+
+    if($head->isDelayed)
+    {   $head = $self->readHead($parser);
+        if(defined $head)
+        {   $self->log(PROGRESS => 'Loaded delayed head.');
+            $self->head($head);
+        }
+        else
+        {   $self->log(ERROR => 'Unable to read delayed head.');
+            return;
+        }
+    }
+    else
+    {   my ($begin, $end) = $body->fileLocation;
+        $parser->filePosition($begin);
+    }
+
+    my $newbody  = $self->readBody($parser, $head);
+    $parser->stop;
+
+    unless(defined $newbody)
+    {   $self->log(ERROR => 'Unable to read delayed body.');
+        return;
+    }
+
+    $self->log(PROGRESS => 'Loaded delayed body.');
+    $self->storeBody($newbody->contentInfoFrom($head));
+}
+
+#-------------------------------------------
+
+
+sub create($)
+{   my ($self, $filename) = @_;
+
+    my $old = $self->filename || '';
+    return $self if $filename eq $old && !$self->isModified;
+
+    # Write the new data to a new file.
+
+    my $new     = $filename . '.new';
+    my $newfile = IO::File->new($new, 'w');
+    $self->log(ERROR => "Cannot write message to $new: $!"), return
+        unless $newfile;
+
+    $self->write($newfile);
+    $newfile->close;
+
+    # Accept the new data
+# maildir produces warning where not expected...
+#   $self->log(WARNING => "Failed to remove $old: $!")
+#       if $old && !unlink $old;
+
+    unlink $old if $old;
+
+    $self->log(ERROR => "Failed to move $new to $filename: $!"), return
+         unless move($new, $filename);
+
+    $self->modified(0);
+    $self->Mail::Box::Dir::Message::filename($filename);
+
+    $self;
+}
+
+#-------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dir/Message.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dir/Message.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dir/Message.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,1017 @@
+
+=head1 NAME
+
+Mail::Box::Dir::Message - one message in a directory organized folder
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Dir::Message
+   is a Mail::Box::Message
+   is a Mail::Message
+   is a Mail::Reporter
+
+ Mail::Box::Dir::Message is extended by
+   Mail::Box::MH::Message
+   Mail::Box::Maildir::Message
+
+
+=head1 SYNOPSIS
+
+ my $folder = new Mail::Box::MH ...
+ my $message = $folder->message(10);
+
+
+=head1 DESCRIPTION
+
+A C<Mail::Box::Dir::Message> is a base class for one message in a
+directory organized folder; each message is stored in a separate file.
+There are no objects of type C<Mail::Box::Dir::Message>, only extensions
+are allowed to be created.
+
+At the moment, two of these extended message types are implemented:
+
+=over 4
+
+=item * L<Mail::Box::MH::Message|Mail::Box::MH::Message>
+
+which represents one message in a L<Mail::Box::MH|Mail::Box::MH> folder.
+
+=item * L<Mail::Box::Maildir::Message|Mail::Box::Maildir::Message>
+
+which represents one message in a L<Mail::Box::Maildir|Mail::Box::Maildir> folder.
+
+=back
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message/"Constructors">
+
+=back
+
+Mail::Box::Dir::Message-E<gt>B<coerce>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box::Message/"METHODS">
+
+=back
+
+Mail::Box::Dir::Message-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+Create a messages in a directory organized folder.
+
+ Option      Defined in       Default                                                       
+ body        L<Mail::Message>  undef                                                         
+ body_type   L<Mail::Box::Message>  <from folder>                                                 
+ deleted     L<Mail::Message>  <false>                                                       
+ field_type  L<Mail::Message>  undef                                                         
+ filename                     undef                                                         
+ fix_header                   C<false>                                                      
+ folder      L<Mail::Box::Message>  <required>                                                    
+ head        L<Mail::Message>  undef                                                         
+ head_type   L<Mail::Message>  L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>
+ labels      L<Mail::Message>  {}                                                            
+ log         L<Mail::Reporter>  C<'WARNINGS'>                                                 
+ messageId   L<Mail::Message>  undef                                                         
+ modified    L<Mail::Message>  <false>                                                       
+ size        L<Mail::Box::Message>  undef                                                         
+ trace       L<Mail::Reporter>  C<'WARNINGS'>                                                 
+ trusted     L<Mail::Message>  <false>                                                       
+
+. body OBJECT
+
+. body_type CODE|CLASS
+
+. deleted BOOLEAN
+
+. field_type CLASS
+
+. filename FILENAME
+
+=over 4
+
+The file where the message is stored in.
+
+=back
+
+. fix_header BOOLEAN
+
+=over 4
+
+See L<Mail::Box::new(fix_headers)|Mail::Box/"Constructors">.
+
+=back
+
+. folder FOLDER
+
+. head OBJECT
+
+. head_type CLASS
+
+. labels ARRAY|HASH
+
+. log LEVEL
+
+. messageId STRING
+
+. modified BOOLEAN
+
+. size INTEGER
+
+. trace LEVEL
+
+. trusted BOOLEAN
+
+=back
+
+=head2 Constructing a message
+
+
+$obj-E<gt>B<bounce>([RG-OBJECT|OPTIONS])
+
+=over 4
+
+See L<Mail::Message::Construct::Bounce/"Constructing a message">
+
+=back
+
+Mail::Box::Dir::Message-E<gt>B<build>([MESSAGE|BODY], CONTENT)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+Mail::Box::Dir::Message-E<gt>B<buildFromBody>(BODY, [HEAD], HEADERS)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forward>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardAttach>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardEncapsulate>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardInline>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardNo>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPostlude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPrelude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardSubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+Mail::Box::Dir::Message-E<gt>B<read>(FILEHANDLE|SCALAR|REF-SCALAR|ARRAY-OF-LINES, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Read/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<rebuild>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<reply>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replyPrelude>([STRING|FIELD|ADDRESS|ARRAY-OF-THINGS])
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replySubject>(STRING)
+
+Mail::Box::Dir::Message-E<gt>B<replySubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+=head2 The Message
+
+
+$obj-E<gt>B<container>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isDummy>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isPart>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<messageId>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<send>([MAILER], OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<toplevel>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<write>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<bcc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<cc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<date>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<destinations>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<from>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<get>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<guessTimestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<head>([HEAD])
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<sender>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<study>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<subject>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<timestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<to>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+=head2 The body
+
+
+$obj-E<gt>B<body>([BODY])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<decoded>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<encode>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isNested>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<parts>(['ALL'|'ACTIVE'|'DELETED'|'RECURSE'|FILTER])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+=head2 Flags
+
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<deleted>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isDeleted>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<label>(LABEL|PAIRS)
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<labels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<labelsToStatus>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<statusToLabels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+=head2 The whole message as text
+
+
+$obj-E<gt>B<file>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<lines>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<printStructure>([FILEHANDLE][, INDENT])
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+=head2 The message
+
+
+$obj-E<gt>B<copyTo>(FOLDER)
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<filename>([FILENAME])
+
+=over 4
+
+Returns the name of the file in which this message is actually stored.  This
+will return C<undef> when the message is not stored in a file.
+
+=back
+
+$obj-E<gt>B<folder>([FOLDER])
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<moveTo>(FOLDER)
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<seqnr>([INTEGER])
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<create>(FILENAME)
+
+=over 4
+
+Create the message in the specified file.  If the message already has
+a filename and is not modified, then a move is tried.  Otherwise the
+message is printed to the file.  If the FILENAME already exists for
+this message, nothing is done.  In any case, the new FILENAME is set
+as well.
+
+=back
+
+$obj-E<gt>B<diskDelete>
+
+=over 4
+
+See L<Mail::Box::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<loadBody>
+
+=over 4
+
+This method is called by the autoloader when the body of the message
+is needed.
+
+=back
+
+$obj-E<gt>B<loadHead>
+
+=over 4
+
+This method is called by the autoloader when the header of the message
+is needed.
+
+=back
+
+$obj-E<gt>B<parser>
+
+=over 4
+
+Create and return a parser for this message (-file).
+
+=back
+
+$obj-E<gt>B<readBody>(PARSER, HEAD [, BODYTYPE])
+
+=over 4
+
+See L<Mail::Box::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readFromParser>(PARSER, [BODYTYPE])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readHead>(PARSER [,CLASS])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<recursiveRebuildPart>(PART, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Internals">
+
+=back
+
+$obj-E<gt>B<storeBody>(BODY)
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<takeMessageId>([STRING])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Message::Construct/"METHODS">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Dir::Message-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Dir::Message-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Dir::Message-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortSize>([VALUE])
+
+Mail::Box::Dir::Message-E<gt>B<shortSize>([VALUE])
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortString>
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<destruct>
+
+=over 4
+
+See L<Mail::Box::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot create parser for $filename.
+
+For some reason (the previous message have told you already) it was not possible
+to create a message parser for the specified filename.
+
+I<Error:> Cannot include forward source as $include.
+
+Unknown alternative for the L<forward(include)|Mail::Message::Construct::Forward/"Constructing a message">.  Valid choices are
+C<NO>, C<INLINE>, C<ATTACH>, and C<ENCAPSULATE>.
+
+I<Error:> Cannot include reply source as $include.
+
+Unknown alternative for the C<include> option of L<reply()|Mail::Message::Construct::Reply/"Constructing a message">.  Valid
+choices are C<NO>, C<INLINE>, and C<ATTACH>.
+
+I<Error:> Cannot write message to $filename: $!
+
+When a modified or new message is written to disk, it is first written
+to a temporary file in the folder directory.  For some reason, it is
+impossible to create this file.
+
+I<Error:> Failed to move $new to $filename: $!
+
+When a modified or new message is written to disk, it is first written
+to a temporary file in the folder directory.  Then, the new file is
+moved to replace the existing file.  Apparently, the latter fails.
+
+I<Error:> No address to create forwarded to.
+
+If a forward message is created, a destination address must be specified.
+
+I<Error:> No default mailer found to send message.
+
+The message L<send()|Mail::Message/"The Message"> mechanism had not enough information to automatically
+find a mail transfer agent to sent this message.  Specify a mailer
+explicitly using the C<via> options.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Unable to read delayed body.
+
+For some reason, the header of the message could be read, but the body
+cannot.  Probably the file has disappeared or the permissions were
+changed during the progress of the program.
+
+I<Error:> Unable to read delayed head.
+
+Mail::Box tries to be I<lazy> with respect to parsing messages.  When a
+directory organized folder is opened, only the filenames of messages are
+collected.  At first use, the messages are read from their file.  Apperently,
+a message is used for the first time here, but has disappeared or is
+unreadible for some other reason.
+
+I<Error:> forwardAttach requires a preamble object
+
+
+I<Error:> forwardEncapsulate requires a preamble object
+
+
+I<Error:> no rebuild rule $name defined.
+
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dir.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dir.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dir.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,88 @@
+
+use strict;
+package Mail::Box::Dir;
+use vars '$VERSION';
+$VERSION = '2.055';
+
+use base 'Mail::Box';
+
+use Mail::Box::Dir::Message;
+
+use Mail::Message::Body::Lines;
+use Mail::Message::Body::File;
+use Mail::Message::Body::Delayed;
+use Mail::Message::Body::Multipart;
+
+use Mail::Message::Head;
+use Mail::Message::Head::Delayed;
+
+use Carp;
+use File::Copy;
+use File::Spec;
+use File::Basename;
+
+
+sub init($)
+{   my ($self, $args)    = @_;
+
+    $args->{body_type} ||= sub {'Mail::Message::Body::Lines'};
+
+    return undef
+        unless $self->SUPER::init($args);
+
+    my $class            = ref $self;
+    my $directory        = $self->{MBD_directory}
+       = $class->folderToDirectory($self->name, $self->folderdir);
+
+       if(-d $directory) {;}
+    elsif($args->{create} && $class->create($directory, %$args)) {;}
+    else
+    {   $self->log(PROGRESS => "$class: No directory $directory.\n");
+        return undef;
+    }
+
+    # About locking
+
+    for($args->{lock_file})
+    {   $self->locker->filename
+          ( !defined $_ ? File::Spec->catfile($directory, '.lock')   # default
+          : File::Spec->file_name_is_absolute($_) ? $_               # absolute
+          :               File::Spec->catfile($directory, $_)        # relative
+          );
+    }
+
+    # Check if we can write to the folder, if we need to.
+
+    if($self->writable && -e $directory && ! -w $directory)
+    {   $self->log(WARNING => "Folder directory $directory is write-protected.\n");
+        $self->{MB_access} = 'r';
+    }
+
+    $self;
+}
+
+#-------------------------------------------
+
+sub organization() { 'DIRECTORY' }
+
+#-------------------------------------------
+
+
+sub directory() { shift->{MBD_directory} }
+
+#-------------------------------------------
+
+
+sub folderToDirectory($$)
+{   my ($class, $name, $folderdir) = @_;
+    $name =~ /^=(.*)/ ? File::Spec->catfile($folderdir,$1) : $name;
+}
+
+#-------------------------------------------
+
+
+sub readMessageFilenames() {shift->notImplemented}
+
+#-------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dir.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dir.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Dir.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,788 @@
+
+=head1 NAME
+
+Mail::Box::Dir - handle folders with a file per message.
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Dir
+   is a Mail::Box
+   is a Mail::Reporter
+
+ Mail::Box::Dir is extended by
+   Mail::Box::MH
+   Mail::Box::Maildir
+
+
+=head1 SYNOPSIS
+
+ # Do not instantiate this object
+
+
+=head1 DESCRIPTION
+
+This documentation describes the way directory organized mailboxes work.
+At the moment, this object is extended by
+
+=over 4
+
+=item * L<Mail::Box::MH|Mail::Box::MH>
+
+MH folders, which are represented by a directory containing files which
+are sequentially numbered.
+
+=item * L<Mail::Box::Maildir|Mail::Box::Maildir>
+
+Maildir folders, which are located in a directory which has sub-directories
+named C<tmp>, C<new>, and C<cur>.  Each of these directories may contain
+files with names which are a combination of a numeric timestamp and some
+status flags.
+
+=back
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+overload: B<@{}>
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+overload: B<cmp>
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<create>(FOLDERNAME, OPTIONS)
+
+Mail::Box::Dir-E<gt>B<create>(FOLDERNAME, OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Constructors">
+
+=back
+
+Mail::Box::Dir-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option             Defined in       Default                                                         
+ access             L<Mail::Box>     C<'r'>                                                          
+ body_delayed_type  L<Mail::Box>     L<Mail::Message::Body::Delayed|Mail::Message::Body::Delayed>    
+ body_type          L<Mail::Box>     L<Mail::Message::Body::Lines|Mail::Message::Body::Lines>        
+ coerce_options     L<Mail::Box>     C<[]>                                                           
+ create             L<Mail::Box>     <false>                                                         
+ extract            L<Mail::Box>     C<10240>                                                        
+ field_type         L<Mail::Box>     undef                                                           
+ fix_headers        L<Mail::Box>     <false>                                                         
+ folder             L<Mail::Box>     C<$ENV{MAIL}>                                                   
+ folderdir          L<Mail::Box>     undef                                                           
+ head_delayed_type  L<Mail::Box>     L<Mail::Message::Head::Delayed|Mail::Message::Head::Delayed>    
+ head_type          L<Mail::Box>     L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>  
+ keep_dups          L<Mail::Box>     <false>                                                         
+ lock_file          L<Mail::Box>     <folder>C</.lock>                                               
+ lock_timeout       L<Mail::Box>     1 hour                                                          
+ lock_type          L<Mail::Box>     L<Mail::Box::Locker::DotLock|Mail::Box::Locker::DotLock>        
+ lock_wait          L<Mail::Box>     10 seconds                                                      
+ locker             L<Mail::Box>     undef                                                           
+ log                L<Mail::Reporter>  C<'WARNINGS'>                                                   
+ manager            L<Mail::Box>     undef                                                           
+ message_type       L<Mail::Box>     L<Mail::Box::Message|Mail::Box::Message>                        
+ multipart_type     L<Mail::Box>     L<Mail::Message::Body::Multipart|Mail::Message::Body::Multipart>
+ remove_when_empty  L<Mail::Box>     <true>                                                          
+ save_on_exit       L<Mail::Box>     <true>                                                          
+ trace              L<Mail::Reporter>  C<'WARNINGS'>                                                   
+ trusted            L<Mail::Box>     <depends on folder location>                                    
+
+. access MODE
+
+. body_delayed_type CLASS
+
+. body_type CLASS|CODE
+
+. coerce_options ARRAY
+
+. create BOOLEAN
+
+. extract INTEGER | CODE | METHOD | 'LAZY'|'ALWAYS'
+
+. field_type CLASS
+
+. fix_headers BOOLEAN
+
+. folder FOLDERNAME
+
+. folderdir DIRECTORY
+
+. head_delayed_type CLASS
+
+. head_type CLASS
+
+. keep_dups BOOLEAN
+
+. lock_file FILENAME
+
+. lock_timeout SECONDS
+
+. lock_type CLASS|STRING|ARRAY
+
+. lock_wait SECONDS
+
+. locker OBJECT
+
+. log LEVEL
+
+. manager MANAGER
+
+. message_type CLASS
+
+. multipart_type CLASS
+
+. remove_when_empty BOOLEAN
+
+. save_on_exit BOOLEAN
+
+. trace LEVEL
+
+. trusted BOOLEAN
+
+=back
+
+=head2 The folder
+
+
+$obj-E<gt>B<addMessage>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<addMessages>(MESSAGE [, MESSAGE, ...])
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+Mail::Box::Dir-E<gt>B<appendMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<close>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<copyTo>(FOLDER, OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<directory>
+
+=over 4
+
+Returns the directory related to this folder.
+
+I<Example:> 
+
+ print $folder->directory;
+
+=back
+
+$obj-E<gt>B<folderdir>([DIRECTORY])
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+Mail::Box::Dir-E<gt>B<foundIn>([FOLDERNAME], OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<organization>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<type>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<update>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<url>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+=head2 Folder flags
+
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+$obj-E<gt>B<writable>
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+=head2 The messages
+
+
+$obj-E<gt>B<current>([NUMBER|MESSAGE|MESSAGE-ID])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<find>(MESSAGE-ID)
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<findFirstLabeled>(LABEL, [BOOLEAN, [ARRAY-OF-MSGS]])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<message>(INDEX [,MESSAGE])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messageId>(MESSAGE-ID [,MESSAGE])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messageIds>
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messages>(['ALL',RANGE,'ACTIVE','DELETED',LABEL,!LABEL,FILTER])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<scanForMessages>(MESSAGE, MESSAGE-IDS, TIMESPAN, WINDOW)
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+=head2 Sub-folders
+
+
+$obj-E<gt>B<listSubFolders>(OPTIONS)
+
+Mail::Box::Dir-E<gt>B<listSubFolders>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+$obj-E<gt>B<nameOfSubFolder>(NAME)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+$obj-E<gt>B<openRelatedFolder>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+$obj-E<gt>B<openSubFolder>(NAME, OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<coerce>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<determineBodyType>(MESSAGE, HEAD)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<folderToDirectory>(FOLDERNAME, FOLDERDIR)
+
+=over 4
+
+(class method)  Translate a foldername into a filename, with use of the
+FOLDERDIR to replace a leading C<=>.
+
+=back
+
+$obj-E<gt>B<lineSeparator>([STRING|'CR'|'LF'|'CRLF'])
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<locker>
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<read>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<readMessageFilenames>(DIRECTORY)
+
+=over 4
+
+Returns a list of all filenames which are found in this folder
+directory and represent a message.  The filenames are returned as
+relative path.
+
+=back
+
+$obj-E<gt>B<readMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<storeMessage>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<toBeThreaded>(MESSAGES)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<toBeUnthreaded>(MESSAGES)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<updateMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<write>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<writeMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+=head2 Other methods
+
+
+$obj-E<gt>B<timespan2seconds>(TIME)
+
+Mail::Box::Dir-E<gt>B<timespan2seconds>(TIME)
+
+=over 4
+
+See L<Mail::Box/"Other methods">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Dir-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Dir-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Dir-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Box/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> Changes not written to read-only folder $self.
+
+You have opened the folder read-only --which is the default set
+by L<new(access)|Mail::Box/"Constructors">--, made modifications, and now want to close it.
+Set L<close(force)|Mail::Box/"The folder"> if you want to overrule the access mode, or close
+the folder with L<close(write)|Mail::Box/"The folder"> set to C<NEVER>.
+
+I<Error:> Copying failed for one message.
+
+For some reason, for instance disc full, removed by external process, or
+read-protection, it is impossible to copy one of the messages.  Copying will
+proceed for the other messages.
+
+I<Error:> Destination folder $name is not writable.
+
+The folder where the messages are copied to is not opened with write
+access (see L<new(access)|Mail::Box/"Constructors">).  This has no relation with write permission
+to the folder which is controled by your operating system.
+
+I<Warning:> Different messages with id $msgid.
+
+The message id is discovered more than once within the same folder, but the
+content of the message seems to be different.  This should not be possible:
+each message must be unique.
+
+I<Error:> Folder $name is opened read-only
+
+You can not write to this folder unless you have opened the folder to
+write or append with L<new(access)|Mail::Box/"Constructors">, or the C<force> option is set true.
+
+I<Error:> Folder $name not deleted: not writable.
+
+The folder must be opened with write access via L<new(access)|Mail::Box/"Constructors">, otherwise
+removing it will be refused.  So, you may have write-access according to
+the operating system, but that will not automatically mean that this
+C<delete> method permits you to.  The reverse remark is valid as well.
+
+I<Warning:> Folder directory $directory is write-protected.
+
+The folder directory does already exist and is write protected, which may
+interfere with the requested write access.  Change new(access) or the
+permissions on the directory.
+
+I<Error:> Invalid timespan '$timespan' specified.
+
+The string does not follow the strict rules of the time span syntax which
+is permitted as parameter.
+
+I<Warning:> Message-id '$msgid' does not contain a domain.
+
+According to the RFCs, message-ids need to contain a unique random part,
+then an C<@>, and then a domain name.  This is made to avoid the creation
+of two messages with the same id.  The warning emerges when the C<@> is
+missing from the string.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Unable to create subfolder $name of $folder.
+
+The copy includes the subfolders, but for some reason it was not possible
+to copy one of these.  Copying will proceed for all other sub-folders.
+
+I<Error:> Writing folder $name failed
+
+For some reason (you probably got more error messages about this problem)
+it is impossible to write the folder, although you should because there
+were changes made.
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/FastScalar.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/FastScalar.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/FastScalar.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,206 @@
+package Mail::Box::FastScalar;
+use vars '$VERSION';
+$VERSION = '2.055';
+
+
+use strict;
+use warnings;
+use integer;
+
+sub new($) {
+    my ($class, $ref) = @_;
+    my $self = { ref => $ref, data => defined($$ref) ? $$ref : '' };
+
+    bless $self, $class;
+    return $self;
+}
+
+sub autoflush() {}
+
+sub binmode() {}
+
+sub clearerr { return 0; }
+
+sub flush() {}
+
+sub sync() { return 0; }
+
+sub opened() { return $_[0]->{ref}; }
+
+sub open($) {
+    my $self = $_[0];
+
+    $self->{ref} = $_[1];
+    $self->{data} = ${$self->{ref}};
+}
+
+sub close() {
+    my $self = $_[0];
+
+    $self->{data} = '';
+    undef $self->{ref};
+}
+
+sub eof() {
+    my $self = $_[0];
+
+    return length($self->{data}) == 0;
+}
+
+sub getc() {
+    my $self = $_[0];
+
+    return substr($self->{data}, 0, 1, '');
+}
+
+sub print {
+    my $self = shift();
+    my $buf = $#_ ? join('', @_) : $_[0];
+    my $ref = $self->{ref};
+    my $len = length($self->{data});
+
+    if ($len == 0) {
+	$$ref .= $buf;
+    } else {
+	my $pos = length($$ref) - $len;
+
+	$len = length($buf);
+	substr($$ref, $pos, $len) = $buf;
+	$self->{data} = substr($$ref, $pos + $len, -1);
+    }
+    return 1;
+}
+
+sub read($$;$) {
+    my $self = $_[0];
+    my $buf = substr($self->{data}, 0, $_[2], '');
+
+    ($_[3] ? substr($_[1], $_[3]) : $_[1]) = $buf;
+    return length($buf);
+}
+
+sub sysread($$;$) {
+    return shift->read(@_);
+}
+
+sub seek($$) {
+    my $self = $_[0];
+    my $whence = $_[2];
+    my $ref = $self->{ref};
+    my $len = length($$ref);
+    my $pos;
+
+    if ($whence == 0) {
+	$pos = $_[1];
+    } elsif ($whence == 1) {
+	$pos = $len - length($self->{data}) + $_[1];
+    } elsif ($whence == 2) {
+	$pos = $len - length($self->{data}) - $_[1];
+    } else {
+	return;
+    }
+
+    if ($pos > $len) {
+	$pos = $len;
+    } elsif ($pos < 0) {
+	$pos = 0;
+    }
+    $self->{data} = substr($$ref, $pos);
+    return 1;
+}
+
+sub sysseek($$) {
+    return $_[0]->seek($_[1], $_[2]);
+}
+
+sub setpos($) {
+    return $_[0]->seek($_[1], 0);
+}
+
+sub sref() {
+    return $_[0]->{ref};
+}
+
+sub getpos() {
+    my $self = $_[0];
+
+    return length(${$self->{ref}}) - length($self->{data});
+}
+
+sub tell() {
+    my $self = $_[0];
+
+    return length(${$self->{ref}}) - length($self->{data});
+}
+
+sub write($$;$) {
+    my $self = $_[0];
+    my $buf = substr($_[1], $_[3] || 0, $_[2]);
+    my $ref = $self->{ref};
+    my $len = length($self->{data});
+
+    if ($len == 0) {
+	$$ref .= $buf;
+    } else {
+	my $pos = length($$ref) - $len;
+
+	$len = length($buf);
+	substr($$ref, $pos, $len) = $buf;
+	$self->{data} = substr($$ref, $pos + $len, -1, '');
+    }
+    return $len;
+}
+
+sub syswrite($;$$) {
+    return shift()->write(@_);
+}
+
+sub getline() {
+    my $self = $_[0];
+    my $data = \$self->{data};
+
+    if ((my $idx = index($$data, $/)) == -1 || !defined($/)) {
+	my $r = $$data;
+
+	return unless (length($r) > 0);
+	$$data = '';
+	return $r;
+    } else {
+	return substr($$data, 0, $idx + 1, '');
+    }
+}
+
+sub getlines() {
+    my $self = $_[0];
+    my $data = $self->{data};
+    my @lines;
+
+    $self->{data} = '';
+    if (defined($/)) {
+	my $idx;
+
+	while (($idx = index($data, $/)) != -1) {
+	    push(@lines, substr($data, 0, $idx + 1, ''));
+	}
+    }
+    push(@lines, $data) if (length($data) > 0);
+    return wantarray() ? @lines : \@lines;
+}
+
+sub TIEHANDLE {
+    ((defined($_[1]) && UNIVERSAL::isa($_[1], "Mail::Box::FastScalar"))
+         ? $_[1] : shift->new(@_));
+}
+
+sub GETC { shift()->getc(@_) }
+sub PRINT { shift()->print(@_) }
+sub PRINTF { shift()->print(sprintf(shift, @_)) }
+sub READ { shift()->read(@_) }
+sub READLINE { wantarray ? shift()->getlines(@_) : shift()->getline(@_) }
+sub WRITE { shift()->write(@_); }
+sub CLOSE { shift()->close(@_); }
+sub SEEK { shift()->seek(@_); }
+sub TELL { shift()->tell(@_); }
+sub EOF { shift()->eof(@_); }
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/FastScalar.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/FastScalar.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/FastScalar.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,48 @@
+
+=head1 NAME
+
+Mail::Box::FastScalar - fast alternative to IO::Scalar
+
+
+
+
+=head1 DESCRIPTION
+
+Contributed by "Todd Richmond" (richmond at proofpoint.com)  This package
+should be released as separate package, but till then is incorporated
+in the Mail::Box module.
+
+Extremely fast L<IO::Scalar> replacement - >20x improvement in
+getline(s)()
+
+=head2 Warnings
+
+You cannot modify the original reference between calls unless you
+C<$obj->seek(1, 0)> to reset the object - VERY rare usage case
+
+$/ must be undef or string - "" and \scalar unimplemented
+
+
+
+
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/File/Message.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/File/Message.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/File/Message.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,133 @@
+
+use strict;
+package Mail::Box::File::Message;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box::Message';
+
+use POSIX 'SEEK_SET';
+use Carp;
+
+
+sub init($)
+{   my ($self, $args) = @_;
+    $self->SUPER::init($args);
+
+    $self->fromLine($args->{from_line})
+        if exists $args->{from_line};
+
+    $self;
+}
+
+#------------------------------------------
+
+sub coerce($)
+{   my ($self, $message) = @_;
+    return $message if $message->isa(__PACKAGE__);
+    $self->SUPER::coerce($message)->labelsToStatus;
+}
+
+#-------------------------------------------
+
+
+sub write(;$)
+{   my $self  = shift;
+    my $out   = shift || select;
+
+    $out->print($self->fromLine);
+    $self->head->print($out);
+    $self->body->printEscapedFrom($out);
+    $out->print("\n");
+    $self;
+}
+
+#-------------------------------------------
+
+sub clone()
+{   my $self  = shift;
+    my $clone = $self->SUPER::clone;
+    $clone->{MBMM_from_line} = $self->{MBMM_from_line};
+    $clone;
+}
+
+#-------------------------------------------
+
+
+sub fromLine(;$)
+{   my $self = shift;
+
+    $self->{MBMM_from_line} = shift if @_;
+    $self->{MBMM_from_line} ||= $self->head->createFromLine;
+}
+
+#------------------------------------------
+
+
+sub readFromParser($)
+{   my ($self, $parser) = @_;
+    my ($start, $fromline)  = $parser->readSeparator;
+    return unless $fromline;
+
+    $self->{MBMM_from_line} = $fromline;
+    $self->{MBMM_begin}     = $start;
+
+    $self->SUPER::readFromParser($parser) or return;
+    $self;
+}
+
+#-------------------------------------------
+
+sub loadHead() { shift->head }
+
+#-------------------------------------------
+
+
+sub loadBody()
+{   my $self     = shift;
+
+    my $body     = $self->body;
+    return $body unless $body->isDelayed;
+
+    my ($begin, $end) = $body->fileLocation;
+
+    my $parser   = $self->folder->parser;
+    $parser->filePosition($begin);
+
+    my $newbody  = $self->readBody($parser, $self->head);
+    unless($newbody)
+    {   $self->log(ERROR => 'Unable to read delayed body.');
+        return;
+    }
+
+    $self->log(PROGRESS => 'Loaded delayed body.');
+    $self->storeBody($newbody->contentInfoFrom($self->head));
+
+    $newbody;
+}
+
+#-------------------------------------------
+
+
+sub fileLocation()
+{   my $self = shift;
+
+    wantarray
+     ? ($self->{MBMM_begin}, ($self->body->fileLocation)[1])
+     : $self->{MBMM_begin};
+}
+
+#------------------------------------------
+
+
+sub moveLocation($)
+{   my ($self, $dist) = @_;
+    $self->{MBMM_begin} -= $dist;
+
+    $self->head->moveLocation($dist);
+    $self->body->moveLocation($dist);
+    $self;
+}
+
+#-------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/File/Message.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/File/Message.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/File/Message.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,967 @@
+
+=head1 NAME
+
+Mail::Box::File::Message - one message in a Mbox folder
+
+
+=head1 INHERITANCE
+
+ Mail::Box::File::Message
+   is a Mail::Box::Message
+   is a Mail::Message
+   is a Mail::Reporter
+
+ Mail::Box::File::Message is extended by
+   Mail::Box::Dbx::Message
+   Mail::Box::Mbox::Message
+
+
+=head1 SYNOPSIS
+
+ my $folder  = new Mail::Box::File folder => $ENV{MAIL}, ...;
+ my $message = $folder->message(0);
+
+
+=head1 DESCRIPTION
+
+Maintain one message in an file based folder, any L<Mail::Box::File|Mail::Box::File>
+extension.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message/"Constructors">
+
+=back
+
+Mail::Box::File::Message-E<gt>B<coerce>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box::Message/"METHODS">
+
+=back
+
+Mail::Box::File::Message-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+Messages in file-based folders use the following options for creation:
+
+ Option      Defined in       Default                                                       
+ body        L<Mail::Message>  undef                                                         
+ body_type   L<Mail::Box::Message>  <from folder>                                                 
+ deleted     L<Mail::Message>  <false>                                                       
+ field_type  L<Mail::Message>  undef                                                         
+ folder      L<Mail::Box::Message>  <required>                                                    
+ from_line                    undef                                                         
+ head        L<Mail::Message>  undef                                                         
+ head_type   L<Mail::Message>  L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>
+ labels      L<Mail::Message>  {}                                                            
+ log         L<Mail::Reporter>  C<'WARNINGS'>                                                 
+ messageId   L<Mail::Message>  undef                                                         
+ modified    L<Mail::Message>  <false>                                                       
+ size        L<Mail::Box::Message>  undef                                                         
+ trace       L<Mail::Reporter>  C<'WARNINGS'>                                                 
+ trusted     L<Mail::Message>  <false>                                                       
+
+. body OBJECT
+
+. body_type CODE|CLASS
+
+. deleted BOOLEAN
+
+. field_type CLASS
+
+. folder FOLDER
+
+. from_line STRING
+
+=over 4
+
+The line which begins each message in the file. Some people detest
+this line, but this is just how things were invented...
+
+=back
+
+. head OBJECT
+
+. head_type CLASS
+
+. labels ARRAY|HASH
+
+. log LEVEL
+
+. messageId STRING
+
+. modified BOOLEAN
+
+. size INTEGER
+
+. trace LEVEL
+
+. trusted BOOLEAN
+
+=back
+
+=head2 Constructing a message
+
+
+$obj-E<gt>B<bounce>([RG-OBJECT|OPTIONS])
+
+=over 4
+
+See L<Mail::Message::Construct::Bounce/"Constructing a message">
+
+=back
+
+Mail::Box::File::Message-E<gt>B<build>([MESSAGE|BODY], CONTENT)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+Mail::Box::File::Message-E<gt>B<buildFromBody>(BODY, [HEAD], HEADERS)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forward>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardAttach>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardEncapsulate>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardInline>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardNo>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPostlude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPrelude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardSubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+Mail::Box::File::Message-E<gt>B<read>(FILEHANDLE|SCALAR|REF-SCALAR|ARRAY-OF-LINES, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Read/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<rebuild>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<reply>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replyPrelude>([STRING|FIELD|ADDRESS|ARRAY-OF-THINGS])
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replySubject>(STRING)
+
+Mail::Box::File::Message-E<gt>B<replySubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+=head2 The Message
+
+
+$obj-E<gt>B<container>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isDummy>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isPart>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<messageId>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<send>([MAILER], OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<toplevel>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<write>([FILEHANDLE])
+
+=over 4
+
+Write one message to a file handle.  It is the message including the
+leading 'From ' line and trailing blank.  The From-line may interfere
+with lines in the body: those lines are escaped with an extra '>'.
+
+I<Example:> 
+
+ $msg->write(\*FILE);    # print the message with encaps to FILE
+ $msg->write;            # message with encaps to selected filehandle
+ $msg->print(\*FILE);    # the message without encaps.
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<bcc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<cc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<date>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<destinations>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<from>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<get>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<guessTimestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<head>([HEAD])
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<sender>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<study>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<subject>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<timestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<to>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+=head2 The body
+
+
+$obj-E<gt>B<body>([BODY])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<decoded>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<encode>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isNested>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<parts>(['ALL'|'ACTIVE'|'DELETED'|'RECURSE'|FILTER])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+=head2 Flags
+
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<deleted>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isDeleted>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<label>(LABEL|PAIRS)
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<labels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<labelsToStatus>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<statusToLabels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+=head2 The whole message as text
+
+
+$obj-E<gt>B<file>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<lines>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<printStructure>([FILEHANDLE][, INDENT])
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+=head2 The message
+
+
+$obj-E<gt>B<copyTo>(FOLDER)
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<folder>([FOLDER])
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<fromLine>([LINE])
+
+=over 4
+
+Many people detest file-style folders because they store messages all in
+one file, where a line starting with C<From > leads the header.  If we
+receive a message from a file-based folder, we store that line.  If we write
+to such a file, but there is no such line stored, then we try to generate
+one.
+
+If LINE is provided, then the starting line is set to this value.
+
+=back
+
+$obj-E<gt>B<moveTo>(FOLDER)
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<seqnr>([INTEGER])
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<diskDelete>
+
+=over 4
+
+See L<Mail::Box::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<fileLocation>
+
+=over 4
+
+Returns the location of the whole message including the from-line.  In
+LIST context, both begin and end are returned.  In SCALAR context, only
+the begin is passed back.
+
+=back
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<loadBody>
+
+=over 4
+
+=back
+
+$obj-E<gt>B<moveLocation>(DISTANCE)
+
+=over 4
+
+The message is relocated in the file, being moved over DISTANCE bytes.
+Setting a new location will update the according information in the header
+and body.
+
+=back
+
+$obj-E<gt>B<readBody>(PARSER, HEAD [, BODYTYPE])
+
+=over 4
+
+See L<Mail::Box::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readFromParser>(PARSER)
+
+=over 4
+
+Read one message from a L<Mail::Box::File|Mail::Box::File> based folder, including the
+message separator.
+
+=back
+
+$obj-E<gt>B<readHead>(PARSER [,CLASS])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<recursiveRebuildPart>(PART, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Internals">
+
+=back
+
+$obj-E<gt>B<storeBody>(BODY)
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<takeMessageId>([STRING])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Message::Construct/"METHODS">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::File::Message-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::File::Message-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::File::Message-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortSize>([VALUE])
+
+Mail::Box::File::Message-E<gt>B<shortSize>([VALUE])
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortString>
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<destruct>
+
+=over 4
+
+See L<Mail::Box::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot include forward source as $include.
+
+Unknown alternative for the L<forward(include)|Mail::Message::Construct::Forward/"Constructing a message">.  Valid choices are
+C<NO>, C<INLINE>, C<ATTACH>, and C<ENCAPSULATE>.
+
+I<Error:> Cannot include reply source as $include.
+
+Unknown alternative for the C<include> option of L<reply()|Mail::Message::Construct::Reply/"Constructing a message">.  Valid
+choices are C<NO>, C<INLINE>, and C<ATTACH>.
+
+I<Error:> No address to create forwarded to.
+
+If a forward message is created, a destination address must be specified.
+
+I<Error:> No default mailer found to send message.
+
+The message L<send()|Mail::Message/"The Message"> mechanism had not enough information to automatically
+find a mail transfer agent to sent this message.  Specify a mailer
+explicitly using the C<via> options.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Unable to read delayed body.
+
+
+I<Error:> forwardAttach requires a preamble object
+
+
+I<Error:> forwardEncapsulate requires a preamble object
+
+
+I<Error:> no rebuild rule $name defined.
+
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/File.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/File.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/File.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,512 @@
+
+use strict;
+package Mail::Box::File;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box';
+
+use Mail::Box::File::Message;
+
+use Mail::Message::Body::Lines;
+use Mail::Message::Body::File;
+use Mail::Message::Body::Delayed;
+use Mail::Message::Body::Multipart;
+
+use Mail::Message::Head;
+
+use Carp;
+use File::Copy;
+use File::Spec;
+use File::Basename;
+use POSIX ':unistd_h';
+use IO::File ();
+
+my $windows;
+BEGIN { $windows = $^O =~ m/mswin32|cygwin/i }
+
+
+my $default_folder_dir = exists $ENV{HOME} ? $ENV{HOME} . '/Mail' : '.';
+
+sub _default_body_type($$)
+{   my $size = shift->guessBodySize || 0;
+    'Mail::Message::Body::'.($size > 10000 ? 'File' : 'Lines');
+}
+
+sub init($)
+{   my ($self, $args) = @_;
+    $args->{folderdir} ||= $default_folder_dir;
+    $args->{body_type} ||= \&_default_body_type;
+    $args->{lock_file} ||= '--';   # to be resolved later
+
+    return unless defined $self->SUPER::init($args);
+
+    my $class = ref $self;
+
+    my $filename         = $self->{MBF_filename}
+       = $class->folderToFilename
+           ( $self->name
+           , $self->folderdir
+           );
+
+       if(-e $filename) {;}    # Folder already exists
+    elsif(   $args->{create} && $class->create($args->{folder}, %$args)) {;}
+    else
+    {   $self->log(PROGRESS =>
+                      "File $filename for folder $self does not exist.");
+        return;
+    }
+
+    $self->{MBF_policy}  = $args->{write_policy};
+
+    # Lock the folder.
+
+    my $locker   = $self->locker;
+
+    my $lockfile = $locker->filename;
+    if($lockfile eq '--')            # filename to be used not resolved yet
+    {   my $lockdir   = $filename;
+        $lockdir      =~ s!/([^/]*)$!!;
+        my $extension = $args->{lock_extension} || '.lock';
+
+        $locker->filename
+          ( File::Spec->file_name_is_absolute($extension) ? $extension
+          : $extension =~ m!^\.!  ? "$filename$extension"
+          :                         File::Spec->catfile($lockdir, $extension)
+          );
+    }
+
+    unless($locker->lock)
+    {   $self->log(ERROR => "Cannot get a lock on $class folder $self.");
+        return;
+    }
+
+    # Check if we can write to the folder, if we need to.
+
+    if($self->writable && ! -w $filename)
+    {   $self->log(WARNING => "Folder $self file $filename is write-protected.");
+        $self->{MB_access} = 'r';
+    }
+
+    # Start parser if reading is required.
+
+      $self->{MB_access} !~ m/r/ ? $self
+    : $self->parser              ? $self
+    :                              undef;
+}
+
+#-------------------------------------------
+
+
+sub create($@)
+{   my ($thingy, $name, %args) = @_;
+    my $class     = ref $thingy      || $thingy;
+    my $folderdir = $args{folderdir} || $default_folder_dir;
+    my $subext    = $args{subfolder_extension};    # not always available
+    my $filename  = $class->folderToFilename($name, $folderdir, $subext);
+
+    return $class if -f $filename;
+
+    my $dir       = dirname $filename;
+    if(-f $dir && defined $subext)
+    {   $dir      .= $subext;
+        $filename  = File::Spec->catfile($dir, basename $filename);
+    }
+
+    $class->log(ERROR => "Cannot create directory $dir for folder $name: $!"),return
+        unless -d $dir || mkdir $dir, 0755;
+
+    $class->moveAwaySubFolder($filename, $subext)
+        if -d $filename && defined $subext;
+
+    if(my $create = IO::File->new($filename, 'w'))
+    {   $class->log(PROGRESS => "Created folder $name.");
+        $create->close or return;
+    }
+    else
+    {   $class->log(WARNING => "Cannot create folder file $name: $!\n");
+        return;
+    }
+
+    $class;
+}
+
+#-------------------------------------------
+
+sub foundIn($@)
+{   my $class = shift;
+    my $name  = @_ % 2 ? shift : undef;
+    my %args  = @_;
+    $name   ||= $args{folder} or return;
+
+    my $folderdir = $args{folderdir} || $default_folder_dir;
+    my $filename  = $class->folderToFilename($name, $folderdir);
+
+    -f $filename;
+}
+
+#-------------------------------------------
+
+sub organization() { 'FILE' }
+
+#-------------------------------------------
+
+sub size()
+{   my $self = shift;
+    $self->isModified ? $self->SUPER::size : -s $self->filename;
+}
+
+#-------------------------------------------
+
+sub close(@)
+{   my $self = $_[0];            # be careful, we want to set the calling
+    undef $_[0];                 #    ref to undef, as the SUPER does.
+    shift;
+
+    my $rc = $self->SUPER::close(@_);
+
+    if(my $parser = delete $self->{MBF_parser}) { $parser->stop }
+
+    $rc;
+}
+
+#-------------------------------------------
+
+
+sub appendMessages(@)
+{   my $class  = shift;
+    my %args   = @_;
+
+    my @messages
+      = exists $args{message}  ? $args{message}
+      : exists $args{messages} ? @{$args{messages}}
+      :                          return ();
+
+    my $folder   = $class->new(lock_type => 'NONE', @_, access => 'w+')
+       or return ();
+ 
+    my $filename = $folder->filename;
+
+    my $out      = IO::File->new($filename, 'a');
+    unless($out)
+    {   $class->log(ERROR => "Cannot append messages to folder file $filename: $!");
+        return ();
+    }
+
+    my $msgtype = $class.'::Message';
+    my @coerced;
+
+    foreach my $msg (@messages)
+    {   my $coerced
+           = $msg->isa($msgtype) ? $msg
+           : $msg->can('clone')  ? $msgtype->coerce($msg->clone)
+           :                       $msgtype->coerce($msg);
+
+        $coerced->write($out);
+        push @coerced, $coerced;
+    }
+
+    my $ok = $folder->close;
+    return 0 unless $out->close && $ok;
+
+    @coerced;
+}
+
+#-------------------------------------------
+
+
+sub filename() { shift->{MBF_filename} }
+
+#-------------------------------------------
+
+
+sub parser()
+{   my $self = shift;
+
+    return $self->{MBF_parser}
+        if defined $self->{MBF_parser};
+
+    my $source = $self->filename;
+
+    my $mode = $self->{MB_access} || 'r';
+    $mode    = 'r+' if $mode eq 'rw' || $mode eq 'a';
+
+    my $parser = $self->{MBF_parser}
+       = Mail::Box::Parser->new
+        ( filename  => $source
+        , mode      => $mode
+        , trusted   => $self->{MB_trusted}
+        , fix_header_errors => $self->{MB_fix_headers}
+        , $self->logSettings
+        ) or return;
+
+    $parser->pushSeparator('From ');
+    $parser;
+}
+
+#-------------------------------------------
+
+sub readMessages(@)
+{   my ($self, %args) = @_;
+
+    $self->messageCreateOptions
+     ( $args{message_type}
+     , $self->logSettings
+     , folder     => $self
+     , head_type  => $args{head_type}
+     , field_type => $args{field_type}
+     , trusted    => $args{trusted}
+     );
+
+    $self->updateMessages;
+}
+ 
+#-------------------------------------------
+
+
+sub updateMessages(@)
+{   my ($self, %args) = @_;
+    my $parser   = $self->parser or return;
+
+    # On a directory, simulate an empty folder with only subfolders.
+    my $filename = $self->filename;
+    return $self if -d $filename;
+
+    if(my $last  = $self->message(-1))
+    {  (undef, my $end) = $last->fileLocation;
+       $parser->filePosition($end);
+    }
+
+    my ($type, @msgopts) = $self->messageCreateOptions;
+    my $count    = 0;
+
+    while(1)
+    {   my $message = $type->new(@msgopts);
+        last unless $message->readFromParser($parser);
+        $self->storeMessage($message);
+        $count++;
+    }
+
+    $self->log(PROGRESS => "Found $count new messages in $filename")
+        if $count;
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub messageCreateOptions(@)
+{   my ($self, @options) = @_;
+    if(@options)
+    {   ref($_) && ref($_) =~ m/^Mail::/ && weaken $_ for @options;
+        $self->{MBF_create_options} = \@options;
+    }
+    
+    @{$self->{MBF_create_options}};
+}
+
+#-------------------------------------------
+
+
+sub moveAwaySubFolder($$)
+{   my ($self, $dir, $extension) = @_;
+    $self->log("ERROR: Cannot move away sub-folder $dir")
+       unless move $dir, $dir.$extension;
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub writeMessages($)
+{   my ($self, $args) = @_;
+
+    my $filename = $self->filename;
+    if( ! @{$args->{messages}} && $self->{MB_remove_empty})
+    {   $self->log(WARNING => "Cannot remove folder $self file $filename: $!")
+             unless unlink $filename;
+        return $self;
+    }
+
+    my $policy = exists $args->{policy} ? $args->{policy} : $self->{MBF_policy};
+    $policy  ||= '';
+
+    my $success
+      = ! -e $filename       ? $self->_write_new($args)
+      : $policy eq 'INPLACE' ? $self->_write_inplace($args)
+      : $policy eq 'REPLACE' ? $self->_write_replace($args)
+      : $self->_write_replace($args) ? 1
+      : $self->_write_inplace($args);
+
+    unless($success)
+    {   $self->log(ERROR => "Unable to update folder $self.");
+        return;
+    }
+
+    $self->parser->restart;
+    $self;
+}
+
+sub _write_new($)
+{   my ($self, $args) = @_;
+
+    my $filename = $self->filename;
+    my $new      = IO::File->new($filename, 'w');
+    return 0 unless defined $new;
+
+    $_->write($new) foreach @{$args->{messages}};
+
+    $new->close or return 0;
+
+    $self->log(PROGRESS =>
+                  "Wrote new folder $self with ".@{$args->{messages}}."msgs.");
+    1;
+}
+
+# First write to a new file, then replace the source folder in one
+# move.  This is much slower than inplace update, but it is safer,
+# The folder is always in the right shape, even if the program is
+# interrupted.
+
+sub _write_replace($)
+{   my ($self, $args) = @_;
+
+    my $filename = $self->filename;
+    my $tmpnew   = $self->tmpNewFolder($filename);
+
+    my $new      = IO::File->new($tmpnew, 'w')   or return 0;
+    my $old      = IO::File->new($filename, 'r') or return 0;
+
+    my ($reprint, $kept) = (0,0);
+
+    foreach my $message ( @{$args->{messages}} )
+    {
+        my $newbegin = $new->tell;
+        my $oldbegin = $message->fileLocation;
+
+        if($message->isModified)
+        {   $message->write($new);
+            $message->moveLocation($newbegin - $oldbegin)
+               if defined $oldbegin;
+            $reprint++;
+        }
+        else
+        {   my ($begin, $end) = $message->fileLocation;
+            my $need = $end-$begin;
+
+            $old->seek($begin, 0);
+            my $whole;
+            my $size = $old->read($whole, $need);
+
+            $self->log(ERROR => "File too short to get write message "
+                                . $message->seqnr. " ($size, $need)")
+               unless $size == $need;
+
+            $new->print($whole);
+            $new->print("\n");
+
+            $message->moveLocation($newbegin - $oldbegin);
+            $kept++;
+        }
+    }
+
+    my $ok = $new->close;
+    return 0 unless $old->close && $ok;
+
+    unlink $filename if $windows;
+    unless(move $tmpnew, $filename)
+    {   $self->log(WARNING =>
+            "Cannot replace $filename by $tmpnew, to update folder $self: $!");
+
+        unlink $tmpnew;
+        return 0;
+    }
+
+    $self->log(PROGRESS => "Folder $self replaced ($kept, $reprint)");
+    1;
+}
+
+# Inplace is currently very poorly implemented.  From the first
+# location where changes appear, all messages are rewritten.
+
+sub _write_inplace($)
+{   my ($self, $args) = @_;
+
+    my @messages = @{$args->{messages}};
+    my $last;
+
+    my ($msgnr, $kept) = (0, 0);
+    while(@messages)
+    {   my $next = $messages[0];
+        last if $next->isModified || $next->seqnr!=$msgnr++;
+        $last    = shift @messages;
+        $kept++;
+    }
+
+    if(@messages==0 && $msgnr==$self->messages)
+    {   $self->log(PROGRESS => "No changes to be written to $self.");
+        return 1;
+    }
+
+    $_->body->load foreach @messages;
+
+    my $mode     = $^O eq 'MSWin32' ? 'a' : '+<';
+    my $filename = $self->filename;
+
+    my $old      = IO::File->new($filename, $mode) or return 0;
+
+    # Chop the folder after the messages which does not have to change.
+
+    my $end = defined $last ? ($last->fileLocation)[1] : 0;
+
+    $end =~ m/(.*)/;  # untaint, only required by perl5.6.1
+    $end = $1;
+
+    unless($old->truncate($end))
+    {   # truncate impossible: try replace writing
+        $old->close;
+        return 0;
+    }
+
+    unless(@messages)
+    {   # All further messages only are flagged to be deleted
+        $old->close or return 0;
+        $self->log(PROGRESS => "Folder $self shortened in-place ($kept kept)");
+        return 1;
+    }
+
+    # go to the end of the truncated output file.
+    $old->seek(0, 2);
+
+    # Print the messages which have to move.
+    my $printed = @messages;
+    foreach my $message (@messages)
+    {   my $oldbegin = $message->fileLocation;
+        my $newbegin = $old->tell;
+        $message->write($old);
+        $message->moveLocation($newbegin - $oldbegin);
+    }
+
+    $old->close or return 0;
+    $self->log(PROGRESS => "Folder $self updated in-place ($kept, $printed)");
+    1;
+}
+
+#-------------------------------------------
+
+
+sub folderToFilename($$;$)
+{   my ($thing, $name, $folderdir) = @_;
+
+    substr $name, 0, 1, $folderdir
+        if substr $name, 0, 1 eq '=';
+
+    $name;
+}
+
+sub tmpNewFolder($) { shift->filename . '.tmp' }
+
+#-------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/File.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/File.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/File.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,1002 @@
+
+=head1 NAME
+
+Mail::Box::File - handle file-based folders
+
+
+=head1 INHERITANCE
+
+ Mail::Box::File
+   is a Mail::Box
+   is a Mail::Reporter
+
+ Mail::Box::File is extended by
+   Mail::Box::Dbx
+   Mail::Box::Mbox
+
+
+=head1 SYNOPSIS
+
+
+
+=head1 DESCRIPTION
+
+C<Mail::Box::File> is the base-class for all file-based folders: folders
+which bundle multiple messages into one single file.  Usually, these
+messages are separated by a special line which indicates the start of
+the next one.
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+overload: B<@{}>
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+overload: B<cmp>
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<create>(FOLDERNAME, OPTIONS)
+
+Mail::Box::File-E<gt>B<create>(FOLDERNAME, OPTIONS)
+
+=over 4
+
+ Option     Defined in    Default
+ folderdir  L<Mail::Box>  undef  
+
+. folderdir DIRECTORY
+
+=back
+
+Mail::Box::File-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option             Defined in       Default                                                         
+ access             L<Mail::Box>     C<'r'>                                                          
+ body_delayed_type  L<Mail::Box>     L<Mail::Message::Body::Delayed|Mail::Message::Body::Delayed>    
+ body_type                           <see description>                                               
+ coerce_options     L<Mail::Box>     C<[]>                                                           
+ create             L<Mail::Box>     <false>                                                         
+ extract            L<Mail::Box>     C<10240>                                                        
+ field_type         L<Mail::Box>     undef                                                           
+ fix_headers        L<Mail::Box>     <false>                                                         
+ folder             L<Mail::Box>     C<$ENV{MAIL}>                                                   
+ folderdir          L<Mail::Box>     C<$ENV{HOME}.'/Mail'>                                           
+ head_delayed_type  L<Mail::Box>     L<Mail::Message::Head::Delayed|Mail::Message::Head::Delayed>    
+ head_type          L<Mail::Box>     L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>  
+ keep_dups          L<Mail::Box>     <false>                                                         
+ lock_extension                      C<'.lock'>                                                      
+ lock_file          L<Mail::Box>     <foldername>.<lock-extension>                                   
+ lock_timeout       L<Mail::Box>     1 hour                                                          
+ lock_type          L<Mail::Box>     L<Mail::Box::Locker::DotLock|Mail::Box::Locker::DotLock>        
+ lock_wait          L<Mail::Box>     10 seconds                                                      
+ locker             L<Mail::Box>     undef                                                           
+ log                L<Mail::Reporter>  C<'WARNINGS'>                                                   
+ manager            L<Mail::Box>     undef                                                           
+ message_type       L<Mail::Box>     L<Mail::Box::File::Message|Mail::Box::File::Message>            
+ multipart_type     L<Mail::Box>     L<Mail::Message::Body::Multipart|Mail::Message::Body::Multipart>
+ remove_when_empty  L<Mail::Box>     <true>                                                          
+ save_on_exit       L<Mail::Box>     <true>                                                          
+ trace              L<Mail::Reporter>  C<'WARNINGS'>                                                   
+ trusted            L<Mail::Box>     <depends on folder location>                                    
+ write_policy                        undef                                                           
+
+. access MODE
+
+. body_delayed_type CLASS
+
+. body_type CLASS|CODE
+
+=over 4
+
+The default C<body_type> option for C<File> folders, which will cause
+messages larger than 10kB to be stored in files and smaller files
+in memory, is implemented like this:
+
+ sub determine_body_type($$)
+ {   my $head = shift;
+     my $size = shift || 0;
+     'Mail::Message::Body::'
+        . ($size > 10000 ? 'File' : 'Lines');
+ }
+
+=back
+
+. coerce_options ARRAY
+
+. create BOOLEAN
+
+. extract INTEGER | CODE | METHOD | 'LAZY'|'ALWAYS'
+
+. field_type CLASS
+
+. fix_headers BOOLEAN
+
+. folder FOLDERNAME
+
+. folderdir DIRECTORY
+
+. head_delayed_type CLASS
+
+. head_type CLASS
+
+. keep_dups BOOLEAN
+
+. lock_extension FILENAME|STRING
+
+=over 4
+
+When the dotlock locking mechanism is used, the lock is created with a
+hardlink to the folder file.  For C<Mail::Box::File> type of folders, this
+file is by default named as the folder-file itself followed by
+C<.lock>.  For example: the C<Mail/inbox> folder file will have a hardlink
+made as C<Mail/inbox.lock>.
+
+You may specify an absolute filename, a relative (to the folder's
+directory) filename, or an extension (preceded by a dot).  So valid
+examples are:
+
+ .lock        # appended to the folder's filename
+ my_own_lockfile.test   # full filename, same dir
+ /etc/passwd            # somewhere else
+
+When the program runs with less priviledges (as normal user), often the
+default inbox folder can not be locked with the lockfile name which is
+produced by default.
+
+=back
+
+. lock_file FILENAME
+
+. lock_timeout SECONDS
+
+. lock_type CLASS|STRING|ARRAY
+
+. lock_wait SECONDS
+
+. locker OBJECT
+
+. log LEVEL
+
+. manager MANAGER
+
+. message_type CLASS
+
+. multipart_type CLASS
+
+. remove_when_empty BOOLEAN
+
+. save_on_exit BOOLEAN
+
+. trace LEVEL
+
+. trusted BOOLEAN
+
+. write_policy 'REPLACE'|'INPLACE'|undef
+
+=over 4
+
+Sets the default write policy, as default for a later call to
+L<write(policy)|Mail::Box::File/"Internals">.  With C<undef>, the best policy is autodetected.
+
+=back
+
+=back
+
+=head2 The folder
+
+
+$obj-E<gt>B<addMessage>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<addMessages>(MESSAGE [, MESSAGE, ...])
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+Mail::Box::File-E<gt>B<appendMessages>(OPTIONS)
+
+=over 4
+
+Appending messages to a file based folder which is not opened is a little
+risky.  In practice, this is often done without locking the folder.  So,
+an other application may write to the folder at the same time... :(  Hopefully,
+all goes fast enough that the chance on collition is small.
+
+ Option    Defined in       Default   
+ folder    L<Mail::Box>     <required>
+ message   L<Mail::Box>     undef     
+ messages  L<Mail::Box>     undef     
+
+. folder FOLDERNAME
+
+. message MESSAGE
+
+. messages ARRAY-OF-MESSAGES
+
+=back
+
+$obj-E<gt>B<close>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<copyTo>(FOLDER, OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<filename>
+
+=over 4
+
+Returns the filename for this folder, which may be an absolute or relative
+path to the file.
+
+I<Example:> 
+
+ print $folder->filename;
+
+=back
+
+$obj-E<gt>B<folderdir>([DIRECTORY])
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+Mail::Box::File-E<gt>B<foundIn>([FOLDERNAME], OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<organization>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<type>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<update>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<url>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+=head2 Folder flags
+
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+$obj-E<gt>B<writable>
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+=head2 The messages
+
+
+$obj-E<gt>B<current>([NUMBER|MESSAGE|MESSAGE-ID])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<find>(MESSAGE-ID)
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<findFirstLabeled>(LABEL, [BOOLEAN, [ARRAY-OF-MSGS]])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<message>(INDEX [,MESSAGE])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messageId>(MESSAGE-ID [,MESSAGE])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messageIds>
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messages>(['ALL',RANGE,'ACTIVE','DELETED',LABEL,!LABEL,FILTER])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<scanForMessages>(MESSAGE, MESSAGE-IDS, TIMESPAN, WINDOW)
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+=head2 Sub-folders
+
+
+$obj-E<gt>B<listSubFolders>(OPTIONS)
+
+Mail::Box::File-E<gt>B<listSubFolders>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+$obj-E<gt>B<nameOfSubFolder>(NAME)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+$obj-E<gt>B<openRelatedFolder>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+$obj-E<gt>B<openSubFolder>(NAME, OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<coerce>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<determineBodyType>(MESSAGE, HEAD)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<folderToFilename>(FOLDERNAME, FOLDERDIR, [SUBEXT])
+
+Mail::Box::File-E<gt>B<folderToFilename>(FOLDERNAME, FOLDERDIR, [SUBEXT])
+
+=over 4
+
+Translate a folder name into a filename, using the
+FOLDERDIR value to replace a leading C<=>.  SUBEXT is only used for MBOX
+folders.
+
+=back
+
+$obj-E<gt>B<lineSeparator>([STRING|'CR'|'LF'|'CRLF'])
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<locker>
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<messageCreateOptions>([TYPE, CONFIG])
+
+=over 4
+
+Returns a key-value list of options to be used each time a new message
+is read from a file.  The list is preceeded by the TYPE of message which
+has to be created.
+
+This data is used by L<readMessages()|Mail::Box/"Internals"> and L<updateMessages()|Mail::Box::File/"Internals">.  With
+TYPE and CONFIG, a new configuration is set.
+
+=back
+
+$obj-E<gt>B<moveAwaySubFolder>(DIRECTORY, EXTENSION)
+
+=over 4
+
+The DIRECTORY is renamed by appending the EXTENSION, which defaults to C<".d">,
+to make place for a folder file on that specific location.  C<false> is
+returned if this failed.
+
+=back
+
+$obj-E<gt>B<parser>
+
+=over 4
+
+Create a parser for this mailbox.  The parser stays alive as long as
+the folder is open.
+
+=back
+
+$obj-E<gt>B<read>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<readMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<storeMessage>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<toBeThreaded>(MESSAGES)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<toBeUnthreaded>(MESSAGES)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<updateMessages>(OPTIONS)
+
+=over 4
+
+For file based folders, the file handle stays open until the folder
+is closed.  Update is therefore rather simple: move to the end
+of the last known message, and continue reading...
+
+=back
+
+$obj-E<gt>B<write>(OPTIONS)
+
+=over 4
+
+ Option        Defined in       Default
+ force         L<Mail::Box>     <false>
+ policy                         undef  
+ save_deleted  L<Mail::Box>     <false>
+
+. force BOOLEAN
+
+. policy 'REPLACE'|'INPLACE'|undef
+
+=over 4
+
+In what way will the mail folder be updated.  If not specified during the
+write, the value of the L<new(write_policy)|Mail::Box::File/"METHODS"> at folder creation is taken.
+
+Valid values:
+
+=over 4
+
+=item * C<REPLACE>
+
+First a new folder is written in the same directory as the folder which has
+to be updated, and then a call to move will throw away the old immediately
+replacing it by the new.
+
+Writing in C<REPLACE> module is slightly optimized: messages which are not 
+modified are copied from file to file, byte by byte.  This is much
+faster than printing the data which is will be done for modified messages.
+
+=item * C<INPLACE>
+
+The original folder file will be opened read/write.  All message which where
+not changed will be left untouched, until the first deleted or modified
+message is detected.  All further messages are printed again.
+
+=item * C<undef>
+
+As default, or when C<undef> is explicitly specified, first C<REPLACE> mode
+is tried.  Only when that fails, an C<INPLACE> update is performed.
+
+=back
+
+C<INPLACE> will be much faster than C<REPLACE> when applied on large
+folders, however requires the C<truncate> function to be implemented on
+your operating system (at least available for recent versions of Linux,
+Solaris, Tru64, HPUX).  It is also dangerous: when the program is interrupted
+during the update process, the folder is corrupted.  Data may be lost.
+
+However, in some cases it is not possible to write the folder with
+C<REPLACE>.  For instance, the usual incoming mail folder on UNIX is
+stored in a directory where a user can not write.  Of course, the
+C<root> and C<mail> users can, but if you want to use this Perl module
+with permission of a normal user, you can only get it to work in C<INPLACE>
+mode.  Be warned that in this case folder locking via a lockfile is not
+possible as well.
+
+=back
+
+. save_deleted BOOLEAN
+
+=back
+
+$obj-E<gt>B<writeMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+=head3 File based folders
+
+File based folders maintain a folder (a set of messages) in one
+single file.  The advantage is that your folder has only one
+single name, which speeds-up access to all messages at once.
+
+The disadvantage over directory based folder (see L<Mail::Box::Dir|Mail::Box::Dir>)
+is that you have to construct some means to keep all message apart,
+for instance by adding a message separator, and this will cause
+problems.  Where access to all messages at once is faster in file
+based folders, access to a single message is (much) slower, because
+the whole folder must be read.
+
+=head3 File based folders
+
+File based folders maintain a folder (a set of messages) in one
+single file.  The advantage is that your folder has only one
+single name, which speeds-up access to all messages at once.
+
+The disadvantage over directory based folder (see L<Mail::Box::Dir|Mail::Box::Dir>)
+is that you have to construct some means to keep all message apart,
+for instance by adding a message separator, and this will cause
+problems.  Where access to all messages at once is faster in file
+based folders, access to a single message is (much) slower, because
+the whole folder must be read.
+
+=head2 Other methods
+
+
+$obj-E<gt>B<timespan2seconds>(TIME)
+
+Mail::Box::File-E<gt>B<timespan2seconds>(TIME)
+
+=over 4
+
+See L<Mail::Box/"Other methods">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::File-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::File-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::File-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Box/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot append messages to folder file $filename: $!
+
+Appending messages to a not-opened file-organized folder may fail when the
+operating system does not allow write access to the file at hand.
+
+I<Error:> Cannot create directory $dir for folder $name.
+
+While creating a file-organized folder, at most one level of directories
+is created above it.  Apparently, more levels of directories are needed,
+or the operating system does not allow you to create the directory.
+
+I<Error:> Cannot create folder file $name: $!
+
+The file-organized folder file cannot be created for the indicated reason.
+In common cases, the operating system does not grant you write access to
+the directory where the folder file should be stored.
+
+I<Error:> Cannot get a lock on $type folder $self.
+
+A lock is required to get access to the folder.  If no locking is needed,
+specify the NONE lock type.
+
+I<Error:> Cannot move away sub-folder $dir
+
+
+I<Warning:> Cannot remove folder $name file $filename: $!
+
+Writing an empty folder will usually cause that folder to be removed,
+which fails for the indicated reason.  L<new(remove_when_empty)|Mail::Box/"Constructors">
+
+I<Warning:> Cannot remove folder $name file $filename: $!
+
+Writing an empty folder will usually cause that folder to be removed,
+which fails for the indicated reason.  L<new(remove_when_empty)|Mail::Box/"Constructors">
+controls whether the empty folder will removed; setting it to false
+(C<0>) may be needed to avoid this message.
+
+I<Error:> Cannot replace $filename by $tempname, to update folder $name: $!
+
+The replace policy wrote a new folder file to update the existing, but
+was unable to give the final touch: replacing the old version of the
+folder file for the indicated reason.
+
+I<Warning:> Changes not written to read-only folder $self.
+
+You have opened the folder read-only --which is the default set
+by L<new(access)|Mail::Box/"Constructors">--, made modifications, and now want to close it.
+Set L<close(force)|Mail::Box/"The folder"> if you want to overrule the access mode, or close
+the folder with L<close(write)|Mail::Box/"The folder"> set to C<NEVER>.
+
+I<Error:> Copying failed for one message.
+
+For some reason, for instance disc full, removed by external process, or
+read-protection, it is impossible to copy one of the messages.  Copying will
+proceed for the other messages.
+
+I<Error:> Destination folder $name is not writable.
+
+The folder where the messages are copied to is not opened with write
+access (see L<new(access)|Mail::Box/"Constructors">).  This has no relation with write permission
+to the folder which is controled by your operating system.
+
+I<Warning:> Different messages with id $msgid.
+
+The message id is discovered more than once within the same folder, but the
+content of the message seems to be different.  This should not be possible:
+each message must be unique.
+
+I<Error:> File too short to get write message $nr ($size, $need)
+
+Mail::Box is lazy: it tries to leave messages in the folders until they
+are used, which saves time and memory usage.  When this message appears,
+something is terribly wrong: some lazy message are needed for updating the
+folder, but they cannot be retreived from the original file anymore.  In
+this case, messages can be lost.
+
+This message does appear regularly on Windows systems when using the
+'replace' write policy.  Please help to find the cause, probably something
+to do with Windows incorrectly handling multiple filehandles open in the
+same file.
+
+I<Warning:> Folder $name file $filename is write-protected.
+
+The folder is opened writable or for appending via L<new(access)|Mail::Box/"Constructors">,
+but the operating system does not permit writing to the file.  The folder
+will be opened read-only.
+
+I<Error:> Folder $name not deleted: not writable.
+
+The folder must be opened with write access via L<new(access)|Mail::Box/"Constructors">, otherwise
+removing it will be refused.  So, you may have write-access according to
+the operating system, but that will not automatically mean that this
+C<delete> method permits you to.  The reverse remark is valid as well.
+
+I<Error:> Invalid timespan '$timespan' specified.
+
+The string does not follow the strict rules of the time span syntax which
+is permitted as parameter.
+
+I<Warning:> Message-id '$msgid' does not contain a domain.
+
+According to the RFCs, message-ids need to contain a unique random part,
+then an C<@>, and then a domain name.  This is made to avoid the creation
+of two messages with the same id.  The warning emerges when the C<@> is
+missing from the string.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Unable to create subfolder $name of $folder.
+
+The copy includes the subfolders, but for some reason it was not possible
+to copy one of these.  Copying will proceed for all other sub-folders.
+
+I<Error:> Unable to update folder $self.
+
+When a folder is to be written, both replace and inplace write policies are
+tried,  If both fail, the whole update fails.  You may see other, related,
+error messages to indicate the real problem.
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4/Head.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4/Head.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4/Head.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,62 @@
+
+use strict;
+
+package Mail::Box::IMAP4::Head;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Head';
+
+use Date::Parse;
+
+
+sub init($$)
+{   my ($self, $args) = @_;
+    $self->SUPER::init($args);
+
+    $self->{MBIH_c_fields} = $args->{cache_fields};
+    $self;
+}
+
+#------------------------------------------
+
+
+sub get($;$)
+{   my ($self, $name, $index) = @_;
+
+       if(not $self->{MBIH_c_fields}) { ; }
+    elsif(wantarray)
+    {   my @values = $self->SUPER::get(@_);
+        return @values if @values;
+    }
+    else
+    {   my $value  = $self->SUPER::get(@_);
+        return $value  if defined $value;
+    }
+
+    # Something here, playing with ENVELOPE, may improve the performance
+    # as well.
+    my $imap   = $self->folder->transporter;
+
+    my @fields = $imap->getFields($name);
+
+    if(@fields && $self->{MBIH_c_fields})
+    {   $self->addNoRealize($_) for @fields
+    }
+
+      defined $index ? $fields[$index]
+    : wantarray      ? @fields
+    :                  $fields[0];
+}
+
+#------------------------------------------
+
+sub guessBodySize() {undef}
+
+#-------------------------------------------
+
+sub guessTimestamp() {undef}
+
+#------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4/Head.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4/Head.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4/Head.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,414 @@
+
+=head1 NAME
+
+Mail::Box::IMAP4::Head - header fields related IMAP interface
+
+
+=head1 INHERITANCE
+
+ Mail::Box::IMAP4::Head
+   is a Mail::Message::Head
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+
+
+=head1 DESCRIPTION
+
+This class implements a pure IMAP4 protocol interface, where as few
+data is retreived from the header as possible.  This may look nice
+to you, but is not sufficient for many tasks.  For instance, you cannot
+removed or modify fields this way.
+
+Change L<Mail::Box::IMAP4::new(cache_head)|Mail::Box::IMAP4/"METHODS"> to C<YES> or C<DELAY>, to
+get a message header which is capable of performing all possible
+games with headers.  On the other hand: the other settings are not
+100% safe...
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Message::Head/"OVERLOADED">
+
+=back
+
+overload: B<bool>
+
+=over 4
+
+See L<Mail::Message::Head/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<build>(FIELDS)
+
+=over 4
+
+See L<Mail::Message::Head/"Constructors">
+
+=back
+
+Mail::Box::IMAP4::Head-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option        Defined in       Default                                                 
+ cache_fields                   C<false>                                                
+ field_type    L<Mail::Message::Head>  L<Mail::Message::Field::Fast|Mail::Message::Field::Fast>
+ log           L<Mail::Reporter>  C<'WARNINGS'>                                           
+ message       L<Mail::Message::Head>  undef                                                   
+ modified      L<Mail::Message::Head>  <false>                                                 
+ trace         L<Mail::Reporter>  C<'WARNINGS'>                                           
+
+. cache_fields BOOLEAN
+
+=over 4
+
+This is only a read-cache on fields, because this kind of header does
+not allow writing of fields.  See L<Mail::Box::IMAP4::new(cache_head)|Mail::Box::IMAP4/"METHODS">,
+this value is set to C<false> for C<NO> and C<true> for C<PARTIAL>..
+
+=back
+
+. field_type CLASS
+
+. log LEVEL
+
+. message MESSAGE
+
+. modified BOOLEAN
+
+. trace LEVEL
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<isEmpty>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<knownNames>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<message>([MESSAGE])
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<orderedFields>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+=head2 Access to the header
+
+
+$obj-E<gt>B<get>(NAME [,INDEX])
+
+=over 4
+
+Get the information about the header line NAME.  Realization will
+take place.
+
+=back
+
+$obj-E<gt>B<study>(NAME [,INDEX])
+
+=over 4
+
+See L<Mail::Message::Head/"Access to the header">
+
+=back
+
+=head2 About the body
+
+
+$obj-E<gt>B<guessBodySize>
+
+=over 4
+
+See L<Mail::Message::Head/"About the body">
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+See L<Mail::Message::Head/"About the body">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<addNoRealize>(FIELD)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<addOrderedFields>(FIELDS)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<fileLocation>
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<load>
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<moveLocation>(DISTANCE)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<read>(PARSER)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<setNoRealize>(FIELD)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::IMAP4::Head-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::IMAP4::Head-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::IMAP4::Head-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4/Message.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4/Message.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4/Message.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,179 @@
+
+use strict;
+use warnings;
+
+package Mail::Box::IMAP4::Message;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box::Net::Message';
+
+use Date::Parse 'str2time';
+
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    $self->SUPER::init($args);
+
+    $self->{MBIM_write_labels}
+       = exists $args->{write_labels} ? $args->{write_labels} : 1;
+
+    $self->{MBIM_cache_labels} = $args->{cache_labels};
+    $self->{MBIM_cache_head}   = $args->{cache_head};
+    $self->{MBIM_cache_body}   = $args->{cache_body};
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub size($)
+{   my $self = shift;
+    
+    return $self->SUPER::size
+        unless $self->isDelayed;
+
+    $self->fetch('RFC822.SIZE');
+}
+
+#------------------------------------------
+
+sub recvstamp()
+{   my $date = shift->fetch('INTERNALDATE');
+    defined $date ? str2time($date) : undef;
+}
+
+#-------------------------------------------
+
+
+sub label(@)
+{   my $self = shift;
+    my $imap = $self->folder->transporter or return;
+    my $id   = $self->unique;
+
+    if(@_ == 1)
+    {   # get one value only
+        my $label  = shift;
+        my $labels = $self->{MM_labels};
+	return $labels->{$label}
+	   if exists $labels->{$label} || exists $labels->{seen};
+
+	my %flags = $imap->getFlags($id);
+        if($self->{MBIM_cache_labels})
+	{   @{$labels}{keys %flags} = values %flags;
+            delete $self->{MBIM_labels_changed};
+	}
+	return $flags{$label};
+    }
+
+    my @private;
+    if($self->{MBIM_write_labels})
+    {    @private = $imap->setFlags($id, @_);
+         delete $self->{MBIM_labels_changed};
+    }
+    else
+    {    @private = @_;
+    }
+
+    my $labels  = $self->{MM_labels};
+    my @keep    = $self->{MBIM_cache_labels} ? @_ : @private;
+
+    while(@keep)
+    {   my ($k, $v) = (shift @keep, shift @keep);
+        next if defined $labels->{$k} && $labels->{$k} eq $v;
+
+        $self->{MBIM_labels_changed}++;
+        $labels->{$k} = $v;
+    }
+    $self->modified(1) if @private && $self->{MBIM_labels_changed};
+ 
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub labels()
+{   my $self   = shift;
+    my $labels = $self->SUPER::labels;
+    $labels    = { %$labels } unless $self->{MBIM_cache_labels};
+
+    unless(exists $labels->{seen})
+    {   my $imap = $self->folder->transporter or return;
+        my %flags = $imap->getFlags($self->unique);
+        @{$labels}{keys %flags} = values %flags;
+    }
+
+    $labels;
+}
+
+#-------------------------------------------
+
+
+sub loadHead()
+{   my $self     = shift;
+    my $head     = $self->head;
+    return $head unless $head->isDelayed;
+
+    $head         = $self->folder->getHead($self);
+    $self->head($head) if $self->{MBIM_cache_head};
+    $head;
+}
+
+#-------------------------------------------
+
+sub loadBody()
+{   my $self     = shift;
+
+    my $body     = $self->body;
+    return $body unless $body->isDelayed;
+
+    (my $head, $body) = $self->folder->getHeadAndBody($self);
+    return undef unless defined $head;
+
+    $self->head($head)      if $self->{MBIM_cache_head} && $head->isDelayed;
+    $self->storeBody($body) if $self->{MBIM_cache_body};
+    $body;
+}
+
+#-------------------------------------------
+
+
+sub fetch(@)
+{   my ($self, @info) = @_;
+    my $folder = $self->folder;
+    my $answer = ($folder->fetch( [$self], @info))[0];
+
+    @info==1 ? $answer->{$info[0]} : @{$answer}{@info};
+}
+
+#-------------------------------------------
+
+
+sub writeDelayed($$)
+{   my ($self, $foldername, $imap) = @_;
+
+    my $id     = $self->unique;
+    my $labels = $self->labels;
+
+    if($self->head->modified || $self->body->modified || !$id)
+    {
+        $imap->appendMessage($self, $foldername);
+        if($id)
+        {   $self->delete;
+            $self->unique(undef);
+        }
+    }
+    elsif($self->{MBIM_labels_changed})
+    {   $imap->setFlags($id, %$labels);  # non-IMAP4 labels disappear
+        delete $self->{MBIM_labels_changed};
+    }
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4/Message.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4/Message.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4/Message.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,1050 @@
+
+=head1 NAME
+
+Mail::Box::IMAP4::Message - one message on a IMAP4 server
+
+
+=head1 INHERITANCE
+
+ Mail::Box::IMAP4::Message
+   is a Mail::Box::Net::Message
+   is a Mail::Box::Message
+   is a Mail::Message
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my $folder = new Mail::Box::IMAP4 ...
+ my $message = $folder->message(10);
+
+
+=head1 DESCRIPTION
+
+A C<Mail::Box::IMAP4::Message> represents one message on a IMAP4 server,
+maintained by a L<Mail::Box::IMAP4|Mail::Box::IMAP4> folder. Each message is stored as
+separate entity on the server, and maybe temporarily in your program
+as well.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message/"Constructors">
+
+=back
+
+Mail::Box::IMAP4::Message-E<gt>B<coerce>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box::Message/"METHODS">
+
+=back
+
+Mail::Box::IMAP4::Message-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option        Defined in       Default                                                       
+ body          L<Mail::Message>  undef                                                         
+ body_type     L<Mail::Box::Message>  L<Mail::Message::Body::Lines|Mail::Message::Body::Lines>      
+ cache_body                     <false>                                                       
+ cache_head                     <false>                                                       
+ cache_labels                   <false>                                                       
+ deleted       L<Mail::Message>  <false>                                                       
+ field_type    L<Mail::Message>  undef                                                         
+ folder        L<Mail::Box::Message>  <required>                                                    
+ head          L<Mail::Message>  undef                                                         
+ head_type     L<Mail::Message>  L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>
+ labels        L<Mail::Message>  {}                                                            
+ log           L<Mail::Reporter>  C<'WARNINGS'>                                                 
+ messageId     L<Mail::Message>  undef                                                         
+ modified      L<Mail::Message>  <false>                                                       
+ size          L<Mail::Box::Message>  undef                                                         
+ trace         L<Mail::Reporter>  C<'WARNINGS'>                                                 
+ trusted       L<Mail::Message>  <false>                                                       
+ unique        L<Mail::Box::Net::Message>  <unique string>                                               
+ write_labels                   <true>                                                        
+
+. body OBJECT
+
+. body_type CODE|CLASS
+
+. cache_body BOOLEAN
+
+. cache_head BOOLEAN
+
+. cache_labels BOOLEAN
+
+=over 4
+
+All standard IMAP labels can be cached on the local server to improve
+speed.  This has the same dangers as setting C<write_labels> to false.
+The caching starts when the first label of the message was read.
+
+=back
+
+. deleted BOOLEAN
+
+. field_type CLASS
+
+. folder FOLDER
+
+. head OBJECT
+
+. head_type CLASS
+
+. labels ARRAY|HASH
+
+. log LEVEL
+
+. messageId STRING
+
+. modified BOOLEAN
+
+. size INTEGER
+
+. trace LEVEL
+
+. trusted BOOLEAN
+
+. unique STRING
+
+. write_labels BOOLEAN
+
+=over 4
+
+When a label is changed or its value read, using L<label()|Mail::Box::IMAP4::Message/"METHODS">, that info
+should be sent to the IMAP server.  But, this action could be superfluous,
+for instance because the label was already set or clear, and communication
+is expensive.  On the other hand, someone else may use IMAP to make
+changes in the same folder, and will get the updates too late or never...
+
+=back
+
+=back
+
+=head2 Constructing a message
+
+
+$obj-E<gt>B<bounce>([RG-OBJECT|OPTIONS])
+
+=over 4
+
+See L<Mail::Message::Construct::Bounce/"Constructing a message">
+
+=back
+
+Mail::Box::IMAP4::Message-E<gt>B<build>([MESSAGE|BODY], CONTENT)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+Mail::Box::IMAP4::Message-E<gt>B<buildFromBody>(BODY, [HEAD], HEADERS)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forward>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardAttach>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardEncapsulate>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardInline>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardNo>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPostlude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPrelude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardSubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+Mail::Box::IMAP4::Message-E<gt>B<read>(FILEHANDLE|SCALAR|REF-SCALAR|ARRAY-OF-LINES, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Read/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<rebuild>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<reply>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replyPrelude>([STRING|FIELD|ADDRESS|ARRAY-OF-THINGS])
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replySubject>(STRING)
+
+Mail::Box::IMAP4::Message-E<gt>B<replySubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+=head2 The Message
+
+
+$obj-E<gt>B<container>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isDummy>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isPart>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<messageId>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<send>([MAILER], OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+Returns the size of this message.  If the message is still on the remote
+server, IMAP is used to ask for the size.  When the message is already loaded
+onto the local system, the size of the parsed message is taken.  These
+sizes can differ because the difference in line-ending representation.
+
+=back
+
+$obj-E<gt>B<toplevel>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<write>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<bcc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<cc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<date>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<destinations>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<from>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<get>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<guessTimestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<head>([HEAD])
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<sender>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<study>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<subject>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<timestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<to>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+=head2 The body
+
+
+$obj-E<gt>B<body>([BODY])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<decoded>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<encode>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isNested>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<parts>(['ALL'|'ACTIVE'|'DELETED'|'RECURSE'|FILTER])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+=head2 Flags
+
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<deleted>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isDeleted>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<label>(LABEL|PAIRS)
+
+=over 4
+
+With only one argument, the value related to LABEL is returned.  With
+more that one argument, the list is interpreted a label-value PAIRS
+to be set.
+
+The IMAP protocol defines its own names for the labels, which must
+be set imediately to inform other IMAP clients which may have the
+same folder open. But that can be changed with L<new(write_labels)|Mail::Box::IMAP4::Message/"METHODS">.
+Some labels are translated to the corresponding IMAP system labels. 
+
+=back
+
+$obj-E<gt>B<labels>
+
+=over 4
+
+Get the names of all labels (LIST context, not efficient in IMAP4), or
+a reference to a hash with labels.  You should only use the returned
+hash to read the labels, because changes made to it will not be passed
+to the remote server.  See L<labels()|Mail::Box::IMAP4::Message/"METHODS"> to set values.
+
+=back
+
+$obj-E<gt>B<labelsToStatus>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<statusToLabels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+=head2 The whole message as text
+
+
+$obj-E<gt>B<file>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<lines>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<printStructure>([FILEHANDLE][, INDENT])
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+=head2 The message
+
+
+$obj-E<gt>B<copyTo>(FOLDER)
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<folder>([FOLDER])
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<moveTo>(FOLDER)
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<seqnr>([INTEGER])
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<unique>([STRING|undef])
+
+=over 4
+
+See L<Mail::Box::Net::Message/"The message">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<diskDelete>
+
+=over 4
+
+See L<Mail::Box::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<fetch>([INFO, ...])
+
+=over 4
+
+Use the IMAP's C<UID FETCH IMAP> command to get some data about this
+message.  The INFO request is passed to L<Mail::Box::IMAP4::fetch()|Mail::Box::IMAP4/"Internals">.
+Without INFO, C<ALL> information is retreived and returned as a HASH.
+
+=back
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<loadBody>
+
+=over 4
+
+See L<Mail::Box::Net::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readBody>(PARSER, HEAD [, BODYTYPE])
+
+=over 4
+
+See L<Mail::Box::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readFromParser>(PARSER, [BODYTYPE])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readHead>(PARSER [,CLASS])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<recursiveRebuildPart>(PART, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Internals">
+
+=back
+
+$obj-E<gt>B<storeBody>(BODY)
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<takeMessageId>([STRING])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<writeDelayed>(IMAP)
+
+=over 4
+
+Write all delayed information, like label changes, to the server.  This
+is done under force, so should even be done for folders opened without
+write-access. This method is called indirectly by a L<Mail::Box::write()|Mail::Box/"Internals">
+or L<Mail::Box::close()|Mail::Box/"The folder">.
+
+The IMAP argument is a Mail::IMAPClient which has the right folder
+already selected.
+
+Writing changes to the remote folder is not without hassle: IMAP4
+(or is it only L<Mail::IMAPClient> doesn't support replacing header
+or body.  Therefore, when either of them change, the whole message is
+rewritten to the server (which is supported), and the original flagged
+for deletion.
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Message::Construct/"METHODS">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::IMAP4::Message-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::IMAP4::Message-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::IMAP4::Message-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortSize>([VALUE])
+
+Mail::Box::IMAP4::Message-E<gt>B<shortSize>([VALUE])
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortString>
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<destruct>
+
+=over 4
+
+See L<Mail::Box::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot include forward source as $include.
+
+Unknown alternative for the L<forward(include)|Mail::Message::Construct::Forward/"Constructing a message">.  Valid choices are
+C<NO>, C<INLINE>, C<ATTACH>, and C<ENCAPSULATE>.
+
+I<Error:> Cannot include reply source as $include.
+
+Unknown alternative for the C<include> option of L<reply()|Mail::Message::Construct::Reply/"Constructing a message">.  Valid
+choices are C<NO>, C<INLINE>, and C<ATTACH>.
+
+I<Error:> No address to create forwarded to.
+
+If a forward message is created, a destination address must be specified.
+
+I<Error:> No default mailer found to send message.
+
+The message L<send()|Mail::Message/"The Message"> mechanism had not enough information to automatically
+find a mail transfer agent to sent this message.  Specify a mailer
+explicitly using the C<via> options.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Unable to read delayed body.
+
+
+I<Error:> Unable to read delayed head.
+
+
+I<Error:> forwardAttach requires a preamble object
+
+
+I<Error:> forwardEncapsulate requires a preamble object
+
+
+I<Error:> no rebuild rule $name defined.
+
+
+
+=head1 DETAILS
+
+
+=head2 Labels
+
+
+=head3 IMAP protocol flags
+
+Labels (or flags) are known to all folder formats, but differ how they
+are stored.  Some folder types use message header lines to keep the
+labels, other use a seperate file.  The IMAP protocol does not specify
+how the labels are kept on the server, but does specify how they are named.
+
+The label names as defined by the IMAP protocol are standardized into
+the MailBox standard to hide folder differences.  The following translations
+are always performed:
+
+ \Seen     => seen
+ \Answered => replied
+ \Flagged  => flagged
+ \Deleted  => deleted
+ \Draft    => draft
+ \Recent   => NOT old
+
+I<Example:> of label translations
+
+
+ $imap->message(3)->label(replied => 1, draft => 0);
+
+will result in a IMAP protocol statements like
+
+ A003 STORE 4 +FLAGS (\Answered)
+ A003 STORE 4 -FLAGS (\Draft)
+
+=head3 Other labels
+
+Of course, your program may be in need for more labels than those provided
+by the protocol.  You can still use these: they stay locally (and are
+lost when the folder is closed).  Some IMAP4 extensions permit more labels
+than the basic RFC, but that is not yet supported by this implementation.
+
+=head3 Caching labels
+
+When you ask for one or more flags of a message more than once, you may
+improve the overall performance by setting L<new(cache_labels)|Mail::Box::IMAP4::Message/"METHODS"> to C<YES>.
+However, this may cause inconsistencies when multiple clients use the
+same folder on the IMAP server.
+
+You may also delay the label updates to the server until the
+folder is closed (or for ever when read-only is required).  When
+L<Mail::Box::write()|Mail::Box/"Internals"> or L<Mail::Box::close()|Mail::Box/"The folder"> is called, it is decided
+whether to throw all changes away or write after all.
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,323 @@
+
+use strict;
+use warnings;
+
+package Mail::Box::IMAP4;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box::Net';
+
+use Mail::Box::IMAP4::Message;
+use Mail::Box::IMAP4::Head;
+use Mail::Transport::IMAP4;
+
+use Mail::Box::Parser::Perl;
+use Mail::Message::Head::Complete;
+use Mail::Message::Head::Delayed;
+
+use Scalar::Util 'weaken';
+
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    # Need some prediction for correct defaults
+    my $access    = $args->{access} ||= 'r';
+    my $writeable = $access =~ m/w|a/;
+    my $ch        = $self->{MBI_c_head}
+      = $args->{cache_head} || ($writeable ? 'NO' : 'DELAY');
+
+    $args->{head_type} ||= 'Mail::Box::IMAP4::Head'
+       if $ch eq 'NO' || $ch eq 'PARTIAL';
+
+    $args->{body_type}  ||= 'Mail::Message::Body::Lines';
+
+    $self->SUPER::init($args);
+
+    $self->{MBI_domain}   = $args->{domain};
+    $self->{MBI_c_labels} = $args->{cache_labels}
+                         || ($writeable  ? 'NO' : 'DELAY');
+    $self->{MBI_c_body}   = $args->{cache_body}
+                         || ($writeable ? 'NO' : 'DELAY');
+
+
+    my $transport = $args->{transporter} || 'Mail::Transport::IMAP4';
+    unless(ref $transport)
+    {   eval "require $transport";
+        $self->log(ERROR => "Cannot install transporter $transport:\n$@\n"),
+           return () if $@;
+
+        $transport = $self->createTransporter($transport, %$args)
+	    or return undef;
+    }
+
+    $self->transporter($transport);
+    $self;
+}
+
+#-------------------------------------------
+
+sub create($@)
+{   my ($class, %args) =  @_;
+    $class->log(INTERNAL => "Folder creation for IMAP4 not implemented yet");
+    undef;
+}
+
+#-------------------------------------------
+
+sub foundIn(@)
+{   my $self = shift;
+    unshift @_, 'folder' if @_ % 2;
+    my %options = @_;
+
+       (exists $options{type}   && $options{type}   =~ m/^imap/i)
+    || (exists $options{folder} && $options{folder} =~ m/^imap/);
+}
+
+#-------------------------------------------
+
+sub type() {'imap4'}
+
+#-------------------------------------------
+
+
+sub close(@)
+{   my $self = shift;
+    $self->SUPER::close(@_) or return ();
+    $self->transporter(undef);
+    $self;
+}
+
+#-------------------------------------------
+
+sub listSubFolders(@)
+{   my ($thing, %args) = @_;
+    my $self = $thing;
+
+    $self = $thing->new(%args) or return ()  # list toplevel
+        unless ref $thing;
+
+    my $imap = $self->transporter;
+    defined $imap ? $imap->folders($self) : ();
+}
+
+#-------------------------------------------
+
+sub nameOfSubfolder($)
+{   my ($self, $name) = @_;
+    $name;
+}
+
+#-------------------------------------------
+
+
+sub readMessages(@)
+{   my ($self, %args) = @_;
+
+    my $name  = $self->name;
+    return $self if $name eq '/';
+
+    my $imap  = $self->transporter;
+    my @log   = $self->logSettings;
+    my $seqnr = 0;
+
+    my $cl    = $self->{MBI_c_labels} ne 'NO';
+    my $wl    = $self->{MBI_c_labels} ne 'DELAY';
+
+    my $ch    = $self->{MBI_c_head};
+    my $ht    = $ch eq 'DELAY' ? $args{head_delayed_type} : $args{head_type};
+    my @ho    = $ch eq 'PARTIAL' ? (cache_fields => 1) : ();
+
+    foreach my $id ($imap->ids)
+    {   my $head    = $ht->new(@log, @ho);
+        my $message = $args{message_type}->new
+         ( head      => $head
+         , unique    => $id
+         , folder    => $self
+         , seqnr     => $seqnr++
+
+	 , cache_labels => $cl
+	 , write_labels => $wl
+         , cache_head   => ($ch eq 'DELAY')
+         , cache_body   => ($ch ne 'NO')
+         );
+
+        my $body    = $args{body_delayed_type}
+           ->new(@log, message => $message);
+
+        $message->storeBody($body);
+
+        $self->storeMessage($message);
+    }
+
+    $self;
+}
+ 
+#-------------------------------------------
+
+
+sub getHead($)
+{   my ($self, $message) = @_;
+    my $imap   = $self->transporter or return;
+
+    my $uidl   = $message->unique;
+    my @fields = $imap->getFields($uidl, 'ALL');
+
+    unless(@fields)
+    {   $self->log(WARNING => "Message $uidl disappeared from $self.");
+        return;
+    }
+
+    my $head = $self->{MB_head_type}->new;
+    $head->addNoRealize($_) for @fields;
+
+    $self->log(PROGRESS => "Loaded head of $uidl.");
+    $head;
+}
+
+#-------------------------------------------
+
+
+sub getHeadAndBody($)
+{   my ($self, $message) = @_;
+    my $imap  = $self->transporter or return;
+    my $uid   = $message->unique;
+    my $lines = $imap->getMessageAsString($uid);
+
+    unless(defined $lines)
+    {   $self->log(WARNING => "Message $uid disappeared from $self.");
+        return ();
+     }
+
+    my $parser = Mail::Box::Parser::Perl->new   # not parseable by C parser
+     ( filename  => "$imap"
+     , file      => Mail::Box::FastScalar->new(\$lines)
+     );
+
+    my $head = $message->readHead($parser);
+    unless(defined $head)
+    {   $self->log(WARNING => "Cannot find head back for $uid in $self.");
+        $parser->stop;
+        return ();
+    }
+
+    my $body = $message->readBody($parser, $head);
+    unless(defined $body)
+    {   $self->log(WARNING => "Cannot read body for $uid in $self.");
+        $parser->stop;
+        return ();
+    }
+
+    $parser->stop;
+
+    $self->log(PROGRESS => "Loaded message $uid.");
+    ($head, $body->contentInfoFrom($head));
+}
+
+#-------------------------------------------
+
+
+sub body(;$)
+{   my $self = shift;
+    unless(@_)
+    {   my $body = $self->{MBI_cache_body} ? $self->SUPER::body : undef;
+    }
+
+    $self->unique();
+    $self->SUPER::body(@_);
+}
+
+#-------------------------------------------
+
+
+
+sub write(@)
+{   my ($self, %args) = @_;
+    my $imap  = $self->transporter or return;
+
+    $self->SUPER::write(%args, transporter => $imap) or return;
+
+    if($args{save_deleted})
+    {   $self->log(NOTICE => "Impossible to keep deleted messages in IMAP")
+    }
+    else { $imap->destroyDeleted }
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub writeMessages($@)
+{   my ($self, $args) = @_;
+
+    my $imap = $args->{transporter};
+    my $fn   = $self->name;
+
+    $_->writeDelayed($fn, $imap) for @{$args->{messages}};
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+my %transporters;
+sub createTransporter($@)
+{   my ($self, $class, %args) = @_;
+
+    my $hostname = $self->{MBN_hostname} || 'localhost';
+    my $port     = $self->{MBN_port}     || '143';
+    my $username = $self->{MBN_username} || $ENV{USER};
+
+    my $join     = exists $args{join_connection} ? $args{join_connection} : 1;
+
+    my $linkid;
+    if($join)
+    {   $linkid  = "$hostname:$port:$username";
+        return $transporters{$linkid} if defined $transporters{$linkid};
+    }
+
+    my $transporter = $class->new
+     ( %args,
+     , hostname => $hostname, port     => $port
+     , username => $username, password => $self->{MBN_password}
+     , domain   => $self->{MBI_domain}
+     ) or return undef;
+
+    if(defined $linkid)
+    {   $transporters{$linkid} = $transporter;
+        weaken($transporters{$linkid});
+    }
+
+    $transporter;
+}
+
+#-------------------------------------------
+
+
+sub transporter(;$)
+{   my $self = shift;
+    my $imap = @_ ? ($self->{MBI_transport} = shift) : $self->{MBI_transport};
+    return unless defined $imap;
+
+    my $name = $self->name;
+    $imap->folder($name) unless $name eq '/';
+
+    $imap;
+}
+
+#-------------------------------------------
+
+
+sub fetch($@)
+{   my ($self, $what, @info) = @_;
+    my $imap = $self->transporter or return [];
+    $what = $self->messages($what) unless ref $what eq 'ARRAY';
+    $imap->fetch($what, @info);
+}
+
+#-------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/IMAP4.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,1013 @@
+
+=head1 NAME
+
+Mail::Box::IMAP4 - handle IMAP4 folders as client
+
+
+=head1 INHERITANCE
+
+ Mail::Box::IMAP4
+   is a Mail::Box::Net
+   is a Mail::Box
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ use Mail::Box::IMAP4;
+ my $folder = new Mail::Box::IMAP4 folder => $ENV{MAIL}, ...;
+
+
+=head1 DESCRIPTION
+
+UNDER DEVELOPMENT!!!! LIMITATIONS:
+
+=over 4
+=item * this implementation is close to NOT TESTED!
+Of course, some testing has been done, but this is far from complete. Please
+contribute with ideas are problem reports.
+
+=item * messages are all treated as separte items
+
+Performance can be improved combining request for multiple subjects. For
+instance, a preloadFields() or a preloadEnvelope() would speed-up most
+
+applications
+=back
+
+Maintain a folder which has its messages stored on a remote server.  The
+communication between the client application and the server is implemented
+using the IMAP4 protocol.
+
+This class uses L<Mail::Transport::IMAP4|Mail::Transport::IMAP4> to hide the transport of
+information, and focusses solely on the correct handling of messages
+within a IMAP4 folder.  More than one IMAP4 folder can be handled by
+one single IMAP4 connection.
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+overload: B<@{}>
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+overload: B<cmp>
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<create>(FOLDER, OPTIONS)
+
+Mail::Box::IMAP4-E<gt>B<create>(FOLDER, OPTIONS)
+
+=over 4
+
+See L<Mail::Box::Net/"METHODS">
+
+=back
+
+Mail::Box::IMAP4-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+The C<new> can have many OPTIONS.  Not only the ones listed here below,
+but also all the OPTIONS for L<Mail::Transport::IMAP4::new()|Mail::Transport::IMAP4/"METHODS"> can be
+passed.
+
+The default depends on the value of L<new(cache_head)|Mail::Box::IMAP4/"METHODS">.
+
+Without folder name, no folder is selected.  Only few methods are
+available now, for instance L<listSubFolders()|Mail::Box/"Sub-folders"> to get the top-level
+folder names.  Usually, the folder named C<INBOX> will be present.
+
+ Option             Defined in       Default                                                                                                           
+ access             L<Mail::Box>     'r'                                                                                                               
+ body_delayed_type  L<Mail::Box>     L<Mail::Message::Body::Delayed|Mail::Message::Body::Delayed>                                                      
+ body_type          L<Mail::Box>     L<Mail::Message::Body::Lines|Mail::Message::Body::Lines>                                                          
+ cache_body                          C<NO>                                                                                                             
+ cache_head                          C<NO> or C<DELAY>                                                                                                 
+ cache_labels                        C<NO> or C<DELAY>                                                                                                 
+ coerce_options     L<Mail::Box>     C<[]>                                                                                                             
+ create             L<Mail::Box>     <false>                                                                                                           
+ extract            L<Mail::Box>     C<10240>                                                                                                          
+ field_type         L<Mail::Box>     undef                                                                                                             
+ fix_headers        L<Mail::Box>     <false>                                                                                                           
+ folder             L<Mail::Box>     C</>                                                                                                              
+ folderdir          L<Mail::Box>     <not used>                                                                                                        
+ head_delayed_type  L<Mail::Box>     L<Mail::Message::Head::Delayed|Mail::Message::Head::Delayed>                                                      
+ head_type          L<Mail::Box>     L<Mail::Box::IMAP4::Head|Mail::Box::IMAP4::Head> or L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>
+ join_connection                     C<true>                                                                                                           
+ keep_dups          L<Mail::Box>     <false>                                                                                                           
+ lock_file          L<Mail::Box>     undef                                                                                                             
+ lock_timeout       L<Mail::Box>     1 hour                                                                                                            
+ lock_type          L<Mail::Box>     C<'NONE'>                                                                                                         
+ lock_wait          L<Mail::Box>     10 seconds                                                                                                        
+ locker             L<Mail::Box>     undef                                                                                                             
+ log                L<Mail::Reporter>  C<'WARNINGS'>                                                                                                     
+ manager            L<Mail::Box>     undef                                                                                                             
+ message_type       L<Mail::Box>     L<Mail::Box::IMAP4::Message|Mail::Box::IMAP4::Message>                                                            
+ multipart_type     L<Mail::Box>     L<Mail::Message::Body::Multipart|Mail::Message::Body::Multipart>                                                  
+ password           L<Mail::Box::Net>  undef                                                                                                             
+ remove_when_empty  L<Mail::Box>     <false>                                                                                                           
+ save_on_exit       L<Mail::Box>     <true>                                                                                                            
+ server_name        L<Mail::Box::Net>  undef                                                                                                             
+ server_port        L<Mail::Box::Net>  143                                                                                                               
+ trace              L<Mail::Reporter>  C<'WARNINGS'>                                                                                                     
+ transporter                         L<Mail::Transport::IMAP4|Mail::Transport::IMAP4>                                                                  
+ trusted            L<Mail::Box>     <false>                                                                                                           
+ username           L<Mail::Box::Net>  undef                                                                                                             
+
+. access MODE
+
+. body_delayed_type CLASS
+
+. body_type CLASS|CODE
+
+. cache_body 'NO'|'YES'|'DELAY'
+
+=over 4
+
+Body objects are immutable, but may still cached or not.  In common
+case, the body of a message is requested via L<Mail::Message::body()|Mail::Message/"The body">
+or L<Mail::Message::decoded()|Mail::Message/"The body">.  This returns a handle to a body object.
+You may decide wether that body object can be reused or not.  C<NO>
+means: retreive the data each time again, C<YES> will cache the body data,
+C<DELAY> will send the whole message when the folder is closed.
+
+        [local cache]  [write]
+ NO         no           no
+ YES        yes          no
+ DELAY      yes          yes
+
+=back
+
+. cache_head 'NO'|'PARTIAL'|'DELAY'
+
+=over 4
+
+For a read-only folder, C<DELAY> is the default, otherwise C<NO> is
+choosen.  The four configuration parameter have subtile consequences.
+To start with a table:
+
+        [local cache]  [write]  [default head_type]
+ NO         no           no     Mail::Box::IMAP4::Head
+ PARTIAL    yes          no     Mail::Box::IMAP4::Head
+ DELAY      yes          yes    Mail::Message::Head::Complete
+
+The default C<head_type> is L<Mail::Box::IMAP4::Head|Mail::Box::IMAP4::Head>, the
+default C<cached_head_type> is L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>.
+
+Having a local cache means that a lookup for a field is first done
+in a local data-structure (which extends L<Mail::Message::Head::Partial|Mail::Message::Head::Partial>),
+and only on the remote server if it was not found.  This is dangerous,
+because your locally cached data can be out-of-sync with the server.
+However, it may give you a nice performance benefit.
+
+C<DELAY> will always collect the whole
+header for you.  This is required when you want to look for Resent Groups
+(See L<Mail::Message::Head::ResentGroup|Mail::Message::Head::ResentGroup>) or other field order dependent
+header access.  A L<Mail::Message::Head::Delayed|Mail::Message::Head::Delayed> will be created first.
+
+=back
+
+. cache_labels 'NO'|'WRITE'|'DELAY'
+
+=over 4
+
+When labels from a message are received, these values can be kept. However,
+this imposes dangers where the server's internal label storage may get out
+of sync with your data.
+
+With C<NO>, no caching will take place (but the performance will be
+worse). With C<WRITE>, all label access will be cached, but written to
+the server as well.  Both C<NO> and C<WRITE> will update the labels on
+the served, even when the folder was opened read-only.  C<DELAY> will
+not write the changed information to the server, but delay that till
+the moment that the folder is closed.  It only works when the folder is
+opened read/write or write is enforced.
+
+The default is C<DELAY> for folders which where opened read-only.  This
+means that you still can force an update with L<close(write)|Mail::Box/"The folder">.  For folders
+which are opened read-write, the default is the safeset setting, which is
+C<NO>.
+
+=back
+
+. coerce_options ARRAY
+
+. create BOOLEAN
+
+. extract INTEGER | CODE | METHOD | 'LAZY'|'ALWAYS'
+
+. field_type CLASS
+
+. fix_headers BOOLEAN
+
+. folder FOLDERNAME
+
+. folderdir DIRECTORY
+
+. head_delayed_type CLASS
+
+. head_type CLASS
+
+. join_connection BOOLEAN
+
+=over 4
+
+Within this Mail::Box::IMAP4 class is registered which transporters are
+already in use, i.e. which connections to the IMAP server are already
+in established.  When this option is set, multiple folder openings on the
+same server will try to reuse one connection.
+
+=back
+
+. keep_dups BOOLEAN
+
+. lock_file FILENAME
+
+. lock_timeout SECONDS
+
+. lock_type CLASS|STRING|ARRAY
+
+. lock_wait SECONDS
+
+. locker OBJECT
+
+. log LEVEL
+
+. manager MANAGER
+
+. message_type CLASS
+
+. multipart_type CLASS
+
+. password STRING
+
+. remove_when_empty BOOLEAN
+
+. save_on_exit BOOLEAN
+
+. server_name HOSTNAME
+
+. server_port INTEGER
+
+. trace LEVEL
+
+. transporter OBJECT|CLASS
+
+=over 4
+
+The name of the CLASS which will interface with the connection.  When you
+implement your own extension to L<Mail::Transport::IMAP4|Mail::Transport::IMAP4>, you can either
+specify a fully instantiated transporter OBJECT, or the name of your own
+CLASS.  When an OBJECT is given, most other options will be ignored.
+
+=back
+
+. trusted BOOLEAN
+
+. username STRING
+
+I<Example:> 
+
+ my $imap   = Mail::Box::IMAP4->new(username => 'myname',
+    password => 'mypassword', server_name => 'imap.xs4all.nl');
+
+ my $url    = 'imap4://user:password@imap.xs4all.nl');
+ my $imap   = $mgr->open($url);
+
+ my $client = Mail::IMAPClient->new(...);
+ my $imap   = Mail::Box::IMAP4->new(imap_client => $client);
+
+=back
+
+=head2 The folder
+
+
+$obj-E<gt>B<addMessage>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<addMessages>(MESSAGE [, MESSAGE, ...])
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+Mail::Box::IMAP4-E<gt>B<appendMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<close>(OPTIONS)
+
+=over 4
+
+Close the folder.  In the case of IMAP, more than one folder can use
+the same connection, therefore, closing a folder does not always close
+the connection to the server.  Only when no folder is using the
+connection anymore, a logout will be invoked by
+L<Mail::Transport::IMAP4::DESTROY()|Mail::Transport::IMAP4/"Cleanup">
+
+ Option        Defined in       Default    
+ force         L<Mail::Box>     <false>    
+ save_deleted  L<Mail::Box>     C<false>   
+ write         L<Mail::Box>     C<MODIFIED>
+
+. force BOOLEAN
+
+. save_deleted BOOLEAN
+
+. write 'ALWAYS'|'NEVER'|'MODIFIED'
+
+=back
+
+$obj-E<gt>B<copyTo>(FOLDER, OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<folderdir>([DIRECTORY])
+
+=over 4
+
+See L<Mail::Box::Net/"METHODS">
+
+=back
+
+Mail::Box::IMAP4-E<gt>B<foundIn>([FOLDERNAME], OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<organization>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<type>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<update>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<url>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+=head2 Folder flags
+
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+$obj-E<gt>B<writable>
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+=head2 The messages
+
+
+$obj-E<gt>B<current>([NUMBER|MESSAGE|MESSAGE-ID])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<find>(MESSAGE-ID)
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<findFirstLabeled>(LABEL, [BOOLEAN, [ARRAY-OF-MSGS]])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<message>(INDEX [,MESSAGE])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messageId>(MESSAGE-ID [,MESSAGE])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messageIds>
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messages>(['ALL',RANGE,'ACTIVE','DELETED',LABEL,!LABEL,FILTER])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<scanForMessages>(MESSAGE, MESSAGE-IDS, TIMESPAN, WINDOW)
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+=head2 Sub-folders
+
+
+$obj-E<gt>B<listSubFolders>(OPTIONS)
+
+Mail::Box::IMAP4-E<gt>B<listSubFolders>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+$obj-E<gt>B<nameOfSubFolder>(NAME)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+$obj-E<gt>B<openRelatedFolder>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+$obj-E<gt>B<openSubFolder>(NAME, OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<body>([BODY])
+
+=over 4
+
+=back
+
+$obj-E<gt>B<coerce>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<createTransporter>(CLASS, OPTIONS)
+
+=over 4
+
+Create a transporter object (an instance of L<Mail::Transport::IMAP4|Mail::Transport::IMAP4>), where
+CLASS defines the exact object type.  As OPTIONS, everything which is
+acceptable to a transporter initiation can be used (see
+L<Mail::Transport::IMAP4::new()|Mail::Transport::IMAP4/"METHODS">.
+
+ Option           Defined in  Default
+ join_connection              C<true>
+
+. join_connection BOOLEAN
+
+=over 4
+
+See L<new(join_connection)|Mail::Box::IMAP4/"METHODS">.  When false, the connection will never be shared
+with other IMAP mail boxes.
+
+=back
+
+=back
+
+$obj-E<gt>B<determineBodyType>(MESSAGE, HEAD)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<fetch>(ARRAY-OF-MESSAGES|MESSAGE-SELECTION, INFO)
+
+=over 4
+
+Low-level data retreival about one or more messages via IMAP4 from
+the remote server. Some of this data may differ from the information
+which is stored in the message objects which are created by MailBox,
+so you should avoid the use of this method for your own purposes.
+The IMAP implementation provides some wrappers around this, providing
+the correct behavior.
+
+An array of MESSAGES may be specified or some MESSAGE SELECTION,
+acceptable to L<Mail::Box::messages()|Mail::Box/"The messages">.  Examples of the latter are
+C<'ALL'>, C<'DELETED'>, or C<spam> (messages labelled to contain spam).
+
+The INFO contains one or more attributes as defined by the IMAP protocol.
+You have to read the full specs of the related RFCs to see these.
+
+=back
+
+$obj-E<gt>B<getHead>(MESSAGE)
+
+=over 4
+
+Read the header for the specified message from the remote server.
+C<undef> is returned in case the message disappeared.
+
+=back
+
+$obj-E<gt>B<getHeadAndBody>(MESSAGE)
+
+=over 4
+
+Read all data for the specified message from the remote server.
+Return head and body of the mesasge as list, or an empty list
+if the MESSAGE disappeared from the server.
+
+=back
+
+$obj-E<gt>B<lineSeparator>([STRING|'CR'|'LF'|'CRLF'])
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<locker>
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<read>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<readMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<storeMessage>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<toBeThreaded>(MESSAGES)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<toBeUnthreaded>(MESSAGES)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<transporter>([OBJECT])
+
+=over 4
+
+Returns the object which is the interface to the IMAP4 protocol handler.
+The IMAP4 handler has the current folder selected.
+When an OBJECT is specified, it is set to be the transporter from
+that moment on.  The OBJECT must extend L<Mail::Transport::IMAP4|Mail::Transport::IMAP4>.
+
+=back
+
+$obj-E<gt>B<updateMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<write>(OPTIONS)
+
+=over 4
+
+The IMAP protocol usually writes the data immediately to the remote server,
+because that's what the protocol wants.  However, some options to L<new()|Mail::Box::IMAP4/"METHODS">
+may delay that to boost performance.  This method will, when the folder is
+being closed, write that info after all.
+
+ Option        Defined in       Default
+ force         L<Mail::Box>     <false>
+ save_deleted                   <false>
+
+. force BOOLEAN
+
+. save_deleted BOOLEAN
+
+=over 4
+
+You may be able to save the messages which are flagged for deletion now,
+but they will be removed anyway when the folder is closed.
+
+=back
+
+=back
+
+$obj-E<gt>B<writeMessages>(OPTIONS)
+
+=over 4
+
+ Option       Defined in       Default   
+ messages     L<Mail::Box>     <required>
+ transporter                   <required>
+
+. messages ARRAY
+
+. transporter OBJECT
+
+=back
+
+=head2 Other methods
+
+
+$obj-E<gt>B<timespan2seconds>(TIME)
+
+Mail::Box::IMAP4-E<gt>B<timespan2seconds>(TIME)
+
+=over 4
+
+See L<Mail::Box/"Other methods">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::IMAP4-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::IMAP4-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::IMAP4-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Box/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> Cannot find head back for $uidl in $folder.
+
+The header was read before, but now seems empty: the IMAP4 server does
+not produce the header lines anymore.
+
+I<Warning:> Cannot read body for $uidl in $folder.
+
+The header of the message was retreived from the IMAP4 server, but the
+body is not read, for an unknown reason.
+
+I<Error:> Copying failed for one message.
+
+For some reason, for instance disc full, removed by external process, or
+read-protection, it is impossible to copy one of the messages.  Copying will
+proceed for the other messages.
+
+I<Error:> Destination folder $name is not writable.
+
+The folder where the messages are copied to is not opened with write
+access (see L<new(access)|Mail::Box/"Constructors">).  This has no relation with write permission
+to the folder which is controled by your operating system.
+
+I<Warning:> Different messages with id $msgid.
+
+The message id is discovered more than once within the same folder, but the
+content of the message seems to be different.  This should not be possible:
+each message must be unique.
+
+I<Error:> Folder $name not deleted: not writable.
+
+The folder must be opened with write access via L<new(access)|Mail::Box/"Constructors">, otherwise
+removing it will be refused.  So, you may have write-access according to
+the operating system, but that will not automatically mean that this
+C<delete> method permits you to.  The reverse remark is valid as well.
+
+I<Notice:> Impossible to keep deleted messages in IMAP
+
+Some folder type have a 'deleted' flag which can be stored in the folder to
+be performed later.  The folder keeps that knowledge even when the folder
+is rewritten.  Well, IMAP4 cannot play that trick.
+
+I<Error:> Invalid timespan '$timespan' specified.
+
+The string does not follow the strict rules of the time span syntax which
+is permitted as parameter.
+
+I<Warning:> Message $uidl disappeared from $folder.
+
+Trying to get the specific message from the server, but it appears to be
+gone.
+
+I<Warning:> Message $uidl disappeared from $folder.
+
+Trying to get the specific message from the server, but it appears to be
+gone.
+
+I<Warning:> Message-id '$msgid' does not contain a domain.
+
+According to the RFCs, message-ids need to contain a unique random part,
+then an C<@>, and then a domain name.  This is made to avoid the creation
+of two messages with the same id.  The warning emerges when the C<@> is
+missing from the string.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Unable to create subfolder $name of $folder.
+
+The copy includes the subfolders, but for some reason it was not possible
+to copy one of these.  Copying will proceed for all other sub-folders.
+
+
+=head1 DETAILS
+
+
+=head2 How IMAP4 folders work
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/DotLock.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/DotLock.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/DotLock.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,108 @@
+
+use strict;
+
+package Mail::Box::Locker::DotLock;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box::Locker';
+
+use IO::File;
+use Carp;
+use File::Spec;
+
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    unless($args->{file})
+    {   my $folder = $args->{folder} or confess;
+        my $org    = $folder->organization;
+
+        $args->{file}
+          = $org eq 'FILE'      ? $folder->filename . '.lock'
+          : $org eq 'DIRECTORY' ? File::Spec->catfile($folder->directory, '.lock')
+          : croak "Need lock file name for DotLock.";
+    }
+
+    $self->SUPER::init($args);
+}
+
+#-------------------------------------------
+
+sub name() {'DOTLOCK'}
+
+#-------------------------------------------
+
+sub _try_lock($)
+{   my ($self, $lockfile) = @_;
+    return if -e $lockfile;
+
+    my $flags    = $^O eq 'MSWin32'
+                 ?  O_CREAT|O_EXCL|O_WRONLY
+                 :  O_CREAT|O_EXCL|O_WRONLY|O_NONBLOCK;
+
+    my $lock     = IO::File->new($lockfile, $flags, 0600)
+       or return 0;
+
+    close $lock;
+    1;
+}
+
+#-------------------------------------------
+
+sub unlock()
+{   my $self = shift;
+    return $self unless $self->{MBL_has_lock};
+
+    my $lock = $self->filename;
+
+    unlink $lock
+        or warn "Couldn't remove lockfile $lock: $!\n";
+
+    delete $self->{MBL_has_lock};
+    $self;
+}
+
+#-------------------------------------------
+
+sub lock()
+{   my $self   = shift;
+    return 1 if $self->hasLock;
+
+    my $lockfile = $self->filename;
+    my $end      = $self->{MBL_timeout} eq 'NOTIMEOUT' ? -1
+                 : $self->{MBL_timeout};
+    my $expire   = $self->{MBL_expires}/86400;  # in days for -A
+
+    while(1)
+    {
+        return $self->{MBL_has_lock} = 1
+           if $self->_try_lock($lockfile);
+
+        if(-e $lockfile && -A $lockfile > $expire)
+        {
+            if(unlink $lockfile)
+            {   warn "Removed expired lockfile $lockfile.\n";
+                redo;
+            }
+            else
+            {   warn "Failed to remove expired lockfile $lockfile: $!\n";
+                last;
+            }
+        }
+
+        last unless --$end;
+        sleep 1;
+    }
+
+    return 0;
+}
+
+#-------------------------------------------
+
+sub isLocked() { -e shift->filename }
+
+#-------------------------------------------
+
+1;
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/DotLock.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/DotLock.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/DotLock.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,285 @@
+
+=head1 NAME
+
+Mail::Box::Locker::DotLock - lock a folder with a separate file
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Locker::DotLock
+   is a Mail::Box::Locker
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ See Mail::Box::Locker
+
+
+=head1 DESCRIPTION
+
+The C<::DotLock> object lock the folder by creating a file with the
+same name as the folder, extended by C<.lock>.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Box::Locker::DotLock-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option   Defined in       Default             
+ expires  L<Mail::Box::Locker>  1 hour              
+ file                      <folderfile>C<.lock>
+ folder   L<Mail::Box::Locker>  <required>          
+ log      L<Mail::Reporter>  C<'WARNINGS'>       
+ method   L<Mail::Box::Locker>  C<'DOTLOCK'>        
+ timeout  L<Mail::Box::Locker>  10 seconds          
+ trace    L<Mail::Reporter>  C<'WARNINGS'>       
+
+. expires SECONDS
+
+. file FILENAME
+
+=over 4
+
+Name of the file to lock.  By default, the folder's name is extended with
+C<.lock>.
+
+=back
+
+. folder FOLDER
+
+. log LEVEL
+
+. method STRING|CLASS|ARRAY
+
+. timeout SECONDS|'NOTIMEOUT'
+
+. trace LEVEL
+
+=back
+
+=head2 The Locker
+
+
+$obj-E<gt>B<filename>([FILENAME])
+
+=over 4
+
+See L<Mail::Box::Locker/"The Locker">
+
+=back
+
+$obj-E<gt>B<folder>
+
+=over 4
+
+See L<Mail::Box::Locker/"The Locker">
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Box::Locker/"The Locker">
+
+=back
+
+=head2 Locking
+
+
+$obj-E<gt>B<hasLock>
+
+=over 4
+
+See L<Mail::Box::Locker/"Locking">
+
+=back
+
+$obj-E<gt>B<isLocked>
+
+=over 4
+
+See L<Mail::Box::Locker/"Locking">
+
+=back
+
+$obj-E<gt>B<lock>(FOLDER)
+
+=over 4
+
+See L<Mail::Box::Locker/"Locking">
+
+=back
+
+$obj-E<gt>B<unlock>
+
+=over 4
+
+See L<Mail::Box::Locker/"Locking">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Locker::DotLock-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Locker::DotLock-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Locker::DotLock-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Box::Locker/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/Flock.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/Flock.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/Flock.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,107 @@
+
+use strict;
+
+package Mail::Box::Locker::Flock;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box::Locker';
+
+use IO::File;
+use Fcntl         qw/:DEFAULT :flock/;
+use Errno         qw/EAGAIN/;
+
+
+#-------------------------------------------
+
+sub name() {'FLOCK'}
+
+#-------------------------------------------
+
+sub _try_lock($)
+{   my ($self, $file) = @_;
+    flock $file, LOCK_EX|LOCK_NB;
+}
+
+sub _unlock($)
+{   my ($self, $file) = @_;
+    flock $file, LOCK_UN;
+    delete $self->{MBL_has_lock};
+    $self;
+}
+
+#-------------------------------------------
+
+
+# 'r+' is require under Solaris and AIX, other OSes are satisfied with 'r'.
+my $lockfile_access_mode = ($^O eq 'solaris' || $^O eq 'aix') ? 'r+' : 'r';
+
+sub lock()
+{   my $self  = shift;
+    return 1 if $self->hasLock;
+
+    my $filename = $self->filename;
+
+    my $file   = IO::File->new($filename, $lockfile_access_mode);
+    unless($file)
+    {   $self->log(ERROR =>
+           "Unable to open flock file $filename for $self->{MBL_folder}: $!");
+        return 0;
+    }
+
+    my $end = $self->{MBL_timeout} eq 'NOTIMEOUT' ? -1 : $self->{MBL_timeout};
+
+    while(1)
+    {   if($self->_try_lock($file))
+        {   $self->{MBL_has_lock}    = 1;
+            $self->{MBLF_filehandle} = $file;
+            return 1;
+        }
+
+        if($! != EAGAIN)
+        {   $self->log(ERROR =>
+               "Will never get a flock on $filename for $self->{MBL_folder}: $!");
+            last;
+        }
+
+        last unless --$end;
+        sleep 1;
+    }
+
+    return 0;
+}
+
+#-------------------------------------------
+
+
+sub isLocked()
+{   my $self     = shift;
+    my $filename = $self->filename;
+
+    my $file     = IO::File->new($filename, $lockfile_access_mode);
+    unless($file)
+    {   $self->log(ERROR =>
+            "Unable to check lock file $filename for $self->{MBL_folder}: $!");
+        return 0;
+    }
+
+    $self->_try_lock($file) or return 0;
+    $self->_unlock($file);
+    $file->close;
+
+    1;
+}
+
+#-------------------------------------------
+
+sub unlock()
+{   my $self = shift;
+
+    $self->_unlock(delete $self->{MBLF_filehandle})
+       if $self->hasLock;
+
+    $self;
+}
+
+#-------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/Flock.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/Flock.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/Flock.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,296 @@
+
+=head1 NAME
+
+Mail::Box::Locker::Flock - lock a folder using kernel file-locking
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Locker::Flock
+   is a Mail::Box::Locker
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ See Mail::Box::Locker
+
+
+=head1 DESCRIPTION
+
+The C<::Flock> object lock the folder by creating an exclusive lock on
+the file using the kernel's C<flock> facilities.  This lock is created
+on a separate file-handle to the folder file, so not the handle which
+is reading.
+
+File locking does not work in some situations, for instance for
+operating systems do not support C<flock>.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Box::Locker::Flock-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option   Defined in       Default      
+ expires  L<Mail::Box::Locker>  1 hour       
+ file     L<Mail::Box::Locker>  undef        
+ folder   L<Mail::Box::Locker>  <required>   
+ log      L<Mail::Reporter>  C<'WARNINGS'>
+ method   L<Mail::Box::Locker>  C<'FLOCK'>   
+ timeout  L<Mail::Box::Locker>  10 seconds   
+ trace    L<Mail::Reporter>  C<'WARNINGS'>
+
+. expires SECONDS
+
+. file FILENAME
+
+. folder FOLDER
+
+. log LEVEL
+
+. method STRING|CLASS|ARRAY
+
+. timeout SECONDS|'NOTIMEOUT'
+
+. trace LEVEL
+
+=back
+
+=head2 The Locker
+
+
+$obj-E<gt>B<filename>([FILENAME])
+
+=over 4
+
+See L<Mail::Box::Locker/"The Locker">
+
+=back
+
+$obj-E<gt>B<folder>
+
+=over 4
+
+See L<Mail::Box::Locker/"The Locker">
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Box::Locker/"The Locker">
+
+=back
+
+=head2 Locking
+
+
+$obj-E<gt>B<hasLock>
+
+=over 4
+
+See L<Mail::Box::Locker/"Locking">
+
+=back
+
+$obj-E<gt>B<isLocked>
+
+=over 4
+
+=back
+
+$obj-E<gt>B<lock>
+
+=over 4
+
+=back
+
+$obj-E<gt>B<unlock>
+
+=over 4
+
+See L<Mail::Box::Locker/"Locking">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Locker::Flock-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Locker::Flock-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Locker::Flock-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Box::Locker/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Unable to check lock file $filename for $folder: $!
+
+To check whether the filename is used to flock a folder, the file must be
+opened.  Apparently this fails, which does not mean that the folder is
+locked neither that it is unlocked.
+
+I<Error:> Unable to open flock file $filename for $folder: $!
+
+For flock-ing a folder it must be opened, which does not succeed for the
+specified reason.
+
+I<Error:> Will never get a flock at $filename for $folder: $!
+
+Tried to flock the folder, but it did not succeed.  The error code received
+from the OS indicates that it will not succeed ever, so we do not need to
+try again.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/Multi.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/Multi.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/Multi.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,111 @@
+
+use strict;
+
+package Mail::Box::Locker::Multi;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box::Locker';
+
+use Carp;
+
+
+sub init($)
+{   my ($self, $args) = @_;
+    $self->SUPER::init($args);
+
+    my @use
+     = exists $args->{use} ? @{$args->{use}}
+     : $^O =~ m/mswin/i    ? qw/    POSIX Flock/
+     :                       qw/NFS POSIX Flock/;
+
+    my (@lockers, @used);
+
+    foreach my $method (@use)
+    {   my $locker = eval
+        {   Mail::Box::Locker->new
+              ( %$args
+              , method  => $method
+              , timeout => 1
+              )
+        };
+        next unless defined $locker;
+
+        push @lockers, $locker;
+        push @used, $method;
+    }
+
+    $self->{MBLM_lockers} = \@lockers;
+    $self->log(PROGRESS => "Multi-locking via @used.");
+    $self;
+}
+
+#-------------------------------------------
+
+sub name() {'MULTI'}
+
+#-------------------------------------------
+
+sub _try_lock($)
+{   my $self     = shift;
+    my @successes;
+
+    foreach my $locker ($self->lockers)
+    {
+        unless($locker->lock)
+        {   $_->unlock foreach @successes;
+            return 0;
+        }
+        push @successes, $locker;
+    }
+
+    1;
+}
+
+#-------------------------------------------
+
+sub unlock()
+{   my $self = shift;
+    return $self unless $self->{MBL_has_lock};
+
+    $_->unlock foreach $self->lockers;
+    delete $self->{MBL_has_lock};
+
+    $self;
+}
+
+#-------------------------------------------
+
+sub lock()
+{   my $self  = shift;
+    return 1 if $self->hasLock;
+
+    my $end   = $self->{MBL_timeout} eq 'NOTIMEOUT' ? -1 : $self->{MBL_timeout};
+
+    while(1)
+    {   return $self->{MBL_has_lock} = 1
+            if $self->_try_lock;
+
+        last unless --$end;
+        sleep 1;
+    }
+
+    return 0;
+}
+
+#-------------------------------------------
+
+sub isLocked()
+{   my $self     = shift;
+    $self->_try_lock($self->filename) or return 0;
+    $self->unlock;
+    1;
+}
+
+#-------------------------------------------
+
+
+sub lockers() { @{shift->{MBLM_lockers}} }
+
+#-------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/Multi.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/Multi.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/Multi.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,309 @@
+
+=head1 NAME
+
+Mail::Box::Locker::Multi - lock a folder in all ways which work
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Locker::Multi
+   is a Mail::Box::Locker
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ See Mail::Box::Locker
+
+
+=head1 DESCRIPTION
+
+The C<::Multi> locker locks a folder in each way it can.  This way, the
+chance is highest that any other program will leave the folder alone
+during our access to it.
+
+NFS-lock and Flock are tried.  More may be added when the ways to
+lock are extended.  DotLock overlaps with NFS-lock, but NFS-lock is
+safer, so that version is preferred.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Box::Locker::Multi-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option   Defined in       Default       
+ expires  L<Mail::Box::Locker>  1 hour        
+ file     L<Mail::Box::Locker>  undef         
+ folder   L<Mail::Box::Locker>  <required>    
+ log      L<Mail::Reporter>  C<'WARNINGS'> 
+ method   L<Mail::Box::Locker>  C<'MULTI'>    
+ timeout  L<Mail::Box::Locker>  10 seconds    
+ trace    L<Mail::Reporter>  C<'WARNINGS'> 
+ use                       <all possible>
+
+. expires SECONDS
+
+. file FILENAME
+
+. folder FOLDER
+
+. log LEVEL
+
+. method STRING|CLASS|ARRAY
+
+. timeout SECONDS|'NOTIMEOUT'
+
+. trace LEVEL
+
+. use ARRAY
+
+=over 4
+
+Array of locker types and locker objects to be used to lock one
+folder.  The type names are converted into objects.
+
+Some locking types are not available on some platforms, so they will
+not be excluded from the default list (NFS POSIX Flock).
+
+=back
+
+I<Example:> using a subset of multi-lockers
+
+
+ my $locker = Mail::Box::Locker::Multy->new(use => ['DOTLOCK','FLOCK']);
+
+=back
+
+=head2 The Locker
+
+
+$obj-E<gt>B<filename>([FILENAME])
+
+=over 4
+
+See L<Mail::Box::Locker/"The Locker">
+
+=back
+
+$obj-E<gt>B<folder>
+
+=over 4
+
+See L<Mail::Box::Locker/"The Locker">
+
+=back
+
+$obj-E<gt>B<lockers>
+
+=over 4
+
+Returns a list with all locker objects used by this object.
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Box::Locker/"The Locker">
+
+=back
+
+=head2 Locking
+
+
+$obj-E<gt>B<hasLock>
+
+=over 4
+
+See L<Mail::Box::Locker/"Locking">
+
+=back
+
+$obj-E<gt>B<isLocked>
+
+=over 4
+
+See L<Mail::Box::Locker/"Locking">
+
+=back
+
+$obj-E<gt>B<lock>(FOLDER)
+
+=over 4
+
+See L<Mail::Box::Locker/"Locking">
+
+=back
+
+$obj-E<gt>B<unlock>
+
+=over 4
+
+See L<Mail::Box::Locker/"Locking">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Locker::Multi-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Locker::Multi-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Locker::Multi-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Box::Locker/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/NFS.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/NFS.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/NFS.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,134 @@
+
+use strict;
+
+package Mail::Box::Locker::NFS;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box::Locker';
+
+use Sys::Hostname;
+use IO::File;
+use Carp;
+
+
+sub name() {'NFS'}
+
+#-------------------------------------------
+
+# METHOD nfs
+# This hack is copied from the Mail::Folder packages, as written
+# by Kevin Jones.  Cited from his code:
+#    Whhheeeee!!!!!
+#    In NFS, the O_CREAT|O_EXCL isn't guaranteed to be atomic.
+#    So we create a temp file that is probably unique in space
+#    and time ($folder.lock.$time.$pid.$host).
+#    Then we use link to create the real lock file. Since link
+#    is atomic across nfs, this works.
+#    It loses if it's on a filesystem that doesn't do long filenames.
+
+my $hostname = hostname;
+
+sub _tmpfilename()
+{   my $self = shift;
+    return $self->{MBL_tmp} if $self->{MBL_tmp};
+
+    my $folder = $self->{MBL_folder};
+    $self->{MBL_tmp} = $self->filename . $$;
+}
+
+sub _construct_tmpfile()
+{   my $self    = shift;
+    my $tmpfile = $self->_tmpfilename;
+
+    my $fh      = IO::File->new($tmpfile, O_CREAT|O_WRONLY, 0600)
+        or return undef;
+
+    $fh->close;
+    $tmpfile;
+}
+
+sub _try_lock($$)
+{   my ($self, $tmpfile, $lockfile) = @_;
+
+    return undef
+        unless link $tmpfile, $lockfile;
+
+    my $linkcount = (stat $tmpfile)[3];
+
+    unlink $tmpfile;
+    $linkcount == 2;
+}
+
+sub _unlock($$)
+{   my ($self, $tmpfile, $lockfile) = @_;
+
+    unlink $lockfile
+        or warn "Couldn't remove lockfile $lockfile: $!\n";
+
+    unlink $tmpfile;
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub lock()
+{   my $self     = shift;
+    return 1 if $self->hasLock;
+
+    my $folder   = $self->{MBL_folder};
+    my $lockfile = $self->filename;
+    my $tmpfile  = $self->_construct_tmpfile or return;
+    my $end      = $self->{MBL_timeout} eq 'NOTIMEOUT' ? -1
+                 : $self->{MBL_timeout};
+    my $expires  = $self->{MBL_expires}/86400;  # in days for -A
+
+    if(-e $lockfile && -A $lockfile > $expires)
+    {   if(unlink $lockfile)
+             { $self->log(WARNING => "Removed expired lockfile $lockfile.\n") }
+        else { $self->log(ERROR =>
+                        "Unable to remove expired lockfile $lockfile: $!") }
+    }
+
+    while(1)
+    {   if($self->_try_lock($tmpfile, $lockfile))
+        {   $self->{MBL_has_lock} = 1;
+            return 1;
+        }
+
+        last unless --$end;
+        sleep 1;
+    }
+
+    return 0;
+}
+
+#-------------------------------------------
+
+sub isLocked()
+{   my $self     = shift;
+    my $tmpfile  = $self->_construct_tmpfile or return 0;
+    my $lockfile = $self->filename;
+
+    my $fh = $self->_try_lock($tmpfile, $lockfile) or return 0;
+
+    close $fh;
+    $self->_unlock($tmpfile, $lockfile);
+    1;
+}
+
+#-------------------------------------------
+
+sub unlock($)
+{   my $self   = shift;
+    return $self unless $self->hasLock;
+
+    $self->_unlock($self->_tmpfilename, $self->filename);
+    delete $self->{MBL_has_lock};
+    $self;
+}
+
+#-------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/NFS.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/NFS.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/NFS.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,292 @@
+
+=head1 NAME
+
+Mail::Box::Locker::NFS - lock a folder with a separate file, NFS-safe
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Locker::NFS
+   is a Mail::Box::Locker
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ See Mail::Box::Locker
+
+
+=head1 DESCRIPTION
+
+Like the C<::DotLock> locker, but then in an NFS-safe fashion.  Over NFS,
+the creation of a file is not atomic.  The C<::DotLock> locker depends
+on an atomic C<open> system call, hence in not usable to lock a folder
+which accessed over NFS.  The C<::NFS>
+locker is therefore more complicated (so therefore slower), but will work
+for NFS --and for local disks as well.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Box::Locker::NFS-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option   Defined in       Default      
+ expires  L<Mail::Box::Locker>  1 hour       
+ file     L<Mail::Box::Locker>  undef        
+ folder   L<Mail::Box::Locker>  <required>   
+ log      L<Mail::Reporter>  C<'WARNINGS'>
+ method   L<Mail::Box::Locker>  C<'NFS'>     
+ timeout  L<Mail::Box::Locker>  10 seconds   
+ trace    L<Mail::Reporter>  C<'WARNINGS'>
+
+. expires SECONDS
+
+. file FILENAME
+
+. folder FOLDER
+
+. log LEVEL
+
+. method STRING|CLASS|ARRAY
+
+. timeout SECONDS|'NOTIMEOUT'
+
+. trace LEVEL
+
+=back
+
+=head2 The Locker
+
+
+$obj-E<gt>B<filename>([FILENAME])
+
+=over 4
+
+See L<Mail::Box::Locker/"The Locker">
+
+=back
+
+$obj-E<gt>B<folder>
+
+=over 4
+
+See L<Mail::Box::Locker/"The Locker">
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Box::Locker/"The Locker">
+
+=back
+
+=head2 Locking
+
+
+$obj-E<gt>B<hasLock>
+
+=over 4
+
+See L<Mail::Box::Locker/"Locking">
+
+=back
+
+$obj-E<gt>B<isLocked>
+
+=over 4
+
+See L<Mail::Box::Locker/"Locking">
+
+=back
+
+$obj-E<gt>B<lock>
+
+=over 4
+
+=back
+
+$obj-E<gt>B<unlock>
+
+=over 4
+
+See L<Mail::Box::Locker/"Locking">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Locker::NFS-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Locker::NFS-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Locker::NFS-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Box::Locker/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Warning:> Removed expired lockfile $filename.
+
+A lock file was found which was older than the expiration period as
+specified with L<new(timeout)|Mail::Box::Locker/"METHODS">.  The lock file was succesfully
+removed.
+
+I<Error:> Unable to remove expired lockfile $lockfile: $!
+
+A lock file was found which was older than the expiration period as
+specified with the L<new(timeout)|Mail::Box::Locker/"METHODS"> option.  It is impossible to remove that
+lock file, so we need to wait until it vanishes by some external cause.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/POSIX.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/POSIX.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/POSIX.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,105 @@
+
+use strict;
+
+package Mail::Box::Locker::POSIX;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box::Locker';
+
+use POSIX;
+use Fcntl;
+use IO::File;
+
+
+#-------------------------------------------
+
+sub name() {'POSIX'}
+
+#-------------------------------------------
+
+sub _try_lock($)
+{   my ($self, $file) = @_;
+    $? = fcntl($file, F_SETLK, pack('s @256', F_WRLCK)) || 0;
+    $?==0;
+}
+
+sub _unlock($)
+{   my ($self, $file) = @_;
+    fcntl($file, F_SETLK, pack('s @256', F_UNLCK));
+    delete $self->{MBL_has_lock};
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub lock()
+{   my $self  = shift;
+    return 1 if $self->hasLock;
+
+    my $filename = $self->filename;
+
+    my $file   = IO::File->new($filename, 'r+');
+    unless(defined $file)
+    {   $self->log(ERROR =>
+           "Unable to open POSIX lock file $filename for $self->{MBL_folder}: $!");
+        return 0;
+    }
+
+    my $end = $self->{MBL_timeout} eq 'NOTIMEOUT' ? -1 : $self->{MBL_timeout};
+
+    while(1)
+    {   if($self->_try_lock($file))
+        {   $self->{MBL_has_lock}    = 1;
+            $self->{MBLF_filehandle} = $file;
+            return 1;
+        }
+
+        if($? != EAGAIN)
+        {   $self->log(ERROR =>
+            "Will never get a POSIX lock on $filename for $self->{MBL_folder}: $!");
+            last;
+        }
+
+        last unless --$end;
+        sleep 1;
+    }
+
+    return 0;
+}
+
+#-------------------------------------------
+
+
+sub isLocked()
+{   my $self     = shift;
+    my $filename = $self->filename;
+
+    my $file     = IO::File->new($filename, "r");
+    unless($file)
+    {   $self->log(ERROR =>
+               "Unable to check lock file $filename for $self->{MBL_folder}: $!");
+        return 0;
+    }
+
+    $self->_try_lock($file) or return 0;
+    $self->_unlock($file);
+    $file->close;
+
+    1;
+}
+
+#-------------------------------------------
+
+sub unlock()
+{   my $self = shift;
+
+    $self->_unlock(delete $self->{MBLF_filehandle})
+       if $self->hasLock;
+
+    $self;
+}
+
+#-------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/POSIX.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/POSIX.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker/POSIX.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,293 @@
+
+=head1 NAME
+
+Mail::Box::Locker::POSIX - lock a folder using kernel file-locking
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Locker::POSIX
+   is a Mail::Box::Locker
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ See Mail::Box::Locker
+
+
+=head1 DESCRIPTION
+
+This locker object is created by the folder to get an exclusive lock on
+the file which contains the data using the kernel's POSIX facilities.  This
+lock is created on a separate file-handle to the folder file, so not the
+handle which is reading.  Not all platforms support POSIX locking.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Box::Locker::POSIX-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option   Defined in       Default      
+ expires  L<Mail::Box::Locker>  1 hour       
+ file     L<Mail::Box::Locker>  undef        
+ folder   L<Mail::Box::Locker>  <required>   
+ log      L<Mail::Reporter>  C<'WARNINGS'>
+ method   L<Mail::Box::Locker>  C<POSIX>     
+ timeout  L<Mail::Box::Locker>  10 seconds   
+ trace    L<Mail::Reporter>  C<'WARNINGS'>
+
+. expires SECONDS
+
+. file FILENAME
+
+. folder FOLDER
+
+. log LEVEL
+
+. method STRING|CLASS|ARRAY
+
+. timeout SECONDS|'NOTIMEOUT'
+
+. trace LEVEL
+
+=back
+
+=head2 The Locker
+
+
+$obj-E<gt>B<filename>([FILENAME])
+
+=over 4
+
+See L<Mail::Box::Locker/"The Locker">
+
+=back
+
+$obj-E<gt>B<folder>
+
+=over 4
+
+See L<Mail::Box::Locker/"The Locker">
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Box::Locker/"The Locker">
+
+=back
+
+=head2 Locking
+
+
+$obj-E<gt>B<hasLock>
+
+=over 4
+
+See L<Mail::Box::Locker/"Locking">
+
+=back
+
+$obj-E<gt>B<isLocked>
+
+=over 4
+
+=back
+
+$obj-E<gt>B<lock>
+
+=over 4
+
+=back
+
+$obj-E<gt>B<unlock>
+
+=over 4
+
+See L<Mail::Box::Locker/"Locking">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Locker::POSIX-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Locker::POSIX-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Locker::POSIX-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Box::Locker/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Unable to check lock file $filename for $folder: $!
+
+To check whether the filename is used to flock a folder, the file must be
+opened.  Apparently this fails, which does not mean that the folder is
+locked neither that it is unlocked.
+
+I<Error:> Unable to open POSIX lock file $filename for $folder: $!
+
+For POSIX style locking, a folder it must be opened, which does not
+succeed for the specified reason.
+
+I<Error:> Will never get a POSIX lock at $filename for $folder: $!
+
+Tried to lock the folder, but it did not succeed.  The error code received
+from the OS indicates that it will not succeed ever, so we do not need to
+try again.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,130 @@
+
+use strict;
+
+package Mail::Box::Locker;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Reporter';
+
+use Carp;
+use File::Spec;
+use Scalar::Util 'weaken';
+
+#-------------------------------------------
+
+
+my %lockers =
+  ( DOTLOCK => __PACKAGE__ .'::DotLock'
+  , FLOCK   => __PACKAGE__ .'::Flock'
+  , MULTI   => __PACKAGE__ .'::Multi'
+  , NFS     => __PACKAGE__ .'::NFS'
+  , NONE    => __PACKAGE__
+  , POSIX   => __PACKAGE__ .'::POSIX'
+  );
+
+sub new(@)
+{   my $class  = shift;
+
+    return $class->SUPER::new(@_)
+        unless $class eq __PACKAGE__;
+
+    # Try to figure out which locking method we really want (bootstrap)
+
+    my %args   = @_;
+    my $method = !defined $args{method}       ? 'DOTLOCK'
+               : ref $args{method} eq 'ARRAY' ? 'MULTI'
+               :                                 uc $args{method};
+
+    my $create = $lockers{$method} || $args{$method};
+
+    local $"   = ' or ';
+    confess "No locking method $method defined: use @{[ keys %lockers ]}"
+        unless $create;
+
+    # compile the locking module (if needed)
+    eval "require $create";
+    confess $@ if $@;
+
+    $args{use} = $args{method} if ref $args{method} eq 'ARRAY';
+
+    $create->SUPER::new(%args);
+}
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    $self->SUPER::init($args);
+
+    $self->{MBL_folder}   = $args->{folder}
+        or croak "No folder specified to be locked.\n";
+
+    weaken($self->{MBL_folder});
+
+    $self->{MBL_expires}  = $args->{expires}   || 3600;  # one hour
+    $self->{MBL_timeout}  = $args->{timeout}   || 10;    # ten secs
+    $self->{MBL_filename} = $args->{file}      || $args->{folder}->name;
+    $self->{MBL_has_lock} = 0;
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub name {shift->notImplemented}
+
+#-------------------------------------------
+
+sub lockMethod($$$$)
+{   confess "Method removed: use inheritance to implement own method."
+}
+
+#-------------------------------------------
+
+
+sub folder() {shift->{MBL_folder}}
+
+#-------------------------------------------
+
+
+sub filename(;$)
+{   my $self = shift;
+    $self->{MBL_filename} = shift if @_;
+    $self->{MBL_filename};
+}
+
+#-------------------------------------------
+
+
+sub lock($) { shift->{MBL_has_lock} = 1 }
+
+#-------------------------------------------
+
+
+sub isLocked($) {0}
+
+#-------------------------------------------
+
+
+sub hasLock() {shift->{MBL_has_lock} }
+
+#-------------------------------------------
+
+
+# implementation hazard: the unlock must be self-reliant, without
+# help by the folder, because it may be called at global destruction
+# after the folder has been removed.
+
+sub unlock() { shift->{MBL_has_lock} = 0 }
+
+#-------------------------------------------
+
+
+sub DESTROY()
+{   my $self = shift;
+    $self->unlock if $self->hasLock;
+    $self->SUPER::DESTROY;
+    $self;
+}
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Locker.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,427 @@
+
+=head1 NAME
+
+Mail::Box::Locker - manage the locking of mail folders
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Locker
+   is a Mail::Reporter
+
+ Mail::Box::Locker is extended by
+   Mail::Box::Locker::DotLock
+   Mail::Box::Locker::Flock
+   Mail::Box::Locker::Multi
+   Mail::Box::Locker::NFS
+   Mail::Box::Locker::POSIX
+
+
+=head1 SYNOPSIS
+
+ use Mail::Box::Locker;
+ my $locker = new Mail::Box::Locker(folder => $folder);
+
+ $locker->lock;
+ $locker->isLocked;
+ $locker->hasLock;
+ $locker->unlock;
+
+ use Mail::Box;
+ my $folder = Mail::Box->new(lock_method => 'DOTLOCK');
+ print $folder->locker->type;
+
+
+=head1 DESCRIPTION
+
+Each L<Mail::Box|Mail::Box> will create its own C<Mail::Box::Locker> object which
+will handle the locking for it.  You can access of the object directly
+from the folder, as shown in the examples below.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Box::Locker-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+Create a new lock. You may do this directly. However, in most cases the
+lock will not be separately instantiated but will be the second class in
+a multiple inheritance construction with a L<Mail::Box|Mail::Box>.
+
+Generally the client program specifies the locking behavior through
+options given to the folder class.
+
+ Option   Defined in       Default      
+ expires                   1 hour       
+ file                      undef        
+ folder                    <required>   
+ log      L<Mail::Reporter>  C<'WARNINGS'>
+ method                    C<'DOTLOCK'> 
+ timeout                   10 seconds   
+ trace    L<Mail::Reporter>  C<'WARNINGS'>
+
+. expires SECONDS
+
+=over 4
+
+How long can a lock exist?  If a different e-mail program leaves a stale
+lock, then this lock will be removed automatically after the specified
+number of seconds.
+
+=back
+
+. file FILENAME
+
+=over 4
+
+Name of the file to lock.  By default, the name of the folder is taken.
+
+=back
+
+. folder FOLDER
+
+=over 4
+
+Which FOLDER is to be locked, a L<Mail::Box|Mail::Box> object.
+
+=back
+
+. log LEVEL
+
+. method STRING|CLASS|ARRAY
+
+=over 4
+
+Which kind of locking, specified as one of the following names as STRING.
+You may also specify a CLASS name, or an ARRAY of names.  In case of an
+ARRAY, a 'multi' locker is started with all thee 
+full CLASS name.
+
+Supported locking names are
+
+=over 4
+
+=item 'DOTLOCK' | 'dotlock'
+
+The folder handler creates a file which signals that it is in use.  This
+is a bit problematic, because not all mail-handling software agree on
+the name of the file to be created.
+
+On various folder types, the lockfile differs.  See the documentation for
+each folder, which describes the locking strategy as well as special
+options to change the default behavior.
+
+=item 'FLOCK' | 'flock'
+
+For some folder handlers, locking is based on a file locking mechanism
+provided by the operating system.  However, this does not work on all
+systems, such as network filesystems, and such. This also doesn't work on
+folders based on directories (L<Mail::Box::Dir|Mail::Box::Dir> and derived).
+
+=item 'POSIX' | 'posix'
+
+Use the POSIX standard fcntl locking.
+
+=item 'MULTI' | 'multi'
+
+Use ALL available locking methods at the same time, to have a bigger
+chance that the folder will not be modified by some other application
+which uses an unspecified locking method.  When one of the locking
+methods disallows access, the locking fails.
+
+=item 'NFS' | 'nfs'
+
+A kind of C<dotlock> file-locking mechanism, but adapted to work over
+NFS.  Extra precaution is needed because an C<open O_EXCL> on NFS is
+not an atomic action.
+
+=item 'NONE' | 'none'
+
+Do not use locking.
+
+=back
+
+The other option is to produce your own C<Mail::Box::Locker> derived class,
+which implements the desired locking method. (Please consider offering it
+for inclusion in the public Mail::Box module!) Create an instance of that
+class with this parameter:
+
+ my $locker = Mail::Box::Locker::MyOwn->new;
+ $folder->open(locker => $locker);
+
+=back
+
+. timeout SECONDS|'NOTIMEOUT'
+
+=over 4
+
+How long to wait while trying to acquire the lock. The lock request will
+fail when the specified number of seconds is reached.  If C<'NOTIMEOUT'> is
+specified, the module will wait until the lock can be taken.
+
+Whether it is possible to limit the wait time is platform- and
+locking-method-specific.  For instance, the `dotlock' method on Windows
+will always wait until the lock has been received.
+
+=back
+
+. trace LEVEL
+
+=back
+
+=head2 The Locker
+
+
+$obj-E<gt>B<filename>([FILENAME])
+
+=over 4
+
+Returns the filename which is used to lock the folder, optionally after
+setting it to the specified FILENAME.
+
+I<Example:> 
+
+ print $locker->filename;
+
+=back
+
+$obj-E<gt>B<folder>
+
+=over 4
+
+Returns the folder object which is locker.
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+Returns the method used to lock the folder. See the L<new(method)|Mail::Box::Locker/"METHODS"> for
+details on how to specify the lock method.  The name of the method is
+returned in upper-case.
+
+I<Example:> 
+
+ if($locker->name eq 'FLOCK') ...
+
+=back
+
+=head2 Locking
+
+
+$obj-E<gt>B<hasLock>
+
+=over 4
+
+Check whether the folder has the lock.
+
+I<Example:> 
+
+ if($locker->hasLock) {...}
+ if($folder->locker->hasLock) {...}
+
+=back
+
+$obj-E<gt>B<isLocked>
+
+=over 4
+
+Test if the folder is locked by this or a different application.
+
+I<Example:> 
+
+ if($locker->isLocked) {...}
+ if($folder->locker->isLocked) {...}
+
+=back
+
+$obj-E<gt>B<lock>(FOLDER)
+
+=over 4
+
+Get a lock on a folder.  This will return false if the lock fails.
+
+I<Example:> 
+
+ die unless $locker->lock;
+ if($folder->locker->lock) {...}
+
+=back
+
+$obj-E<gt>B<unlock>
+
+=over 4
+
+Undo the lock on a folder.
+
+I<Example:> 
+
+ $locker->unlock;
+ $folder->locker->unlock;
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Locker-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Locker-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Locker-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+When the locker is destroyed, for instance when the folder is closed
+or the program ends, the lock will be automatically removed.
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH/Index.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH/Index.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH/Index.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,115 @@
+
+use strict;
+
+package Mail::Box::MH::Index;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Reporter';
+
+use Mail::Message::Head::Subset;
+use Carp;
+
+
+#-------------------------------------------
+
+
+sub init($)
+{   my ($self, $args) = @_;
+    $self->SUPER::init($args);
+
+    $self->{MBMI_filename}  = $args->{filename}
+       or croak "No index filename specified.";
+
+    $self->{MBMI_head_wrap} = $args->{head_wrap} || 72;
+    $self->{MBMI_head_type}
+       = $args->{head_type} || 'Mail::Message::Head::Subset';
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub filename() {shift->{MBMI_filename}}
+
+#-------------------------------------------
+
+
+sub write(@)
+{   my $self      = shift;
+    my $index     = $self->filename or return $self;
+    my $fieldtype = 'Mail::Message::Field';
+
+    # Remove empty index-file.
+    unless(@_)
+    {   unlink $index;
+        return $self;
+    }
+
+    my $written    = 0;
+
+    local *INDEX;
+    open INDEX, '>', $index or return;
+
+    foreach my $msg (@_)
+    {   my $head     = $msg->head;
+        next if $head->isDelayed;
+
+        my $filename = $msg->filename;
+        $head->setNoRealize($fieldtype->new('X-MailBox-Filename' => $filename));
+        $head->setNoRealize($fieldtype->new('X-MailBox-Size'  => -s $filename));
+        $head->print(\*INDEX);
+        $written++;
+    }
+
+    close INDEX;
+
+    unlink $index unless $written;
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub read(;$)
+{   my $self     = shift;
+    my $filename = $self->{MBMI_filename};
+
+    my $parser   = Mail::Box::Parser->new
+      ( filename => $filename
+      , mode     => 'r'
+      ) or return;
+
+    my @options  = ($self->logSettings, wrap_length => $self->{MBMI_head_wrap});
+    my $type     = $self->{MBMI_head_type};
+    my $index_age= -M $filename;
+    my %index;
+
+    while(my $head = $type->new(@options)->read($parser))
+    {   my $msgfile = $head->get('x-mailbox-filename');
+        my $size    = int $head->get('x-mailbox-size');
+        next unless -f $msgfile && -s _ == $size;
+        next if defined $index_age && -M _ >= $index_age;
+
+        $index{$msgfile} = $head;
+    }
+
+    $parser->stop;
+
+    $self->{MBMI_index} = \%index;
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub get($)
+{   my ($self, $msgfile) = @_;
+    $self->{MBMI_index}{$msgfile};
+}
+
+#-------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH/Index.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH/Index.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH/Index.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,288 @@
+
+=head1 NAME
+
+Mail::Box::MH::Index - keep index files for messages.
+
+
+=head1 INHERITANCE
+
+ Mail::Box::MH::Index
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my $index = Mail::Box::MH::Index->new;
+ $index->read(...)
+ $index->write(...)
+
+
+=head1 DESCRIPTION
+
+Message folders which store their data in one single file per message are
+very inefficient for producing subject overviews and for computing message
+threads.  The C<Mail::Box::MH::Index> object is able to store and read a the
+headers of a set of C<Mail::Box::MH::Message> messages which are
+part of a single C<Mail::Box::MH> folder in one file.
+
+When the C<Mail::Box::MH::Index> functionality is enabled by specifying
+L<Mail::Box::MH::new(keep_index)|Mail::Box::MH/"METHODS"> when opening a folder, the index file
+is automatically read.  When the folder is closed, a new index file is
+created.
+
+Special care is taken to avoid problems which occur when the user changes
+or removes message files without updating the index. If the index is not
+trustworthy it will not be used (costing some performance for the reader
+of the folder).
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Box::MH::Index-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option     Defined in       Default                                                   
+ filename                    <required>                                                
+ head_type                   L<Mail::Message::Head::Subset|Mail::Message::Head::Subset>
+ head_wrap                   72                                                        
+ log        L<Mail::Reporter>  C<'WARNINGS'>                                             
+ trace      L<Mail::Reporter>  C<'WARNINGS'>                                             
+
+. filename FILENAME
+
+=over 4
+
+The FILENAME which is used to store the headers of all the e-mails for
+one folder. This must be an absolute pathname.
+
+=back
+
+. head_type CLASS
+
+=over 4
+
+The type of headers which will be used to store header information when
+it is read from the index file.  You can not be sure the index contains
+all header line (the mailbox may have been updated without updating
+the index) so this will usually be (an sub-class of)
+L<Mail::Message::Head::Subset|Mail::Message::Head::Subset>.
+
+=back
+
+. head_wrap INTEGER
+
+=over 4
+
+The preferred number of character in each header line.
+
+=back
+
+. log LEVEL
+
+. trace LEVEL
+
+=back
+
+=head2 The Index
+
+
+$obj-E<gt>B<filename>
+
+=over 4
+
+Returns the name of the index file.
+
+=back
+
+$obj-E<gt>B<get>(MSGFILE)
+
+=over 4
+
+Look if there is header info for the specified MSGFILE.  The filename
+represents one message in folder type which are organized as directory.
+This method will return an object of the L<new(head_type)|Mail::Box::MH::Index/"Constructors"> as specified
+during creation of the index object, or C<undef> if the information
+is not known or not trustworthy -i.e. the file size changed.
+
+=back
+
+$obj-E<gt>B<read>
+
+=over 4
+
+Read the index file.  The header objects can after this be requested
+with the get() method.
+
+=back
+
+$obj-E<gt>B<write>(MESSAGES)
+
+=over 4
+
+Write an index file containing the headers specified MESSAGES
+(Mail::Message objects).
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::MH::Index-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::MH::Index-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::MH::Index-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH/Labels.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH/Labels.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH/Labels.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,163 @@
+
+use strict;
+
+package Mail::Box::MH::Labels;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Reporter';
+
+use Mail::Message::Head::Subset;
+
+use File::Copy;
+use Carp;
+
+
+#-------------------------------------------
+
+
+sub init($)
+{   my ($self, $args) = @_;
+    $self->SUPER::init($args);
+    $self->{MBML_filename}  = $args->{filename}
+       or croak "No label filename specified.";
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub filename() {shift->{MBML_filename}}
+
+#-------------------------------------------
+
+
+sub get($)
+{   my ($self, $msgnr) = @_;
+    $self->{MBML_labels}[$msgnr];
+}
+
+#-------------------------------------------
+
+
+sub read()
+{   my $self = shift;
+    my $seq  = $self->filename;
+
+    open SEQ, '<', $seq
+       or return;
+
+    my @labels;
+
+    local $_;
+    while(<SEQ>)
+    {   s/\s*\#.*$//;
+        next unless length;
+
+        next unless s/^\s*(\w+)\s*\:\s*//;
+        my $label = $1;
+
+        my $set   = 1;
+           if($label eq 'cur'   ) { $label = 'current' }
+        elsif($label eq 'unseen') { $label = 'seen'; $set = 0 }
+
+        foreach (split /\s+/)
+        {   if( /^(\d+)\-(\d+)\s*$/ )
+            {   push @{$labels[$_]}, $label, $set foreach $1..$2;
+            }
+            elsif( /^\d+\s*$/ )
+            {   push @{$labels[$_]}, $label, $set;
+            }
+        }
+    }
+
+    close SEQ;
+
+    $self->{MBML_labels} = \@labels;
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub write(@)
+{   my $self     = shift;
+    my $filename = $self->filename;
+
+    # Remove when no messages are left.
+    unless(@_)
+    {   unlink $filename;
+        return $self;
+    }
+
+    open my $out, '>', $filename or return;
+    $self->print($out, @_);
+    close $out;
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub append(@)
+{   my $self     = shift;
+    my $filename = $self->filename;
+
+    open(my $out, '>>', $filename) or return;
+    $self->print($out, @_);
+    close $out;
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub print($@)
+{   my ($self, $out) = (shift, shift);
+
+    # Collect the labels from the selected messages.
+    my %labeled;
+    foreach my $message (@_)
+    {   my $labels = $message->labels;
+        (my $seq   = $message->filename) =~ s!.*/!!;
+
+        push @{$labeled{unseen}}, $seq
+            unless $labels->{seen};
+
+        foreach (keys %$labels)
+        {   push @{$labeled{$_}}, $seq
+                if $labels->{$_};
+        }
+    }
+    delete $labeled{seen};
+
+    # Write it out
+
+    local $"     = ' ';
+    foreach (sort keys %labeled)
+    {
+        my @msgs = @{$labeled{$_}};  #they are ordered already.
+        $_ = 'cur' if $_ eq 'current';
+        print $out "$_:";
+
+        while(@msgs)
+        {   my $start = shift @msgs;
+            my $end   = $start;
+
+            $end = shift @msgs
+                 while @msgs && $msgs[0]==$end+1;
+
+            print $out ($start==$end ? " $start" : " $start-$end");
+        }
+        print $out "\n";
+    }
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH/Labels.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH/Labels.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH/Labels.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,270 @@
+
+=head1 NAME
+
+Mail::Box::MH::Labels - maintain MH message related labels
+
+
+=head1 INHERITANCE
+
+ Mail::Box::MH::Labels
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my $labels = Mail::Box::MH::Labels->new;
+ $labels->read(...)
+ $labels->write(...)
+
+
+=head1 DESCRIPTION
+
+MH type message folders use one dedicated file per folder-directory to list
+special tags to messages in that folder.  By doing this, mail agents may
+avoid parsing all the messages, which is very resource consuming.
+
+Labels can be used to group messages, for instance to reflect which
+messages have been read or which look like spam.  Some labels are
+predefined, but more can be added without limitation.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Box::MH::Labels-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option    Defined in       Default      
+ filename                   <required>   
+ log       L<Mail::Reporter>  C<'WARNINGS'>
+ trace     L<Mail::Reporter>  C<'WARNINGS'>
+
+. filename FILENAME
+
+=over 4
+
+The FILENAME which is used in each directory to store the headers of all
+mails. The filename must be an absolute path.
+
+=back
+
+. log LEVEL
+
+. trace LEVEL
+
+=back
+
+=head2 The Label Table
+
+
+$obj-E<gt>B<append>(MESSAGES)
+
+=over 4
+
+Append the label information about the specified MESSAGES to the end
+of the label file.  The information will not be merged with the
+information already present in the label file.
+
+=back
+
+$obj-E<gt>B<filename>
+
+=over 4
+
+Returns the name of the index file.
+
+=back
+
+$obj-E<gt>B<get>(MSGNR)
+
+=over 4
+
+Look if there is label info for message MSGNR.
+
+=back
+
+$obj-E<gt>B<print>(FILEHANDLE, MESSAGES)
+
+=over 4
+
+Print the labels of the specified messages to the opened file.
+
+=back
+
+$obj-E<gt>B<read>
+
+=over 4
+
+Read all label information from file.
+
+=back
+
+$obj-E<gt>B<write>(MESSAGES)
+
+=over 4
+
+Write the labels related to the specified messages to the label file.
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::MH::Labels-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::MH::Labels-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::MH::Labels-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH/Message.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH/Message.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH/Message.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,14 @@
+
+use strict;
+use warnings;
+
+package Mail::Box::MH::Message;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box::Dir::Message';
+
+use File::Copy;
+use Carp;
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH/Message.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH/Message.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH/Message.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,972 @@
+
+=head1 NAME
+
+Mail::Box::MH::Message - one message in an MH-folder
+
+
+=head1 INHERITANCE
+
+ Mail::Box::MH::Message
+   is a Mail::Box::Dir::Message
+   is a Mail::Box::Message
+   is a Mail::Message
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my $folder = new Mail::Box::MH ...
+ my $message = $folder->message(10);
+
+
+=head1 DESCRIPTION
+
+A C<Mail::Box::MH::Message> represents one message in an
+L<Mail::Box::MH|Mail::Box::MH> folder . Each message is stored in a separate file,
+as for all L<Mail::Box::Dir|Mail::Box::Dir> folder types.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message/"Constructors">
+
+=back
+
+Mail::Box::MH::Message-E<gt>B<coerce>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box::Message/"METHODS">
+
+=back
+
+Mail::Box::MH::Message-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box::Dir::Message/"METHODS">
+
+=back
+
+=head2 Constructing a message
+
+
+$obj-E<gt>B<bounce>([RG-OBJECT|OPTIONS])
+
+=over 4
+
+See L<Mail::Message::Construct::Bounce/"Constructing a message">
+
+=back
+
+Mail::Box::MH::Message-E<gt>B<build>([MESSAGE|BODY], CONTENT)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+Mail::Box::MH::Message-E<gt>B<buildFromBody>(BODY, [HEAD], HEADERS)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forward>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardAttach>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardEncapsulate>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardInline>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardNo>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPostlude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPrelude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardSubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+Mail::Box::MH::Message-E<gt>B<read>(FILEHANDLE|SCALAR|REF-SCALAR|ARRAY-OF-LINES, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Read/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<rebuild>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<reply>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replyPrelude>([STRING|FIELD|ADDRESS|ARRAY-OF-THINGS])
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replySubject>(STRING)
+
+Mail::Box::MH::Message-E<gt>B<replySubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+=head2 The Message
+
+
+$obj-E<gt>B<container>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isDummy>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isPart>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<messageId>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<send>([MAILER], OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<toplevel>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<write>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<bcc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<cc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<date>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<destinations>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<from>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<get>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<guessTimestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<head>([HEAD])
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<sender>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<study>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<subject>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<timestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<to>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+=head2 The body
+
+
+$obj-E<gt>B<body>([BODY])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<decoded>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<encode>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isNested>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<parts>(['ALL'|'ACTIVE'|'DELETED'|'RECURSE'|FILTER])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+=head2 Flags
+
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<deleted>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isDeleted>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<label>(LABEL|PAIRS)
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<labels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<labelsToStatus>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<statusToLabels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+=head2 The whole message as text
+
+
+$obj-E<gt>B<file>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<lines>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<printStructure>([FILEHANDLE][, INDENT])
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+=head2 The message
+
+
+$obj-E<gt>B<copyTo>(FOLDER)
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<filename>([FILENAME])
+
+=over 4
+
+See L<Mail::Box::Dir::Message/"The message">
+
+=back
+
+$obj-E<gt>B<folder>([FOLDER])
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<moveTo>(FOLDER)
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<seqnr>([INTEGER])
+
+=over 4
+
+The order of this message in the folder, counted from zero.  Do not
+change the number (unless you understand the implications).
+
+WARNING:  This sequence number has nothing to do with the message's
+filename, which in case of MH folders are also numbers!  If you need
+that one, use the File::Basename subroutine basename of the filename.
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<create>(FILENAME)
+
+=over 4
+
+See L<Mail::Box::Dir::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<diskDelete>
+
+=over 4
+
+See L<Mail::Box::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<loadBody>
+
+=over 4
+
+See L<Mail::Box::Dir::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<loadHead>
+
+=over 4
+
+See L<Mail::Box::Dir::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<parser>
+
+=over 4
+
+See L<Mail::Box::Dir::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readBody>(PARSER, HEAD [, BODYTYPE])
+
+=over 4
+
+See L<Mail::Box::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readFromParser>(PARSER, [BODYTYPE])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readHead>(PARSER [,CLASS])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<recursiveRebuildPart>(PART, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Internals">
+
+=back
+
+$obj-E<gt>B<storeBody>(BODY)
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<takeMessageId>([STRING])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Message::Construct/"METHODS">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::MH::Message-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::MH::Message-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::MH::Message-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortSize>([VALUE])
+
+Mail::Box::MH::Message-E<gt>B<shortSize>([VALUE])
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortString>
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<destruct>
+
+=over 4
+
+See L<Mail::Box::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot create parser for $filename.
+
+For some reason (the previous message have told you already) it was not possible
+to create a message parser for the specified filename.
+
+I<Error:> Cannot include forward source as $include.
+
+Unknown alternative for the L<forward(include)|Mail::Message::Construct::Forward/"Constructing a message">.  Valid choices are
+C<NO>, C<INLINE>, C<ATTACH>, and C<ENCAPSULATE>.
+
+I<Error:> Cannot include reply source as $include.
+
+Unknown alternative for the C<include> option of L<reply()|Mail::Message::Construct::Reply/"Constructing a message">.  Valid
+choices are C<NO>, C<INLINE>, and C<ATTACH>.
+
+I<Error:> Cannot write message to $filename: $!
+
+When a modified or new message is written to disk, it is first written
+to a temporary file in the folder directory.  For some reason, it is
+impossible to create this file.
+
+I<Error:> Failed to move $new to $filename: $!
+
+When a modified or new message is written to disk, it is first written
+to a temporary file in the folder directory.  Then, the new file is
+moved to replace the existing file.  Apparently, the latter fails.
+
+I<Error:> No address to create forwarded to.
+
+If a forward message is created, a destination address must be specified.
+
+I<Error:> No default mailer found to send message.
+
+The message L<send()|Mail::Message/"The Message"> mechanism had not enough information to automatically
+find a mail transfer agent to sent this message.  Specify a mailer
+explicitly using the C<via> options.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Unable to read delayed body.
+
+For some reason, the header of the message could be read, but the body
+cannot.  Probably the file has disappeared or the permissions were
+changed during the progress of the program.
+
+I<Error:> Unable to read delayed head.
+
+Mail::Box tries to be I<lazy> with respect to parsing messages.  When a
+directory organized folder is opened, only the filenames of messages are
+collected.  At first use, the messages are read from their file.  Apperently,
+a message is used for the first time here, but has disappeared or is
+unreadible for some other reason.
+
+I<Error:> forwardAttach requires a preamble object
+
+
+I<Error:> forwardEncapsulate requires a preamble object
+
+
+I<Error:> no rebuild rule $name defined.
+
+
+
+=head1 DETAILS
+
+
+=head2 Labels
+
+
+=head3 The .mh_sequences file
+
+Typically, the file which contains the labels is called C<.mh_sequences>.
+The MH messages are numbered from C<1>.  As example content for
+C<.mh_sequences>:
+
+ cur: 93
+ unseen: 32 35-56 67-80
+
+To generalize labels on messages, two are treated specially:
+
+=over 4
+
+=item * cur
+
+The C<cur> specifies the number of the message where the user stopped
+reading mail from this folder at last access.  Internally in these
+modules referred to as label C<current>.
+
+=item * unseen
+
+With C<unseen> is listed which message was never read.
+This must be a mistake in the design of MH: it must be a source of
+confusion.  People should never use labels with a negation in the
+name:
+
+ if($seen)           if(!$unseen)    #yuk!
+ if(!$seen)          if($unseen)
+ unless($seen)       unless($unseen) #yuk!
+
+So: label C<unseen> is translated into C<seen> for internal use.
+
+=back
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,427 @@
+
+use strict;
+package Mail::Box::MH;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box::Dir';
+
+use Mail::Box::MH::Index;
+use Mail::Box::MH::Message;
+use Mail::Box::MH::Labels;
+
+use Carp;
+use File::Spec;
+use File::Basename;
+
+# Since MailBox 2.052, the use of File::Spec is reduced to the minimum,
+# because it is too slow.  The '/' directory separators do work on
+# Windows too.
+
+
+my $default_folder_dir = exists $ENV{HOME} ? "$ENV{HOME}/.mh" : '.';
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    $args->{folderdir}     ||= $default_folder_dir;
+    $args->{lock_file}     ||= $args->{index_filename};
+
+    $self->SUPER::init($args);
+
+    my $folderdir            = $self->folderdir;
+    my $directory            = $self->directory;
+    return unless -d $directory;
+
+    # About the index
+
+    $self->{MBM_keep_index}  = $args->{keep_index} || 0;
+    $self->{MBM_index}       = $args->{index};
+    $self->{MBM_index_type}  = $args->{index_type} || 'Mail::Box::MH::Index';
+    for($args->{index_filename})
+    {  $self->{MBM_index_filename}
+          = !defined $_ ? "$directory/.index"          # default
+          : File::Spec->file_name_is_absolute($_) ? $_ # absolute
+          :               "$directory/$_";             # relative
+    }
+
+    # About labels
+
+    $self->{MBM_labels}      = $args->{labels};
+    $self->{MBM_labels_type} = $args->{labels_type} || 'Mail::Box::MH::Labels';
+    for($args->{labels_filename})
+    {   $self->{MBM_labels_filename}
+          = !defined $_ ? "$directory/.mh_sequences"
+          : File::Spec->file_name_is_absolute($_) ? $_   # absolute
+          :               "$directory/$_";               # relative
+    }
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub create($@)
+{   my ($thingy, $name, %args) = @_;
+    my $class     = ref $thingy      || $thingy;
+    my $folderdir = $args{folderdir} || $default_folder_dir;
+    my $directory = $class->folderToDirectory($name, $folderdir);
+
+    return $class if -d $directory;
+
+    if(mkdir $directory, 0700)
+    {   $class->log(PROGRESS => "Created folder $name.\n");
+        return $class;
+    }
+    else
+    {   $class->log(ERROR => "Cannot create MH folder $name: $!\n");
+        return;
+    }
+}
+
+#-------------------------------------------
+
+sub foundIn($@)
+{   my $class = shift;
+    my $name  = @_ % 2 ? shift : undef;
+    my %args  = @_;
+    my $folderdir = $args{folderdir} || $default_folder_dir;
+    my $directory = $class->folderToDirectory($name, $folderdir);
+
+    return 0 unless -d $directory;
+    return 1 if -f "$directory/1";
+
+    # More thorough search required in case some numbered messages
+    # disappeared (lost at fsck or copy?)
+
+    return unless opendir DIR, $directory;
+    foreach (readdir DIR)
+    {   next unless m/^\d+$/;   # Look for filename which is a number.
+        closedir DIR;
+        return 1;
+    }
+
+    closedir DIR;
+    0;
+}
+
+#-------------------------------------------
+
+sub type() {'mh'}
+
+#-------------------------------------------
+
+sub listSubFolders(@)
+{   my ($class, %args) = @_;
+    my $dir;
+    if(ref $class)
+    {   $dir   = $class->directory;
+        $class = ref $class;
+    }
+    else
+    {   my $folder    = $args{folder}    || '=';
+        my $folderdir = $args{folderdir} || $default_folder_dir;
+        $dir   = $class->folderToDirectory($folder, $folderdir);
+    }
+
+    $args{skip_empty} ||= 0;
+    $args{check}      ||= 0;
+
+    # Read the directories from the directory, to find all folders
+    # stored here.  Some directories have to be removed because they
+    # are created by all kinds of programs, but are no folders.
+
+    return () unless -d $dir && opendir DIR, $dir;
+
+    my @dirs = grep { !/^\d+$|^\./ && -d "$dir/$_" && -r _ }
+                   readdir DIR;
+
+    closedir DIR;
+
+    # Skip empty folders.  If a folder has sub-folders, then it is not
+    # empty.
+    if($args{skip_empty})
+    {    my @not_empty;
+
+         foreach my $subdir (@dirs)
+         {   if(-f "$dir/$subdir/1")
+             {   # Fast found: the first message of a filled folder.
+                 push @not_empty, $subdir;
+                 next;
+             }
+
+             opendir DIR, "$dir/$subdir" or next;
+             my @entities = grep !/^\./, readdir DIR;
+             closedir DIR;
+
+             if(grep /^\d+$/, @entities)   # message 1 was not there, but
+             {   push @not_empty, $subdir; # other message-numbers exist.
+                 next;
+             }
+
+             foreach (@entities)
+             {   next unless -d "$dir/$subdir/$_";
+                 push @not_empty, $subdir;
+                 last;
+             }
+
+         }
+
+         @dirs = @not_empty;
+    }
+
+    # Check if the files we want to return are really folders.
+
+    @dirs = map { m/(.*)/ && $1 ? $1 : () } @dirs;   # untaint
+    return @dirs unless $args{check};
+
+    grep { $class->foundIn("$dir/$_") } @dirs;
+}
+
+#-------------------------------------------
+
+sub nameOfSubFolder($@)
+{   my ($self, $name) = (shift, shift);
+    $self->directory . '/' . $name;
+}
+
+#-------------------------------------------
+
+sub openSubFolder($)
+{   my ($self, $name) = @_;
+
+    my $subdir = $self->nameOfSubFolder($name);
+    unless(-d $subdir || mkdir $subdir, 0755)
+    {   warn "Cannot create subfolder $name for $self: $!\n";
+        return;
+    }
+
+    $self->SUPER::openSubFolder($name, @_);
+}
+
+#-------------------------------------------
+
+
+sub appendMessages(@)
+{   my $class  = shift;
+    my %args   = @_;
+
+    my @messages = exists $args{message} ? $args{message}
+                 : exists $args{messages} ? @{$args{messages}}
+                 : return ();
+
+    my $self     = $class->new(@_, access => 'a')
+        or return ();
+
+    my $directory= $self->directory;
+    return unless -d $directory;
+
+    my $locker   = $self->locker;
+    unless($locker->lock)
+    {   $self->log(ERROR => "Cannot append message without lock on $self.");
+        return;
+    }
+
+    my $msgnr    = $self->highestMessageNumber +1;
+
+    foreach my $message (@messages)
+    {   my $filename = "$directory/$msgnr";
+        $message->create($filename)
+           or $self->log(ERROR =>
+	           "Unable to write message for $self to $filename: $!\n");
+
+        $msgnr++;
+    }
+ 
+    my $labels   = $self->labels->append(@messages);
+
+    $locker->unlock;
+    $self->close;
+
+    @messages;
+}
+
+#-------------------------------------------
+
+
+sub highestMessageNumber()
+{   my $self = shift;
+
+    return $self->{MBM_highest_msgnr}
+        if exists $self->{MBM_highest_msgnr};
+
+    my $directory    = $self->directory;
+
+    opendir DIR, $directory or return;
+    my @messages = sort {$a <=> $b} grep /^\d+$/, readdir DIR;
+    closedir DIR;
+
+    $messages[-1];
+}
+
+#-------------------------------------------
+
+
+sub index()
+{   my $self  = shift;
+    return () unless $self->{MBM_keep_index};
+    return $self->{MBM_index} if defined $self->{MBM_index};
+
+    $self->{MBM_index} = $self->{MBM_index_type}->new
+     ( filename  => $self->{MBM_index_filename}
+     , $self->logSettings
+     )
+
+}
+
+#-------------------------------------------
+
+
+sub labels()
+{   my $self   = shift;
+    return $self->{MBM_labels} if defined $self->{MBM_labels};
+
+    $self->{MBM_labels} = $self->{MBM_labels_type}->new
+      ( filename => $self->{MBM_labels_filename}
+      , $self->logSettings
+      )
+}
+
+#-------------------------------------------
+
+sub readMessageFilenames
+{   my ($self, $dirname) = @_;
+
+    opendir DIR, $dirname or return;
+
+    # list of numerically sorted, untainted filenames.
+    my @msgnrs
+       = sort {$a <=> $b}
+            map { /^(\d+)$/ && -f "$dirname/$1" ? $1 : () }
+               readdir DIR;
+
+    closedir DIR;
+
+    @msgnrs;
+}
+
+#-------------------------------------------
+
+sub readMessages(@)
+{   my ($self, %args) = @_;
+
+    my $directory = $self->directory;
+    return unless -d $directory;
+
+    my $locker = $self->locker;
+    $locker->lock or return;
+
+    my @msgnrs = $self->readMessageFilenames($directory);
+
+    my $index  = $self->{MBM_index};
+    unless($index)
+    {   $index = $self->index;
+        $index->read if $index;
+    }
+
+    my $labels = $self->{MBM_labels};
+    unless($labels)
+    {    $labels = $self->labels;
+         $labels->read if $labels;
+    }
+
+    my $body_type   = $args{body_delayed_type};
+    my $head_type   = $args{head_delayed_type};
+    my @log         = $self->logSettings;
+
+    foreach my $msgnr (@msgnrs)
+    {
+        my $msgfile = "$directory/$msgnr";
+
+        my $head;
+        $head       = $index->get($msgfile) if $index;
+        $head     ||= $head_type->new(@log);
+
+        my $message = $args{message_type}->new
+         ( head       => $head
+         , filename   => $msgfile
+         , folder     => $self
+         , fix_header => $self->{MB_fix_headers}
+         );
+
+        my $labref  = $labels ? $labels->get($msgnr) : ();
+        $message->label(seen => 1, $labref ? @$labref : ());
+
+        $message->storeBody($body_type->new(@log, message => $message));
+        $self->storeMessage($message);
+    }
+
+    $self->{MBM_highest_msgnr}  = $msgnrs[-1];
+    $self;
+}
+ 
+#-------------------------------------------
+
+
+sub writeMessages($)
+{   my ($self, $args) = @_;
+
+    # Write each message.  Two things complicate life:
+    #   1 - we may have a huge folder, which should not be on disk twice
+    #   2 - we may have to replace a message, but it is unacceptable
+    #       to remove the original before we are sure that the new version
+    #       is on disk.
+
+    my $locker    = $self->locker;
+    $self->log(ERROR => "Cannot write folder $self without lock."), return
+        unless $locker->lock;
+
+    my $renumber  = exists $args->{renumber} ? $args->{renumber} : 1;
+    my $directory = $self->directory;
+    my @messages  = @{$args->{messages}};
+
+    my $writer    = 0;
+    foreach my $message (@messages)
+    {
+        my $filename = $message->filename;
+
+        my $newfile;
+        if($renumber || !$filename)
+        {   $newfile = $directory . '/' . ++$writer;
+        }
+        else
+        {   $newfile = $filename;
+            $writer  = basename $filename;
+        }
+
+        $message->create($newfile);
+    }
+
+    # Write the labels- and the index-file.
+
+    my $labels = $self->labels;
+    $labels->write(@messages) if $labels;
+
+    my $index  = $self->index;
+    $index->write(@messages) if $index;
+
+    $locker->unlock;
+
+    # Remove an empty folder.  This is done last, because the code before
+    # in this method will have cleared the contents of the directory.
+
+    if(!@messages && $self->{MB_remove_empty})
+    {   # If something is still in the directory, this will fail, but I
+        # don't mind.
+        rmdir $directory;
+    }
+
+    $self;
+}
+
+#-------------------------------------------
+
+#-------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/MH.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,951 @@
+
+=head1 NAME
+
+Mail::Box::MH - handle MH folders
+
+
+=head1 INHERITANCE
+
+ Mail::Box::MH
+   is a Mail::Box::Dir
+   is a Mail::Box
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ use Mail::Box::MH;
+ my $folder = new Mail::Box::MH folder => $ENV{MAIL}, ...;
+
+
+=head1 DESCRIPTION
+
+This documentation describes how MH mailboxes work, and what you
+can do with the MH folder object C<Mail::Box::MH>.
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+overload: B<@{}>
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+overload: B<cmp>
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<create>(FOLDERNAME, OPTIONS)
+
+Mail::Box::MH-E<gt>B<create>(FOLDERNAME, OPTIONS)
+
+=over 4
+
+ Option     Defined in    Default
+ folderdir  L<Mail::Box>  undef  
+
+. folderdir DIRECTORY
+
+=back
+
+Mail::Box::MH-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option             Defined in       Default                                                         
+ access             L<Mail::Box>     C<'r'>                                                          
+ body_delayed_type  L<Mail::Box>     L<Mail::Message::Body::Delayed|Mail::Message::Body::Delayed>    
+ body_type          L<Mail::Box>     L<Mail::Message::Body::Lines|Mail::Message::Body::Lines>        
+ coerce_options     L<Mail::Box>     C<[]>                                                           
+ create             L<Mail::Box>     <false>                                                         
+ extract            L<Mail::Box>     C<10240>                                                        
+ field_type         L<Mail::Box>     undef                                                           
+ fix_headers        L<Mail::Box>     <false>                                                         
+ folder             L<Mail::Box>     C<$ENV{MAIL}>                                                   
+ folderdir          L<Mail::Box>     C<$ENV{HOME}/.mh>                                               
+ head_delayed_type  L<Mail::Box>     L<Mail::Message::Head::Delayed|Mail::Message::Head::Delayed>    
+ head_type          L<Mail::Box>     L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>  
+ index                               undef                                                           
+ index_filename                      <foldername>C</.index>                                          
+ index_type                          L<Mail::Box::MH::Index|Mail::Box::MH::Index>                    
+ keep_dups          L<Mail::Box>     <false>                                                         
+ keep_index                          0                                                               
+ labels                              undef                                                           
+ labels_filename                     <foldername>C</.mh_sequence>                                    
+ labels_type                         L<Mail::Box::MH::Labels|Mail::Box::MH::Labels>                  
+ lock_file          L<Mail::Box>     <index_file>                                                    
+ lock_timeout       L<Mail::Box>     1 hour                                                          
+ lock_type          L<Mail::Box>     L<Mail::Box::Locker::DotLock|Mail::Box::Locker::DotLock>        
+ lock_wait          L<Mail::Box>     10 seconds                                                      
+ locker             L<Mail::Box>     undef                                                           
+ log                L<Mail::Reporter>  C<'WARNINGS'>                                                   
+ manager            L<Mail::Box>     undef                                                           
+ message_type       L<Mail::Box>     L<Mail::Box::Message|Mail::Box::Message>                        
+ multipart_type     L<Mail::Box>     L<Mail::Message::Body::Multipart|Mail::Message::Body::Multipart>
+ remove_when_empty  L<Mail::Box>     <true>                                                          
+ save_on_exit       L<Mail::Box>     <true>                                                          
+ trace              L<Mail::Reporter>  C<'WARNINGS'>                                                   
+ trusted            L<Mail::Box>     <depends on folder location>                                    
+
+. access MODE
+
+. body_delayed_type CLASS
+
+. body_type CLASS|CODE
+
+. coerce_options ARRAY
+
+. create BOOLEAN
+
+. extract INTEGER | CODE | METHOD | 'LAZY'|'ALWAYS'
+
+. field_type CLASS
+
+. fix_headers BOOLEAN
+
+. folder FOLDERNAME
+
+. folderdir DIRECTORY
+
+. head_delayed_type CLASS
+
+. head_type CLASS
+
+. index OBJECT
+
+=over 4
+
+You may specify an OBJECT of a type which extends L<Mail::Box::MH::Index|Mail::Box::MH::Index>
+(at least implements a C<get()> method), as alternative for an index file
+reader as created by C<Mail::Box::MH>.
+
+=back
+
+. index_filename FILENAME
+
+=over 4
+
+The FILENAME which is used in each directory to store the headers of all
+mails. The filename shall not contain a directory path. (e.g. Do not use
+C</usr/people/jan/.index>, nor C<subdir/.index>, but say C<.index>.)
+
+=back
+
+. index_type CLASS
+
+. keep_dups BOOLEAN
+
+. keep_index BOOLEAN
+
+=over 4
+
+Keep an index file of the specified mailbox, one file per directory.
+Using an index file will speed up things considerably, because it avoids
+reading all the message files the moment that you open the folder.  When
+you open a folder, you can use the index file to retrieve information such
+as the subject of each message, instead of having to read possibly
+thousands of messages.
+
+=back
+
+. labels OBJECT
+
+=over 4
+
+You may specify an OBJECT of a type which extends L<Mail::Box::MH::Labels|Mail::Box::MH::Labels>
+(at least implements the C<get()> method), as alternative for labels file
+reader as created by C<Mail::Box::MH>.
+
+=back
+
+. labels_filename FILENAME
+
+=over 4
+
+In MH-folders, messages can be labeled, for instance based on the
+sender or whether it is read or not.  This status is kept in a
+file which is usually called C<.mh_sequences>, but that name can
+be overruled with this flag.
+
+=back
+
+. labels_type CLASS
+
+. lock_file FILENAME
+
+. lock_timeout SECONDS
+
+. lock_type CLASS|STRING|ARRAY
+
+. lock_wait SECONDS
+
+. locker OBJECT
+
+. log LEVEL
+
+. manager MANAGER
+
+. message_type CLASS
+
+. multipart_type CLASS
+
+. remove_when_empty BOOLEAN
+
+. save_on_exit BOOLEAN
+
+. trace LEVEL
+
+. trusted BOOLEAN
+
+=back
+
+=head2 The folder
+
+
+$obj-E<gt>B<addMessage>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<addMessages>(MESSAGE [, MESSAGE, ...])
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+Mail::Box::MH-E<gt>B<appendMessages>(OPTIONS)
+
+=over 4
+
+Append a message to a folder which is not open.
+
+ Option    Defined in       Default   
+ folder    L<Mail::Box>     <required>
+ message   L<Mail::Box>     undef     
+ messages  L<Mail::Box>     undef     
+
+. folder FOLDERNAME
+
+. message MESSAGE
+
+. messages ARRAY-OF-MESSAGES
+
+=back
+
+$obj-E<gt>B<close>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<copyTo>(FOLDER, OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<directory>
+
+=over 4
+
+See L<Mail::Box::Dir/"The folder">
+
+=back
+
+$obj-E<gt>B<folderdir>([DIRECTORY])
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+Mail::Box::MH-E<gt>B<foundIn>([FOLDERNAME], OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<organization>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<type>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<update>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<url>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+=head2 Folder flags
+
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+$obj-E<gt>B<writable>
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+=head2 The messages
+
+
+$obj-E<gt>B<current>([NUMBER|MESSAGE|MESSAGE-ID])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<find>(MESSAGE-ID)
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<findFirstLabeled>(LABEL, [BOOLEAN, [ARRAY-OF-MSGS]])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<message>(INDEX [,MESSAGE])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messageId>(MESSAGE-ID [,MESSAGE])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messageIds>
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messages>(['ALL',RANGE,'ACTIVE','DELETED',LABEL,!LABEL,FILTER])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<scanForMessages>(MESSAGE, MESSAGE-IDS, TIMESPAN, WINDOW)
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+=head2 Sub-folders
+
+
+$obj-E<gt>B<listSubFolders>(OPTIONS)
+
+Mail::Box::MH-E<gt>B<listSubFolders>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+$obj-E<gt>B<nameOfSubFolder>(NAME)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+$obj-E<gt>B<openRelatedFolder>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+$obj-E<gt>B<openSubFolder>(NAME, OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<coerce>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<determineBodyType>(MESSAGE, HEAD)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<folderToDirectory>(FOLDERNAME, FOLDERDIR)
+
+=over 4
+
+See L<Mail::Box::Dir/"Internals">
+
+=back
+
+$obj-E<gt>B<highestMessageNumber>
+
+=over 4
+
+Returns the highest number which is used in the folder to store a file.
+This method may be called when the folder is read (then this number can
+be derived without file-system access), but also when the folder is not
+read (yet).
+
+=back
+
+$obj-E<gt>B<index>
+
+=over 4
+
+Create a index reader/writer object.
+
+=back
+
+$obj-E<gt>B<labels>
+
+=over 4
+
+Create a label reader/writer object.
+
+=back
+
+$obj-E<gt>B<lineSeparator>([STRING|'CR'|'LF'|'CRLF'])
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<locker>
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<read>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<readMessageFilenames>(DIRECTORY)
+
+=over 4
+
+See L<Mail::Box::Dir/"Internals">
+
+=back
+
+$obj-E<gt>B<readMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<storeMessage>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<toBeThreaded>(MESSAGES)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<toBeUnthreaded>(MESSAGES)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<updateMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<write>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<writeMessages>(OPTIONS)
+
+=over 4
+
+ Option    Defined in       Default   
+ messages  L<Mail::Box>     <required>
+ renumber                   <true>    
+
+. messages ARRAY
+
+. renumber BOOLEAN
+
+=over 4
+
+Permit renumbering of message.  By default this is true, but for some
+unknown reason, you may be thinking that messages should not be renumbered.
+
+=back
+
+=back
+
+=head2 Other methods
+
+
+$obj-E<gt>B<timespan2seconds>(TIME)
+
+Mail::Box::MH-E<gt>B<timespan2seconds>(TIME)
+
+=over 4
+
+See L<Mail::Box/"Other methods">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::MH-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::MH-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::MH-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Box/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot append message without lock on $folder.
+
+It is impossible to append one or more messages to the folder which is
+not opened, because locking it failes.  The folder may be in use by
+an other application, or you may need to specify some lock related
+options (see L<new()|Mail::Box::MH/"METHODS">).
+
+I<Error:> Cannot create MH folder $name: $!
+
+For some reason, it is impossible to create the folder.  Check the permissions
+and the name of the folder.  Does the path to the directory to be created
+exist?
+
+I<Error:> Cannot write folder $name without lock.
+
+It is impossible to get a lock on the folder, which means that the changes
+can not be made.  You may need to tune the lock related options which
+are available at folder creation.
+
+I<Warning:> Changes not written to read-only folder $self.
+
+You have opened the folder read-only --which is the default set
+by L<new(access)|Mail::Box/"Constructors">--, made modifications, and now want to close it.
+Set L<close(force)|Mail::Box/"The folder"> if you want to overrule the access mode, or close
+the folder with L<close(write)|Mail::Box/"The folder"> set to C<NEVER>.
+
+I<Error:> Copying failed for one message.
+
+For some reason, for instance disc full, removed by external process, or
+read-protection, it is impossible to copy one of the messages.  Copying will
+proceed for the other messages.
+
+I<Error:> Destination folder $name is not writable.
+
+The folder where the messages are copied to is not opened with write
+access (see L<new(access)|Mail::Box/"Constructors">).  This has no relation with write permission
+to the folder which is controled by your operating system.
+
+I<Warning:> Different messages with id $msgid.
+
+The message id is discovered more than once within the same folder, but the
+content of the message seems to be different.  This should not be possible:
+each message must be unique.
+
+I<Error:> Folder $name is opened read-only
+
+You can not write to this folder unless you have opened the folder to
+write or append with L<new(access)|Mail::Box/"Constructors">, or the C<force> option is set true.
+
+I<Error:> Folder $name not deleted: not writable.
+
+The folder must be opened with write access via L<new(access)|Mail::Box/"Constructors">, otherwise
+removing it will be refused.  So, you may have write-access according to
+the operating system, but that will not automatically mean that this
+C<delete> method permits you to.  The reverse remark is valid as well.
+
+I<Error:> Invalid timespan '$timespan' specified.
+
+The string does not follow the strict rules of the time span syntax which
+is permitted as parameter.
+
+I<Warning:> Message-id '$msgid' does not contain a domain.
+
+According to the RFCs, message-ids need to contain a unique random part,
+then an C<@>, and then a domain name.  This is made to avoid the creation
+of two messages with the same id.  The warning emerges when the C<@> is
+missing from the string.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Unable to create subfolder $name of $folder.
+
+The copy includes the subfolders, but for some reason it was not possible
+to copy one of these.  Copying will proceed for all other sub-folders.
+
+I<Error:> Unable to write message for $folder to $filename: $!
+
+The new message could not be written to its new file, for the specific
+reason.
+
+I<Error:> Writing folder $name failed
+
+For some reason (you probably got more error messages about this problem)
+it is impossible to write the folder, although you should because there
+were changes made.
+
+
+=head1 DETAILS
+
+
+=head2 How MH folders work
+
+MH-type folders use a directory to store the messages of one folder.  Each
+message is stored in a separate file.  This seems useful, because changes
+in a folder change only a few of these small files, in contrast with
+file-based folders where changes in a folder cause rewrites of huge
+folder files.
+
+However, MH-based folders perform very bad if you need header information
+of all messages.  For instance, if you want to have full knowledge about
+all message-threads (see L<Mail::Box::Thread::Manager|Mail::Box::Thread::Manager>) in the folder, it
+requires to read all header lines in all message files.  And usually, reading
+your messages in threads is desired.
+
+So, each message is written in a separate file.  The filenames are
+numbers, which count from C<1>.  Next to these message files, a
+directory may contain a file named C<.mh_sequences>, storing labels which
+relate to the messages.  Furthermore, a folder-directory may contain
+sub-directories, which are seen as sub-folders.
+
+=head2 This implementation
+
+This implementation supports the C<.mh-sequences> file and sub-folders.
+Next to this, considerable effort it made to avoid reading each message-file.
+This should boost performance of the MailBox distribution over other
+Perl-modules which are able to read folders.
+
+Folder types which store their messages each in one file, together in
+one directory, are bad for performance.  Consider that you want to know
+the subjects of all messages, while browser through a folder with your
+mail-reading client.  This would cause all message-files to be read.
+
+L<Mail::Box::MH|Mail::Box::MH> has two ways to try improve performance.  You can use
+an index-file, and use on delay-loading.  The combination performs even
+better.  Both are explained in the next sections.
+
+=head2 An index-file
+
+If you specify L<new(keep_index)|Mail::Box::MH/"METHODS">, then all header-lines of all messages
+from the folder which have been read once, will also be written into
+one dedicated index-file (one file per folder).  The default filename
+is C<.index>
+
+However, index-files are not supported by any other reader which supports
+MH (as far as I know).  If you read the folders with such I client, it
+will not cause unrecoverable conflicts with this index-file, but at most
+be bad for performance.
+
+If you do not (want to) use an index-file, then delay-loading may
+save your day.
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Maildir/Message.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Maildir/Message.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Maildir/Message.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,118 @@
+
+package Mail::Box::Maildir::Message;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box::Dir::Message';
+
+use strict;
+use File::Copy;
+use Carp;
+use warnings;
+
+
+sub filename(;$)
+{   my $self    = shift;
+    my $oldname = $self->SUPER::filename();
+    return $oldname unless @_;
+
+    my $newname = shift;
+    return $newname if defined $oldname && $oldname eq $newname;
+
+    my ($id, $semantics, $flags)
+     = $newname =~ m!(.*?)(?:\:([12])\,([A-Z]*))!
+     ? ($1, $2, $3)
+     : ($newname, '','');
+
+    my %flags;
+    $flags{$_}++ foreach split //, $flags;
+
+    $self->SUPER::label
+     ( draft   => ($flags{D} || 0)
+     , flagged => ($flags{F} || 0)
+     , replied => ($flags{R} || 0)
+     , seen    => ($flags{S} || 0)
+     , deleted => ($flags{T} || 0)
+     );
+
+    if(defined $oldname)
+    {   move $oldname, $newname
+           or confess "Cannot move $oldname to $newname: $!";
+    }
+
+    $self->SUPER::filename($newname);
+}
+
+#-------------------------------------------
+
+
+sub guessTimestamp()
+{   my $self = shift;
+    my $timestamp   = $self->SUPER::guessTimestamp;
+    return $timestamp if defined $timestamp;
+
+    $self->filename =~ m/^(\d+)/ ? $1 : undef;
+}
+
+#-------------------------------------------
+
+
+sub label(@)
+{   my $self   = shift;
+    return $self->SUPER::label unless @_;
+
+    my $return = $self->SUPER::label(@_);
+    $self->labelsToFilename;
+    $return;
+}
+
+#-------------------------------------------
+
+
+sub labelsToFilename()
+{   my $self   = shift;
+    my $labels = $self->labels;
+    my $old    = $self->filename;
+
+    my ($folderdir, $set, $oldname)
+      = $old =~ m!(.*)/(new|cur|tmp)/([^:]*)(\:[^:]*)?$!;
+
+    my $newflags    # alphabeticly ordered!
+      = ($labels->{draft}   ? 'D' : '')
+      . ($labels->{flagged} ? 'F' : '')
+      . ($labels->{replied} ? 'R' : '')
+      . ($labels->{seen}    ? 'S' : '')
+      . ($labels->{deleted} ? 'T' : '');
+
+    my $newset = $labels->{accepted} ? 'cur' : 'new';
+    if($set ne $newset)
+    {   my $folder = $self->folder;
+        $folder->modified(1) if defined $folder;
+    }
+
+    my $new = File::Spec->catfile($folderdir, $newset, "$oldname:2,$newflags");
+
+    if($new ne $old)
+    {   unless(move $old, $new)
+        {   warn "Cannot rename $old to $new: $!";
+            return;
+        }
+        $self->log(PROGRESS => "Moved $old to $new.");
+        $self->SUPER::filename($new);
+    }
+
+    $new;
+}
+
+#-------------------------------------------
+
+
+sub accept(;$)
+{   my $self   = shift;
+    my $accept = @_ ? shift : 1;
+    $self->label(accepted => $accept);
+}
+
+#-------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Maildir/Message.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Maildir/Message.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Maildir/Message.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,1013 @@
+
+=head1 NAME
+
+Mail::Box::Maildir::Message - one message in a Maildir folder
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Maildir::Message
+   is a Mail::Box::Dir::Message
+   is a Mail::Box::Message
+   is a Mail::Message
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my $folder = new Mail::Box::Maildir ...
+ my $message = $folder->message(10);
+
+
+=head1 DESCRIPTION
+
+A C<Mail::Box::Maildir::Message> represents one message in an
+L<Mail::Box::Maildir|Mail::Box::Maildir> folder. Each message is stored in a separate file.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message/"Constructors">
+
+=back
+
+Mail::Box::Maildir::Message-E<gt>B<coerce>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box::Message/"METHODS">
+
+=back
+
+Mail::Box::Maildir::Message-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box::Dir::Message/"METHODS">
+
+=back
+
+=head2 Constructing a message
+
+
+$obj-E<gt>B<bounce>([RG-OBJECT|OPTIONS])
+
+=over 4
+
+See L<Mail::Message::Construct::Bounce/"Constructing a message">
+
+=back
+
+Mail::Box::Maildir::Message-E<gt>B<build>([MESSAGE|BODY], CONTENT)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+Mail::Box::Maildir::Message-E<gt>B<buildFromBody>(BODY, [HEAD], HEADERS)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forward>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardAttach>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardEncapsulate>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardInline>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardNo>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPostlude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPrelude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardSubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+Mail::Box::Maildir::Message-E<gt>B<read>(FILEHANDLE|SCALAR|REF-SCALAR|ARRAY-OF-LINES, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Read/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<rebuild>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<reply>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replyPrelude>([STRING|FIELD|ADDRESS|ARRAY-OF-THINGS])
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replySubject>(STRING)
+
+Mail::Box::Maildir::Message-E<gt>B<replySubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+=head2 The Message
+
+
+$obj-E<gt>B<container>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isDummy>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isPart>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<messageId>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<send>([MAILER], OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<toplevel>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<write>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<bcc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<cc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<date>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<destinations>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<from>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<get>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<guessTimestamp>
+
+=over 4
+
+The filename of a C<Mail::Box::Maildir::Message> contains a timestamp.  This
+is a wild guess about the actual time of sending of the message: it is the
+time of receipt which may be seconds to hours off.  But is still a good
+guess...  When the message header is not parsed, then this date is used.
+
+=back
+
+$obj-E<gt>B<head>([HEAD])
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<sender>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<study>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<subject>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<timestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<to>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+=head2 The body
+
+
+$obj-E<gt>B<body>([BODY])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<decoded>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<encode>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isNested>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<parts>(['ALL'|'ACTIVE'|'DELETED'|'RECURSE'|FILTER])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+=head2 Flags
+
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<deleted>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isDeleted>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<label>(LABEL|PAIRS)
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<labels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<labelsToStatus>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<statusToLabels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+=head2 The whole message as text
+
+
+$obj-E<gt>B<file>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<lines>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<printStructure>([FILEHANDLE][, INDENT])
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+=head2 The message
+
+
+$obj-E<gt>B<copyTo>(FOLDER)
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<filename>([FILENAME])
+
+=over 4
+
+Returns the current filename for this message.  If the FILENAME argument
+is specified, a new filename will be set.  For maildir messages this
+means that modifications are immediately performed: there will be
+a rename (move) from the old name to the new name.  Labels may change
+within in the message object as well.
+
+=back
+
+$obj-E<gt>B<folder>([FOLDER])
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<moveTo>(FOLDER)
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<seqnr>([INTEGER])
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+=head2 Labels
+
+
+$obj-E<gt>B<labelsToFilename>
+
+=over 4
+
+When the labels on a message change, this may implicate a change in
+the message's filename.  The change will take place immediately.  The
+new filename (which may be the same as the old filename) is returned.
+C<undef> is returned when the rename is required but fails.
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<accept>([BOOLEAN])
+
+=over 4
+
+Accept a message for the folder.  This will move it from the C<new>
+or C<tmp> sub-directories into the C<cur> sub-directory (or back when
+the BOOLEAN is C<false>).  When you accept an already accepted message,
+nothing will happen.
+
+=back
+
+$obj-E<gt>B<create>(FILENAME)
+
+=over 4
+
+See L<Mail::Box::Dir::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<diskDelete>
+
+=over 4
+
+See L<Mail::Box::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<loadBody>
+
+=over 4
+
+See L<Mail::Box::Dir::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<loadHead>
+
+=over 4
+
+See L<Mail::Box::Dir::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<parser>
+
+=over 4
+
+See L<Mail::Box::Dir::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readBody>(PARSER, HEAD [, BODYTYPE])
+
+=over 4
+
+See L<Mail::Box::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readFromParser>(PARSER, [BODYTYPE])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readHead>(PARSER [,CLASS])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<recursiveRebuildPart>(PART, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Internals">
+
+=back
+
+$obj-E<gt>B<storeBody>(BODY)
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<takeMessageId>([STRING])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Message::Construct/"METHODS">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Maildir::Message-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Maildir::Message-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Maildir::Message-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortSize>([VALUE])
+
+Mail::Box::Maildir::Message-E<gt>B<shortSize>([VALUE])
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortString>
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<destruct>
+
+=over 4
+
+See L<Mail::Box::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot create parser for $filename.
+
+For some reason (the previous message have told you already) it was not possible
+to create a message parser for the specified filename.
+
+I<Error:> Cannot include forward source as $include.
+
+Unknown alternative for the L<forward(include)|Mail::Message::Construct::Forward/"Constructing a message">.  Valid choices are
+C<NO>, C<INLINE>, C<ATTACH>, and C<ENCAPSULATE>.
+
+I<Error:> Cannot include reply source as $include.
+
+Unknown alternative for the C<include> option of L<reply()|Mail::Message::Construct::Reply/"Constructing a message">.  Valid
+choices are C<NO>, C<INLINE>, and C<ATTACH>.
+
+I<Error:> Cannot write message to $filename: $!
+
+When a modified or new message is written to disk, it is first written
+to a temporary file in the folder directory.  For some reason, it is
+impossible to create this file.
+
+I<Error:> Failed to move $new to $filename: $!
+
+When a modified or new message is written to disk, it is first written
+to a temporary file in the folder directory.  Then, the new file is
+moved to replace the existing file.  Apparently, the latter fails.
+
+I<Error:> No address to create forwarded to.
+
+If a forward message is created, a destination address must be specified.
+
+I<Error:> No default mailer found to send message.
+
+The message L<send()|Mail::Message/"The Message"> mechanism had not enough information to automatically
+find a mail transfer agent to sent this message.  Specify a mailer
+explicitly using the C<via> options.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Unable to read delayed body.
+
+For some reason, the header of the message could be read, but the body
+cannot.  Probably the file has disappeared or the permissions were
+changed during the progress of the program.
+
+I<Error:> Unable to read delayed head.
+
+Mail::Box tries to be I<lazy> with respect to parsing messages.  When a
+directory organized folder is opened, only the filenames of messages are
+collected.  At first use, the messages are read from their file.  Apperently,
+a message is used for the first time here, but has disappeared or is
+unreadible for some other reason.
+
+I<Error:> forwardAttach requires a preamble object
+
+
+I<Error:> forwardEncapsulate requires a preamble object
+
+
+I<Error:> no rebuild rule $name defined.
+
+
+
+=head1 DETAILS
+
+
+=head2 Labels
+
+
+=head3 Flags in filename
+
+When new messages arrive on system and have to be stored in a maildir folder,
+they are put in the C<new> sub-directory of the folder (first created in
+the C<tmp> sub-directory and then immediately moved to C<new>).
+The following information was found at L<http://cr.yp.to/proto/maildir.html>.
+
+Each message is written in a separate file.  The filename is
+constructed from the time-of-arrival, a hostname, an unique component,
+a syntax marker, and flags. For example C<1014220791.meteor.42:2,DF>.
+The filename must match:
+
+ my ($time, $unique, $hostname, $info)
+    = $filename =~ m!^(\d+)\.(.*)\.(\w+)(\:.*)?$!;
+ my ($semantics, $flags)
+    = $info =~ m!([12])\,([RSTDF]+)$!;
+ my @flags = split //, $flags;
+
+When an application opens the folder, there may be messages in C<new>
+which are new arival, and messages in C<cur>.  The latter are labeled
+C<accepted>.  To move a message from C<new> to C<cur>, you have two
+options with the same effect:
+
+  $msg->accept;
+  $msg->label(accept => 1);
+
+See L<accept()|Mail::Box::Maildir::Message/"Internals">, L<label()|Mail::Message/"Flags">, L<Mail::Box::Maildir::new(accept_new)|Mail::Box::Maildir/"METHODS">,
+and L<Mail::Box::Maildir::acceptMessages()|Mail::Box::Maildir/"Internals">
+
+The messages are moved, and their name is immediately
+extended with flags.  An example:
+
+ new/897979431.meteor.42      may become
+ cur/897979431.meteor.42:2,FS
+
+The added characters C<':2,'> refer to the "second state of processing",
+where the message has been inspected.  And the characters (which should
+be in alphabetic order) mean
+
+ D      => draft
+ F      => flagged
+ R      => replied  (answered)
+ S      => seen
+ T      => deleted  (tagged for deletion)
+
+The flags will immediately change when L<label()|Mail::Message/"Flags"> or L<delete()|Mail::Message/"Flags"> is used,
+which differs from other message implementations: maildir is stateless,
+and should not break when applications crash.
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Maildir.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Maildir.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Maildir.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,389 @@
+
+use strict;
+package Mail::Box::Maildir;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box::Dir';
+
+use Mail::Box::Maildir::Message;
+
+use Carp;
+use File::Copy;
+use File::Basename 'basename';
+use Sys::Hostname;
+
+# Maildir is only supported on UNIX, because the filenames probably
+# do not work on other platforms.  Since MailBox 2.052, the use of
+# File::Spec to create filenames has been removed: benchmarks showed
+# that catfile() consumed 20% of the time of a folder open().  And
+# '/' file separators work on Windows too!
+
+
+my $default_folder_dir = exists $ENV{HOME} ? "$ENV{HOME}/.maildir" : '.';
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    croak "No locking possible for maildir folders."
+       if exists $args->{locker}
+       || (defined $args->{lock_type} && $args->{lock_type} ne 'NONE');
+
+    $args->{lock_type}   = 'NONE';
+    $args->{folderdir} ||= $default_folder_dir;
+
+    return undef
+        unless $self->SUPER::init($args);
+
+    $self->acceptMessages if $args->{accept_new};
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub create($@)
+{   my ($thingy, $name, %args) = @_;
+    my $class     = ref $thingy      || $thingy;
+    my $folderdir = $args{folderdir} || $default_folder_dir;
+    my $directory = $class->folderToDirectory($name, $folderdir);
+
+    if($class->createDirs($directory))
+    {   $class->log(PROGRESS => "Created folder Maildir $name.");
+        return $class;
+    }
+    else
+    {   $class->log(ERROR => "Cannot create Maildir folder $name.");
+        return undef;
+    }
+}
+
+#-------------------------------------------
+
+sub foundIn($@)
+{   my $class = shift;
+    my $name  = @_ % 2 ? shift : undef;
+    my %args  = @_;
+    my $folderdir = $args{folderdir} || $default_folder_dir;
+    my $directory = $class->folderToDirectory($name, $folderdir);
+
+    -d "$directory/cur";
+}
+
+#-------------------------------------------
+
+sub type() {'maildir'}
+
+#-------------------------------------------
+
+sub listSubFolders(@)
+{   my ($class, %args) = @_;
+    my $dir;
+
+    if(ref $class)
+    {   $dir   = $class->directory;
+        $class = ref $class;
+    }
+    else
+    {   my $folder    = $args{folder}    || '=';
+        my $folderdir = $args{folderdir} || $default_folder_dir;
+        $dir   = $class->folderToDirectory($folder, $folderdir);
+    }
+
+    $args{skip_empty} ||= 0;
+    $args{check}      ||= 0;
+
+    # Read the directories from the directory, to find all folders
+    # stored here.  Some directories have to be removed because they
+    # are created by all kinds of programs, but are no folders.
+
+    return () unless -d $dir && opendir DIR, $dir;
+
+    my @dirs;
+    while(my $d = readdir DIR)
+    {   next if $d =~ m/^(new|tmp|cur|\.\.?)$/;
+
+        my $dir = "$dir/$d";
+        push @dirs, $d if -d $dir && -r _;
+    }
+
+    closedir DIR;
+
+    # Skip empty folders.
+
+    @dirs = grep {!$class->folderIsEmpty("$dir/$_")} @dirs
+        if $args{skip_empty};
+
+    # Check if the files we want to return are really folders.
+
+    @dirs = map { m/(.*)/ && $1 } @dirs;  # untaint
+    return @dirs unless $args{check};
+
+    grep { $class->foundIn("$dir/$_") } @dirs;
+}
+
+#-------------------------------------------
+
+sub nameOfSubFolder($)
+{   my ($self, $name) = @_;
+    $self->directory.'/'.$name;
+}
+
+#-------------------------------------------
+
+sub openSubFolder($@)
+{   my ($self, $name) = (shift, shift);
+    $self->createDirs($self->nameOfSubFolder($name));
+    $self->SUPER::openSubFolder($name, @_);
+}
+
+#-------------------------------------------
+
+my $uniq = rand 1000;
+
+
+sub coerce($)
+{   my ($self, $message) = @_;
+
+    my $is_native = $message->isa('Mail::Box::Maildir::Message');
+    my $coerced   = $self->SUPER::coerce($message);
+
+    my $basename  = $is_native ? basename($message->filename)
+      : ($message->timestamp || time) .'.'. hostname .'.'. $uniq++;
+
+    my $dir = $self->directory;
+    my $tmp = "$dir/tmp/$basename";
+    my $new = "$dir/new/$basename";
+
+    if($coerced->create($tmp) && $coerced->create($new))
+         {$self->log(PROGRESS => "Added Maildir message in $new") }
+    else {$self->log(ERROR    => "Cannot create Maildir message file $new.") }
+
+    $coerced->labelsToFilename unless $is_native;
+    $coerced;
+}
+
+#-------------------------------------------
+
+
+sub createDirs($)
+{   my ($thing, $dir) = @_;
+
+    $thing->log(ERROR => "Cannot create Maildir folder directory $dir: $!\n"), return
+        unless -d $dir || mkdir $dir;
+
+    my $tmp = "$dir/tmp";
+    $thing->log(ERROR => "Cannot create Maildir folder subdir $tmp: $!\n"), return
+        unless -d $tmp || mkdir $tmp;
+
+    my $new = "$dir/new";
+    $thing->log(ERROR => "Cannot create Maildir folder subdir $new: $!\n"), return
+        unless -d $new || mkdir $new;
+
+    my $cur = "$dir/cur";
+    $thing->log(ERROR =>  "Cannot create Maildir folder subdir $cur: $!\n"), return
+        unless -d $cur || mkdir $cur;
+
+    $thing;
+}
+
+#-------------------------------------------
+
+
+sub folderIsEmpty($)
+{   my ($self, $dir) = @_;
+    return 1 unless -d $dir;
+
+    foreach (qw/tmp new cur/)
+    {   my $subdir = "$dir/$_";
+        next unless -d $subdir;
+
+        opendir DIR, $subdir or return 0;
+        my $first  = readdir DIR;
+        closedir DIR;
+
+        return 0 if defined $first;
+    }
+
+    opendir DIR, $dir or return 1;
+    while(my $entry = readdir DIR)
+    {   next if $entry =~
+           m/^(?:tmp|cur|new|bulletin(?:time|lock)|seriallock|\..?)$/;
+
+        closedir DIR;
+        return 0;
+    }
+
+    closedir DIR;
+    1;
+}
+
+#-------------------------------------------
+
+sub readMessageFilenames
+{   my ($self, $dirname) = @_;
+
+    opendir DIR, $dirname or return ();
+
+    # unsorted list of untainted filenames.
+    my @files = map { /^(\d[\w.:,=\-]+)$/
+                      && -f "$dirname/$1" ? $1 : () }
+                   readdir DIR;
+    closedir DIR;
+
+    # Sort the names.  Solve the Y2K (actually the 1 billion seconds
+    # since 1970 bug) which hunts Maildir.  The timestamp, which is
+    # the start of the filename will have some 0's in front, so each
+    # timestamp has the same length.
+
+    my %unified;
+    m/^(\d+)/ and $unified{ ('0' x (9-length($1))).$_ } = $_ foreach @files;
+
+    map { "$dirname/$unified{$_}" }
+        sort keys %unified;
+}
+
+#-------------------------------------------
+
+sub readMessages(@)
+{   my ($self, %args) = @_;
+
+    my $directory = $self->directory;
+    return unless -d $directory;
+
+    #
+    # Read all messages
+    #
+
+    my $curdir  = "$directory/cur";
+    my @cur     = map { [$_, 1] } $self->readMessageFilenames($curdir);
+
+    my $newdir  = "$directory/new";
+    my @new     = map { [$_, 0] } $self->readMessageFilenames($newdir);
+    my @log     = $self->logSettings;
+
+    foreach (@cur, @new)
+    {   my ($filename, $accepted) = @$_;
+        my $message = $args{message_type}->new
+         ( head      => $args{head_delayed_type}->new(@log)
+         , filename  => $filename
+         , folder    => $self
+         , fix_header=> $self->{MB_fix_headers}
+         , labels    => [ accepted => $accepted ]
+         );
+
+        my $body    = $args{body_delayed_type}->new(@log, message => $message);
+        $message->storeBody($body) if $body;
+        $self->storeMessage($message);
+    }
+
+    $self;
+}
+ 
+#-------------------------------------------
+
+
+sub acceptMessages($)
+{   my ($self, %args) = @_;
+    my @accept = $self->messages('!accepted');
+    $_->accept foreach @accept;
+    @accept;
+}
+
+#-------------------------------------------
+
+sub writeMessages($)
+{   my ($self, $args) = @_;
+
+    # Write each message.  Two things complicate life:
+    #   1 - we may have a huge folder, which should not be on disk twice
+    #   2 - we may have to replace a message, but it is unacceptable
+    #       to remove the original before we are sure that the new version
+    #       is on disk.
+
+    my $writer    = 0;
+
+    my $directory = $self->directory;
+    my @messages  = @{$args->{messages}};
+
+    my $tmpdir    = "$directory/tmp";
+    die "Cannot create directory $tmpdir: $!"
+        unless -d $tmpdir || mkdir $tmpdir;
+
+    foreach my $message (@messages)
+    {   next unless $message->isModified;
+
+        my $filename = $message->filename;
+        my $basename = basename $filename;
+
+        my $newtmp   = "$directory/tmp/$basename";
+        open my $new, '>', $newtmp
+           or croak "Cannot create file $newtmp: $!";
+
+        $message->write($new);
+        close $new;
+
+        unlink $filename;
+        move $newtmp, $filename
+            or warn "Cannot move $newtmp to $filename: $!\n";
+    }
+
+    # Remove an empty folder.  This is done last, because the code before
+    # in this method will have cleared the contents of the directory.
+
+    if(!@messages && $self->{MB_remove_empty})
+    {   # If something is still in the directory, this will fail, but I
+        # don't mind.
+        rmdir "$directory/cur";
+        rmdir "$directory/tmp";
+        rmdir "$directory/new";
+        rmdir $directory;
+    }
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub appendMessages(@)
+{   my $class  = shift;
+    my %args   = @_;
+
+    my @messages = exists $args{message}  ?   $args{message}
+                 : exists $args{messages} ? @{$args{messages}}
+                 : return ();
+
+    my $self     = $class->new(@_, access => 'a');
+    my $directory= $self->directory;
+    return unless -d $directory;
+
+    my $tmpdir   = "$directory/tmp";
+    croak "Cannot create directory $tmpdir: $!", return
+        unless -d $tmpdir || mkdir $tmpdir;
+
+    foreach my $message (@messages)
+    {   my $is_native = $message->isa('Mail::Box::Maildir::Message');
+        my $coerced   = $self->SUPER::coerce($message);
+
+        my $basename  = $is_native ? basename($message->filename)
+         : ($message->timestamp || time) .'.'. hostname .'.'. $uniq++;
+
+       my $dir = $self->directory;
+       my $tmp = "$dir/tmp/$basename";
+       my $new = "$dir/new/$basename";
+
+       if($coerced->create($tmp) && $coerced->create($new))
+            {$self->log(PROGRESS => "Appended Maildir message in $new") }
+       else {$self->log(ERROR    =>
+                "Cannot append Maildir message in $new to folder $self.") }
+    }
+ 
+    $self->close;
+
+    @messages;
+}
+
+#-------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Maildir.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Maildir.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Maildir.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,863 @@
+
+=head1 NAME
+
+Mail::Box::Maildir - handle Maildir folders
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Maildir
+   is a Mail::Box::Dir
+   is a Mail::Box
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ use Mail::Box::Maildir;
+ my $folder = new Mail::Box::Maildir folder => $ENV{MAIL}, ...;
+
+
+=head1 DESCRIPTION
+
+This documentation describes how Maildir mailboxes work, and what you
+can do with the Maildir folder object C<Mail::Box::Maildir>.
+
+Maildir is B<not supported for Windows>, because it create filenames
+which are not accepted by the Windows system.
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+overload: B<@{}>
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+overload: B<cmp>
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<create>(FOLDERNAME, OPTIONS)
+
+Mail::Box::Maildir-E<gt>B<create>(FOLDERNAME, OPTIONS)
+
+=over 4
+
+ Option     Defined in    Default
+ folderdir  L<Mail::Box>  undef  
+
+. folderdir DIRECTORY
+
+=back
+
+Mail::Box::Maildir-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option             Defined in       Default                                                         
+ accept_new                          <false>                                                         
+ access             L<Mail::Box>     C<'r'>                                                          
+ body_delayed_type  L<Mail::Box>     L<Mail::Message::Body::Delayed|Mail::Message::Body::Delayed>    
+ body_type          L<Mail::Box>     L<Mail::Message::Body::Lines|Mail::Message::Body::Lines>        
+ coerce_options     L<Mail::Box>     C<[]>                                                           
+ create             L<Mail::Box>     <false>                                                         
+ extract            L<Mail::Box>     C<10240>                                                        
+ field_type         L<Mail::Box>     undef                                                           
+ fix_headers        L<Mail::Box>     <false>                                                         
+ folder             L<Mail::Box>     C<$ENV{MAIL}>                                                   
+ folderdir          L<Mail::Box>     C<$ENV{HOME}/.maildir>                                          
+ head_delayed_type  L<Mail::Box>     L<Mail::Message::Head::Delayed|Mail::Message::Head::Delayed>    
+ head_type          L<Mail::Box>     L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>  
+ keep_dups          L<Mail::Box>     <false>                                                         
+ lock_file          L<Mail::Box>     <not used>                                                      
+ lock_timeout       L<Mail::Box>     <not used>                                                      
+ lock_type          L<Mail::Box>     C<'NONE'> (constant)                                            
+ lock_wait          L<Mail::Box>     <not used>                                                      
+ locker             L<Mail::Box>     undef                                                           
+ log                L<Mail::Reporter>  C<'WARNINGS'>                                                   
+ manager            L<Mail::Box>     undef                                                           
+ message_type       L<Mail::Box>     L<Mail::Box::Message|Mail::Box::Message>                        
+ multipart_type     L<Mail::Box>     L<Mail::Message::Body::Multipart|Mail::Message::Body::Multipart>
+ remove_when_empty  L<Mail::Box>     <true>                                                          
+ save_on_exit       L<Mail::Box>     <true>                                                          
+ trace              L<Mail::Reporter>  C<'WARNINGS'>                                                   
+ trusted            L<Mail::Box>     <depends on folder location>                                    
+
+. accept_new BOOLEAN
+
+=over 4
+
+When the folder is open, some messages may be stored in the C<new>
+sub-directory.  By default, these messages are immediately moved to
+the C<cur> directory when the folder is opened.  Otherwise, you have
+to call L<acceptMessages()|Mail::Box::Maildir/"Internals"> or L<Mail::Box::Maildir::Message::accept()|Mail::Box::Maildir::Message/"Internals">.
+
+=back
+
+. access MODE
+
+. body_delayed_type CLASS
+
+. body_type CLASS|CODE
+
+. coerce_options ARRAY
+
+. create BOOLEAN
+
+. extract INTEGER | CODE | METHOD | 'LAZY'|'ALWAYS'
+
+. field_type CLASS
+
+. fix_headers BOOLEAN
+
+. folder FOLDERNAME
+
+. folderdir DIRECTORY
+
+. head_delayed_type CLASS
+
+. head_type CLASS
+
+. keep_dups BOOLEAN
+
+. lock_file FILENAME
+
+. lock_timeout SECONDS
+
+. lock_type CLASS|STRING|ARRAY
+
+. lock_wait SECONDS
+
+. locker OBJECT
+
+. log LEVEL
+
+. manager MANAGER
+
+. message_type CLASS
+
+. multipart_type CLASS
+
+. remove_when_empty BOOLEAN
+
+. save_on_exit BOOLEAN
+
+. trace LEVEL
+
+. trusted BOOLEAN
+
+=back
+
+=head2 The folder
+
+
+$obj-E<gt>B<addMessage>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<addMessages>(MESSAGE [, MESSAGE, ...])
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+Mail::Box::Maildir-E<gt>B<appendMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<close>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<copyTo>(FOLDER, OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<directory>
+
+=over 4
+
+See L<Mail::Box::Dir/"The folder">
+
+=back
+
+$obj-E<gt>B<folderdir>([DIRECTORY])
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+Mail::Box::Maildir-E<gt>B<foundIn>([FOLDERNAME], OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<organization>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<type>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<update>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<url>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+=head2 Folder flags
+
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+$obj-E<gt>B<writable>
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+=head2 The messages
+
+
+$obj-E<gt>B<current>([NUMBER|MESSAGE|MESSAGE-ID])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<find>(MESSAGE-ID)
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<findFirstLabeled>(LABEL, [BOOLEAN, [ARRAY-OF-MSGS]])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<message>(INDEX [,MESSAGE])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messageId>(MESSAGE-ID [,MESSAGE])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messageIds>
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messages>(['ALL',RANGE,'ACTIVE','DELETED',LABEL,!LABEL,FILTER])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<scanForMessages>(MESSAGE, MESSAGE-IDS, TIMESPAN, WINDOW)
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+=head2 Sub-folders
+
+
+$obj-E<gt>B<listSubFolders>(OPTIONS)
+
+Mail::Box::Maildir-E<gt>B<listSubFolders>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+$obj-E<gt>B<nameOfSubFolder>(NAME)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+$obj-E<gt>B<openRelatedFolder>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+$obj-E<gt>B<openSubFolder>(NAME, OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<acceptMessages>
+
+=over 4
+
+Accept all messages which are waiting in the C<new> directory to be
+moved to the C<cur> directory.  This will not rescan the directory
+for newly arrived messages, because that's a task for L<update()|Mail::Box/"The folder">.
+
+=back
+
+Mail::Box::Maildir-E<gt>B<appendMessage>(OPTIONS)
+
+=over 4
+
+=back
+
+$obj-E<gt>B<coerce>(MESSAGE)
+
+=over 4
+
+=back
+
+$obj-E<gt>B<createDirs>(FOLDERDIR)
+
+Mail::Box::Maildir-E<gt>B<createDirs>(FOLDERDIR)
+
+=over 4
+
+The FOLDERDIR contains the absolute path of the location where the
+messages are kept.  Maildir folders contain a C<tmp>, C<new>, and
+C<cur> sub-directory within that folder directory as well.  This
+method will ensure that all directories exist.
+Returns false on failure.
+
+=back
+
+$obj-E<gt>B<determineBodyType>(MESSAGE, HEAD)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<folderIsEmpty>(FOLDERDIR)
+
+Mail::Box::Maildir-E<gt>B<folderIsEmpty>(FOLDERDIR)
+
+=over 4
+
+Checks whether the folder whose directory is specified as absolute FOLDERDIR
+is empty or not.  A folder is empty when the C<tmp>, C<new>, and C<cur>
+subdirectories are empty and some files which are left there by application
+programs.  The maildir spec explicitly states: C<.qmail>, C<bulletintime>,
+C<bulletinlock> and C<seriallock>.  If any other files are found, the
+directory is considered not-empty.
+
+=back
+
+$obj-E<gt>B<folderToDirectory>(FOLDERNAME, FOLDERDIR)
+
+=over 4
+
+See L<Mail::Box::Dir/"Internals">
+
+=back
+
+$obj-E<gt>B<lineSeparator>([STRING|'CR'|'LF'|'CRLF'])
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<locker>
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<read>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<readMessageFilenames>(DIRECTORY)
+
+=over 4
+
+See L<Mail::Box::Dir/"Internals">
+
+=back
+
+$obj-E<gt>B<readMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<storeMessage>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<toBeThreaded>(MESSAGES)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<toBeUnthreaded>(MESSAGES)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<updateMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<write>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<writeMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+=head2 Other methods
+
+
+$obj-E<gt>B<timespan2seconds>(TIME)
+
+Mail::Box::Maildir-E<gt>B<timespan2seconds>(TIME)
+
+=over 4
+
+See L<Mail::Box/"Other methods">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Maildir-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Maildir-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Maildir-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Box/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot append Maildir message in $new to folder $self.
+
+The message (or messages) could not be stored in the right directories
+for the Maildir folder.
+
+I<Error:> Cannot create Maildir directory $dir: $!
+
+A Maildir folder is represented by a directory, with some sub-directories.  The
+top folder directory could not be created for the reason indicated.
+
+I<Error:> Cannot create Maildir folder $name.
+
+One or more of the directories required to administer a Maildir folder
+could not be created.
+
+I<Error:> Cannot create Maildir message file $new.
+
+A message is converted from some other message format into a Maildir format
+by writing it to a file with a name which contains the status flags of the
+message.  Apparently, creating this file failed.
+
+I<Error:> Cannot create Maildir subdir $dir: $!
+
+Each Maildir folder has three sub-directories for administration: C<new>,
+C<tmp>, and C<cur>.  The mentioned directory could not be created for
+the indicated reason.
+
+I<Warning:> Changes not written to read-only folder $self.
+
+You have opened the folder read-only --which is the default set
+by L<new(access)|Mail::Box/"Constructors">--, made modifications, and now want to close it.
+Set L<close(force)|Mail::Box/"The folder"> if you want to overrule the access mode, or close
+the folder with L<close(write)|Mail::Box/"The folder"> set to C<NEVER>.
+
+I<Error:> Copying failed for one message.
+
+For some reason, for instance disc full, removed by external process, or
+read-protection, it is impossible to copy one of the messages.  Copying will
+proceed for the other messages.
+
+I<Error:> Destination folder $name is not writable.
+
+The folder where the messages are copied to is not opened with write
+access (see L<new(access)|Mail::Box/"Constructors">).  This has no relation with write permission
+to the folder which is controled by your operating system.
+
+I<Warning:> Different messages with id $msgid.
+
+The message id is discovered more than once within the same folder, but the
+content of the message seems to be different.  This should not be possible:
+each message must be unique.
+
+I<Error:> Folder $name is opened read-only
+
+You can not write to this folder unless you have opened the folder to
+write or append with L<new(access)|Mail::Box/"Constructors">, or the C<force> option is set true.
+
+I<Error:> Folder $name not deleted: not writable.
+
+The folder must be opened with write access via L<new(access)|Mail::Box/"Constructors">, otherwise
+removing it will be refused.  So, you may have write-access according to
+the operating system, but that will not automatically mean that this
+C<delete> method permits you to.  The reverse remark is valid as well.
+
+I<Error:> Invalid timespan '$timespan' specified.
+
+The string does not follow the strict rules of the time span syntax which
+is permitted as parameter.
+
+I<Warning:> Message-id '$msgid' does not contain a domain.
+
+According to the RFCs, message-ids need to contain a unique random part,
+then an C<@>, and then a domain name.  This is made to avoid the creation
+of two messages with the same id.  The warning emerges when the C<@> is
+missing from the string.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Unable to create subfolder $name of $folder.
+
+The copy includes the subfolders, but for some reason it was not possible
+to copy one of these.  Copying will proceed for all other sub-folders.
+
+I<Error:> Writing folder $name failed
+
+For some reason (you probably got more error messages about this problem)
+it is impossible to write the folder, although you should because there
+were changes made.
+
+
+=head1 DETAILS
+
+The explanation is complicated, but for normal use you should bother
+yourself with all details.
+
+=head2 How MAILDIR folders work
+
+Maildir-type folders use a directory to store the messages of one folder.
+Each message is stored in a separate file.  This seems useful, because
+changes in a folder change only a few of these small files, in contrast with
+file-based folders where changes in a folder cause rewrites of huge
+folder-files.
+
+However, Maildir based folders perform very bad if you need header information
+of all messages.  For instance, if you want to have full knowledge about
+all message-threads (see L<Mail::Box::Thread::Manager|Mail::Box::Thread::Manager>) in the folder, it
+requires to read all header lines in all message files.  And usually, reading
+your messages as threads is desired.  Maildir maintains a tiny amount
+of info visible in the filename, which may make it perform just a little
+bit faster than MH.
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Manager.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Manager.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Manager.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,506 @@
+use strict;
+use warnings;
+
+package Mail::Box::Manager;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Reporter';
+
+use Mail::Box;
+
+use Carp;
+use List::Util   'first';
+use Scalar::Util 'weaken';
+
+#-------------------------------------------
+
+
+my @basic_folder_types =
+  ( [ mbox    => 'Mail::Box::Mbox'    ]
+  , [ mh      => 'Mail::Box::MH'      ]
+  , [ maildir => 'Mail::Box::Maildir' ]
+  , [ pop     => 'Mail::Box::POP3'    ]
+  , [ pop3    => 'Mail::Box::POP3'    ]
+  );
+
+my @managers;  # usually only one, but there may be more around :(
+
+sub init($)
+{   my ($self, $args) = @_;
+    $self->SUPER::init($args);
+
+    # Register all folder-types.  There may be some added later.
+
+    my @new_types;
+    if(exists $args->{folder_types})
+    {   @new_types = ref $args->{folder_types}[0]
+                   ? @{$args->{folder_types}}
+                   : $args->{folder_types};
+    }
+
+    my @basic_types = reverse @basic_folder_types;
+    if(my $basic = $args->{autodetect})
+    {   my %types = map { ( $_ => 1) } (ref $basic ? @$basic : ($basic));
+        @basic_types = grep { $types{$_->[0]} } @basic_types;
+    }
+
+    $self->{MBM_folder_types} = [];
+    $self->registerType(@$_) foreach @new_types, @basic_types;
+
+    $self->{MBM_default_type} = $args->{default_folder_type};
+
+    # Inventory on existing folder-directories.
+
+    $self->{MBM_folderdirs} = [ '.' ];
+    if(exists $args->{folderdir})
+    {   my @dirs = $args->{folderdir};
+        @dirs = @{$dirs[0]} if ref $dirs[0];
+        push @{$self->{MBM_folderdirs}}, @dirs;
+    }
+
+    if(exists $args->{folderdirs})
+    {   my @dirs = $args->{folderdirs};
+        @dirs = @{$dirs[0]} if ref $dirs[0];
+        push @{$self->{MBM_folderdirs}}, @dirs;
+    }
+
+    $self->{MBM_folders} = [];
+    $self->{MBM_threads} = [];
+
+    push @managers, $self;
+    weaken $managers[-1];
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub registerType($$@)
+{   my ($self, $name, $class, @options) = @_;
+    unshift @{$self->{MBM_folder_types}}, [$name, $class, @options];
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub folderTypes()
+{   my $self = shift;
+    my %uniq;
+    $uniq{$_->[0]}++ foreach @{$self->{MBM_folder_types}};
+    sort keys %uniq;
+}
+
+
+#-------------------------------------------
+
+
+sub open(@)
+{   my $self = shift;
+    my $name = @_ % 2 ? shift : undef;
+    my %args = @_;
+
+    $name    = defined $args{folder} ? $args{folder} : $ENV{MAIL}
+        unless defined $name;
+
+    unless(defined $name)
+    {   $self->log(ERROR => "Don't know which folder I should open: no name.");
+        return undef;
+    }
+      
+    if($name =~ m/^(\w+)\:/ && grep { $_ eq $1 } $self->folderTypes)
+    {   # Complicated folder URL
+        my %decoded = $self->decodeFolderURL($name);
+        if(keys %decoded)
+        {   # accept decoded info
+            @args{keys %decoded} = values %decoded;
+        }
+        else
+        {   $self->log(ERROR => "Illegal folder URL '$name'.");
+            return;
+        }
+    }
+    else
+    {   # Simple folder name
+        $args{folder} = $name;
+    }
+
+    unless(defined $name && length $name)
+    {   $self->log(ERROR => "No foldername specified to open.\n");
+        return undef;
+    }
+        
+    $args{folderdir} ||= $self->{MBM_folderdirs}->[0]
+        if $self->{MBM_folderdirs};
+
+    $args{access} ||= 'r';
+
+    if($args{create} && $args{access} !~ m/w|a/)
+    {   $self->log(WARNING
+           => "Will never create a folder $name without having write access.");
+        undef $args{create};
+    }
+
+    # Do not open twice.
+    if(my $folder = $self->isOpenFolder($name))
+    {   $self->log(WARNING => "Folder $name is already open.\n");
+        return undef;
+    }
+
+    #
+    # Which folder type do we need?
+    #
+
+    my ($folder_type, $class, @defaults);
+    if(my $type = $args{type})
+    {   # User-specified foldertype prevails.
+        foreach (@{$self->{MBM_folder_types}})
+        {   (my $abbrev, $class, @defaults) = @$_;
+
+            if($type eq $abbrev || $type eq $class)
+            {   $folder_type = $abbrev;
+                last;
+            }
+        }
+
+        $self->log(ERROR => "Folder type $type is unknown, using autodetect.")
+            unless $folder_type;
+    }
+
+    unless($folder_type)
+    {   # Try to autodetect foldertype.
+        foreach (@{$self->{MBM_folder_types}})
+        {   (my $abbrev, $class, @defaults) = @$_;
+
+            eval("require $class");
+            next if $@;
+
+            if($class->foundIn($name, @defaults, %args))
+            {   $folder_type = $abbrev;
+                last;
+            }
+        }
+     }
+
+    unless($folder_type)
+    {   # Use specified default
+        if(my $type = $self->{MBM_default_type})
+        {   foreach (@{$self->{MBM_folder_types}})
+            {   (my $abbrev, $class, @defaults) = @$_;
+                if($type eq $abbrev || $type eq $class)
+                {   $folder_type = $abbrev;
+                    last;
+                }
+            }
+        }
+    }
+
+    unless($folder_type)
+    {   # use first type (last defined)
+        ($folder_type, $class, @defaults) = @{$self->{MBM_folder_types}[0]};
+    }
+    
+    #
+    # Try to open the folder
+    #
+
+    eval "require $class";
+    croak $@ if $@;
+
+    push @defaults, manager => $self;
+    my $folder = $class->new(@defaults, %args);
+
+    unless(defined $folder)
+    {   $self->log(WARNING =>"Folder does not exist, failed opening $folder_type folder $name.");
+        return;
+    }
+
+    $self->log(PROGRESS => "Opened folder $name ($folder_type).");
+    push @{$self->{MBM_folders}}, $folder;
+    $folder;
+}
+
+#-------------------------------------------
+
+
+sub openFolders() { @{shift->{MBM_folders}} }
+
+#-------------------------------------------
+
+
+sub isOpenFolder($)
+{   my ($self, $name) = @_;
+    first {$name eq $_->name} $self->openFolders;
+}
+
+#-------------------------------------------
+
+
+sub close($@)
+{   my ($self, $folder, @options) = @_;
+    return unless $folder;
+
+    my $name      = $folder->name;
+    my @remaining = grep {$name ne $_->name} @{$self->{MBM_folders}};
+
+    # folder opening failed:
+    return if @{$self->{MBM_folders}} == @remaining;
+
+    $self->{MBM_folders} = [ @remaining ];
+    $_->removeFolder($folder) foreach @{$self->{MBM_threads}};
+
+    $folder->close(close_by_manager => 1, @options);
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub closeAllFolders(@)
+{   my ($self, @options) = @_;
+    $_->close(@options) foreach $self->openFolders;
+    $self;
+}
+
+END {map {defined $_ && $_->closeAllFolders} @managers}
+
+#-------------------------------------------
+
+
+sub delete($@)
+{   my ($self, $name, @options) = @_;
+    my $folder = $self->open(folder => $name, @options) or return;
+    $folder->delete;
+}
+
+#-------------------------------------------
+
+
+sub appendMessage(@)
+{   my $self     = shift;
+    my @appended = $self->appendMessages(@_);
+    wantarray ? @appended : $appended[0];
+}
+
+sub appendMessages(@)
+{   my $self = shift;
+    my $folder;
+    $folder  = shift if !ref $_[0] || $_[0]->isa('Mail::Box');
+
+    my @messages;
+    push @messages, shift while @_ && ref $_[0];
+
+    my %options = @_;
+    $folder ||= $options{folder};
+
+    # Try to resolve filenames into opened-files.
+    $folder = $self->isOpenFolder($folder) || $folder
+        unless ref $folder;
+
+    if(ref $folder)
+    {   # An open file.
+        unless($folder->isa('Mail::Box'))
+        {   $self->log(ERROR =>
+                "Folder $folder is not a Mail::Box; cannot add a message.\n");
+            return ();
+        }
+
+        foreach (@messages)
+        {   next unless $_->isa('Mail::Box::Message') && $_->folder;
+            $self->log(WARNING =>
+               "Use moveMessage() or copyMessage() to move between open folders.");
+        }
+
+        return $folder->addMessages(@messages);
+    }
+
+    # Not an open file.
+    # Try to autodetect the folder-type and then add the message.
+
+    my ($name, $class, @gen_options, $found);
+
+    foreach (@{$self->{MBM_folder_types}})
+    {   ($name, $class, @gen_options) = @$_;
+        eval "require $class";
+        next if $@;
+
+        if($class->foundIn($folder, @gen_options, access => 'a'))
+        {   $found++;
+            last;
+        }
+    }
+ 
+    # The folder was not found at all, so we take the default folder-type.
+    my $type = $self->{MBM_default_type};
+    if(!$found && $type)
+    {   foreach (@{$self->{MBM_folder_types}})
+        {   ($name, $class, @gen_options) = @$_;
+            if($type eq $name || $type eq $class)
+            {   $found++;
+                last;
+            }
+        }
+    }
+
+    # Even the default foldertype was not found (or nor defined).
+    ($name, $class, @gen_options) = @{$self->{MBM_folder_types}[0]}
+        unless $found;
+
+    $class->appendMessages
+      ( type     => $name
+      , messages => \@messages
+      , @gen_options
+      , %options
+      , folder   => $folder
+      );
+}
+
+#-------------------------------------------
+
+
+sub copyMessage(@)
+{   my $self   = shift;
+    my $folder;
+    $folder    = shift if !ref $_[0] || $_[0]->isa('Mail::Box');
+
+    my @messages;
+    while(@_ && ref $_[0])
+    {   my $message = shift;
+        $self->log(ERROR =>
+            "Use appendMessage() to add messages which are not in a folder.")
+                unless $message->isa('Mail::Box::Message');
+        push @messages, $message;
+    }
+
+    my %options = @_;
+    $folder ||= $options{folder};
+
+    # Try to resolve filenames into opened-files.
+    $folder = $self->isOpenFolder($folder) || $folder
+        unless ref $folder;
+
+    my @coerced
+     = ref $folder
+     ? map {$_->copyTo($folder)} @messages
+     : $self->appendMessages(@messages, %options, folder => $folder);
+
+    # hidden option, do not use it: it's designed to optimize moveMessage
+    if($options{_delete})
+    {   $_->label(deleted => 1) foreach @messages;
+    }
+
+    @coerced;
+}
+
+#-------------------------------------------
+
+
+sub moveMessage(@)
+{   my $self = shift;
+    $self->copyMessage(@_, _delete => 1);
+}
+
+#-------------------------------------------
+
+
+#-------------------------------------------
+
+
+sub threads(@)
+{   my $self    = shift;
+    my @folders;
+    push @folders, shift
+       while @_ && ref $_[0] && $_[0]->isa('Mail::Box');
+    my %args    = @_;
+
+    my $base    = 'Mail::Box::Thread::Manager';
+    my $type    = $args{threader_type} || $base;
+
+    my $folders = delete $args{folder} || delete $args{folders};
+    push @folders
+     , ( !$folders               ? ()
+       : ref $folders eq 'ARRAY' ? @$folders
+       :                           $folders
+       );
+
+    $self->log(INTERNAL => "No folders specified.\n")
+       unless @folders;
+
+    my $threads;
+    if(ref $type)
+    {   # Already prepared object.
+        $self->log(INTERNAL => "You need to pass a $base derived")
+            unless $type->isa($base);
+        $threads = $type;
+    }
+    else
+    {   # Create an object.  The code is compiled, which safes us the
+        # need to compile Mail::Box::Thread::Manager when no threads are needed.
+        eval "require $type";
+        $self->log(INTERNAL => "Unusable threader $type: $@") if $@;
+        $self->log(INTERNAL => "You need to pass a $base derived")
+            unless $type->isa($base);
+
+        $threads = $type->new(manager => $self, %args);
+    }
+
+    $threads->includeFolder($_) foreach @folders;
+    push @{$self->{MBM_threads}}, $threads;
+    $threads;
+}
+
+#-------------------------------------------
+
+
+sub toBeThreaded($@)
+{   my $self = shift;
+    $_->toBeThreaded(@_) foreach @{$self->{MBM_threads}};
+}
+
+#-------------------------------------------
+
+
+sub toBeUnthreaded($@)
+{   my $self = shift;
+    $_->toBeUnthreaded(@_) foreach @{$self->{MBM_threads}};
+}
+
+#-------------------------------------------
+
+
+sub decodeFolderURL($)
+{   my ($self, $name) = @_;
+
+    return unless
+       my ($type, $username, $password, $hostname, $port, $path)
+          = $name =~ m!^(\w+)\:             # protocol
+                       (?://
+                          (?:([^:@./]*)     # username
+                            (?:\:([^@/]*))? # password
+                           \@)?
+                           ([\w.-]+)?       # hostname
+                           (?:\:(\d+))?     # port number
+                        )?
+                        (.*)                # foldername
+                      !x;
+
+    $username ||= $ENV{USER} || $ENV{LOGNAME};
+
+    $password ||= '';        # decode password from url
+    $password =~ s/\+/ /g;
+    $password =~ s/\%([A-Fa-f0-9]{2})/chr hex $1/ge;
+
+    $hostname ||= 'localhost';
+    $path     ||= '=';
+
+    ( type        => $type,     folder      => $path
+    , username    => $username, password    => $password
+    , server_name => $hostname, server_port => $port
+    );
+}
+
+#-------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Manager.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Manager.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Manager.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,671 @@
+
+=head1 NAME
+
+Mail::Box::Manager - manage a set of folders
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Manager
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ use Mail::Box::Manager;
+ my $mgr     = new Mail::Box::Manager;
+
+ # Create folder objects.
+ my $folder   = $mgr->open(folder => $ENV{MAIL});
+ my $message1 = $folder->message(0);
+ $mgr->copyMessage('Draft', $message);
+
+ my @messages = $folder->message(0,3);
+ $mgr->moveMessage('Outbox', @messages, create => 1 );
+ $mgr->close($folder);
+
+ # Create thread-detectors (see Mail::Box::Thread::Manager)
+ my $t       = $mgr->threads($inbox, $outbox);
+
+ my $threads = $mgr->threads(folder => $folder);
+ foreach my $thread ($threads->all)
+ {   $thread->print;
+ }
+
+ $mgr->registerType(mbox => 'Mail::Box::MyType');
+
+
+=head1 DESCRIPTION
+
+The manager keeps track on a set of open folders and a set of message-thread
+supporting objects.  You are not obliged to use this object (you can
+directly create a L<Mail::Box::Mbox|Mail::Box::Mbox> if you prefer), but you will create
+more portable and safer code if you do use it.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Box::Manager-E<gt>B<new>(ARGS)
+
+=over 4
+
+ Option               Defined in       Default                   
+ autodetect                            C<undef>                  
+ default_folder_type                   C<'mbox'>                 
+ folder_types                          <all standard types>      
+ folderdir                             C<[ '.' ]>                
+ folderdirs                            <synonym for C<folderdir>>
+ log                  L<Mail::Reporter>  C<'WARNINGS'>             
+ trace                L<Mail::Reporter>  C<'WARNINGS'>             
+
+. autodetect TYPE|ARRAY-OF-TYPES
+
+=over 4
+
+Select only a subset of the folder types which are implemented by MailBox
+to be detected automatically.  This may improve the auto-detection of
+folder types.  Normally, all folder types will be tried when a folder's
+name is incorrect, but this option limits the types which are checked
+and therefore may respond faster.
+
+=back
+
+. default_folder_type NAME|CLASS
+
+=over 4
+
+Specifies the default folder type for newly created folders.  If this
+option is not specified, the most recently registered type is used (see
+L<registerType()|Mail::Box::Manager/"Manage folders"> and the L<new(folder_types)|Mail::Box::Manager/"METHODS"> option.
+
+=back
+
+. folder_types NEW-TYPE | ARRAY-OF-NEW-TYPES
+
+=over 4
+
+Add one or more new folder types to the list of known types.  The order is
+important: when you open a file without specifying its type, the
+manager will start trying the last added list of types, in order.
+
+Each TYPE is specified as an array which contains name, class, and
+defaults for options which overrule the usual defaults.  You may specify
+folder-specific defaults as OPTIONS.  They override the settings of
+the manager.
+
+=back
+
+. folderdir DIRECTORY
+
+=over 4
+
+The default directory, or directories, where folders are
+located.  C<Mail::Box::Manager> can autodetect the existing folder-types.
+There may be different kinds of folders opened at the same time, and
+messages can be moved between those types, although that may result in
+a loss of information depending on the folder types.
+
+=back
+
+. folderdirs [DIRECTORIES]
+
+. log LEVEL
+
+. trace LEVEL
+
+=back
+
+=head2 Manage folders
+
+
+$obj-E<gt>B<close>(FOLDER, OPTIONS)
+
+=over 4
+
+C<close> removes the specified folder from the list of open folders.
+Indirectly it will update the files on disk if needed (depends on
+the L<Mail::Box::new(save_on_exit)|Mail::Box/"Constructors"> flag for each folder). OPTIONS are
+passed to L<Mail::Box::close()|Mail::Box/"The folder"> of the folder.
+
+The folder's messages will also be withdrawn from the known message threads.
+You may also close the folder directly. The manager will be informed
+about this event and take appropriate actions.
+
+I<Example:> 
+
+ my $inbox = $mgr->open('inbox');
+ $mgr->close($inbox);
+ $inbox->close;        # alternative
+
+=back
+
+$obj-E<gt>B<closeAllFolders>(, OPTIONS)
+
+=over 4
+
+C<closeAllFolders> calls close() for each folder managed by
+this object.  It is called just before the program stops (before global
+cleanup).
+
+=back
+
+$obj-E<gt>B<delete>(FOLDERNAME [,OPTIONS])
+
+=over 4
+
+Remove the named folder, including all its sub-folders.  The OPTIONS
+are the same as those for L<open()|Mail::Box::Manager/"Manage folders">.
+
+The deletion of a folder can take some time.  Dependent on the type of
+folder, the folder must be read first.  For some folder-types this will
+be fast.
+
+=back
+
+$obj-E<gt>B<folderTypes>
+
+=over 4
+
+Returns the list of currently defined folder types.
+
+I<Example:> 
+
+ print join("\n", $manager->folderTypes), "\n";
+
+=back
+
+$obj-E<gt>B<isOpenFolder>(FOLDER)
+
+=over 4
+
+Returns true if the FOLDER is currently open.
+
+I<Example:> 
+
+ print "Yes\n" if $mgr->isOpenFolder('Inbox');
+
+=back
+
+$obj-E<gt>B<open>([FOLDERNAME], OPTIONS)
+
+=over 4
+
+Open a folder which name is specified as first parameter or with
+the option flag C<folder>.  The folder type is autodetected unless
+the C<type> is specified.
+
+C<open> carries options for the manager which are described here, but
+may also have additional options for the folder type.  For a
+description of the folder options, see the options to the constructor
+L<Mail::Box::new()|Mail::Box/"Constructors"> for each type of mail box.
+
+ Option     Defined in       Default                 
+ create                      <false>                 
+ folder                      C<$ENV{MAIL}>           
+ folderdir                   C<'.'>                  
+ type                        <first, usually C<mbox>>
+
+. create BOOLEAN
+
+=over 4
+
+Create the folder if it does not exist. By default, this is not done.
+The C<type> option specifies which type of folder is created.
+
+=back
+
+. folder NAME|URL
+
+=over 4
+
+Which folder to open, specified by NAME or special URL.
+The URL format is composed as
+
+ type://username:password@hostname:port/foldername
+
+Like real URLs, all fields are optional and have smart defaults, as long
+as the string starts with a known folder type.  Far
+from all folder types support all these options, but at least they are
+always split-out.  Be warned that special characters in the password should
+be properly url-encoded.
+
+When you specify anything which does not match the URL format, it is
+passed directly to the C<new> method of the folder which is opened.
+
+=back
+
+. folderdir DIRECTORY
+
+=over 4
+
+The directory where the folders are usually stored.
+
+=back
+
+. type FOLDERTYPENAME|FOLDERTYPE
+
+=over 4
+
+Specify the type of the folder.  If you do not specify this option while
+opening a folder for reading, the manager checks all registered folder
+types in order for the ability to open the folder. If you open a new
+folder for writing, then the default will be the most recently registered
+type. (If you add more than one type at once, the first of the list is
+used.)
+
+=back
+
+I<Example:> opening folders via the manager
+
+
+ my $jack  = $manager->open(folder => '=jack',
+    type => 'mbox');
+
+ my $rcvd  = $manager->open('myMail',
+    type => 'Mail::Box::Mbox', access => 'rw');
+
+ my $inbox = $manager->open('Inbox')
+    or die "Cannot open Inbox.\n";
+
+ my $pop   = 'pop3://myself:secret@pop3.server.com:120/x';
+ my $send  = $manager->open($url);
+
+ my $send  = $manager->open(folder => '/x',
+   type => 'pop3', username => 'myself', password => 'secret'
+   server_name => 'pop3.server.com', server_port => '120');
+
+=back
+
+$obj-E<gt>B<openFolders>
+
+=over 4
+
+Returns a list of all open folders.
+
+=back
+
+$obj-E<gt>B<registerType>(TYPE, CLASS [,OPTIONS])
+
+=over 4
+
+With C<registerType> you can register one TYPE of folders.  The CLASS
+is compiled automatically, so you do not need to C<use> them in your own
+modules.  The TYPE is just an arbitrary name.
+
+The added types are prepended to the list of known types, so they are
+checked first when a folder is opened in autodetect mode.
+
+I<Example:> 
+
+ $manager->registerType(mbox => 'Mail::Box::Mbox',
+     save_on_exit => 0, folderdir => '/tmp');
+
+=back
+
+=head2 Move messages to folders
+
+
+$obj-E<gt>B<appendMessage>([FOLDER|FOLDERNAME,] MESSAGES, OPTIONS)
+
+=over 4
+
+Append one or more messages to a folder (therefore, an C<appendMessages()>
+is defined as well). You may specify a FOLDERNAME or an opened folder
+as the first argument. When the name is that of an open folder, it is
+treated as if the folder-object was specified, and not directly access
+the folder-files.  You may also specify the foldername as part of the
+options list.
+
+If a message is added to an already opened folder, it is only added to
+the structure internally in the program.  The data will not be written to
+disk until a write of that folder takes place.  When the name of an
+unopened folder is given, the folder is opened, the messages stored on
+disk, and then the folder is closed.
+
+A message must be an instance of a L<Mail::Message|Mail::Message>.  The actual message
+type does not have to match the folder type--the folder will try to
+resolve the differences with minimal loss of information.  The coerced
+messages (how the were actually written) are returned as list.
+
+The OPTIONS is a list of key/values, which are added to (overriding)
+the default options for the detected folder type.
+
+I<Example:> 
+
+ $mgr->appendMessage('=send', $message, folderdir => '/');
+ $mgr->appendMessage($received, $inbox->messages);
+
+ my @appended = $mgr->appendMessages($inbox->messages,
+    folder => 'Drafts');
+ $_->label(seen => 1) foreach @appended;
+
+=back
+
+$obj-E<gt>B<copyMessage>([FOLDER|FOLDERNAME,] MESSAGES, OPTIONS)
+
+=over 4
+
+Copy a message from one folder into another folder.  If the destination
+folder is already opened, the copied message is stored in memory and
+written to disk when a write of the folder is later performed. Otherwise,
+the destination folder will be opened, the message written, and then the
+folder closed.
+
+You need to specify a folder's name or folder object as the first
+argument, or in the options list.  The options are the same as those
+which can be specified when opening a folder.
+
+I<Example:> 
+
+ my $drafts = $mgr->open(folder => 'Drafts');
+ my $outbox = $mgr->open(folder => 'Outbox');
+ $mgr->copyMessage($outbox, $drafts->message(0));
+
+ my @messages = $drafts->message(1,2);
+ $mgr->copyMessage('=Trash', @messages.
+    folderdir => '/tmp', create => 1);
+
+ $mgr->copyMessage($drafts->message(1),
+    folder => '=Drafts' folderdir => '/tmp',
+    create => 1);
+
+=back
+
+$obj-E<gt>B<moveMessage>([FOLDER|FOLDERNAME,] MESSAGES, OPTIONS)
+
+=over 4
+
+Move a message from one folder to another.  Be warned that removals from
+a folder only take place when the folder is closed, so the message is only
+flagged to be deleted in the opened source folder.
+
+ $mgr->moveMessage($received, $inbox->message(1))
+
+is equivalent to
+
+ $mgr->copyMessage($received, $inbox->message(1));
+ $inbox->message(1)->delete;
+
+=back
+
+=head2 Manage message threads
+
+
+$obj-E<gt>B<threads>([FOLDERS], OPTIONS)
+
+=over 4
+
+Create a new object which keeps track of message threads.  You can
+read about the possible options in L<Mail::Box::Thread::Manager|Mail::Box::Thread::Manager>.
+As OPTIONS specify one folder or an array of FOLDERS.
+It is also permitted to specify folders before the options.
+
+I<Example:> 
+
+ my $t1 = $mgr->threads(folders => [ $inbox, $send ]);
+ my $t2 = $mgr->threads($inbox);
+ my $t3 = $mgr->threads($inbox, $send);
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<decodeFolderURL>(URL)
+
+=over 4
+
+Try to decompose a folder name which is specified as URL (see open())
+into separate options.
+
+=back
+
+$obj-E<gt>B<toBeThreaded>(FOLDER, MESSAGES)
+
+=over 4
+
+Signal to the manager that all thread managers which are using the
+specified folder must be informed that new messages are
+coming in.
+
+=back
+
+$obj-E<gt>B<toBeUnthreaded>(FOLDER, MESSAGES)
+
+=over 4
+
+Signal to the manager that all thread managers which are using the
+specified folder must be informed that new messages are
+or going out.
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Manager-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Manager-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Manager-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Don't know which folder I should open: no name
+
+
+I<Warning:> Folder $name is already open.
+
+You cannot ask the manager for a folder which is already open. In some
+older releases (before MailBox 2.049), this was permitted, but then
+behaviour changed, because many nasty side-effects are to be expected.
+For instance, an L<Mail::Box::update()|Mail::Box/"The folder"> on one folder handle would
+influence the second, probably unexpectedly.
+
+I<Error:> Folder $name is not a Mail::Box; cannot add a message.
+
+The folder where the message should be appended to is an object which is
+not a folder type which extends L<Mail::Box|Mail::Box>.  Probably, it is not a folder
+at all.
+
+I<Warning:> Folder does not exist, failed opening $type folder $name.
+
+The folder does not exist and creating is not permitted (see
+L<open(create)|Mail::Box::Manager/"Manage folders">) or did not succeed.  When you do not have sufficient
+access rights to the folder (for instance wrong password for POP3),
+this warning will be produced as well.
+
+The manager tried to open a folder of the specified type.  It may help
+to explicitly state the type of your folder with the C<type> option.
+There will probably be another warning or error message which is related
+to this report and provides more details about its cause.  You may also
+have a look at L<new(autodetect)|Mail::Box::Manager/"METHODS"> and L<new(folder_types)|Mail::Box::Manager/"METHODS">.
+
+I<Warning:> Folder type $type is unknown, using autodetect.
+
+The specified folder type (see L<open(type)|Mail::Box::Manager/"Manage folders">, possibly derived from
+the folder name when specified as url) is not known to the manager.
+This may mean that you forgot to require the L<Mail::Box|Mail::Box> extension
+which implements this folder type, but probably it is a typo.  Usually,
+the manager is able to figure-out which type to use by itself.
+
+I<Error:> Illegal folder URL '$url'.
+
+The folder name was specified as URL, but not according to the syntax.
+See L<decodeFolderURL()|Mail::Box::Manager/"Internals"> for an description of the syntax.
+
+I<Error:> No foldername specified to open.
+
+C<open()> needs a folder name as first argument (before the list of options),
+or with the C<folder> option within the list.  If no name was found, the
+MAIL environment variable is checked.  When even that does not result in
+a usable folder, then this error is produced.  The error may be caused by
+an accidental odd-length option list.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Use appendMessage() to add messages which are not in a folder.
+
+You do not need to copy this message into the folder, because you do
+not share the message between folders.
+
+I<Warning:> Use moveMessage() or copyMessage() to move between open folders.
+
+The message is already part of a folder, and now it should be appended
+to a different folder.  You need to decide between copy or move, which
+both will clone the message (not the body, because they are immutable).
+
+I<Error:> Will never create a folder $name without having write access.
+
+You have set L<open(create)|Mail::Box::Manager/"Manage folders">, but only want to read the folder.  Create is
+only useful for folders which have write or append access modes
+(see L<Mail::Box::new(access)|Mail::Box/"Constructors">).
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Mbox/Message.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Mbox/Message.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Mbox/Message.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,42 @@
+
+use strict;
+package Mail::Box::Mbox::Message;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box::File::Message';
+
+
+#-------------------------------------------
+
+sub head(;$$)
+{   my $self  = shift;
+    return $self->SUPER::head unless @_;
+
+    my ($head, $labels) = @_;
+    $self->SUPER::head($head, $labels);
+
+    $self->statusToLabels if $head && !$head->isDelayed;
+    $head;
+}
+
+#-------------------------------------------
+
+sub label(@)
+{   my $self   = shift;
+    $self->loadHead;    # be sure the status fields have been read
+    my $return = $self->SUPER::label(@_);
+    $return;
+}
+
+#-------------------------------------------
+
+sub labels(@)
+{   my $self   = shift;
+    $self->loadHead;    # be sure the status fields have been read
+    $self->SUPER::labels(@_);
+}
+
+#------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Mbox/Message.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Mbox/Message.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Mbox/Message.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,892 @@
+
+=head1 NAME
+
+Mail::Box::Mbox::Message - one message in a Mbox folder
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Mbox::Message
+   is a Mail::Box::File::Message
+   is a Mail::Box::Message
+   is a Mail::Message
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my $folder  = new Mail::Box::Mbox folder => $ENV{MAIL}, ...;
+ my $message = $folder->message(0);
+
+
+=head1 DESCRIPTION
+
+Maintain one message in an L<Mail::Box::Mbox|Mail::Box::Mbox> folder.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message/"Constructors">
+
+=back
+
+Mail::Box::Mbox::Message-E<gt>B<coerce>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box::Message/"METHODS">
+
+=back
+
+Mail::Box::Mbox::Message-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box::File::Message/"METHODS">
+
+=back
+
+=head2 Constructing a message
+
+
+$obj-E<gt>B<bounce>([RG-OBJECT|OPTIONS])
+
+=over 4
+
+See L<Mail::Message::Construct::Bounce/"Constructing a message">
+
+=back
+
+Mail::Box::Mbox::Message-E<gt>B<build>([MESSAGE|BODY], CONTENT)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+Mail::Box::Mbox::Message-E<gt>B<buildFromBody>(BODY, [HEAD], HEADERS)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forward>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardAttach>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardEncapsulate>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardInline>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardNo>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPostlude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPrelude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardSubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+Mail::Box::Mbox::Message-E<gt>B<read>(FILEHANDLE|SCALAR|REF-SCALAR|ARRAY-OF-LINES, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Read/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<rebuild>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<reply>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replyPrelude>([STRING|FIELD|ADDRESS|ARRAY-OF-THINGS])
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replySubject>(STRING)
+
+Mail::Box::Mbox::Message-E<gt>B<replySubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+=head2 The Message
+
+
+$obj-E<gt>B<container>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isDummy>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isPart>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<messageId>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<send>([MAILER], OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<toplevel>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<write>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Box::File::Message/"METHODS">
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<bcc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<cc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<date>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<destinations>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<from>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<get>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<guessTimestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<head>([HEAD])
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<sender>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<study>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<subject>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<timestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<to>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+=head2 The body
+
+
+$obj-E<gt>B<body>([BODY])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<decoded>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<encode>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isNested>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<parts>(['ALL'|'ACTIVE'|'DELETED'|'RECURSE'|FILTER])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+=head2 Flags
+
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<deleted>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isDeleted>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<label>(LABEL|PAIRS)
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<labels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<labelsToStatus>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<statusToLabels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+=head2 The whole message as text
+
+
+$obj-E<gt>B<file>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<lines>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<printStructure>([FILEHANDLE][, INDENT])
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+=head2 The message
+
+
+$obj-E<gt>B<copyTo>(FOLDER)
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<folder>([FOLDER])
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<fromLine>([LINE])
+
+=over 4
+
+See L<Mail::Box::File::Message/"The message">
+
+=back
+
+$obj-E<gt>B<moveTo>(FOLDER)
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<seqnr>([INTEGER])
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<diskDelete>
+
+=over 4
+
+See L<Mail::Box::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<fileLocation>
+
+=over 4
+
+See L<Mail::Box::File::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<loadBody>
+
+=over 4
+
+See L<Mail::Box::File::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<moveLocation>(DISTANCE)
+
+=over 4
+
+See L<Mail::Box::File::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readBody>(PARSER, HEAD [, BODYTYPE])
+
+=over 4
+
+See L<Mail::Box::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readFromParser>(PARSER)
+
+=over 4
+
+See L<Mail::Box::File::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readHead>(PARSER [,CLASS])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<recursiveRebuildPart>(PART, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Internals">
+
+=back
+
+$obj-E<gt>B<storeBody>(BODY)
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<takeMessageId>([STRING])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Message::Construct/"METHODS">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Mbox::Message-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Mbox::Message-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Mbox::Message-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortSize>([VALUE])
+
+Mail::Box::Mbox::Message-E<gt>B<shortSize>([VALUE])
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortString>
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<destruct>
+
+=over 4
+
+See L<Mail::Box::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot include forward source as $include.
+
+Unknown alternative for the L<forward(include)|Mail::Message::Construct::Forward/"Constructing a message">.  Valid choices are
+C<NO>, C<INLINE>, C<ATTACH>, and C<ENCAPSULATE>.
+
+I<Error:> Cannot include reply source as $include.
+
+Unknown alternative for the C<include> option of L<reply()|Mail::Message::Construct::Reply/"Constructing a message">.  Valid
+choices are C<NO>, C<INLINE>, and C<ATTACH>.
+
+I<Error:> No address to create forwarded to.
+
+If a forward message is created, a destination address must be specified.
+
+I<Error:> No default mailer found to send message.
+
+The message L<send()|Mail::Message/"The Message"> mechanism had not enough information to automatically
+find a mail transfer agent to sent this message.  Specify a mailer
+explicitly using the C<via> options.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Unable to read delayed body.
+
+
+I<Error:> forwardAttach requires a preamble object
+
+
+I<Error:> forwardEncapsulate requires a preamble object
+
+
+I<Error:> no rebuild rule $name defined.
+
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Mbox.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Mbox.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Mbox.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,185 @@
+
+use strict;
+package Mail::Box::Mbox;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box::File';
+
+use Mail::Box::Mbox::Message;
+
+
+our $default_folder_dir    = exists $ENV{HOME} ? $ENV{HOME} . '/Mail' : '.';
+our $default_sub_extension = '.d';
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    $self->{MBM_sub_ext}    # required during init
+        = $args->{subfolder_extension} || $default_sub_extension;
+
+    $self->SUPER::init($args);
+}
+
+#-------------------------------------------
+
+
+sub create($@)
+{   my ($thingy, $name, %args) = @_;
+    my $class = ref $thingy    || $thingy;
+    $args{folderdir}           ||= $default_folder_dir;
+    $args{subfolder_extension} ||= $default_sub_extension;
+
+    $class->SUPER::create($name, %args);
+}
+
+#-------------------------------------------
+
+
+sub foundIn($@)
+{   my $class = shift;
+    my $name  = @_ % 2 ? shift : undef;
+    my %args  = @_;
+    $name   ||= $args{folder} or return;
+
+    my $folderdir = $args{folderdir} || $default_folder_dir;
+    my $extension = $args{subfolder_extension} || $default_sub_extension;
+    my $filename  = $class->folderToFilename($name, $folderdir, $extension);
+
+    if(-d $filename)      # fake empty folder, with sub-folders
+    {   return 1 unless -f File::Spec->catfile($filename, '1')   # MH
+                     || -d File::Spec->catdir($filename, 'cur'); # Maildir
+    }
+
+    return 0 unless -f $filename;
+    return 1 if -z $filename;               # empty folder is ok
+
+    open my $file, '<', $filename or return 0;
+    local $_;
+    while(<$file>)
+    {   next if /^\s*$/;                    # skip empty lines
+        $file->close;
+        return substr($_, 0, 5) eq 'From '; # found Mbox separator?
+    }
+
+    return 1;
+}
+
+#-------------------------------------------
+
+sub writeMessages($)
+{   my ($self, $args) = @_;
+
+    $self->SUPER::writeMessages($args) or return;
+
+    if($self->{MB_remove_empty})
+    {   # Can the sub-folder directory be removed?  Don't mind if this
+        # doesn't work: probably no subdir or still something in it.  This
+        # is a rather blunt approach...
+        rmdir $self->filename . $self->{MBM_sub_ext};
+    }
+
+    $self;
+}
+
+#-------------------------------------------
+
+sub type() {'mbox'}
+
+#-------------------------------------------
+
+
+sub listSubFolders(@)
+{   my ($thingy, %args)  = @_;
+    my $class      = ref $thingy || $thingy;
+
+    my $skip_empty = $args{skip_empty} || 0;
+    my $check      = $args{check}      || 0;
+
+    my $folder     = exists $args{folder} ? $args{folder} : '=';
+    my $folderdir  = exists $args{folderdir}
+                   ? $args{folderdir}
+                   : $default_folder_dir;
+
+    my $extension  = $args{subfolder_extension};
+    my $dir;
+    if(ref $thingy)   # Mail::Box::Mbox
+    {    $extension ||= $thingy->{MBM_sub_ext};
+         $dir = $thingy->filename;
+    }
+    else
+    {    $extension ||= $default_sub_extension;
+         $dir = $class->folderToFilename($folder, $folderdir, $extension);
+    }
+
+    my $real       = -d $dir ? $dir : "$dir$extension";
+    return () unless opendir DIR, $real;
+
+    # Some files have to be removed because they are created by all
+    # kinds of programs, but are no folders.
+
+    my @entries = grep { ! m/\.lo?ck$/ && ! m/^\./ } readdir DIR;
+    closedir DIR;
+
+    # Look for files in the folderdir.  They should be readable to
+    # avoid warnings for usage later.  Furthermore, if we check on
+    # the size too, we avoid a syscall especially to get the size
+    # of the file by performing that check immediately.
+
+    my %folders;  # hash to immediately un-double names.
+
+    foreach (@entries)
+    {   my $entry = File::Spec->catfile($real, $_);
+        next unless -r $entry;
+        if( -f _ )
+        {   next if $args{skip_empty} && ! -s _;
+            next if $args{check} && !$class->foundIn($entry);
+            $folders{$_}++;
+        }
+        elsif( -d _ )
+        {   # Directories may create fake folders.
+            if($args{skip_empty})
+            {   opendir DIR, $entry or next;
+                my @sub = grep !/^\./, readdir DIR;
+                closedir DIR;
+                next unless @sub;
+            }
+
+            (my $folder = $_) =~ s/$extension$//;
+            $folders{$folder}++;
+        }
+    }
+
+    map { m/(.*)/ && $1 } keys %folders;   # untained names
+}
+
+#-------------------------------------------
+
+
+sub folderToFilename($$;$)
+{   my ($thingy, $name, $folderdir, $extension) = @_;
+
+    $extension ||=
+          ref $thingy ? $thingy->{MBM_sub_ext} : $default_sub_extension;
+
+    $name     =~ s#^=#$folderdir/#;
+    my @parts = split m!/!, $name;
+
+    my $real  = shift @parts;
+    $real     = '/' if $real eq '';
+
+    if(@parts)
+    {   my $file  = pop @parts;
+
+        $real = File::Spec->catdir($real.(-d $real ? '' : $extension), $_) 
+           foreach @parts;
+
+        $real = File::Spec->catfile($real.(-d $real ? '' : $extension), $file);
+    }
+
+    $real;
+}
+
+#-------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Mbox.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Mbox.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Mbox.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,916 @@
+
+=head1 NAME
+
+Mail::Box::Mbox - handle folders in Mbox format
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Mbox
+   is a Mail::Box::File
+   is a Mail::Box
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ use Mail::Box::Mbox;
+ my $folder = Mail::Box::Mbox->new(folder => $ENV{MAIL}, ...);
+
+
+=head1 DESCRIPTION
+
+This documentation describes how Mbox mailboxes work, and also describes
+what you can do with the Mbox folder object Mail::Box::Mbox.
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+overload: B<@{}>
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+overload: B<cmp>
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<create>(FOLDERNAME, OPTIONS)
+
+Mail::Box::Mbox-E<gt>B<create>(FOLDERNAME, OPTIONS)
+
+=over 4
+
+ Option               Defined in       Default
+ folderdir            L<Mail::Box>     undef  
+ subfolder_extension                   undef  
+
+. folderdir DIRECTORY
+
+. subfolder_extension STRING
+
+=over 4
+
+If a directory is found on the location of the folder to be created, this
+STRING is used to extend that directory name with.  This will cause the
+directory to be seen as sub-folder for the created folder.  This argument
+is passed to L<folderToFilename()|Mail::Box::Mbox/"Internals">.
+
+=back
+
+=back
+
+Mail::Box::Mbox-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option               Defined in       Default                                                         
+ access               L<Mail::Box>     C<'r'>                                                          
+ body_delayed_type    L<Mail::Box>     L<Mail::Message::Body::Delayed|Mail::Message::Body::Delayed>    
+ body_type            L<Mail::Box::File>  <see description>                                               
+ coerce_options       L<Mail::Box>     C<[]>                                                           
+ create               L<Mail::Box>     <false>                                                         
+ extract              L<Mail::Box>     C<10240>                                                        
+ field_type           L<Mail::Box>     undef                                                           
+ fix_headers          L<Mail::Box>     <false>                                                         
+ folder               L<Mail::Box>     C<$ENV{MAIL}>                                                   
+ folderdir            L<Mail::Box>     C<$ENV{HOME}.'/Mail'>                                           
+ head_delayed_type    L<Mail::Box>     L<Mail::Message::Head::Delayed|Mail::Message::Head::Delayed>    
+ head_type            L<Mail::Box>     L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>  
+ keep_dups            L<Mail::Box>     <false>                                                         
+ lock_extension       L<Mail::Box::File>  C<'.lock'>                                                      
+ lock_file            L<Mail::Box>     <foldername>.<lock-extension>                                   
+ lock_timeout         L<Mail::Box>     1 hour                                                          
+ lock_type            L<Mail::Box>     L<Mail::Box::Locker::DotLock|Mail::Box::Locker::DotLock>        
+ lock_wait            L<Mail::Box>     10 seconds                                                      
+ locker               L<Mail::Box>     undef                                                           
+ log                  L<Mail::Reporter>  C<'WARNINGS'>                                                   
+ manager              L<Mail::Box>     undef                                                           
+ message_type         L<Mail::Box>     L<Mail::Box::Mbox::Message|Mail::Box::Mbox::Message>            
+ multipart_type       L<Mail::Box>     L<Mail::Message::Body::Multipart|Mail::Message::Body::Multipart>
+ remove_when_empty    L<Mail::Box>     <true>                                                          
+ save_on_exit         L<Mail::Box>     <true>                                                          
+ subfolder_extension                   C<'.d'>                                                         
+ trace                L<Mail::Reporter>  C<'WARNINGS'>                                                   
+ trusted              L<Mail::Box>     <depends on folder location>                                    
+ write_policy         L<Mail::Box::File>  undef                                                           
+
+. access MODE
+
+. body_delayed_type CLASS
+
+. body_type CLASS|CODE
+
+. coerce_options ARRAY
+
+. create BOOLEAN
+
+. extract INTEGER | CODE | METHOD | 'LAZY'|'ALWAYS'
+
+. field_type CLASS
+
+. fix_headers BOOLEAN
+
+. folder FOLDERNAME
+
+. folderdir DIRECTORY
+
+. head_delayed_type CLASS
+
+. head_type CLASS
+
+. keep_dups BOOLEAN
+
+. lock_extension FILENAME|STRING
+
+. lock_file FILENAME
+
+. lock_timeout SECONDS
+
+. lock_type CLASS|STRING|ARRAY
+
+. lock_wait SECONDS
+
+. locker OBJECT
+
+. log LEVEL
+
+. manager MANAGER
+
+. message_type CLASS
+
+. multipart_type CLASS
+
+. remove_when_empty BOOLEAN
+
+. save_on_exit BOOLEAN
+
+. subfolder_extension STRING
+
+=over 4
+
+Mbox folders do not support sub-folders.  However, this module can
+simulate sub-directories if the user wants it to.  When a subfolder of
+folder C<xyz> is created, we create a directory which is called C<xyz.d>
+to contain them.  This extension C<.d> can be changed using this option.
+
+=back
+
+. trace LEVEL
+
+. trusted BOOLEAN
+
+. write_policy 'REPLACE'|'INPLACE'|undef
+
+=back
+
+=head2 The folder
+
+
+$obj-E<gt>B<addMessage>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<addMessages>(MESSAGE [, MESSAGE, ...])
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+Mail::Box::Mbox-E<gt>B<appendMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box::File/"METHODS">
+
+=back
+
+$obj-E<gt>B<close>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<copyTo>(FOLDER, OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<filename>
+
+=over 4
+
+See L<Mail::Box::File/"The folder">
+
+=back
+
+$obj-E<gt>B<folderdir>([DIRECTORY])
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+Mail::Box::Mbox-E<gt>B<foundIn>([FOLDERNAME], [OPTIONS])
+
+=over 4
+
+If no FOLDERNAME is specified, then the value of the C<folder> option
+is taken.  A mbox folder is a file which starts with a separator
+line: a line with C<'From '> as first characters.  Blank lines which
+start the file are ignored, which is not for all MUA's acceptable.
+
+ Option               Defined in       Default      
+ folder                                undef        
+ folderdir            L<Mail::Box>     undef        
+ subfolder_extension                   <from object>
+
+. folder FOLDERNAME
+
+. folderdir DIRECTORY
+
+. subfolder_extension STRING
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<organization>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<type>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<update>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<url>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+=head2 Folder flags
+
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+$obj-E<gt>B<writable>
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+=head2 The messages
+
+
+$obj-E<gt>B<current>([NUMBER|MESSAGE|MESSAGE-ID])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<find>(MESSAGE-ID)
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<findFirstLabeled>(LABEL, [BOOLEAN, [ARRAY-OF-MSGS]])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<message>(INDEX [,MESSAGE])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messageId>(MESSAGE-ID [,MESSAGE])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messageIds>
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messages>(['ALL',RANGE,'ACTIVE','DELETED',LABEL,!LABEL,FILTER])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<scanForMessages>(MESSAGE, MESSAGE-IDS, TIMESPAN, WINDOW)
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+=head2 Sub-folders
+
+
+$obj-E<gt>B<listSubFolders>(OPTIONS)
+
+Mail::Box::Mbox-E<gt>B<listSubFolders>(OPTIONS)
+
+=over 4
+
+ Option               Defined in       Default      
+ check                L<Mail::Box>     <false>      
+ folder               L<Mail::Box>     <required>   
+ folderdir            L<Mail::Box>     <from folder>
+ skip_empty           L<Mail::Box>     <false>      
+ subfolder_extension                   <from object>
+
+. check BOOLEAN
+
+. folder FOLDERNAME
+
+. folderdir DIRECTORY
+
+. skip_empty BOOL
+
+. subfolder_extension STRING
+
+=over 4
+
+When the method is called on an open folder, the extension defined by it is
+used to detect sub-folders by default.  Otherwise, C<'.d'> is taken.
+
+=back
+
+=back
+
+$obj-E<gt>B<nameOfSubFolder>(NAME)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+$obj-E<gt>B<openRelatedFolder>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+$obj-E<gt>B<openSubFolder>(NAME, OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<coerce>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<determineBodyType>(MESSAGE, HEAD)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<folderToFilename>(FOLDERNAME, FOLDERDIR, [EXTENSION])
+
+Mail::Box::Mbox-E<gt>B<folderToFilename>(FOLDERNAME, FOLDERDIR, [EXTENSION])
+
+=over 4
+
+Translate a folder name into a filename, using the
+FOLDERDIR value to replace a leading C<=>.  If no EXTENSION is specified and
+this method is called as instance method, new(subfolder_extension) is used.
+Otherwise, the extension default to C<'.d'>.
+
+=back
+
+$obj-E<gt>B<lineSeparator>([STRING|'CR'|'LF'|'CRLF'])
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<locker>
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<messageCreateOptions>([TYPE, CONFIG])
+
+=over 4
+
+See L<Mail::Box::File/"Internals">
+
+=back
+
+$obj-E<gt>B<moveAwaySubFolder>(DIRECTORY, EXTENSION)
+
+=over 4
+
+See L<Mail::Box::File/"Internals">
+
+=back
+
+$obj-E<gt>B<parser>
+
+=over 4
+
+See L<Mail::Box::File/"Internals">
+
+=back
+
+$obj-E<gt>B<read>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<readMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<storeMessage>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<toBeThreaded>(MESSAGES)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<toBeUnthreaded>(MESSAGES)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<updateMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box::File/"Internals">
+
+=back
+
+$obj-E<gt>B<write>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box::File/"Internals">
+
+=back
+
+$obj-E<gt>B<writeMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+=head3 File based folders
+
+
+=head2 Other methods
+
+
+$obj-E<gt>B<timespan2seconds>(TIME)
+
+Mail::Box::Mbox-E<gt>B<timespan2seconds>(TIME)
+
+=over 4
+
+See L<Mail::Box/"Other methods">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Mbox-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Mbox-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Mbox-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Box/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot append messages to folder file $filename: $!
+
+Appending messages to a not-opened file-organized folder may fail when the
+operating system does not allow write access to the file at hand.
+
+I<Error:> Cannot move away sub-folder $dir
+
+
+I<Warning:> Cannot remove folder $name file $filename: $!
+
+Writing an empty folder will usually cause that folder to be removed,
+which fails for the indicated reason.  L<new(remove_when_empty)|Mail::Box/"Constructors">
+
+I<Warning:> Cannot remove folder $name file $filename: $!
+
+Writing an empty folder will usually cause that folder to be removed,
+which fails for the indicated reason.  L<new(remove_when_empty)|Mail::Box/"Constructors">
+controls whether the empty folder will removed; setting it to false
+(C<0>) may be needed to avoid this message.
+
+I<Error:> Cannot replace $filename by $tempname, to update folder $name: $!
+
+The replace policy wrote a new folder file to update the existing, but
+was unable to give the final touch: replacing the old version of the
+folder file for the indicated reason.
+
+I<Warning:> Changes not written to read-only folder $self.
+
+You have opened the folder read-only --which is the default set
+by L<new(access)|Mail::Box/"Constructors">--, made modifications, and now want to close it.
+Set L<close(force)|Mail::Box/"The folder"> if you want to overrule the access mode, or close
+the folder with L<close(write)|Mail::Box/"The folder"> set to C<NEVER>.
+
+I<Error:> Copying failed for one message.
+
+For some reason, for instance disc full, removed by external process, or
+read-protection, it is impossible to copy one of the messages.  Copying will
+proceed for the other messages.
+
+I<Error:> Destination folder $name is not writable.
+
+The folder where the messages are copied to is not opened with write
+access (see L<new(access)|Mail::Box/"Constructors">).  This has no relation with write permission
+to the folder which is controled by your operating system.
+
+I<Warning:> Different messages with id $msgid.
+
+The message id is discovered more than once within the same folder, but the
+content of the message seems to be different.  This should not be possible:
+each message must be unique.
+
+I<Error:> File too short to get write message $nr ($size, $need)
+
+Mail::Box is lazy: it tries to leave messages in the folders until they
+are used, which saves time and memory usage.  When this message appears,
+something is terribly wrong: some lazy message are needed for updating the
+folder, but they cannot be retreived from the original file anymore.  In
+this case, messages can be lost.
+
+This message does appear regularly on Windows systems when using the
+'replace' write policy.  Please help to find the cause, probably something
+to do with Windows incorrectly handling multiple filehandles open in the
+same file.
+
+I<Error:> Folder $name not deleted: not writable.
+
+The folder must be opened with write access via L<new(access)|Mail::Box/"Constructors">, otherwise
+removing it will be refused.  So, you may have write-access according to
+the operating system, but that will not automatically mean that this
+C<delete> method permits you to.  The reverse remark is valid as well.
+
+I<Error:> Invalid timespan '$timespan' specified.
+
+The string does not follow the strict rules of the time span syntax which
+is permitted as parameter.
+
+I<Warning:> Message-id '$msgid' does not contain a domain.
+
+According to the RFCs, message-ids need to contain a unique random part,
+then an C<@>, and then a domain name.  This is made to avoid the creation
+of two messages with the same id.  The warning emerges when the C<@> is
+missing from the string.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Unable to create subfolder $name of $folder.
+
+The copy includes the subfolders, but for some reason it was not possible
+to copy one of these.  Copying will proceed for all other sub-folders.
+
+I<Error:> Unable to update folder $self.
+
+When a folder is to be written, both replace and inplace write policies are
+tried,  If both fail, the whole update fails.  You may see other, related,
+error messages to indicate the real problem.
+
+
+=head1 DETAILS
+
+
+=head2 How MBOX folders work
+
+MBOX folders store many messages in one file.  Each message begins with a
+line which starts with the string C<From >.  Lines inside a message which
+accidentally start with C<From> are, in the file, preceded by `E<gt>'. This
+character is stripped when the message is read.
+
+In this respect must be noted that the format of the MBOX files is not
+strictly defined.  The exact content of the separator lines differ between
+Mail User Agents (MUA's).  Besides, some MUAs (like mutt) forget to encode
+the C<From > lines within message bodies, breaking other parsers....
+
+=head2 Simulation of sub-folders
+
+MBOX folders do not have a sub-folder concept as directory based folders
+do, but this MBOX module tries to simulate them.  In this implementation
+a directory like
+
+ Mail/subject1/
+
+is taken as an empty folder C<Mail/subject1>, with the folders in that
+directory as sub-folders for it.  You may also use
+
+ Mail/subject1
+ Mail/subject1.d/
+
+where C<Mail/subject1> is the folder, and the folders in the
+C<Mail/subject1.d> directory are used as sub-folders.  If your situation
+is similar to the first example and you want to put messages in that empty
+folder, the directory is automatically (and transparently) renamed, so
+that the second situation is reached.
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Message/Destructed.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Message/Destructed.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Message/Destructed.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,104 @@
+
+use strict;
+
+package Mail::Box::Message::Destructed;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box::Message';
+
+use Carp;
+
+
+sub new(@)
+{   my $class = shift;
+    $class->log(ERROR => 'You cannot instantiate a destructed message');
+    undef;
+}
+ 
+#-------------------------------------------
+
+sub isDummy()    { 1 }
+
+#-------------------------------------------
+
+
+sub head(;$)
+{    my $self = shift;
+     return undef if @_ && !defined(shift);
+
+     $self->log(ERROR => "You cannot take the head of a destructed message");
+     undef;
+}
+
+#-------------------------------------------
+
+
+sub body(;$)
+{    my $self = shift;
+     return undef if @_ && !defined(shift);
+
+     $self->log(ERROR => "You cannot take the body of a destructed message");
+     undef;
+}
+
+#-------------------------------------------
+
+
+sub coerce($)
+{  my ($class, $message) = @_;
+
+   unless($message->isa('Mail::Box::Message'))
+   {  $class->log(ERROR=>"Cannot coerce a ",ref($message), " into destruction");
+      return ();
+   }
+
+   $message->body(undef);
+   $message->head(undef);
+   $message->modified(0);
+
+   bless $message, $class;
+}
+
+#-------------------------------------------
+
+sub modified(;$)
+{  my $self = shift;
+
+   $self->log(ERROR => 'Do not set the modified flag on a destructed message')
+      if @_ && $_[0];
+
+   0;
+}
+
+sub isModified() { 0 }
+
+#-------------------------------------------
+
+
+sub label($;@)
+{  my $self = shift;
+
+   if(@_==1)
+   {   my $label = shift;
+       return $self->SUPER::label('deleted') if $label eq 'deleted';
+       $self->log(ERROR => "Destructed message has no labels except 'deleted', requested is $label");
+       return 0;
+   }
+
+   my %flags = @_;
+   unless(keys %flags==1 && exists $flags{deleted})
+   {   $self->log(ERROR => "Destructed message has no labels except 'deleted', trying to set @{[ keys %flags ]}");
+       return;
+   }
+
+   $self->log(ERROR => "Destructed messages can not be undeleted")
+      unless $flags{deleted};
+
+   1;
+}
+
+#-------------------------------------------
+
+sub labels() { wantarray ? ('deleted') : { deleted => 1 } }
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Message/Destructed.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Message/Destructed.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Message/Destructed.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,952 @@
+
+=head1 NAME
+
+Mail::Box::Message::Destructed - a destructed message
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Message::Destructed
+   is a Mail::Box::Message
+   is a Mail::Message
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ $folder->message(3)->destruct;
+
+
+=head1 DESCRIPTION
+
+When a message folder is read, each message will be parsed into Perl
+structures.  Especially the header structure can consume a huge amount
+of memory (message bodies can be moved to external temporary files).
+Destructed messages have forcefully cleaned-up all header and body
+information, and are therefore much smaller.  Some useful information
+is still in the object.
+
+BE WARNED: once a message is destructed, it cannot be revived.  Destructing
+enforces irreversable deletion from the folder.  If you have a folder opened
+for read-only, the message will stay in that folder, but otherwise it may
+be deleted.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message/"Constructors">
+
+=back
+
+Mail::Box::Message::Destructed-E<gt>B<coerce>(MESSAGE)
+
+=over 4
+
+Coerce a L<Mail::Box::Message|Mail::Box::Message> into destruction.
+
+I<Example:> of coercion to death
+
+
+ Mail::Box::Message::Destructed->coerce($folder->message(1));
+ $folder->message(1)->destruct;  # same
+
+ my $msg = $folder->message(1);
+ Mail::Box::Message::Destructed->coerce($msg);
+ $msg->destruct;                 # same
+
+=back
+
+Mail::Box::Message::Destructed-E<gt>B<new>(MESSAGE-ID, OPTIONS)
+
+=over 4
+
+You cannot instantiate a destructed message object.  Destruction is
+done by calling L<Mail::Box::Message::destruct()|Mail::Box::Message/"Cleanup">.
+
+ Option      Defined in       Default                                                       
+ body        L<Mail::Message>  undef                                                         
+ body_type   L<Mail::Box::Message>  <from folder>                                                 
+ deleted     L<Mail::Message>  <false>                                                       
+ field_type  L<Mail::Message>  undef                                                         
+ folder      L<Mail::Box::Message>  <required>                                                    
+ head        L<Mail::Message>  undef                                                         
+ head_type   L<Mail::Message>  L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>
+ labels      L<Mail::Message>  {}                                                            
+ log         L<Mail::Reporter>  C<'WARNINGS'>                                                 
+ messageId   L<Mail::Message>  undef                                                         
+ modified    L<Mail::Message>  <false>                                                       
+ size        L<Mail::Box::Message>  undef                                                         
+ trace       L<Mail::Reporter>  C<'WARNINGS'>                                                 
+ trusted     L<Mail::Message>  <false>                                                       
+
+. body OBJECT
+
+. body_type CODE|CLASS
+
+. deleted BOOLEAN
+
+. field_type CLASS
+
+. folder FOLDER
+
+. head OBJECT
+
+. head_type CLASS
+
+. labels ARRAY|HASH
+
+. log LEVEL
+
+. messageId STRING
+
+. modified BOOLEAN
+
+. size INTEGER
+
+. trace LEVEL
+
+. trusted BOOLEAN
+
+=back
+
+=head2 Constructing a message
+
+
+$obj-E<gt>B<bounce>([RG-OBJECT|OPTIONS])
+
+=over 4
+
+See L<Mail::Message::Construct::Bounce/"Constructing a message">
+
+=back
+
+Mail::Box::Message::Destructed-E<gt>B<build>([MESSAGE|BODY], CONTENT)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+Mail::Box::Message::Destructed-E<gt>B<buildFromBody>(BODY, [HEAD], HEADERS)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forward>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardAttach>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardEncapsulate>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardInline>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardNo>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPostlude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPrelude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardSubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+Mail::Box::Message::Destructed-E<gt>B<read>(FILEHANDLE|SCALAR|REF-SCALAR|ARRAY-OF-LINES, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Read/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<rebuild>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<reply>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replyPrelude>([STRING|FIELD|ADDRESS|ARRAY-OF-THINGS])
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replySubject>(STRING)
+
+Mail::Box::Message::Destructed-E<gt>B<replySubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+=head2 The Message
+
+
+$obj-E<gt>B<container>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isDummy>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isPart>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<messageId>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<send>([MAILER], OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<toplevel>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<write>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<bcc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<cc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<date>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<destinations>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<from>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<get>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<guessTimestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<head>([HEAD])
+
+=over 4
+
+When C<undef> is specified for HEAD, no change has to take place and
+the method returns silently.  In all other cases, this method will
+complain that the header has been removed.
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<sender>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<study>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<subject>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<timestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<to>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+=head2 The body
+
+
+$obj-E<gt>B<body>([BODY])
+
+=over 4
+
+When C<undef> is specified for BODY, no change has to take place and
+the method returns silently.  In all other cases, this method will
+complain that the body data has been removed.
+
+=back
+
+$obj-E<gt>B<decoded>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<encode>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isNested>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<parts>(['ALL'|'ACTIVE'|'DELETED'|'RECURSE'|FILTER])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+=head2 Flags
+
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<deleted>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isDeleted>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<label>(LABEL|PAIRS)
+
+=over 4
+
+It is possible to delete a destructed message, but not to undelete it.
+
+=back
+
+$obj-E<gt>B<labels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<labelsToStatus>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<statusToLabels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+=head2 The whole message as text
+
+
+$obj-E<gt>B<file>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<lines>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<printStructure>([FILEHANDLE][, INDENT])
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+=head2 The message
+
+
+$obj-E<gt>B<copyTo>(FOLDER)
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<folder>([FOLDER])
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<moveTo>(FOLDER)
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<seqnr>([INTEGER])
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<diskDelete>
+
+=over 4
+
+See L<Mail::Box::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readBody>(PARSER, HEAD [, BODYTYPE])
+
+=over 4
+
+See L<Mail::Box::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readFromParser>(PARSER, [BODYTYPE])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readHead>(PARSER [,CLASS])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<recursiveRebuildPart>(PART, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Internals">
+
+=back
+
+$obj-E<gt>B<storeBody>(BODY)
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<takeMessageId>([STRING])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Message::Construct/"METHODS">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Message::Destructed-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Message::Destructed-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Message::Destructed-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortSize>([VALUE])
+
+Mail::Box::Message::Destructed-E<gt>B<shortSize>([VALUE])
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortString>
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<destruct>
+
+=over 4
+
+See L<Mail::Box::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot coerce a (class) into destruction
+
+Only real L<Mail::Box::Message|Mail::Box::Message> objects can get destructed into
+L<Mail::Box::Message::Destructed|Mail::Box::Message::Destructed> objects.  L<Mail::Message|Mail::Message> free
+their memory immediately when the last reference is lost.
+
+I<Error:> Cannot include forward source as $include.
+
+Unknown alternative for the L<forward(include)|Mail::Message::Construct::Forward/"Constructing a message">.  Valid choices are
+C<NO>, C<INLINE>, C<ATTACH>, and C<ENCAPSULATE>.
+
+I<Error:> Cannot include reply source as $include.
+
+Unknown alternative for the C<include> option of L<reply()|Mail::Message::Construct::Reply/"Constructing a message">.  Valid
+choices are C<NO>, C<INLINE>, and C<ATTACH>.
+
+I<Error:> Destructed message has no labels except 'deleted'
+
+
+I<Error:> Destructed messages can not be undeleted
+
+Once a message is destructed, it can not be revived.  Destruction is an
+optimization in memory usage: if you need an undelete functionality, then
+you can not use L<Mail::Box::Message::destruct()|Mail::Box::Message/"Cleanup">.
+
+I<Error:> No address to create forwarded to.
+
+If a forward message is created, a destination address must be specified.
+
+I<Error:> No default mailer found to send message.
+
+The message L<send()|Mail::Message/"The Message"> mechanism had not enough information to automatically
+find a mail transfer agent to sent this message.  Specify a mailer
+explicitly using the C<via> options.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> You cannot instantiate a destructed message
+
+You cannot instantiate a destructed message object directly.  Destruction
+is done by calling L<Mail::Box::Message::destruct()|Mail::Box::Message/"Cleanup"> on any existing
+folder message.
+
+I<Error:> You cannot take the head/body of a destructed message
+
+The message originated from a folder, but its memory has been freed-up
+forcefully by means of L<Mail::Box::Message::destruct()|Mail::Box::Message/"Cleanup">.  Apparently,
+your program still tries to get to the header or body data after this
+destruction, which is not possible.
+
+I<Error:> forwardAttach requires a preamble object
+
+
+I<Error:> forwardEncapsulate requires a preamble object
+
+
+I<Error:> no rebuild rule $name defined.
+
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Message.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Message.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Message.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,143 @@
+
+use strict;
+use warnings;
+
+package Mail::Box::Message;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message';
+
+use Date::Parse;
+use Scalar::Util 'weaken';
+
+
+sub init($)
+{   my ($self, $args) = @_;
+    $self->SUPER::init($args);
+
+    $self->{MBM_body_type}  = $args->{body_type}
+        if exists $args->{body_type};
+
+    $self->{MBM_folder}     = $args->{folder};
+    weaken($self->{MBM_folder});
+
+    return $self if $self->isDummy;
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub coerce($)
+{   my ($class, $message) = @_;
+    return bless $message, $class
+        if $message->isa(__PACKAGE__);
+
+    $class->SUPER::coerce($message);
+}
+
+#-------------------------------------------
+
+sub head(;$)
+{   my $self  = shift;
+    return $self->SUPER::head unless @_;
+
+    my $new   = shift;
+    my $old   = $self->head;
+    $self->SUPER::head($new);
+
+    return unless defined $new || defined $old;
+
+    my $folder = $self->folder
+        or return $new;
+
+    if(!defined $new && defined $old && !$old->isDelayed)
+    {   $folder->messageId($self->messageId, undef);
+        $folder->toBeUnthreaded($self);
+    }
+    elsif(defined $new && !$new->isDelayed)
+    {   $folder->messageId($self->messageId, $self);
+        $folder->toBeThreaded($self);
+    }
+
+    $new || $old;
+}
+
+#-------------------------------------------
+
+
+sub folder(;$)
+{   my $self = shift;
+    if(@_)
+    {   $self->{MBM_folder} = shift;
+        weaken($self->{MBM_folder});
+        $self->modified(1);
+    }
+    $self->{MBM_folder};
+}
+
+#-------------------------------------------
+
+
+sub seqnr(;$)
+{   my $self = shift;
+    @_ ? $self->{MBM_seqnr} = shift : $self->{MBM_seqnr};
+}
+
+#-------------------------------------------
+
+
+sub copyTo($)
+{   my ($self, $folder) = @_;
+    $folder->addMessage($self->clone);
+}
+
+#-------------------------------------------
+
+
+sub moveTo($)
+{   my ($self, $folder) = @_;
+    my $added = $folder->addMessage($self->clone);
+    $self->label(deleted => 1);
+    $added;
+}
+
+#-------------------------------------------
+
+
+sub readBody($$;$)
+{   my ($self, $parser, $head, $getbodytype) = @_;
+
+    unless($getbodytype)
+    {   my $folder   = $self->{MBM_folder};
+        $getbodytype = sub {$folder->determineBodyType(@_)};
+    }
+
+    $self->SUPER::readBody($parser, $head, $getbodytype);
+}
+
+#-------------------------------------------
+
+
+sub diskDelete() { shift }
+
+#-------------------------------------------
+
+sub forceLoad() {   # compatibility
+   my $self = shift;
+   $self->loadBody(@_);
+   $self;
+}
+
+#-------------------------------------------
+
+
+sub destruct()
+{   require Mail::Box::Message::Destructed;
+    Mail::Box::Message::Destructed->coerce(shift);
+}
+
+#-------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Message.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Message.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Message.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,963 @@
+
+=head1 NAME
+
+Mail::Box::Message - manage one message within a mail-folder
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Message
+   is a Mail::Message
+   is a Mail::Reporter
+
+ Mail::Box::Message is extended by
+   Mail::Box::Dir::Message
+   Mail::Box::File::Message
+   Mail::Box::Message::Destructed
+   Mail::Box::Net::Message
+
+
+=head1 SYNOPSIS
+
+ # Usually these message objects are created indirectly
+ use Mail::Box::Manager;
+ my $manager = Mail::Box::Manager->new;
+ my $folder  = $manager->open(folder => 'Mail/Drafts');
+ my $msg     = $folder->message(1);
+ $msg->delete;
+ $msg->size;   # and much more
+
+
+=head1 DESCRIPTION
+
+These pages do only describe methods which relate to folders.  If you
+access the knowledge of a message, then read L<Mail::Message|Mail::Message>.
+
+During its life, a message will pass through certain stages.  These
+stages were introduced to reduce the access-time to the folder.  Changing
+from stage, the message's body and head objects may change.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message/"Constructors">
+
+=back
+
+Mail::Box::Message-E<gt>B<coerce>(MESSAGE)
+
+=over 4
+
+Coerce a message to be included in a folder.  The folder itself
+is not specified, but the type of the message is transformed correctly.
+The coerced version of the message is returned.  When no changes had
+to be made, the original message is returned.
+
+=back
+
+Mail::Box::Message-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option      Defined in       Default                                                       
+ body        L<Mail::Message>  undef                                                         
+ body_type                    <from folder>                                                 
+ deleted     L<Mail::Message>  <false>                                                       
+ field_type  L<Mail::Message>  undef                                                         
+ folder                       <required>                                                    
+ head        L<Mail::Message>  undef                                                         
+ head_type   L<Mail::Message>  L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>
+ labels      L<Mail::Message>  {}                                                            
+ log         L<Mail::Reporter>  C<'WARNINGS'>                                                 
+ messageId   L<Mail::Message>  undef                                                         
+ modified    L<Mail::Message>  <false>                                                       
+ size                         undef                                                         
+ trace       L<Mail::Reporter>  C<'WARNINGS'>                                                 
+ trusted     L<Mail::Message>  <false>                                                       
+
+. body OBJECT
+
+. body_type CODE|CLASS
+
+=over 4
+
+If the body of a message is used delay-loaded, the message must what type
+of message to become when it finally gets parsed.  The folder which is
+delaying the load must specify the algorithm to determine that type.
+
+=back
+
+. deleted BOOLEAN
+
+. field_type CLASS
+
+. folder FOLDER
+
+=over 4
+
+The folder where this message appeared in.  The argument is
+an instance of (a sub-class of) a L<Mail::Box|Mail::Box>.
+
+=back
+
+. head OBJECT
+
+. head_type CLASS
+
+. labels ARRAY|HASH
+
+. log LEVEL
+
+. messageId STRING
+
+. modified BOOLEAN
+
+. size INTEGER
+
+=over 4
+
+The size of the message, which includes head and body, but without the
+message separators which may be used by the folder type.
+
+=back
+
+. trace LEVEL
+
+. trusted BOOLEAN
+
+=back
+
+=head2 Constructing a message
+
+
+$obj-E<gt>B<bounce>([RG-OBJECT|OPTIONS])
+
+=over 4
+
+See L<Mail::Message::Construct::Bounce/"Constructing a message">
+
+=back
+
+Mail::Box::Message-E<gt>B<build>([MESSAGE|BODY], CONTENT)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+Mail::Box::Message-E<gt>B<buildFromBody>(BODY, [HEAD], HEADERS)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forward>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardAttach>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardEncapsulate>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardInline>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardNo>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPostlude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPrelude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardSubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+Mail::Box::Message-E<gt>B<read>(FILEHANDLE|SCALAR|REF-SCALAR|ARRAY-OF-LINES, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Read/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<rebuild>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<reply>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replyPrelude>([STRING|FIELD|ADDRESS|ARRAY-OF-THINGS])
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replySubject>(STRING)
+
+Mail::Box::Message-E<gt>B<replySubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+=head2 The Message
+
+
+$obj-E<gt>B<container>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isDummy>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isPart>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<messageId>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<send>([MAILER], OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<toplevel>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<write>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<bcc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<cc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<date>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<destinations>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<from>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<get>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<guessTimestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<head>([HEAD])
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<sender>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<study>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<subject>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<timestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<to>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+=head2 The body
+
+
+$obj-E<gt>B<body>([BODY])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<decoded>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<encode>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isNested>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<parts>(['ALL'|'ACTIVE'|'DELETED'|'RECURSE'|FILTER])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+=head2 Flags
+
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<deleted>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isDeleted>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<label>(LABEL|PAIRS)
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<labels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<labelsToStatus>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<statusToLabels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+=head2 The whole message as text
+
+
+$obj-E<gt>B<file>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<lines>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<printStructure>([FILEHANDLE][, INDENT])
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+=head2 The message
+
+
+$obj-E<gt>B<copyTo>(FOLDER)
+
+=over 4
+
+Copy the message to the indicated opened FOLDER, without deleting the
+original.  The coerced message (the copy in the desitnation folder) is
+returned.
+
+I<Example:> 
+
+ my $draft = $mgr->open(folder => 'Draft');
+ $message->copyTo($draft);
+
+=back
+
+$obj-E<gt>B<folder>([FOLDER])
+
+=over 4
+
+In with folder did we detect this message/dummy?  This is a reference
+to the folder-object.
+
+=back
+
+$obj-E<gt>B<moveTo>(FOLDER)
+
+=over 4
+
+Move the message from this folder to the FOLDER specified.  This will
+create a copy using L<clone()|Mail::Message/"Constructors"> first, and flag this original message
+to be deleted.  So until the source folder is closed, two copies of
+the message stay in memory.  The newly created message (part of the
+destination folder) is returned.
+
+=back
+
+$obj-E<gt>B<seqnr>([INTEGER])
+
+=over 4
+
+Get the number of this message is the current folder.  It starts counting
+from zero.  Do not change the number.
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<diskDelete>
+
+=over 4
+
+Remove a message from disk.  This is not from the folder, but everything
+else, like parts of the message which are stored outside from the
+folder.
+
+=back
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readBody>(PARSER, HEAD [, BODYTYPE])
+
+=over 4
+
+Read the body of one message.  The PARSER gives access to the folder file.
+The HEAD has been read with L<readHead()|Mail::Message/"Internals">.  The optional BODYTYPE supplies
+the class name of the body to be created, or a code reference to a
+routine which can produce a body type based on the head (passed as
+first argument).
+
+By default, the BODYTYPE will call L<Mail::Box::determineBodyType()|Mail::Box/"Internals">
+where the message will be added to.
+
+=back
+
+$obj-E<gt>B<readFromParser>(PARSER, [BODYTYPE])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readHead>(PARSER [,CLASS])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<recursiveRebuildPart>(PART, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Internals">
+
+=back
+
+$obj-E<gt>B<storeBody>(BODY)
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<takeMessageId>([STRING])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Message::Construct/"METHODS">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Message-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Message-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Message-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortSize>([VALUE])
+
+Mail::Box::Message-E<gt>B<shortSize>([VALUE])
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortString>
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<destruct>
+
+=over 4
+
+Removes most of the memory occupied by the message by detaching the header
+and body.  Then, the object changes into a L<Mail::Box::Message::Destructed|Mail::Box::Message::Destructed>
+which will catch all attempts to access the header and body.  Be careful
+with the usage of this method.
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot include forward source as $include.
+
+Unknown alternative for the L<forward(include)|Mail::Message::Construct::Forward/"Constructing a message">.  Valid choices are
+C<NO>, C<INLINE>, C<ATTACH>, and C<ENCAPSULATE>.
+
+I<Error:> Cannot include reply source as $include.
+
+Unknown alternative for the C<include> option of L<reply()|Mail::Message::Construct::Reply/"Constructing a message">.  Valid
+choices are C<NO>, C<INLINE>, and C<ATTACH>.
+
+I<Error:> No address to create forwarded to.
+
+If a forward message is created, a destination address must be specified.
+
+I<Error:> No default mailer found to send message.
+
+The message L<send()|Mail::Message/"The Message"> mechanism had not enough information to automatically
+find a mail transfer agent to sent this message.  Specify a mailer
+explicitly using the C<via> options.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> forwardAttach requires a preamble object
+
+
+I<Error:> forwardEncapsulate requires a preamble object
+
+
+I<Error:> no rebuild rule $name defined.
+
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Net/Message.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Net/Message.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Net/Message.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,93 @@
+
+use strict;
+use warnings;
+
+package Mail::Box::Net::Message;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box::Message';
+
+use File::Copy;
+use Carp;
+
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    $self->SUPER::init($args);
+
+    $self->unique($args->{unique});
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub unique(;$)
+{   my $self = shift;
+    @_ ? $self->{MBNM_unique} = shift : $self->{MBNM_unique};
+}
+
+#-------------------------------------------
+
+
+#-------------------------------------------
+
+sub loadHead()
+{   my $self     = shift;
+    my $head     = $self->head;
+    return $head unless $head->isDelayed;
+
+    my $folder   = $self->folder;
+    $folder->lazyPermitted(1);
+
+    my $parser   = $self->parser or return;
+    $self->readFromParser($parser);
+
+    $folder->lazyPermitted(0);
+
+    $self->log(PROGRESS => 'Loaded delayed head.');
+    $self->head;
+}
+
+#-------------------------------------------
+
+
+sub loadBody()
+{   my $self     = shift;
+
+    my $body     = $self->body;
+    return $body unless $body->isDelayed;
+
+    my $head     = $self->head;
+    my $parser   = $self->parser or return;
+
+    if($head->isDelayed)
+    {   $head = $self->readHead($parser);
+        if(defined $head)
+        {   $self->log(PROGRESS => 'Loaded delayed head.');
+            $self->head($head);
+        }
+        else
+        {   $self->log(ERROR => 'Unable to read delayed head.');
+            return;
+        }
+    }
+    else
+    {   my ($begin, $end) = $body->fileLocation;
+        $parser->filePosition($begin);
+    }
+
+    my $newbody  = $self->readBody($parser, $head);
+    unless(defined $newbody)
+    {   $self->log(ERROR => 'Unable to read delayed body.');
+        return;
+    }
+
+    $self->log(PROGRESS => 'Loaded delayed body.');
+    $self->storeBody($newbody->contentInfoFrom($head));
+}
+
+#-------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Net/Message.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Net/Message.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Net/Message.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,935 @@
+
+=head1 NAME
+
+Mail::Box::Net::Message - one message from a distant folder
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Net::Message
+   is a Mail::Box::Message
+   is a Mail::Message
+   is a Mail::Reporter
+
+ Mail::Box::Net::Message is extended by
+   Mail::Box::IMAP4::Message
+   Mail::Box::POP3::Message
+
+
+=head1 SYNOPSIS
+
+ my $folder = new Mail::Box::POP3 ...
+ my $message = $folder->message(10);
+
+
+=head1 DESCRIPTION
+
+A L<Mail::Box::Net::Message|Mail::Box::Net::Message> represents one message in a folder which
+can only be accessed via some kind of protocol.  On this moment, only
+a POP3 client is available.  IMAP, DBI, and NNTP are other candidates.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message/"Constructors">
+
+=back
+
+Mail::Box::Net::Message-E<gt>B<coerce>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box::Message/"METHODS">
+
+=back
+
+Mail::Box::Net::Message-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option      Defined in       Default                                                       
+ body        L<Mail::Message>  undef                                                         
+ body_type   L<Mail::Box::Message>  <from folder>                                                 
+ deleted     L<Mail::Message>  <false>                                                       
+ field_type  L<Mail::Message>  undef                                                         
+ folder      L<Mail::Box::Message>  <required>                                                    
+ head        L<Mail::Message>  undef                                                         
+ head_type   L<Mail::Message>  L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>
+ labels      L<Mail::Message>  {}                                                            
+ log         L<Mail::Reporter>  C<'WARNINGS'>                                                 
+ messageId   L<Mail::Message>  undef                                                         
+ modified    L<Mail::Message>  <false>                                                       
+ size        L<Mail::Box::Message>  undef                                                         
+ trace       L<Mail::Reporter>  C<'WARNINGS'>                                                 
+ trusted     L<Mail::Message>  <false>                                                       
+ unique                       <unique string>                                               
+
+. body OBJECT
+
+. body_type CODE|CLASS
+
+. deleted BOOLEAN
+
+. field_type CLASS
+
+. folder FOLDER
+
+. head OBJECT
+
+. head_type CLASS
+
+. labels ARRAY|HASH
+
+. log LEVEL
+
+. messageId STRING
+
+. modified BOOLEAN
+
+. size INTEGER
+
+. trace LEVEL
+
+. trusted BOOLEAN
+
+. unique STRING
+
+=over 4
+
+The unique keys which identifies this message on the remote server.
+
+=back
+
+=back
+
+=head2 Constructing a message
+
+
+$obj-E<gt>B<bounce>([RG-OBJECT|OPTIONS])
+
+=over 4
+
+See L<Mail::Message::Construct::Bounce/"Constructing a message">
+
+=back
+
+Mail::Box::Net::Message-E<gt>B<build>([MESSAGE|BODY], CONTENT)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+Mail::Box::Net::Message-E<gt>B<buildFromBody>(BODY, [HEAD], HEADERS)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forward>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardAttach>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardEncapsulate>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardInline>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardNo>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPostlude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPrelude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardSubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+Mail::Box::Net::Message-E<gt>B<read>(FILEHANDLE|SCALAR|REF-SCALAR|ARRAY-OF-LINES, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Read/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<rebuild>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<reply>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replyPrelude>([STRING|FIELD|ADDRESS|ARRAY-OF-THINGS])
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replySubject>(STRING)
+
+Mail::Box::Net::Message-E<gt>B<replySubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+=head2 The Message
+
+
+$obj-E<gt>B<container>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isDummy>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isPart>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<messageId>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<send>([MAILER], OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<toplevel>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<write>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<bcc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<cc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<date>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<destinations>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<from>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<get>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<guessTimestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<head>([HEAD])
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<sender>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<study>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<subject>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<timestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<to>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+=head2 The body
+
+
+$obj-E<gt>B<body>([BODY])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<decoded>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<encode>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isNested>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<parts>(['ALL'|'ACTIVE'|'DELETED'|'RECURSE'|FILTER])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+=head2 Flags
+
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<deleted>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isDeleted>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<label>(LABEL|PAIRS)
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<labels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<labelsToStatus>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<statusToLabels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+=head2 The whole message as text
+
+
+$obj-E<gt>B<file>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<lines>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<printStructure>([FILEHANDLE][, INDENT])
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+=head2 The message
+
+
+$obj-E<gt>B<copyTo>(FOLDER)
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<folder>([FOLDER])
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<moveTo>(FOLDER)
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<seqnr>([INTEGER])
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<unique>([STRING|undef])
+
+=over 4
+
+Returns the name of the file in which this message is actually stored.  This
+will return C<undef> when the message is not stored in a file.  When a STRING
+is specified, a new identifier is stored first.
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<diskDelete>
+
+=over 4
+
+See L<Mail::Box::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<loadBody>
+
+=over 4
+
+=back
+
+$obj-E<gt>B<readBody>(PARSER, HEAD [, BODYTYPE])
+
+=over 4
+
+See L<Mail::Box::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readFromParser>(PARSER, [BODYTYPE])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readHead>(PARSER [,CLASS])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<recursiveRebuildPart>(PART, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Internals">
+
+=back
+
+$obj-E<gt>B<storeBody>(BODY)
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<takeMessageId>([STRING])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Message::Construct/"METHODS">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Net::Message-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Net::Message-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Net::Message-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortSize>([VALUE])
+
+Mail::Box::Net::Message-E<gt>B<shortSize>([VALUE])
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortString>
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<destruct>
+
+=over 4
+
+See L<Mail::Box::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot include forward source as $include.
+
+Unknown alternative for the L<forward(include)|Mail::Message::Construct::Forward/"Constructing a message">.  Valid choices are
+C<NO>, C<INLINE>, C<ATTACH>, and C<ENCAPSULATE>.
+
+I<Error:> Cannot include reply source as $include.
+
+Unknown alternative for the C<include> option of L<reply()|Mail::Message::Construct::Reply/"Constructing a message">.  Valid
+choices are C<NO>, C<INLINE>, and C<ATTACH>.
+
+I<Error:> No address to create forwarded to.
+
+If a forward message is created, a destination address must be specified.
+
+I<Error:> No default mailer found to send message.
+
+The message L<send()|Mail::Message/"The Message"> mechanism had not enough information to automatically
+find a mail transfer agent to sent this message.  Specify a mailer
+explicitly using the C<via> options.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Unable to read delayed body.
+
+
+I<Error:> Unable to read delayed head.
+
+
+I<Error:> forwardAttach requires a preamble object
+
+
+I<Error:> forwardEncapsulate requires a preamble object
+
+
+I<Error:> no rebuild rule $name defined.
+
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Net.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Net.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Net.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,88 @@
+
+use strict;
+package Mail::Box::Net;
+use vars '$VERSION';
+$VERSION = '2.055';
+
+use base 'Mail::Box';
+
+use Mail::Box::Net::Message;
+
+use Mail::Message::Body::Lines;
+use Mail::Message::Body::File;
+use Mail::Message::Body::Delayed;
+use Mail::Message::Body::Multipart;
+
+use Mail::Message::Head;
+use Mail::Message::Head::Delayed;
+
+use Carp;
+use File::Copy;
+use File::Spec;
+use File::Basename;
+
+
+sub init($)
+{   my ($self, $args)     = @_;
+
+    $args->{lock_type}  ||= 'NONE';
+    $args->{body_type}  ||= 'Mail::Message::Body::Lines';
+    $args->{folder}     ||= '/';
+    $args->{trusted}    ||= 0;
+
+    $self->SUPER::init($args);
+
+    $self->{MBN_username} = $args->{username};
+    $self->{MBN_password} = $args->{password};
+    $self->{MBN_hostname} = $args->{server_name};
+    $self->{MBN_port}     = $args->{server_port};
+
+    $self->log(WARNING => "The term 'hostname' is confusing wrt folder. You probably need 'server_name'")
+         if exists $args->{hostname};
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub create(@) {shift->notImplemented}
+
+#-------------------------------------------
+
+
+sub folderdir(;$) { undef }
+
+#-------------------------------------------
+
+sub organization() { 'REMOTE' }
+
+#-------------------------------------------
+
+sub url()
+{   my $self = shift;
+
+    my ($user, $pass, $host, $port)
+       = @$self{ qw/MBN_username MBN_password MBN_hostname MBN_port/ };
+
+    my $perm = '';
+    $perm    = $user if defined $user;
+    if(defined $pass)
+    {   $pass  =~ s/(\W)/sprintf "%%%02X", ord $1/ge;
+        $perm .= ':'.$pass;
+    }
+
+    $perm   .= '@'       if length $perm;
+
+    my $loc  = $host;
+    $loc    .= ':'.$port if length $port;
+
+    my $name = $self->name;
+    $loc    .= '/'.$name if $name ne '/';
+    
+    $self->type . '://' . $perm . $loc;
+}
+
+#-------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Net.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Net.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Net.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,788 @@
+
+=head1 NAME
+
+Mail::Box::Net - handle folders which are stored remote.
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Net
+   is a Mail::Box
+   is a Mail::Reporter
+
+ Mail::Box::Net is extended by
+   Mail::Box::IMAP4
+   Mail::Box::POP3
+
+
+=head1 SYNOPSIS
+
+ # Do not instantiate this object directly
+
+
+=head1 DESCRIPTION
+
+At the moment, this object is extended by
+
+=over 4
+
+=item * L<Mail::Box::POP3|Mail::Box::POP3>
+
+Implements the POP3 protocol.
+
+=item * L<Mail::Box::IMAP4|Mail::Box::IMAP4>
+
+Implements the IMAP4 protocol.  B<UNDER DEVELOPMENT>
+
+=back
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+overload: B<@{}>
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+overload: B<cmp>
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<create>(FOLDER, OPTIONS)
+
+Mail::Box::Net-E<gt>B<create>(FOLDER, OPTIONS)
+
+=over 4
+
+Create a new folder on the remote server.
+
+ Option     Defined in    Default   
+ folderdir  L<Mail::Box>  <not used>
+
+. folderdir DIRECTORY
+
+=back
+
+Mail::Box::Net-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option             Defined in       Default                                                         
+ access             L<Mail::Box>     C<'r'>                                                          
+ body_delayed_type  L<Mail::Box>     L<Mail::Message::Body::Delayed|Mail::Message::Body::Delayed>    
+ body_type          L<Mail::Box>     L<Mail::Message::Body::Lines|Mail::Message::Body::Lines>        
+ coerce_options     L<Mail::Box>     C<[]>                                                           
+ create             L<Mail::Box>     <false>                                                         
+ extract            L<Mail::Box>     C<10240>                                                        
+ field_type         L<Mail::Box>     undef                                                           
+ fix_headers        L<Mail::Box>     <false>                                                         
+ folder             L<Mail::Box>     C<'/'>                                                          
+ folderdir          L<Mail::Box>     <not used>                                                      
+ head_delayed_type  L<Mail::Box>     L<Mail::Message::Head::Delayed|Mail::Message::Head::Delayed>    
+ head_type          L<Mail::Box>     L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>  
+ keep_dups          L<Mail::Box>     <false>                                                         
+ lock_file          L<Mail::Box>     undef                                                           
+ lock_timeout       L<Mail::Box>     1 hour                                                          
+ lock_type          L<Mail::Box>     C<'NONE'>                                                       
+ lock_wait          L<Mail::Box>     10 seconds                                                      
+ locker             L<Mail::Box>     undef                                                           
+ log                L<Mail::Reporter>  C<'WARNINGS'>                                                   
+ manager            L<Mail::Box>     undef                                                           
+ message_type       L<Mail::Box>     L<Mail::Box::Message|Mail::Box::Message>                        
+ multipart_type     L<Mail::Box>     L<Mail::Message::Body::Multipart|Mail::Message::Body::Multipart>
+ password                            undef                                                           
+ remove_when_empty  L<Mail::Box>     <false>                                                         
+ save_on_exit       L<Mail::Box>     <true>                                                          
+ server_name                         undef                                                           
+ server_port                         undef                                                           
+ trace              L<Mail::Reporter>  C<'WARNINGS'>                                                   
+ trusted            L<Mail::Box>     <false>                                                         
+ username                            undef                                                           
+
+. access MODE
+
+. body_delayed_type CLASS
+
+. body_type CLASS|CODE
+
+. coerce_options ARRAY
+
+. create BOOLEAN
+
+. extract INTEGER | CODE | METHOD | 'LAZY'|'ALWAYS'
+
+. field_type CLASS
+
+. fix_headers BOOLEAN
+
+. folder FOLDERNAME
+
+. folderdir DIRECTORY
+
+. head_delayed_type CLASS
+
+. head_type CLASS
+
+. keep_dups BOOLEAN
+
+. lock_file FILENAME
+
+. lock_timeout SECONDS
+
+. lock_type CLASS|STRING|ARRAY
+
+. lock_wait SECONDS
+
+. locker OBJECT
+
+. log LEVEL
+
+. manager MANAGER
+
+. message_type CLASS
+
+. multipart_type CLASS
+
+. password STRING
+
+=over 4
+
+The password which is required to contact the remote server.
+
+=back
+
+. remove_when_empty BOOLEAN
+
+. save_on_exit BOOLEAN
+
+. server_name HOSTNAME
+
+=over 4
+
+The name of the host which contains the remote mail server.
+
+=back
+
+. server_port INTEGER
+
+=over 4
+
+Port number in use by the server application.
+
+=back
+
+. trace LEVEL
+
+. trusted BOOLEAN
+
+. username STRING
+
+=over 4
+
+The username which is to be used for the remote server.
+
+=back
+
+=back
+
+=head2 The folder
+
+
+$obj-E<gt>B<addMessage>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<addMessages>(MESSAGE [, MESSAGE, ...])
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+Mail::Box::Net-E<gt>B<appendMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<close>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<copyTo>(FOLDER, OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<folderdir>([DIRECTORY])
+
+=over 4
+
+Not applicatable for folders on a remote server, so will always return
+the C<undef>.
+
+=back
+
+Mail::Box::Net-E<gt>B<foundIn>([FOLDERNAME], OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<organization>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<type>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<update>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<url>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+=head2 Folder flags
+
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+$obj-E<gt>B<writable>
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+=head2 The messages
+
+
+$obj-E<gt>B<current>([NUMBER|MESSAGE|MESSAGE-ID])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<find>(MESSAGE-ID)
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<findFirstLabeled>(LABEL, [BOOLEAN, [ARRAY-OF-MSGS]])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<message>(INDEX [,MESSAGE])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messageId>(MESSAGE-ID [,MESSAGE])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messageIds>
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messages>(['ALL',RANGE,'ACTIVE','DELETED',LABEL,!LABEL,FILTER])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<scanForMessages>(MESSAGE, MESSAGE-IDS, TIMESPAN, WINDOW)
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+=head2 Sub-folders
+
+
+$obj-E<gt>B<listSubFolders>(OPTIONS)
+
+Mail::Box::Net-E<gt>B<listSubFolders>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+$obj-E<gt>B<nameOfSubFolder>(NAME)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+$obj-E<gt>B<openRelatedFolder>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+$obj-E<gt>B<openSubFolder>(NAME, OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<coerce>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<determineBodyType>(MESSAGE, HEAD)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<lineSeparator>([STRING|'CR'|'LF'|'CRLF'])
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<locker>
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<read>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<readMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<storeMessage>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<toBeThreaded>(MESSAGES)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<toBeUnthreaded>(MESSAGES)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<updateMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<write>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<writeMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+=head2 Other methods
+
+
+$obj-E<gt>B<timespan2seconds>(TIME)
+
+Mail::Box::Net-E<gt>B<timespan2seconds>(TIME)
+
+=over 4
+
+See L<Mail::Box/"Other methods">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Net-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Net-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Net-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Box/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> Changes not written to read-only folder $self.
+
+You have opened the folder read-only --which is the default set
+by L<new(access)|Mail::Box/"Constructors">--, made modifications, and now want to close it.
+Set L<close(force)|Mail::Box/"The folder"> if you want to overrule the access mode, or close
+the folder with L<close(write)|Mail::Box/"The folder"> set to C<NEVER>.
+
+I<Error:> Copying failed for one message.
+
+For some reason, for instance disc full, removed by external process, or
+read-protection, it is impossible to copy one of the messages.  Copying will
+proceed for the other messages.
+
+I<Error:> Destination folder $name is not writable.
+
+The folder where the messages are copied to is not opened with write
+access (see L<new(access)|Mail::Box/"Constructors">).  This has no relation with write permission
+to the folder which is controled by your operating system.
+
+I<Warning:> Different messages with id $msgid.
+
+The message id is discovered more than once within the same folder, but the
+content of the message seems to be different.  This should not be possible:
+each message must be unique.
+
+I<Error:> Folder $name is opened read-only
+
+You can not write to this folder unless you have opened the folder to
+write or append with L<new(access)|Mail::Box/"Constructors">, or the C<force> option is set true.
+
+I<Error:> Folder $name not deleted: not writable.
+
+The folder must be opened with write access via L<new(access)|Mail::Box/"Constructors">, otherwise
+removing it will be refused.  So, you may have write-access according to
+the operating system, but that will not automatically mean that this
+C<delete> method permits you to.  The reverse remark is valid as well.
+
+I<Error:> Invalid timespan '$timespan' specified.
+
+The string does not follow the strict rules of the time span syntax which
+is permitted as parameter.
+
+I<Warning:> Message-id '$msgid' does not contain a domain.
+
+According to the RFCs, message-ids need to contain a unique random part,
+then an C<@>, and then a domain name.  This is made to avoid the creation
+of two messages with the same id.  The warning emerges when the C<@> is
+missing from the string.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Unable to create subfolder $name of $folder.
+
+The copy includes the subfolders, but for some reason it was not possible
+to copy one of these.  Copying will proceed for all other sub-folders.
+
+I<Error:> Writing folder $name failed
+
+For some reason (you probably got more error messages about this problem)
+it is impossible to write the folder, although you should because there
+were changes made.
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/POP3/Message.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/POP3/Message.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/POP3/Message.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,91 @@
+
+use strict;
+use warnings;
+
+package Mail::Box::POP3::Message;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box::Net::Message';
+
+use File::Copy;
+use Carp;
+
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    $args->{body_type} ||= 'Mail::Message::Body::Lines';
+
+    $self->SUPER::init($args);
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub size($)
+{   my $self = shift;
+    
+    return $self->SUPER::size
+        unless $self->isDelayed;
+
+    $self->folder->popClient->messageSize($self->unique);
+}
+
+#-------------------------------------------
+
+sub label(@)
+{   my $self = shift;
+    $self->loadHead;              # be sure the labels are read
+    return $self->SUPER::label(@_) if @_==1;
+
+    # POP3 can only set 'deleted' in the source folder.  Don't forget
+    my $olddel = $self->label('deleted') ? 1 : 0;
+    my $ret    = $self->SUPER::label(@_);
+    my $newdel = $self->label('deleted') ? 1 : 0;
+
+    $self->folder->popClient->deleted($newdel, $self->unique)
+        if $newdel != $olddel;
+
+    $ret;
+}
+
+#-------------------------------------------
+
+sub labels(@)
+{   my $self = shift;
+    $self->loadHead;              # be sure the labels are read
+    $self->SUPER::labels(@_);
+}
+
+#-------------------------------------------
+
+
+sub loadHead()
+{   my $self     = shift;
+    my $head     = $self->head;
+    return $head unless $head->isDelayed;
+
+    $head        = $self->folder->getHead($self);
+    $self->head($head);
+
+    $self->statusToLabels;  # not supported by al POP3 servers
+    $head;
+}
+
+#-------------------------------------------
+
+sub loadBody()
+{   my $self     = shift;
+
+    my $body     = $self->body;
+    return $body unless $body->isDelayed;
+
+    (my $head, $body) = $self->folder->getHeadAndBody($self);
+    $self->head($head) if $head->isDelayed;
+    $self->storeBody($body);
+}
+
+#-------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/POP3/Message.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/POP3/Message.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/POP3/Message.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,930 @@
+
+=head1 NAME
+
+Mail::Box::POP3::Message - one message on a POP3 server
+
+
+=head1 INHERITANCE
+
+ Mail::Box::POP3::Message
+   is a Mail::Box::Net::Message
+   is a Mail::Box::Message
+   is a Mail::Message
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my $folder = new Mail::Box::POP3 ...
+ my $message = $folder->message(10);
+
+
+=head1 DESCRIPTION
+
+A C<Mail::Box::POP3::Message> represents one message on a POP3 server,
+maintained by a L<Mail::Box::POP3|Mail::Box::POP3> folder. Each message is stored as
+separate entity on the server, and maybe temporarily in your program
+as well.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message/"Constructors">
+
+=back
+
+Mail::Box::POP3::Message-E<gt>B<coerce>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box::Message/"METHODS">
+
+=back
+
+Mail::Box::POP3::Message-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option      Defined in       Default                                                       
+ body        L<Mail::Message>  undef                                                         
+ body_type   L<Mail::Box::Message>  L<Mail::Message::Body::Lines|Mail::Message::Body::Lines>      
+ deleted     L<Mail::Message>  <false>                                                       
+ field_type  L<Mail::Message>  undef                                                         
+ folder      L<Mail::Box::Message>  <required>                                                    
+ head        L<Mail::Message>  undef                                                         
+ head_type   L<Mail::Message>  L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>
+ labels      L<Mail::Message>  {}                                                            
+ log         L<Mail::Reporter>  C<'WARNINGS'>                                                 
+ messageId   L<Mail::Message>  undef                                                         
+ modified    L<Mail::Message>  <false>                                                       
+ size        L<Mail::Box::Message>  undef                                                         
+ trace       L<Mail::Reporter>  C<'WARNINGS'>                                                 
+ trusted     L<Mail::Message>  <false>                                                       
+ unique      L<Mail::Box::Net::Message>  <unique string>                                               
+
+. body OBJECT
+
+. body_type CODE|CLASS
+
+. deleted BOOLEAN
+
+. field_type CLASS
+
+. folder FOLDER
+
+. head OBJECT
+
+. head_type CLASS
+
+. labels ARRAY|HASH
+
+. log LEVEL
+
+. messageId STRING
+
+. modified BOOLEAN
+
+. size INTEGER
+
+. trace LEVEL
+
+. trusted BOOLEAN
+
+. unique STRING
+
+=back
+
+=head2 Constructing a message
+
+
+$obj-E<gt>B<bounce>([RG-OBJECT|OPTIONS])
+
+=over 4
+
+See L<Mail::Message::Construct::Bounce/"Constructing a message">
+
+=back
+
+Mail::Box::POP3::Message-E<gt>B<build>([MESSAGE|BODY], CONTENT)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+Mail::Box::POP3::Message-E<gt>B<buildFromBody>(BODY, [HEAD], HEADERS)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forward>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardAttach>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardEncapsulate>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardInline>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardNo>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPostlude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPrelude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardSubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+Mail::Box::POP3::Message-E<gt>B<read>(FILEHANDLE|SCALAR|REF-SCALAR|ARRAY-OF-LINES, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Read/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<rebuild>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<reply>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replyPrelude>([STRING|FIELD|ADDRESS|ARRAY-OF-THINGS])
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replySubject>(STRING)
+
+Mail::Box::POP3::Message-E<gt>B<replySubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+=head2 The Message
+
+
+$obj-E<gt>B<container>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isDummy>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isPart>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<messageId>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<send>([MAILER], OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+Returns the size of this message.  If the message is still on the remote
+server, POP is used to ask for the size.  When the message is already loaded
+onto the local system, the size of the parsed message is taken.  These
+sizes can differ because the difference in line-ending representation.
+
+=back
+
+$obj-E<gt>B<toplevel>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<write>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<bcc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<cc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<date>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<destinations>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<from>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<get>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<guessTimestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<head>([HEAD])
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<sender>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<study>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<subject>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<timestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<to>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+=head2 The body
+
+
+$obj-E<gt>B<body>([BODY])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<decoded>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<encode>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isNested>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<parts>(['ALL'|'ACTIVE'|'DELETED'|'RECURSE'|FILTER])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+=head2 Flags
+
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<deleted>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isDeleted>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<label>(LABEL|PAIRS)
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<labels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<labelsToStatus>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<statusToLabels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+=head2 The whole message as text
+
+
+$obj-E<gt>B<file>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<lines>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<printStructure>([FILEHANDLE][, INDENT])
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+=head2 The message
+
+
+$obj-E<gt>B<copyTo>(FOLDER)
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<folder>([FOLDER])
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<moveTo>(FOLDER)
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<seqnr>([INTEGER])
+
+=over 4
+
+See L<Mail::Box::Message/"The message">
+
+=back
+
+$obj-E<gt>B<unique>([STRING|undef])
+
+=over 4
+
+See L<Mail::Box::Net::Message/"The message">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<diskDelete>
+
+=over 4
+
+See L<Mail::Box::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<loadBody>
+
+=over 4
+
+See L<Mail::Box::Net::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readBody>(PARSER, HEAD [, BODYTYPE])
+
+=over 4
+
+See L<Mail::Box::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readFromParser>(PARSER, [BODYTYPE])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readHead>(PARSER [,CLASS])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<recursiveRebuildPart>(PART, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Internals">
+
+=back
+
+$obj-E<gt>B<storeBody>(BODY)
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<takeMessageId>([STRING])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Message::Construct/"METHODS">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::POP3::Message-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::POP3::Message-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::POP3::Message-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortSize>([VALUE])
+
+Mail::Box::POP3::Message-E<gt>B<shortSize>([VALUE])
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortString>
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<destruct>
+
+=over 4
+
+See L<Mail::Box::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot include forward source as $include.
+
+Unknown alternative for the L<forward(include)|Mail::Message::Construct::Forward/"Constructing a message">.  Valid choices are
+C<NO>, C<INLINE>, C<ATTACH>, and C<ENCAPSULATE>.
+
+I<Error:> Cannot include reply source as $include.
+
+Unknown alternative for the C<include> option of L<reply()|Mail::Message::Construct::Reply/"Constructing a message">.  Valid
+choices are C<NO>, C<INLINE>, and C<ATTACH>.
+
+I<Error:> No address to create forwarded to.
+
+If a forward message is created, a destination address must be specified.
+
+I<Error:> No default mailer found to send message.
+
+The message L<send()|Mail::Message/"The Message"> mechanism had not enough information to automatically
+find a mail transfer agent to sent this message.  Specify a mailer
+explicitly using the C<via> options.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Unable to read delayed body.
+
+
+I<Error:> Unable to read delayed head.
+
+
+I<Error:> forwardAttach requires a preamble object
+
+
+I<Error:> forwardEncapsulate requires a preamble object
+
+
+I<Error:> no rebuild rule $name defined.
+
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/POP3.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/POP3.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/POP3.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,259 @@
+
+package Mail::Box::POP3;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box::Net';
+
+use strict;
+use warnings;
+
+use Mail::Box::POP3::Message;
+use Mail::Box::Parser::Perl;
+use Mail::Box::FastScalar;
+
+use File::Spec;
+use File::Basename;
+use Carp;
+
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    $args->{server_port} ||= 110;
+
+    $self->SUPER::init($args);
+
+    $self->{MBP_client}    = $args->{pop_client}; 
+    $self->{MBP_auth}      = $args->{authenticate} || 'AUTO';
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub create($@) { undef }         # fails
+
+#-------------------------------------------
+
+sub foundIn(@)
+{   my $self = shift;
+    unshift @_, 'folder' if @_ % 2;
+    my %options = @_;
+
+       (exists $options{type}   && lc $options{type} eq 'pop3')
+    || (exists $options{folder} && $options{folder} =~ m/^pop/);
+}
+
+#-------------------------------------------
+
+
+sub addMessage($)
+{   my ($self, $message) = @_;
+
+    $self->log(ERROR => "You cannot write a message to a pop server (yet)")
+       if defined $message;
+
+    undef;
+}
+
+#-------------------------------------------
+
+
+sub addMessages(@)
+{   my $self = shift;
+
+    # error message described in addMessage()
+    $self->log(ERROR => "You cannot write messages to a pop server (yet)")
+        if @_;
+
+    ();
+}
+
+#-------------------------------------------
+
+sub type() {'pop3'}
+
+#-------------------------------------------
+
+sub close()
+{   my $self = shift;
+
+    if(my $pop = delete $self->{MBP_client})
+    {   $pop->disconnect;
+    }
+
+    $self->SUPER::close;
+}
+
+#-------------------------------------------
+
+
+sub delete()
+{   my $self = shift;
+    $self->log(NOTICE =>
+        "A POP3 folder cannot be deleted: it will be emptied.");
+
+    $_->label(deleted => 1) foreach $self->messages;
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub listSubFolders(@) { () }     # no
+
+#-------------------------------------------
+
+
+sub openSubFolder($@) { undef }  # fails
+
+#-------------------------------------------
+
+
+sub update() {shift->notImplemented}
+
+#-------------------------------------------
+
+
+sub popClient()
+{   my $self = shift;
+
+    return $self->{MBP_client}
+        if defined $self->{MBP_client};
+
+    my $auth = $self->{auth};
+
+    require Mail::Transport::POP3;
+    my $client  = Mail::Transport::POP3->new
+      ( username     => $self->{MBN_username}
+      , password     => $self->{MBN_password}
+      , hostname     => $self->{MBN_hostname}
+      , port         => $self->{MBN_port}
+      , authenticate => $self->{MBP_auth}
+      );
+
+    $self->log(ERROR => "Cannot create POP3 client for $self.")
+       unless defined $client;
+
+    $self->{MBP_client} = $client;
+}
+
+#-------------------------------------------
+
+sub readMessages(@)
+{   my ($self, %args) = @_;
+
+    my $pop   = $self->popClient or return;
+    my @log   = $self->logSettings;
+    my $seqnr = 0;
+
+    foreach my $id ($pop->ids)
+    {   my $message = $args{message_type}->new
+         ( head      => $args{head_delayed_type}->new(@log)
+         , unique    => $id
+         , folder    => $self
+         , seqnr     => $seqnr++
+         );
+
+        my $body    = $args{body_delayed_type}->new(@log, message => $message);
+        $message->storeBody($body);
+
+        $self->storeMessage($message);
+    }
+
+    $self;
+}
+ 
+#-------------------------------------------
+
+
+sub getHead($)
+{   my ($self, $message) = @_;
+    my $pop   = $self->popClient or return;
+
+    my $uidl  = $message->unique;
+    my $lines = $pop->header($uidl);
+
+    unless(defined $lines)
+    {   $lines = [];
+        $self->log(WARNING  => "Message $uidl disappeared from POP3 server $self.");
+    }
+
+    my $text   = join '', @$lines;
+    my $parser = Mail::Box::Parser::Perl->new   # not parseable by C parser
+     ( filename  => "$pop"
+     , file      => Mail::Box::FastScalar->new(\$text)
+     , fix_headers => $self->{MB_fix_headers}
+     );
+
+    $self->lazyPermitted(1);
+
+    my $head     = $message->readHead($parser);
+    $parser->stop;
+
+    $self->lazyPermitted(0);
+
+    $self->log(PROGRESS => "Loaded head of $uidl.");
+    $head;
+}
+
+#-------------------------------------------
+
+
+sub getHeadAndBody($)
+{   my ($self, $message) = @_;
+    my $pop   = $self->popClient or return;
+
+    my $uidl  = $message->unique;
+    my $lines = $pop->message($uidl);
+
+    unless(defined $lines)
+    {   $lines = [];
+        $self->log(WARNING  => "Message $uidl disappeared from POP3 server $self.");
+     }
+
+    my $parser = Mail::Box::Parser::Perl->new   # not parseable by C parser
+     ( filename  => "$pop"
+     , file      => IO::ScalarArray->new($lines)
+     );
+
+    my $head = $message->readHead($parser);
+    unless(defined $head)
+    {   $self->log(ERROR => "Cannot find head back for $uidl on POP3 server $self.");
+        $parser->stop;
+        return undef;
+    }
+
+    my $body = $message->readBody($parser, $head);
+    unless(defined $body)
+    {   $self->log(ERROR => "Cannot read body for $uidl on POP3 server $self.");
+        $parser->stop;
+        return undef;
+    }
+
+    $parser->stop;
+
+    $self->log(PROGRESS => "Loaded message $uidl.");
+    ($head, $body);
+}
+
+#-------------------------------------------
+
+
+sub writeMessages($@)
+{   my ($self, $args) = @_;
+
+    if(my $modifications = grep {$_->isModified} @{$args->{messages}})
+    {   $self->log(WARNING =>
+           "Update of $modifications messages ignored for POP3 folder $self.");
+    }
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/POP3.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/POP3.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/POP3.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,897 @@
+
+=head1 NAME
+
+Mail::Box::POP3 - handle POP3 folders as client
+
+
+=head1 INHERITANCE
+
+ Mail::Box::POP3
+   is a Mail::Box::Net
+   is a Mail::Box
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ use Mail::Box::POP3;
+ my $folder = new Mail::Box::POP3 folder => $ENV{MAIL}, ...;
+
+
+=head1 DESCRIPTION
+
+Maintain a folder which has its messages stored on a remote server.  The
+communication between the client application and the server is implemented
+using the POP3 protocol.  This class uses L<Mail::Transport::POP3|Mail::Transport::POP3> to
+hide the transport of information, and focusses solely on the correct
+handling of messages within a POP3 folder.
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+overload: B<@{}>
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+overload: B<cmp>
+
+=over 4
+
+See L<Mail::Box/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<create>(FOLDER, OPTIONS)
+
+Mail::Box::POP3-E<gt>B<create>(FOLDER, OPTIONS)
+
+=over 4
+
+It is not possible to create a new folder on a POP3 server.  This method
+will always return C<false>.
+
+ Option     Defined in    Default   
+ folderdir  L<Mail::Box>  <not used>
+
+. folderdir DIRECTORY
+
+=back
+
+Mail::Box::POP3-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+For authentications, you have three choices: specify a foldername which
+resembles an URL, or specify a pop-client object, or separate options
+for user, password, pop-server and server-port.
+
+ Option             Defined in       Default                                                         
+ access             L<Mail::Box>     C<'r'>                                                          
+ authenticate                        C<'AUTO'>                                                       
+ body_delayed_type  L<Mail::Box>     L<Mail::Message::Body::Delayed|Mail::Message::Body::Delayed>    
+ body_type          L<Mail::Box>     L<Mail::Message::Body::Lines|Mail::Message::Body::Lines>        
+ coerce_options     L<Mail::Box>     C<[]>                                                           
+ create             L<Mail::Box>     <not applicable>                                                
+ extract            L<Mail::Box>     C<10240>                                                        
+ field_type         L<Mail::Box>     undef                                                           
+ fix_headers        L<Mail::Box>     <false>                                                         
+ folder             L<Mail::Box>     C<'/'>                                                          
+ folderdir          L<Mail::Box>     <not used>                                                      
+ head_delayed_type  L<Mail::Box>     L<Mail::Message::Head::Delayed|Mail::Message::Head::Delayed>    
+ head_type          L<Mail::Box>     L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>  
+ keep_dups          L<Mail::Box>     <false>                                                         
+ lock_file          L<Mail::Box>     undef                                                           
+ lock_timeout       L<Mail::Box>     1 hour                                                          
+ lock_type          L<Mail::Box>     C<'NONE'>                                                       
+ lock_wait          L<Mail::Box>     10 seconds                                                      
+ locker             L<Mail::Box>     undef                                                           
+ log                L<Mail::Reporter>  C<'WARNINGS'>                                                   
+ manager            L<Mail::Box>     undef                                                           
+ message_type       L<Mail::Box>     L<Mail::Box::POP3::Message|Mail::Box::POP3::Message>            
+ multipart_type     L<Mail::Box>     L<Mail::Message::Body::Multipart|Mail::Message::Body::Multipart>
+ password           L<Mail::Box::Net>  undef                                                           
+ pop_client                          undef                                                           
+ remove_when_empty  L<Mail::Box>     <false>                                                         
+ save_on_exit       L<Mail::Box>     <true>                                                          
+ server_name        L<Mail::Box::Net>  undef                                                           
+ server_port        L<Mail::Box::Net>  110                                                             
+ trace              L<Mail::Reporter>  C<'WARNINGS'>                                                   
+ trusted            L<Mail::Box>     <false>                                                         
+ username           L<Mail::Box::Net>  undef                                                           
+
+. access MODE
+
+. authenticate 'LOGIN'|'APOP'|'AUTO'
+
+=over 4
+
+POP3 can use two methods of authentication: the old LOGIN protocol, which
+transmits a username and password in plain text, and the newer APOP
+protocol which uses MD5 encryption.  APOP is therefore much better, however
+not always supported by the server.  With AUTO, first APOP is tried and
+if that fails LOGIN.
+
+=back
+
+. body_delayed_type CLASS
+
+. body_type CLASS|CODE
+
+. coerce_options ARRAY
+
+. create BOOLEAN
+
+. extract INTEGER | CODE | METHOD | 'LAZY'|'ALWAYS'
+
+. field_type CLASS
+
+. fix_headers BOOLEAN
+
+. folder FOLDERNAME
+
+. folderdir DIRECTORY
+
+. head_delayed_type CLASS
+
+. head_type CLASS
+
+. keep_dups BOOLEAN
+
+. lock_file FILENAME
+
+. lock_timeout SECONDS
+
+. lock_type CLASS|STRING|ARRAY
+
+. lock_wait SECONDS
+
+. locker OBJECT
+
+. log LEVEL
+
+. manager MANAGER
+
+. message_type CLASS
+
+. multipart_type CLASS
+
+. password STRING
+
+. pop_client OBJECT
+
+=over 4
+
+You may want to specify your own pop-client object.  The object
+which is passed must extend L<Mail::Transport::POP3|Mail::Transport::POP3>.
+
+=back
+
+. remove_when_empty BOOLEAN
+
+. save_on_exit BOOLEAN
+
+. server_name HOSTNAME
+
+. server_port INTEGER
+
+. trace LEVEL
+
+. trusted BOOLEAN
+
+. username STRING
+
+I<Example:> 
+
+ my $url = 'pop3://user:password@pop.xs4all.nl'
+ my $pop = Mail::Box::POP3->new($url);
+
+ my $pop = $mgr->open(type => 'pop3',
+    username => 'myname', password => 'mypassword',
+    server_name => 'pop.xs4all.nl');
+
+=back
+
+=head2 The folder
+
+
+$obj-E<gt>B<addMessage>(MESSAGE)
+
+=over 4
+
+It is impossible to write messages to the average POP3 server.  There are
+extensions to the protocol which do permit it, however these are not
+implemented (yet, patches welcome).
+
+C<undef> is returned, and an error displayed.  However, no complaint is
+given when the MESSAGE is C<undef> itself.
+
+=back
+
+$obj-E<gt>B<addMessages>(MESSAGES)
+
+=over 4
+
+As useless as L<addMessage()|Mail::Box::POP3/"METHODS">.  The only acceptable call to this method
+is without any message.
+
+=back
+
+Mail::Box::POP3-E<gt>B<appendMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<close>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<copyTo>(FOLDER, OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+It is not possible to delete a POP3 folder remotely: the best we can do
+is remove all the messages in it... which is the action implemented here.
+A notice is logged about this.
+
+=back
+
+$obj-E<gt>B<folderdir>([DIRECTORY])
+
+=over 4
+
+See L<Mail::Box::Net/"METHODS">
+
+=back
+
+Mail::Box::POP3-E<gt>B<foundIn>([FOLDERNAME], OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<organization>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<type>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+$obj-E<gt>B<update>
+
+=over 4
+
+NOT IMPLEMENTED YET
+
+=back
+
+$obj-E<gt>B<url>
+
+=over 4
+
+See L<Mail::Box/"The folder">
+
+=back
+
+=head2 Folder flags
+
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+$obj-E<gt>B<writable>
+
+=over 4
+
+See L<Mail::Box/"Folder flags">
+
+=back
+
+=head2 The messages
+
+
+$obj-E<gt>B<current>([NUMBER|MESSAGE|MESSAGE-ID])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<find>(MESSAGE-ID)
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<findFirstLabeled>(LABEL, [BOOLEAN, [ARRAY-OF-MSGS]])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<message>(INDEX [,MESSAGE])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messageId>(MESSAGE-ID [,MESSAGE])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messageIds>
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<messages>(['ALL',RANGE,'ACTIVE','DELETED',LABEL,!LABEL,FILTER])
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+$obj-E<gt>B<scanForMessages>(MESSAGE, MESSAGE-IDS, TIMESPAN, WINDOW)
+
+=over 4
+
+See L<Mail::Box/"The messages">
+
+=back
+
+=head2 Sub-folders
+
+
+$obj-E<gt>B<listSubFolders>(OPTIONS)
+
+Mail::Box::POP3-E<gt>B<listSubFolders>(OPTIONS)
+
+=over 4
+
+The standard POP3 protocol does not support sub-folders, so an
+empty list will be returned in any case.
+
+ Option      Defined in       Default      
+ check       L<Mail::Box>     <false>      
+ folder      L<Mail::Box>     <required>   
+ folderdir   L<Mail::Box>     <from folder>
+ skip_empty  L<Mail::Box>     <false>      
+
+. check BOOLEAN
+
+. folder FOLDERNAME
+
+. folderdir DIRECTORY
+
+. skip_empty BOOL
+
+=back
+
+$obj-E<gt>B<nameOfSubFolder>(NAME)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+$obj-E<gt>B<openRelatedFolder>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Sub-folders">
+
+=back
+
+$obj-E<gt>B<openSubFolder>(OPTIONS)
+
+=over 4
+
+It is not possible to open a sub-folder for a POP3 folder, because that
+is not supported by the official POP3 protocol. In any case, C<undef>
+is returned to indicate a failure.
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<coerce>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<determineBodyType>(MESSAGE, HEAD)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<getHead>(MESSAGE)
+
+=over 4
+
+Read the header for the specified message from the remote server.
+
+=back
+
+$obj-E<gt>B<getHeadAndBody>(MESSAGE)
+
+=over 4
+
+Read all data for the specified message from the remote server.
+
+=back
+
+$obj-E<gt>B<lineSeparator>([STRING|'CR'|'LF'|'CRLF'])
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<locker>
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<popClient>
+
+=over 4
+
+Returns the pop client object.  This does not establish the connection.
+
+=back
+
+$obj-E<gt>B<read>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<readMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<storeMessage>(MESSAGE)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<toBeThreaded>(MESSAGES)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<toBeUnthreaded>(MESSAGES)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<updateMessages>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<write>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box/"Internals">
+
+=back
+
+$obj-E<gt>B<writeMessages>(OPTIONS)
+
+=over 4
+
+ Option    Defined in    Default   
+ messages  L<Mail::Box>  <required>
+
+. messages ARRAY
+
+=back
+
+=head2 Other methods
+
+
+$obj-E<gt>B<timespan2seconds>(TIME)
+
+Mail::Box::POP3-E<gt>B<timespan2seconds>(TIME)
+
+=over 4
+
+See L<Mail::Box/"Other methods">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::POP3-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::POP3-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::POP3-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Box/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Notice:> A POP3 folder cannot be deleted: it will be emptied.
+
+Each user has only one POP3 folder on a server.  This folder is created and
+deleted by the server's administrator only.  A delete can only remove the
+messages in the folder for you.
+
+I<Error:> Cannot create POP3 client for $name.
+
+The connection to the POP3 server cannot be established.  You may see
+more, related, error messages about the failure.
+
+I<Error:> Cannot find head back for $uidl on POP3 server $name.
+
+The server told to have this message, but when asked for its headers, no
+single line was returned.  Did the message get destroyed?
+
+I<Error:> Cannot read body for $uidl on POP3 server $name.
+
+The message's headers are retreived from the server, but the body seems
+to be lost.  Did the message get destroyed between reading the header
+and reading the body?
+
+I<Warning:> Changes not written to read-only folder $self.
+
+You have opened the folder read-only --which is the default set
+by L<new(access)|Mail::Box/"Constructors">--, made modifications, and now want to close it.
+Set L<close(force)|Mail::Box/"The folder"> if you want to overrule the access mode, or close
+the folder with L<close(write)|Mail::Box/"The folder"> set to C<NEVER>.
+
+I<Error:> Copying failed for one message.
+
+For some reason, for instance disc full, removed by external process, or
+read-protection, it is impossible to copy one of the messages.  Copying will
+proceed for the other messages.
+
+I<Error:> Destination folder $name is not writable.
+
+The folder where the messages are copied to is not opened with write
+access (see L<new(access)|Mail::Box/"Constructors">).  This has no relation with write permission
+to the folder which is controled by your operating system.
+
+I<Warning:> Different messages with id $msgid.
+
+The message id is discovered more than once within the same folder, but the
+content of the message seems to be different.  This should not be possible:
+each message must be unique.
+
+I<Error:> Folder $name is opened read-only
+
+You can not write to this folder unless you have opened the folder to
+write or append with L<new(access)|Mail::Box/"Constructors">, or the C<force> option is set true.
+
+I<Error:> Invalid timespan '$timespan' specified.
+
+The string does not follow the strict rules of the time span syntax which
+is permitted as parameter.
+
+I<Warning:> Message $uidl on POP3 server $name disappeared.
+
+The server indicated the existence of this message before, however it
+has no information about the message anymore.
+
+I<Warning:> Message-id '$msgid' does not contain a domain.
+
+According to the RFCs, message-ids need to contain a unique random part,
+then an C<@>, and then a domain name.  This is made to avoid the creation
+of two messages with the same id.  The warning emerges when the C<@> is
+missing from the string.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Unable to create subfolder $name of $folder.
+
+The copy includes the subfolders, but for some reason it was not possible
+to copy one of these.  Copying will proceed for all other sub-folders.
+
+I<Error:> Update of $nr messages ignored for POP3 folder $name.
+
+The standard POP3 implementation does not support writing from client back
+to the server.  Therefore, modifications may be lost.
+
+I<Error:> Writing folder $name failed
+
+For some reason (you probably got more error messages about this problem)
+it is impossible to write the folder, although you should because there
+were changes made.
+
+I<Error:> You cannot write a message to a pop server (yet)
+
+Some extensions to the POP3 protocol do permit writing messages to the server,
+but the standard protocol only implements retreival.  Feel invited to extend our
+implementation with writing.
+
+
+=head1 DETAILS
+
+
+=head2 How POP3 folders work
+
+Rfc1939 defines how POP3 works.  POP3 is a really simple protocol to
+receive messages from a server to a user's client.  POP3 is also
+really limited: it can only be used to fetch messages, but has not
+many ways to limit the amount of network traffic, like the IMAP4
+protocol has.
+
+One POP3 account represents only one folder: there is no way of
+sub-folders in POP3.  POP3 doesn't support writing (except for
+some message status flags).
+
+=head2 This implementation
+
+The protocol specifics are implemented in L<Mail::Transport::POP3|Mail::Transport::POP3>,
+written by Liz Mattijsen.  That module does not use any of the
+other POP3 modules available on CPAN for the reason that MailBox
+tries to be smarter: it is capable of re-establishing broken POP3
+connection when the server supports UIDs.
+
+The implementation has shown to work with many different POP servers.
+In the test directory of the distribution, you will find a small
+server implementation, which is used to test the client.
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Parser/Perl.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Parser/Perl.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Parser/Perl.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,350 @@
+use strict;
+use warnings;
+
+package Mail::Box::Parser::Perl;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box::Parser';
+
+use Mail::Message::Field;
+use List::Util 'sum';
+use IO::File;
+
+
+sub init(@)
+{   my ($self, $args) = @_;
+
+    $self->SUPER::init($args) or return;
+
+    $self->{MBPP_trusted} = $args->{trusted};
+    $self->{MBPP_fix}     = $args->{fix_header_errors};
+    $self;
+}
+
+#------------------------------------------
+
+sub pushSeparator($)
+{   my ($self, $sep) = @_;
+    unshift @{$self->{MBPP_separators}}, $sep;
+    $self->{MBPP_strip_gt}++ if $sep eq 'From ';
+    $self;
+}
+
+#------------------------------------------
+
+sub popSeparator()
+{   my $self = shift;
+    my $sep  = shift @{$self->{MBPP_separators}};
+    $self->{MBPP_strip_gt}-- if $sep eq 'From ';
+    $sep;
+}
+    
+#------------------------------------------
+
+sub filePosition(;$)
+{   my $self = shift;
+    @_ ? $self->{MBPP_file}->seek(shift, 0) : $self->{MBPP_file}->tell;
+}
+
+my $empty = qr/^[\015\012]*$/;
+
+#------------------------------------------
+
+
+sub readHeader()
+{   my $self  = shift;
+    my $file  = $self->{MBPP_file};
+
+    my $start = $file->tell;
+    my @ret   = ($start, undef);
+    my $line  = $file->getline;
+
+LINE:
+    while(defined $line)
+    {   last if $line =~ $empty;
+        my ($name, $body) = split /\s*\:\s*/, $line, 2;
+
+        unless(defined $body)
+        {   $self->log(WARNING =>
+                "Unexpected end of header in ".$self->filename.":\n $line");
+
+            if(@ret && $self->fixHeaderErrors)
+            {   $ret[-1][1] .= ' '.$line;  # glue erroneous line to previous field
+                $line = $file->getline;
+                next LINE;
+            }
+            else
+            {   $file->seek(-length $line, 1);
+                last LINE;
+            }
+        }
+
+        $body = "\n" unless length $body;
+
+        # Collect folded lines
+        while($line = $file->getline)
+        {   $line =~ m!^[ \t]! ? ($body .= $line) : last;
+        }
+
+        $body =~ s/\015//g;
+        push @ret, [ $name, $body ];
+    }
+
+    $ret[1]  = $file->tell;
+    @ret;
+}
+
+#------------------------------------------
+
+sub _is_good_end($)
+{   my ($self, $where) = @_;
+
+    # No seps, then when have to trust it.
+    my $sep = $self->{MBPP_separators}[0];
+    return 1 unless defined $sep;
+
+    my $file = $self->{MBPP_file};
+    my $here = $file->tell;
+    $file->seek($where, 0) or return 0;
+
+    # Find first non-empty line on specified location.
+    my $line = $file->getline;
+    $line    = $file->getline while defined $line && $line =~ $empty;
+
+    # Check completed, return to old spot.
+    $file->seek($here, 0);
+    return 1 unless defined $line;
+
+        substr($line, 0, length $sep) eq $sep
+    && ($sep ne 'From ' || $line =~ m/ (19[789]|20[01])\d\b/ );
+}
+
+#------------------------------------------
+
+sub readSeparator()
+{   my $self = shift;
+
+    my $sep   = $self->{MBPP_separators}[0];
+    return () unless defined $sep;
+
+    my $file  = $self->{MBPP_file};
+    my $start = $file->tell;
+
+    my $line  = $file->getline;
+    while(defined $line && $line =~ $empty)
+    {   $start   = $file->tell;
+        $line    = $file->getline;
+    }
+
+    return () unless defined $line;
+
+    $line     =~ s/[\012\015\n]+$/\n/g;
+    return ($start, $line)
+        if substr($line, 0, length $sep) eq $sep;
+
+    $file->seek($start, 0);
+    ();
+}
+
+#------------------------------------------
+
+sub _read_stripped_lines(;$$)
+{   my ($self, $exp_chars, $exp_lines) = @_;
+    $exp_lines  = -1 unless defined $exp_lines;
+    my @seps    = @{$self->{MBPP_separators}};
+
+    my $file    = $self->{MBPP_file};
+    my @lines   = ();
+
+    if(@seps && $self->{MBPP_trusted})
+    {   my $sep  = $seps[0];
+        my $l    = length $sep;
+
+        while(1)
+        {   my $where = $file->tell;
+            my $line  = $file->getline or last;
+
+            if(   substr($line, 0, $l) eq $sep
+               && ($sep ne 'From ' || $line =~ m/ (?:19[789]\d|20[01]\d)/)
+               )
+            {   $file->seek($where, 0);
+                last;
+            }
+
+            push @lines, $line;
+        }
+    }
+    elsif(@seps)
+    {   
+
+  LINE: while(1)
+        {   my $where = $file->getpos;
+            my $line  = $file->getline or last;
+
+            foreach my $sep (@seps)
+            {   next if substr($line, 0, length $sep) ne $sep;
+                next if $sep eq 'From ' && $line !~ m/ (?:19[789]\d|20[01]\d)/;
+
+                $file->setpos($where);
+                last LINE;
+            }
+
+            $line =~ s/\015$//;
+            push @lines, $line;
+        }
+    }
+    else
+    {   # File without separators.
+        @lines = $file->getlines;
+    }
+
+    my $end = $file->tell;
+    if($exp_lines > 0 )
+    {    while(@lines > $exp_lines && $lines[-1] =~ $empty)
+         {   $end -= length $lines[-1];
+             pop @lines;
+         }
+    }
+    elsif(@seps && @lines && $lines[-1] =~ $empty)
+    {   # blank line should be in place before a separator.  Only that
+        # line is removed.
+        $end -= length $lines[-1];      
+        pop @lines;
+    }
+
+    map { s/^\>(\>*From\s)/$1/ } @lines
+        if $self->{MBPP_strip_gt};
+
+    $end, \@lines;
+}
+
+#------------------------------------------
+
+sub _take_scalar($$)
+{   my ($self, $begin, $end) = @_;
+    my $file = $self->{MBPP_file};
+    $file->seek($begin, 0);
+
+    my $return;
+    $file->read($return, $end-$begin);
+    $return =~ s/\015//g;
+    $return;
+}
+
+#------------------------------------------
+
+sub bodyAsString(;$$)
+{   my ($self, $exp_chars, $exp_lines) = @_;
+    my $file  = $self->{MBPP_file};
+    my $begin = $file->tell;
+
+    if(defined $exp_chars && $exp_chars>=0)
+    {   # Get at once may be successful
+        my $end = $begin + $exp_chars;
+
+        if($self->_is_good_end($end))
+        {   my $body = $self->_take_scalar($begin, $end);
+            $body =~ s/^\>(\>*From\s)/$1/gm if $self->{MBPP_strip_gt};
+            return ($begin, $file->tell, $body);
+        }
+    }
+
+    my ($end, $lines) = $self->_read_stripped_lines($exp_chars, $exp_lines);
+    return ($begin, $end, join('', @$lines));
+}
+
+#------------------------------------------
+
+sub bodyAsList(;$$)
+{   my ($self, $exp_chars, $exp_lines) = @_;
+    my $file  = $self->{MBPP_file};
+    my $begin = $file->tell;
+
+    my ($end, $lines) = $self->_read_stripped_lines($exp_chars, $exp_lines);
+    ($begin, $end, @$lines);
+}
+
+#------------------------------------------
+
+sub bodyAsFile($;$$)
+{   my ($self, $out, $exp_chars, $exp_lines) = @_;
+    my $file  = $self->{MBPP_file};
+    my $begin = $file->tell;
+
+    my ($end, $lines) = $self->_read_stripped_lines($exp_chars, $exp_lines);
+
+    $out->print($_) foreach @$lines;
+    ($begin, $end, scalar @$lines);
+}
+
+#------------------------------------------
+
+sub bodyDelayed(;$$)
+{   my ($self, $exp_chars, $exp_lines) = @_;
+    my $file  = $self->{MBPP_file};
+    my $begin = $file->tell;
+
+    if(defined $exp_chars)
+    {   my $end = $begin + $exp_chars;
+
+        if($self->_is_good_end($end))
+        {   $file->seek($end, 0);
+            return ($begin, $end, $exp_chars, $exp_lines);
+        }
+    }
+
+    my ($end, $lines) = $self->_read_stripped_lines($exp_chars, $exp_lines);
+    my $chars = sum(map {length} @$lines);
+    ($begin, $end, $chars, scalar @$lines);
+}
+
+#------------------------------------------
+
+sub openFile($)
+{   my ($self, $args) = @_;
+    my $fh = $args->{file} || IO::File->new($args->{filename}, $args->{mode});
+
+    return unless $fh;
+    $self->{MBPP_file}       = $fh;
+
+    binmode $fh, ':raw'
+       if ref($fh) eq 'GLOB' || $fh->can('BINMODE');
+
+    $self->{MBPP_separators} = [];
+
+    # Prepare the first line.
+    $self->{MBPP_start_line} = 0;
+
+    my $line  = $fh->getline || return $self;
+
+    $line     =~ s/[\012\015]+$/\n/;
+    $self->{MBP_linesep}     = $1;
+    $fh->seek(0, 0);
+
+#   binmode $fh, ':crlf' if $] < 5.007;  # problem with perlIO
+    $self;
+}
+
+#------------------------------------------
+
+sub closeFile()
+{   my $self = shift;
+
+    delete $self->{MBPP_separators};
+    delete $self->{MBPP_strip_gt};
+
+    my $file = delete $self->{MBPP_file} or return;
+    $file->close;
+    $self;
+}
+#------------------------------------------
+
+
+sub fixHeaderErrors(;$)
+{   my $self = shift;
+    @_ ? ($self->{MBPP_fix} = shift) : $self->{MBPP_fix};
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Parser/Perl.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Parser/Perl.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Parser/Perl.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,434 @@
+
+=head1 NAME
+
+Mail::Box::Parser::Perl - reading messages from file using Perl
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Parser::Perl
+   is a Mail::Box::Parser
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+
+
+=head1 DESCRIPTION
+
+The C<Mail::Box::Parser::Perl> implements parsing of messages
+in Perl.  This may be a little slower than the C<C> based parser
+Mail::Box::Parser::C, but will also work on platforms where no C
+compiler is available.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Box::Parser::Perl-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option             Defined in       Default      
+ file               L<Mail::Box::Parser>  undef        
+ filename           L<Mail::Box::Parser>  <required>   
+ fix_header_errors                   <false>      
+ log                L<Mail::Reporter>  C<'WARNINGS'>
+ mode               L<Mail::Box::Parser>  C<'r'>       
+ trace              L<Mail::Reporter>  C<'WARNINGS'>
+ trusted                             <false>      
+
+. file FILE-HANDLE
+
+. filename FILENAME
+
+. fix_header_errors BOOLEAN
+
+=over 4
+
+When header errors are detected, the parsing of the header will
+be stopped.  Other header lines will become part of the body of
+the message.  Set this flag to have the erroneous line added to
+the previous header line.
+
+=back
+
+. log LEVEL
+
+. mode OPENMODE
+
+. trace LEVEL
+
+. trusted BOOLEAN
+
+=over 4
+
+Is the input from the file to be trusted, or does it require extra
+tests.  Related to L<Mail::Box::new(trusted)|Mail::Box/"Constructors">.
+
+=back
+
+=back
+
+=head2 The parser
+
+
+$obj-E<gt>B<fileChanged>
+
+=over 4
+
+See L<Mail::Box::Parser/"The parser">
+
+=back
+
+$obj-E<gt>B<filename>
+
+=over 4
+
+See L<Mail::Box::Parser/"The parser">
+
+=back
+
+$obj-E<gt>B<fixHeaderErrors>([BOOLEAN])
+
+=over 4
+
+If set to C<true>, parsing of a header will not stop on an error, but
+attempt to add the erroneous this line to previous field.  Without BOOLEAN,
+the current setting is returned.
+
+I<Example:> 
+
+ $folder->parser->fixHeaderErrors(1);
+ my $folder = $mgr->open('folder', fix_header_errors => 1);
+
+=back
+
+$obj-E<gt>B<restart>
+
+=over 4
+
+See L<Mail::Box::Parser/"The parser">
+
+=back
+
+$obj-E<gt>B<start>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box::Parser/"The parser">
+
+=back
+
+$obj-E<gt>B<stop>
+
+=over 4
+
+See L<Mail::Box::Parser/"The parser">
+
+=back
+
+=head2 Parsing
+
+
+$obj-E<gt>B<bodyAsFile>(FILEHANDLE [,CHARS [,LINES]])
+
+=over 4
+
+See L<Mail::Box::Parser/"Parsing">
+
+=back
+
+$obj-E<gt>B<bodyAsList>([,CHARS [,LINES]])
+
+=over 4
+
+See L<Mail::Box::Parser/"Parsing">
+
+=back
+
+$obj-E<gt>B<bodyAsString>([,CHARS [,LINES]])
+
+=over 4
+
+See L<Mail::Box::Parser/"Parsing">
+
+=back
+
+$obj-E<gt>B<bodyDelayed>([,CHARS [,LINES]])
+
+=over 4
+
+See L<Mail::Box::Parser/"Parsing">
+
+=back
+
+$obj-E<gt>B<filePosition>([POSITION])
+
+=over 4
+
+See L<Mail::Box::Parser/"Parsing">
+
+=back
+
+$obj-E<gt>B<lineSeparator>
+
+=over 4
+
+See L<Mail::Box::Parser/"Parsing">
+
+=back
+
+$obj-E<gt>B<popSeparator>
+
+=over 4
+
+See L<Mail::Box::Parser/"Parsing">
+
+=back
+
+$obj-E<gt>B<pushSeparator>(STRING|REGEXP)
+
+=over 4
+
+See L<Mail::Box::Parser/"Parsing">
+
+=back
+
+$obj-E<gt>B<readHeader>
+
+=over 4
+
+=back
+
+$obj-E<gt>B<readSeparator>(OPTIONS)
+
+=over 4
+
+See L<Mail::Box::Parser/"Parsing">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<closeFile>
+
+=over 4
+
+See L<Mail::Box::Parser/"Internals">
+
+=back
+
+$obj-E<gt>B<defaultParserType>([CLASS])
+
+Mail::Box::Parser::Perl-E<gt>B<defaultParserType>([CLASS])
+
+=over 4
+
+See L<Mail::Box::Parser/"Internals">
+
+=back
+
+$obj-E<gt>B<openFile>(ARGS)
+
+=over 4
+
+See L<Mail::Box::Parser/"Internals">
+
+=back
+
+$obj-E<gt>B<takeFileInfo>
+
+=over 4
+
+See L<Mail::Box::Parser/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Parser::Perl-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Parser::Perl-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Parser::Perl-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> File $filename changed during access.
+
+When a message parser starts working, it takes size and modification time
+of the file at hand.  If the folder is written, it checks wether there
+were changes in the file made by external programs.
+
+Calling L<Mail::Box::update()|Mail::Box/"The folder"> on a folder before it being closed
+will read these new messages.  But the real source of this problem is
+locking: some external program (for instance the mail transfer agent,
+like sendmail) uses a different locking mechanism as you do and therefore
+violates your rights.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Warning:> Unexpected end of header in $source: $line
+
+While parsing a message from the specified source (usually a file name),
+the parser found a syntax error.  According to the MIME specification in the
+RFCs, each header line must either contain a colon, or start with a blank
+to indicate a folded field.  Apparently, this header contains a line which
+starts on the first position, but not with a field name.
+
+By default, parsing of the header will be stopped.  If there are more header
+lines after the erroneous line, they will be added to the body of the message.
+In case of new(fix_headers) set, the parsing of the header will be continued.
+The erroneous line will be added to the preceding field.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Parser.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Parser.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Parser.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,210 @@
+use strict;
+use warnings;
+
+package Mail::Box::Parser;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Reporter';
+use Carp;
+
+
+sub new(@)
+{   my $class = shift;
+
+    $class eq __PACKAGE__
+    ? $class->defaultParserType->new(@_)   # bootstrap right parser
+    : $class->SUPER::new(@_);
+}
+
+sub init(@)
+{   my ($self, $args) = @_;
+
+    $args->{trace}  ||= 'WARNING';
+
+    $self->SUPER::init($args);
+
+    $self->{MBP_mode} = $args->{mode} || 'r';
+
+    unless($self->{MBP_filename} = $args->{filename} || ref $args->{file})
+    {    $self->log(ERROR => "Filename or handle required to create a parser.");
+         return;
+    }
+
+    $self->start(file => $args->{file});
+}
+
+#------------------------------------------
+
+
+sub start(@)
+{   my $self = shift;
+    my %args = (@_, filename => $self->filename, mode => $self->{MBP_mode});
+
+    $self->openFile(\%args)
+        or return;
+
+    $self->takeFileInfo;
+
+    $self->log(PROGRESS => "Opened folder $args{filename} to be parsed");
+    $self;
+}
+
+#------------------------------------------
+
+
+sub stop()
+{   my $self     = shift;
+
+    my $filename = $self->filename;
+
+#   $self->log(WARNING => "File $filename changed during access.")
+#      if $self->fileChanged;
+
+    $self->log(NOTICE  => "Close parser for file $filename");
+    $self->closeFile;
+}
+
+#------------------------------------------
+
+
+sub restart()
+{   my $self     = shift;
+    my $filename = $self->filename;
+
+    $self->closeFile or return;
+
+    $self->openFile( {filename => $filename, mode => $self->{MBP_mode}} )
+        or return;
+
+    $self->takeFileInfo;
+    $self->log(NOTICE  => "Restarted parser for file $filename");
+    $self;
+}
+
+#------------------------------------------
+
+
+sub fileChanged()
+{   my $self = shift;
+    my ($size, $mtime) = (stat $self->filename)[7,9];
+    return 0 if !defined $size || !defined $mtime;
+    $size != $self->{MBP_size} || $mtime != $self->{MBP_mtime};
+}
+    
+#------------------------------------------
+
+
+sub filename() {shift->{MBP_filename}}
+
+#------------------------------------------
+
+
+sub filePosition(;$) {shift->NotImplemented}
+
+#------------------------------------------
+
+
+sub pushSeparator($) {shift->notImplemented}
+
+#------------------------------------------
+
+
+sub popSeparator($) {shift->notImplemented}
+
+#------------------------------------------
+
+
+sub readSeparator($) {shift->notImplemented}
+
+#------------------------------------------
+
+
+sub readHeader()    {shift->notImplemented}
+
+#------------------------------------------
+
+
+sub bodyAsString() {shift->notImplemented}
+
+#------------------------------------------
+
+
+sub bodyAsList() {shift->notImplemented}
+
+#------------------------------------------
+
+
+sub bodyAsFile() {shift->notImplemented}
+
+#------------------------------------------
+
+
+sub bodyDelayed() {shift->notImplemented}
+
+#------------------------------------------
+
+
+sub lineSeparator() {shift->{MBP_linesep}}
+
+#------------------------------------------
+
+
+sub openFile(@) {shift->notImplemented}
+
+#------------------------------------------
+
+
+sub closeFile(@) {shift->notImplemented}
+
+#------------------------------------------
+
+
+sub takeFileInfo()
+{   my $self     = shift;
+    @$self{ qw/MBP_size MBP_mtime/ } = (stat $self->filename)[7,9];
+}
+
+#------------------------------------------
+
+
+my $parser_type;
+
+sub defaultParserType(;$)
+{   my $class = shift;
+
+    # Select the parser manually?
+    if(@_)
+    {   $parser_type = shift;
+        return $parser_type if $parser_type->isa( __PACKAGE__ );
+
+        confess "Parser $parser_type does not extend "
+              . __PACKAGE__ . "\n";
+    }
+
+    # Already determined which parser we want?
+    return $parser_type if $parser_type;
+
+    # Try to use C-based parser.
+    eval 'require Mail::Box::Parser::C';
+#   warn "C-PARSER errors $@\n" if $@;
+
+    return $parser_type = 'Mail::Box::Parser::C'
+        unless $@;
+
+    # Fall-back on Perl-based parser.
+    require Mail::Box::Parser::Perl;
+    $parser_type = 'Mail::Box::Parser::Perl';
+}
+
+#------------------------------------------
+
+
+sub DESTROY
+{   my $self = shift;
+    $self->stop;
+    $self->SUPER::DESTROY;
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Parser.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Parser.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Parser.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,520 @@
+
+=head1 NAME
+
+Mail::Box::Parser - reading and writing messages
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Parser
+   is a Mail::Reporter
+
+ Mail::Box::Parser is extended by
+   Mail::Box::Parser::Perl
+
+
+=head1 SYNOPSIS
+
+ # Not instatiatiated itself
+
+
+=head1 DESCRIPTION
+
+The C<Mail::Box::Parser> manages the parsing of folders.  Usually, you won't
+need to know anything about this module, except the options which are
+involved with this code.
+
+There are two implementations of this module planned:
+
+=over 4
+
+=item * L<Mail::Box::Parser::Perl|Mail::Box::Parser::Perl>
+
+A slower parser which only uses plain Perl.  This module is a bit slower,
+and does less checking and less recovery.
+
+=item * Mail::Box::Parser::C
+
+A fast parser written in C<C>.  This package is released as separate
+module on CPAN, because the module distribution via CPAN can not
+handle XS files which are not located in the root directory of the
+module tree.  If a C compiler is available on your system, it will be
+used automatically.
+
+=back
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Box::Parser-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+Create a parser object which can handle one file.  For
+mbox-like mailboxes, this object can be used to read a whole folder.  In
+case of MH-like mailboxes, each message is contained in a single file,
+so each message has its own parser object.
+
+ Option    Defined in       Default      
+ file                       undef        
+ filename                   <required>   
+ log       L<Mail::Reporter>  C<'WARNINGS'>
+ mode                       C<'r'>       
+ trace     L<Mail::Reporter>  C<'WARNINGS'>
+
+. file FILE-HANDLE
+
+=over 4
+
+Any C<IO::File> or C<GLOB> which can be used to read the data from.  In
+case this option is specified, the C<filename> is informational only.
+
+=back
+
+. filename FILENAME
+
+=over 4
+
+The name of the file to be read.
+
+=back
+
+. log LEVEL
+
+. mode OPENMODE
+
+=over 4
+
+File-open mode, which defaults to C<'r'>, which means `read-only'.
+See C<perldoc -f open> for possible modes.  Only applicable 
+when no C<file> is specified.
+
+=back
+
+. trace LEVEL
+
+=back
+
+=head2 The parser
+
+
+$obj-E<gt>B<fileChanged>
+
+=over 4
+
+Returns whether the file which is parsed has changed after the last
+time takeFileInfo() was called.
+
+=back
+
+$obj-E<gt>B<filename>
+
+=over 4
+
+Returns the name of the file this parser is working on.
+
+=back
+
+$obj-E<gt>B<restart>
+
+=over 4
+
+Restart the parser on a certain file, usually because the content has
+changed.
+
+=back
+
+$obj-E<gt>B<start>(OPTIONS)
+
+=over 4
+
+Start the parser by opening a file.
+
+ Option  Defined in  Default
+ file                undef  
+
+. file FILEHANDLE|undef
+
+=over 4
+
+The file is already open, for instance because the data must be read
+from STDIN.
+
+=back
+
+=back
+
+$obj-E<gt>B<stop>
+
+=over 4
+
+Stop the parser, which will include a close of the file.  The lock on the
+folder will not be removed (is not the responsibility of the parser).
+
+=back
+
+=head2 Parsing
+
+
+$obj-E<gt>B<bodyAsFile>(FILEHANDLE [,CHARS [,LINES]])
+
+=over 4
+
+Try to read one message-body from the file, and immediately write
+it to the specified file-handle.  Optionally, the predicted number
+of CHARacterS and/or LINES to be read can be supplied.  These values may be
+C<undef> and may be wrong.
+
+The return is a list of three scalars: the location of the body (begin
+and end) and the number of lines in the body.
+
+=back
+
+$obj-E<gt>B<bodyAsList>([,CHARS [,LINES]])
+
+=over 4
+
+Try to read one message-body from the file.  Optionally, the predicted number
+of CHARacterS and/or LINES to be read can be supplied.  These values may be
+C<undef> and may be wrong.
+
+The return is a list of scalars, each containing one line (including
+line terminator), preceded by two integers representing the location
+in the file where this body started and ended.
+
+=back
+
+$obj-E<gt>B<bodyAsString>([,CHARS [,LINES]])
+
+=over 4
+
+Try to read one message-body from the file.  Optionally, the predicted number
+of CHARacterS and/or LINES to be read can be supplied.  These values may be
+C<undef> and may be wrong.
+
+The return is a list of three scalars, the location in the file
+where the body starts, where the body ends, and the string containing the
+whole body.
+
+=back
+
+$obj-E<gt>B<bodyDelayed>([,CHARS [,LINES]])
+
+=over 4
+
+Try to read one message-body from the file, but the data is skipped.
+Optionally, the predicted number of CHARacterS and/or LINES to be skipped
+can be supplied.  These values may be C<undef> and may be wrong.
+
+The return is a list of four scalars: the location of the body (begin and
+end), the size of the body, and the number of lines in the body.  The
+number of lines may be C<undef>.
+
+=back
+
+$obj-E<gt>B<filePosition>([POSITION])
+
+=over 4
+
+Returns the location of the next byte to be used in the file which is
+parsed.  When a POSITION is specified, the location in the file is
+moved to the indicated spot first.
+
+=back
+
+$obj-E<gt>B<lineSeparator>
+
+=over 4
+
+Returns the character or characters which are used to separate lines
+in the folder file.  This is based on the first line of the file.
+UNIX systems use a single LF to separate lines.  Windows uses a CR and
+a LF.  Mac uses CR.
+
+=back
+
+$obj-E<gt>B<popSeparator>
+
+=over 4
+
+Remove the last-pushed separator from the list which is maintained by the
+parser.  This will return C<undef> when there is none left.
+
+=back
+
+$obj-E<gt>B<pushSeparator>(STRING|REGEXP)
+
+=over 4
+
+Add a boundary line.  Separators tell the parser where to stop reading.
+A famous separator is the C<From>-line, which is used in Mbox-like
+folders to separate messages.  But also parts (I<attachments>) is a
+message are divided by separators.
+
+The specified STRING describes the start of the separator-line.  The
+REGEXP can specify a more complicated format.
+
+=back
+
+$obj-E<gt>B<readHeader>
+
+=over 4
+
+Read the whole message-header and return it as list of field-value
+pairs.  Mind that some fields will appear more than once.
+
+The first element will represent the position in the file where the
+header starts.  The follows the list of header field names and bodies.
+
+I<Example:> 
+
+ my ($where, @header) = $parser->readHeader;
+
+=back
+
+$obj-E<gt>B<readSeparator>(OPTIONS)
+
+=over 4
+
+Read the currently active separator (the last one which was pushed).  The
+line (or C<undef>) is returned.  Blank-lines before the separator lines
+are ignored.
+
+The return are two scalars, where the first gives the location of the
+separator in the file, and the second the line which is found as
+separator.  A new separator is activated using L<pushSeparator()|Mail::Box::Parser/"Parsing">.
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<closeFile>
+
+=over 4
+
+Close the file which was being parsed.
+
+=back
+
+$obj-E<gt>B<defaultParserType>([CLASS])
+
+Mail::Box::Parser-E<gt>B<defaultParserType>([CLASS])
+
+=over 4
+
+Returns the parser to be used to parse all subsequent
+messages, possibly first setting the parser using the optional argument.
+Usually, the parser is autodetected; the C<C>-based parser will be used
+when it can be, and the Perl-based parser will be used otherwise.
+
+The CLASS argument allows you to specify a package name to force a
+particular parser to be used (such as your own custom parser). You have
+to C<use> or C<require> the package yourself before calling this method
+with an argument. The parser must be a sub-class of C<Mail::Box::Parser>.
+
+=back
+
+$obj-E<gt>B<openFile>(ARGS)
+
+=over 4
+
+Open the file to be parsed.  ARGS is a ref-hash of options.
+
+ Option    Defined in       Default   
+ filename                   <required>
+ mode                       <required>
+
+. filename FILENAME
+
+. mode STRING
+
+=back
+
+$obj-E<gt>B<takeFileInfo>
+
+=over 4
+
+Capture some data about the file being parsed, to be compared later.
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Parser-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Parser-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Parser-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> File $filename changed during access.
+
+When a message parser starts working, it takes size and modification time
+of the file at hand.  If the folder is written, it checks wether there
+were changes in the file made by external programs.
+
+Calling L<Mail::Box::update()|Mail::Box/"The folder"> on a folder before it being closed
+will read these new messages.  But the real source of this problem is
+locking: some external program (for instance the mail transfer agent,
+like sendmail) uses a different locking mechanism as you do and therefore
+violates your rights.
+
+I<Error:> Filename or handle required to create a parser.
+
+A message parser needs to know the source of the message at creation.  These
+sources can be a filename (string), file handle object or GLOB.
+See new(filename) and new(file).
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search/Grep.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search/Grep.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search/Grep.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,165 @@
+
+package Mail::Box::Search::Grep;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box::Search';
+
+use strict;
+use warnings;
+
+use Carp;
+
+#-------------------------------------------
+
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    $args->{in} ||= ($args->{field} ? 'HEAD' : 'BODY');
+
+    my $deliver = $args->{deliver} || $args->{details};  # details is old name
+    $args->{deliver}
+     = !defined $deliver       ? $deliver
+     : ref $deliver eq 'CODE'  ? $deliver
+     : $deliver eq 'PRINT'     ? sub { $_[0]->printMatch($_[1]) }
+     : ref $deliver eq 'ARRAY' ? sub { push @$deliver, $_[1] }
+     :                           $deliver;
+
+    $self->SUPER::init($args);
+
+    my $take = $args->{field};
+    $self->{MBSG_field_check}
+     = !defined $take         ? sub {1}
+     : !ref $take             ? do {$take = lc $take; sub { $_[1] eq $take }}
+     :  ref $take eq 'Regexp' ? sub { $_[1] =~ $take }
+     :  ref $take eq 'CODE'   ? $take
+     : croak "Illegal field selector $take.";
+
+    my $match = $args->{match}
+       or croak "No match pattern specified.\n";
+    $self->{MBSG_match_check}
+     = !ref $match             ? sub { index("$_[1]", $match) >= $[ }
+     :  ref $match eq 'Regexp' ? sub { "$_[1]" =~ $match } 
+     :  ref $match eq 'CODE'   ? $match
+     : croak "Illegal match pattern $match.";
+
+    $self;
+}
+
+#-------------------------------------------
+
+sub search(@)
+{   my ($self, $object, %args) = @_;
+    delete $self->{MBSG_last_printed};
+    $self->SUPER::search($object, %args);
+}
+
+#-------------------------------------------
+
+sub inHead(@)
+{   my ($self, $part, $head, $args) = @_;
+
+    my @details = (message => $part->toplevel, part => $part);
+    my ($field_check, $match_check, $deliver)
+      = @$self{ qw/MBSG_field_check MBSG_match_check MBS_deliver/ };
+
+    my $matched = 0;
+  LINES:
+    foreach my $field ($head->orderedFields)
+    {   next unless $field_check->($head, $field->name)
+                 && $match_check->($head, $field);
+
+        $matched++;
+        last LINES unless $deliver;  # no deliver: only one match needed
+        $deliver->( {@details, field => $field} );
+    }
+
+    $matched;
+}
+
+
+#-------------------------------------------
+
+sub inBody(@)
+{   my ($self, $part, $body, $args) = @_;
+
+    my @details = (message => $part->toplevel, part => $part);
+    my ($field_check, $match_check, $deliver)
+      = @$self{ qw/MBSG_field_check MBSG_match_check MBS_deliver/ };
+
+    my $matched = 0;
+    my $linenr  = 0;
+
+  LINES:
+    foreach my $line ($body->lines)
+    {   $linenr++;
+        next unless $match_check->($body, $line);
+
+        $matched++;
+        last LINES unless $deliver;  # no deliver: only one match needed
+        $deliver->( {@details, linenr => $linenr, line => $line} );
+    }
+
+    $matched;
+}
+
+#-------------------------------------------
+
+
+#-------------------------------------------
+
+sub printMatch($;$)
+{   my $self = shift;
+    my ($out, $match) = @_==2 ? @_ : (select, shift);
+
+      $match->{field}
+    ? $self->printMatchedHead($out, $match)
+    : $self->printMatchedBody($out, $match)
+}
+
+#-------------------------------------------
+
+
+sub printMatchedHead($$)
+{   my ($self, $out, $match) = @_;
+    my $message = $match->{message};
+    my $msgnr   = $message->seqnr;
+    my $folder  = $message->folder->name;
+    my $lp      = $self->{MBSG_last_printed} || '';
+
+    unless($lp eq "$folder $msgnr")  # match in new message
+    {   my $subject = $message->subject;
+        $out->print("$folder, message $msgnr: $subject\n");
+        $self->{MBSG_last_printed} = "$folder $msgnr";
+    }
+
+    my @lines   = $match->{field}->string;
+    my $inpart  = $match->{part}->isPart ? 'p ' : '  ';
+    $out->print($inpart, join $inpart, @lines);
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub printMatchedBody($$)
+{   my ($self, $out, $match) = @_;
+    my $message = $match->{message};
+    my $msgnr   = $message->seqnr;
+    my $folder  = $message->folder->name;
+    my $lp      = $self->{MBSG_last_printed} || '';
+
+    unless($lp eq "$folder $msgnr")  # match in new message
+    {   my $subject = $message->subject;
+        $out->print("$folder, message $msgnr: $subject\n");
+        $self->{MBSG_last_printed} = "$folder $msgnr";
+    }
+
+    my $inpart  = $match->{part}->isPart ? 'p ' : '  ';
+    $out->print(sprintf "$inpart %2d: %s", $match->{linenr}, $match->{line});
+    $self;
+}
+
+#-------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search/Grep.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search/Grep.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search/Grep.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,377 @@
+
+=head1 NAME
+
+Mail::Box::Search::Grep - select messages within a mail box like grep does
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Search::Grep
+   is a Mail::Box::Search
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ use Mail::Box::Manager;
+ my $mgr    = Mail::Box::Manager->new;
+ my $folder = $mgr->open('Inbox');
+
+ my $filter = Mail::Box::Search::Grep->new
+    ( label => 'selected'
+    , in => 'BODY', match => qr/abc?d*e/
+    );
+
+ my @msgs   = $filter->search($folder);
+
+ my $filter = Mail::Box::Search::Grep->new
+   ( field => 'To'
+   , match => $my_email
+   );
+
+ if($filter->search($message)) {...}
+
+
+=head1 DESCRIPTION
+
+Try to find some text strings in the header and footer of messages.  Various
+ways to limit the search to certain header fields, the whole header, only
+the body, the whole message, but even binary multiparts, are provided for.
+
+The name I<grep> is derived from the UNIX tool I<grep>, which means: "Get
+Regular Expression and Print".  Although you can search using regular
+expressions (the Perl way of them), you do not have to print those as
+result.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Box::Search::Grep-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+Create a UNIX-grep like search filter.
+
+ Option      Defined in       Default                         
+ binaries    L<Mail::Box::Search>  <false>                         
+ decode      L<Mail::Box::Search>  <true>                          
+ delayed     L<Mail::Box::Search>  <true>                          
+ deleted     L<Mail::Box::Search>  <false>                         
+ deliver                      undef                           
+ field                        undef                           
+ in          L<Mail::Box::Search>  <$field ? C<'HEAD'> : C<'BODY'>>
+ label       L<Mail::Box::Search>  undef                           
+ limit       L<Mail::Box::Search>  C<0>                            
+ log         L<Mail::Reporter>  C<'WARNINGS'>                   
+ logical     L<Mail::Box::Search>  C<'REPLACE'>                    
+ match                        <required>                      
+ multiparts  L<Mail::Box::Search>  <true>                          
+ trace       L<Mail::Reporter>  C<'WARNINGS'>                   
+
+. binaries BOOLEAN
+
+. decode BOOLEAN
+
+. delayed BOOLEAN
+
+. deleted BOOLEAN
+
+. deliver undef|CODE|'DELETE'|LABEL|'PRINT'|REF-ARRAY
+
+=over 4
+
+Store the details about where the match was found.  The search may take
+much longer when this feature is enabled.
+
+When an ARRAY is specified it will contain a list of references to hashes.
+Each hash contains the information of one match.  A match in a header
+line will result in a line with fields C<message>, C<part>, and C<field>, where
+the field is a L<Mail::Message::Field|Mail::Message::Field> object.  When the match is in
+the body the hash will contain a C<message>, C<part>, C<linenr>, and C<line>.
+
+In case of a CODE reference, that routine is called for each match. The
+first argument is this search object and the second a reference to same
+hash as would be stored in the array.
+
+The C<PRINT> will call L<printMatchedHead()|Mail::Box::Search::Grep/"The Results"> or L<printMatchedBody()|Mail::Box::Search::Grep/"The Results"> when
+any matching header resp body line was found.  The output is minimized
+by not reprinting the message info on multiple matches in the same
+message.
+
+C<DELETE> will flag
+the message to be deleted in case of a match.  When a multipart's part
+is matched, the whole message will be flagged for deletion.
+
+=back
+
+. field undef|STRING|REGEX|CODE
+
+=over 4
+
+Not valid in combination with C<in> set to C<BODY>.
+The STRING is one full field name (case-insensitive).  Use a REGEX
+to select more than one header line to be scanned. CODE is a routine which
+is called for each field in the header.   The CODE is called with the header
+as first, and the field as second argument.  If the CODE returns true, the
+message is selected.
+
+=back
+
+. in 'HEAD'|'BODY'|'MESSAGE'
+
+. label STRING
+
+. limit NUMBER
+
+. log LEVEL
+
+. logical 'REPLACE'|'AND'|'OR'|'NOT'|'AND NOT'|'OR NOT'
+
+. match STRING|REGEX|CODE
+
+=over 4
+
+The pattern to be search for can be a REGular EXpression, or a STRING.  In
+both cases, the match succeeds if it is found anywhere within the selected
+fields.
+
+With a CODE reference, that function will be called each field or body-line.
+When the result is true, the details are delivered.  The call formats are
+
+ $code->($head, $field);          # for HEAD searches
+ $code->($body, $linenr, $line);  # for BODY searches
+
+The C<$head> resp C<$body> are one message's head resp. body object.  The
+C<$field> is a header line which matches.  The C<$line> and C<$linenr>
+tell the matching line in the body.
+
+Be warned that when you search in C<MESSAGE> the code must accept
+both formats.
+
+=back
+
+. multiparts BOOLEAN
+
+. trace LEVEL
+
+=back
+
+=head2 Searching
+
+
+$obj-E<gt>B<inBody>(PART, BODY)
+
+=over 4
+
+See L<Mail::Box::Search/"Searching">
+
+=back
+
+$obj-E<gt>B<inHead>(PART, HEAD)
+
+=over 4
+
+See L<Mail::Box::Search/"Searching">
+
+=back
+
+$obj-E<gt>B<search>(FOLDER|THREAD|MESSAGE|ARRAY-OF-MESSAGES)
+
+=over 4
+
+See L<Mail::Box::Search/"Searching">
+
+=back
+
+$obj-E<gt>B<searchPart>(PART)
+
+=over 4
+
+See L<Mail::Box::Search/"Searching">
+
+=back
+
+=head2 The Results
+
+
+$obj-E<gt>B<printMatch>([FILEHANDLE], HASH)
+
+=over 4
+
+See L<Mail::Box::Search/"The Results">
+
+=back
+
+$obj-E<gt>B<printMatchedBody>(FILEHANDLE, MATCH)
+
+=over 4
+
+=back
+
+$obj-E<gt>B<printMatchedHead>(FILEHANDLE, MATCH)
+
+=over 4
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Search::Grep-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Search::Grep-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Search::Grep-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search/IMAP.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search/IMAP.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search/IMAP.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,22 @@
+
+package Mail::Box::Search::IMAP;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box::Search';
+
+use strict;
+use warnings;
+
+use Carp;
+
+#-------------------------------------------
+
+
+sub init($)
+{   my ($self, $args) = @_;
+    $self->notImplemented;
+}
+
+#-------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search/IMAP.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search/IMAP.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search/IMAP.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,286 @@
+
+=head1 NAME
+
+Mail::Box::Search::IMAP - select messages within a IMAP folder
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Search::IMAP
+   is a Mail::Box::Search
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ use Mail::Box::Manager;
+ my $mgr    = Mail::Box::Manager->new;
+ my $folder = $mgr->open('imap4:Inbox');
+
+ my $filter = Mail::Box::Search::IMAP->new
+    (  ...to be defined...
+    );
+
+ my @msgs   = $filter->search($folder);
+ if($filter->search($message)) {...}
+
+
+=head1 DESCRIPTION
+
+THIS PACKAGES IS NOT IMPLEMENTED YET: it waits for
+L<Mail::Transport::IMAP4|Mail::Transport::IMAP4> to be available.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Box::Search::IMAP-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option      Defined in       Default      
+ binaries    L<Mail::Box::Search>  <false>      
+ decode      L<Mail::Box::Search>  <true>       
+ delayed     L<Mail::Box::Search>  <true>       
+ deleted     L<Mail::Box::Search>  <false>      
+ deliver     L<Mail::Box::Search>  undef        
+ in          L<Mail::Box::Search>  C<'BODY'>    
+ label       L<Mail::Box::Search>  undef        
+ limit       L<Mail::Box::Search>  C<0>         
+ log         L<Mail::Reporter>  C<'WARNINGS'>
+ logical     L<Mail::Box::Search>  C<'REPLACE'> 
+ multiparts  L<Mail::Box::Search>  <true>       
+ trace       L<Mail::Reporter>  C<'WARNINGS'>
+
+. binaries BOOLEAN
+
+. decode BOOLEAN
+
+. delayed BOOLEAN
+
+. deleted BOOLEAN
+
+. deliver undef|CODE|'DELETE'
+
+. in 'HEAD'|'BODY'|'MESSAGE'
+
+. label STRING
+
+. limit NUMBER
+
+. log LEVEL
+
+. logical 'REPLACE'|'AND'|'OR'|'NOT'|'AND NOT'|'OR NOT'
+
+. multiparts BOOLEAN
+
+. trace LEVEL
+
+=back
+
+=head2 Searching
+
+
+$obj-E<gt>B<inBody>(PART, BODY)
+
+=over 4
+
+See L<Mail::Box::Search/"Searching">
+
+=back
+
+$obj-E<gt>B<inHead>(PART, HEAD)
+
+=over 4
+
+See L<Mail::Box::Search/"Searching">
+
+=back
+
+$obj-E<gt>B<search>(FOLDER|THREAD|MESSAGE|ARRAY-OF-MESSAGES)
+
+=over 4
+
+See L<Mail::Box::Search/"Searching">
+
+=back
+
+$obj-E<gt>B<searchPart>(PART)
+
+=over 4
+
+See L<Mail::Box::Search/"Searching">
+
+=back
+
+=head2 The Results
+
+
+$obj-E<gt>B<printMatch>([FILEHANDLE], HASH)
+
+=over 4
+
+See L<Mail::Box::Search/"The Results">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Search::IMAP-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Search::IMAP-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Search::IMAP-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search/SpamAssassin.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search/SpamAssassin.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search/SpamAssassin.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,70 @@
+
+package Mail::Box::Search::SpamAssassin;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Box::Search';
+
+use strict;
+use warnings;
+
+use Mail::SpamAssassin;
+use Mail::Message::Wrapper::SpamAssassin;
+
+#-------------------------------------------
+
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    $args->{in}  ||= 'MESSAGE';
+    $args->{label} = 'spam' unless exists $args->{label};
+
+    $self->SUPER::init($args);
+
+    $self->{MBSS_rewrite_mail}
+       = defined $args->{rewrite_mail} ? $args->{rewrite_mail} : 1;
+
+    $self->{MBSS_sa}
+       = defined $args->{spamassassin} ? $args->{spamassassin}
+       : Mail::SpamAssassin->new($args->{sa_options} || {});
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub assassinator() { shift->{MBSS_sa} }
+
+#-------------------------------------------
+
+sub searchPart($)
+{   my ($self, $message) = @_;
+
+    my @details = (message => $message);
+   
+    my $sa      = Mail::Message::Wrapper::SpamAssassin->new($message);
+    my $status  = $self->assassinator->check($sa);
+
+    my $is_spam = $status->is_spam;
+    $status->rewrite_mail if $self->{MBSS_rewrite_mail};
+
+    if($is_spam)
+    {   my $deliver = $self->{MBS_deliver};
+        $deliver->( {@details, status => $status} ) if defined $deliver;
+    }
+
+    $is_spam;
+}
+
+#-------------------------------------------
+
+sub inHead(@) {shift->notImplemented}
+
+#-------------------------------------------
+
+sub inBody(@) {shift->notImplemented}
+
+#-------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search/SpamAssassin.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search/SpamAssassin.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search/SpamAssassin.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,365 @@
+
+=head1 NAME
+
+Mail::Box::Search::SpamAssassin - select spam messages with Mail::SpamAssassin
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Search::SpamAssassin
+   is a Mail::Box::Search
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ use Mail::Box::Manager;
+ my $mgr    = Mail::Box::Manager->new;
+ my $folder = $mgr->open('Inbox');
+
+ my $spam = Mail::Box::Search::SpamAssassin->new;
+ if($spam->search($message)) {...}
+
+ my @msgs   = $filter->search($folder);
+ foreach my $msg ($folder->messages)
+ {   $msg->delete if $msg->label('spam');
+ }
+
+ my $spam2 = Mail::Box::Search::SpamAssassin
+               ->new(deliver => 'DELETE');
+ $spam2->search($folder);
+ $mgr->moveMessages($spamfolder, $folder->messages('spam'));
+
+
+=head1 DESCRIPTION
+
+I<Spam> means "unsollicited e-mail", and is as name derived from a
+Monty Python scatch.  Although Monty Python is fun, spam is a pain:
+it needlessly spoils minutes of time from most people: telephone
+bills, overful mailboxes which block honest e-mail, and accidentally
+removal of honest e-mail which looks like spam.  Spam is the pest
+of Internet.
+
+Happily, Mail::Box can be used as spam filter, in combination with
+the useful Mail::SpamAssassin module (which must be installed separately).
+Each message which is searched is wrapped in a
+L<Mail::Message::Wrapper::SpamAssassin|Mail::Message::Wrapper::SpamAssassin> object.
+
+The spam-assassin module version 2 is not really well adapted for
+L<Mail::Message|Mail::Message> objects, which will make this search even slower than
+spam-detection already is.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Box::Search::SpamAssassin-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+Create a spam filter.  Internally, a Mail::SpamAssassin object is
+maintained.
+
+Only the whole message can be searched; this is a limitation of
+the Mail::SpamAssassin module.
+
+ Option         Defined in       Default      
+ binaries       L<Mail::Box::Search>  <false>      
+ decode         L<Mail::Box::Search>  <true>       
+ delayed        L<Mail::Box::Search>  <true>       
+ deleted        L<Mail::Box::Search>  <false>      
+ deliver        L<Mail::Box::Search>  undef        
+ in             L<Mail::Box::Search>  C<'MESSAGE'> 
+ label                           c<'spam'>    
+ limit          L<Mail::Box::Search>  C<0>         
+ log            L<Mail::Reporter>  C<'WARNINGS'>
+ logical        L<Mail::Box::Search>  C<'REPLACE'> 
+ multiparts     L<Mail::Box::Search>  <true>       
+ rewrite_mail                    <true>       
+ sa_options                      C<{ }>       
+ spam_assassin                   undef        
+ trace          L<Mail::Reporter>  C<'WARNINGS'>
+
+. binaries BOOLEAN
+
+. decode BOOLEAN
+
+. delayed BOOLEAN
+
+. deleted BOOLEAN
+
+. deliver undef|CODE|'DELETE'
+
+. in 'HEAD'|'BODY'|'MESSAGE'
+
+. label STRING|undef
+
+=over 4
+
+Mark all selected message with the specified STRING.  If this
+option is explicitly set to C<undef>, the label will not be set.
+
+=back
+
+. limit NUMBER
+
+. log LEVEL
+
+. logical 'REPLACE'|'AND'|'OR'|'NOT'|'AND NOT'|'OR NOT'
+
+. multiparts BOOLEAN
+
+. rewrite_mail BOOLEAN
+
+=over 4
+
+Add lines to the message header describing the results of the spam
+scan. See Mail::SpamAssassin::PerMsgStatus subroutine rewrite_mail.
+
+=back
+
+. sa_options HASH
+
+=over 4
+
+Options to create the internal Mail::SpamAssassin object; see its
+manual page for the available options.  Other setting may be provided
+via SpamAssassins configuration file mechanism, which is explained in
+L<Mail::SpamAssassin::Conf>.
+
+=back
+
+. spam_assassin OBJECT
+
+=over 4
+
+Provide a Mail::SpamAssassin object to be used for searching spam.  If
+none is specified, one is created internally.  The object can be
+retreived with assassinator().
+
+=back
+
+. trace LEVEL
+
+I<Example:> 
+
+ my $filter = Mail::Box::Search::SpamAssassin
+               ->new( found => 'DELETE' );
+
+=back
+
+=head2 Searching
+
+
+$obj-E<gt>B<assassinator>
+
+=over 4
+
+Returns the internally maintained assassinator object.  You may want
+to reach this object for complex configuration.
+
+=back
+
+$obj-E<gt>B<inBody>(PART, BODY)
+
+=over 4
+
+See L<Mail::Box::Search/"Searching">
+
+=back
+
+$obj-E<gt>B<inHead>(PART, HEAD)
+
+=over 4
+
+See L<Mail::Box::Search/"Searching">
+
+=back
+
+$obj-E<gt>B<search>(FOLDER|THREAD|MESSAGE|ARRAY-OF-MESSAGES)
+
+=over 4
+
+See L<Mail::Box::Search/"Searching">
+
+=back
+
+$obj-E<gt>B<searchPart>(PART)
+
+=over 4
+
+See L<Mail::Box::Search/"Searching">
+
+=back
+
+=head2 The Results
+
+
+$obj-E<gt>B<printMatch>([FILEHANDLE], HASH)
+
+=over 4
+
+See L<Mail::Box::Search/"The Results">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Search::SpamAssassin-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Search::SpamAssassin-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Search::SpamAssassin-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,174 @@
+
+package Mail::Box::Search;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Reporter';
+
+use strict;
+use warnings;
+
+use Carp;
+
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    $self->SUPER::init($args);
+
+    my $in = $args->{in} || 'BODY';
+    @$self{ qw/MBS_check_head MBS_check_body/ }
+      = $in eq 'BODY'    ? (0,1)
+      : $in eq 'HEAD'    ? (1,0)
+      : $in eq 'MESSAGE' ? (1,1)
+      : ($self->log(ERROR => "Search in BODY, HEAD or MESSAGE not $in."), return);
+
+    $self->log(ERROR => "Cannot search in header."), return
+        if $self->{MBS_check_head} && !$self->can('inHead');
+
+    $self->log(ERROR => "Cannot search in body."), return
+        if $self->{MBS_check_body} && !$self->can('inBody');
+
+    my $deliver             = $args->{deliver};
+    $self->{MBS_deliver}
+      = ref $deliver eq 'CODE' ? sub { $deliver->($self, $_[0]) }
+      : !defined $deliver      ? undef
+      : $deliver eq 'DELETE'
+        ? sub {$_[0]->{part}->toplevel->label(deleted => 1)}
+      : $self->log(ERROR => "Don't know how to deliver results in $deliver.");
+
+    my $logic               = $args->{logical}  || 'REPLACE';
+    $self->{MBS_negative}   = $logic =~ s/\s*NOT\s*$//;
+    $self->{MBS_logical}    = $logic;
+
+    $self->{MBS_label}      = $args->{label};
+    $self->{MBS_binaries}   = $args->{binaries} || 0;
+    $self->{MBS_limit}      = $args->{limit}    || 0;
+    $self->{MBS_decode}     = $args->{decode}   || 1;
+    $self->{MBS_no_deleted} = not $args->{deleted};
+    $self->{MBS_delayed}    = defined $args->{delayed} ? $args->{delayed} : 1;
+    $self->{MBS_multiparts}
+       = defined $args->{multiparts} ? $args->{multiparts} : 1;
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub search(@)
+{   my ($self, $object) = @_;
+
+    my $label         = $self->{MBS_label};
+    my $limit         = $self->{MBS_limit};
+
+    my @messages
+      = ref $object eq 'ARRAY'        ? @$object
+      : $object->isa('Mail::Box')     ? $object->messages
+      : $object->isa('Mail::Message') ? ($object)
+      : $object->isa('Mail::Box::Thread::Node') ? $object->threadMessages
+      : croak "Expect messages to search, not $object.";
+
+    my $take = 0;
+    if($limit < 0)    { $take = -$limit; @messages = reverse @messages }
+    elsif($limit > 0) { $take = $limit }
+    elsif(!defined $label && !wantarray && !$self->{MBS_deliver}) {$take = 1 }
+
+    my $logic         = $self->{MBS_logical};
+    my @selected;
+    my $count = 0;
+
+    foreach my $message (@messages)
+    {   next if $self->{MBS_no_deleted} && $message->isDeleted;
+        next unless $self->{MBS_delayed} || !$message->isDelayed;
+
+        my $set = defined $label ? $message->label($label) : 0;
+
+        my $selected
+          =  $set && $logic eq 'OR'  ? 1
+          : !$set && $logic eq 'AND' ? 0
+          : $self->{MBS_negative}    ? ! $self->searchPart($message)
+          :                            $self->searchPart($message);
+
+        $message->label($label => $selected) if defined $label;
+        if($selected)
+        {   push @selected, $message;
+            $count++;
+            last if $take && $count == $take;
+        }
+    }
+
+    $limit < 0 ? reverse @selected : @selected;
+}
+
+
+#-------------------------------------------
+
+
+sub searchPart($)
+{  my ($self, $part) = @_;
+
+   my $matched = 0;
+   $matched  = $self->inHead($part, $part->head)
+      if $self->{MBS_check_head};
+
+   return $matched unless $self->{MBS_check_body};
+   return $matched if $matched && !$self->{MBS_deliver};
+
+   my $body  = $part->body;
+   my @bodies;
+
+   # Handle multipart parts.
+
+   if($body->isMultipart)
+   {   return $matched unless $self->{MBS_multiparts};
+       my $no_delayed = not $self->{MBS_delayed};
+       @bodies = ($body->preamble, $body->epilogue);
+
+       foreach my $piece ($body->parts)
+       {   next unless defined $piece;
+           next if $no_delayed && $piece->isDelayed;
+
+           $matched += $self->searchPart($piece);
+           return $matched if $matched && !$self->{MBS_deliver};
+       }
+   }
+   elsif($body->isNested)
+   {   return $matched unless $self->{MBS_multiparts};
+       $matched += $self->searchPart($body->nested);
+   }
+   else
+   {   @bodies = ($body);
+   }
+
+   # Handle normal bodies.
+
+   foreach (@bodies)
+   {   next unless defined $_;
+       next if !$self->{MBS_binaries} && $_->isBinary;
+       my $body   = $self->{MBS_decode} ? $_->decoded : $_;
+       my $inbody = $self->inBody($part, $body);
+       $matched  += $inbody;
+   }
+
+   $matched;
+}
+
+#-------------------------------------------
+
+
+sub inHead(@) {shift->notImplemented}
+
+#-------------------------------------------
+
+
+sub inBody(@) {shift->notImplemented}
+
+#-------------------------------------------
+
+
+sub printMatch($) {shift->notImplemented}
+
+#-------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Search.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,447 @@
+
+=head1 NAME
+
+Mail::Box::Search - select messages within a mail box
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Search
+   is a Mail::Reporter
+
+ Mail::Box::Search is extended by
+   Mail::Box::Search::Grep
+   Mail::Box::Search::IMAP
+   Mail::Box::Search::SpamAssassin
+
+
+=head1 SYNOPSIS
+
+ use Mail::Box::Manager;
+ my $mgr    = Mail::Box::Manager->new;
+ my $folder = $mgr->open('Inbox');
+
+ my $filter = Mail::Box::Search::[something]->new;
+ my @msgs   = $filter->search($folder, ...);
+ if($filter->search($message)) {...}
+
+
+=head1 DESCRIPTION
+
+This C<Mail::Box::Search> class is the base class for various message scan
+algorithms.  The selected messages can be labeled.  Boolean operations on
+messages are supported.
+
+Currently implemented searches:
+
+=over 4
+
+=item L<Mail::Box::Search::Grep|Mail::Box::Search::Grep>
+
+Match header or body against a regular expression in a UNIX C<grep> like
+fashion.
+
+=item L<Mail::Box::Search::SpamAssassin|Mail::Box::Search::SpamAssassin>
+
+Try to detect spam, using Mail::SpamAssassin.
+
+=item L<Mail::Box::Search::IMAP|Mail::Box::Search::IMAP>
+
+Search an IMAP folder for special interface IMAP folders provide for it.
+UNDER CONSTRUCTION till L<Mail::Transport::IMAP4|Mail::Transport::IMAP4> is complete.
+
+=back
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Box::Search-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+Create a filter.
+
+ Option      Defined in       Default      
+ binaries                     <false>      
+ decode                       <true>       
+ delayed                      <true>       
+ deleted                      <false>      
+ deliver                      undef        
+ in                           C<'BODY'>    
+ label                        undef        
+ limit                        C<0>         
+ log         L<Mail::Reporter>  C<'WARNINGS'>
+ logical                      C<'REPLACE'> 
+ multiparts                   <true>       
+ trace       L<Mail::Reporter>  C<'WARNINGS'>
+
+. binaries BOOLEAN
+
+=over 4
+
+Whether to include binary bodies in the search.
+
+=back
+
+. decode BOOLEAN
+
+=over 4
+
+Decode the messages before the search takes place.  Even plain text messages
+can be encoded, for instance as C<quoted-printable>, which may disturb the
+results.  However, decoding will slow-down the search.
+
+=back
+
+. delayed BOOLEAN
+
+=over 4
+
+Include the delayed messages (which will be parsed) in the search.  If you
+set this to false, you may find fewer hits.
+
+=back
+
+. deleted BOOLEAN
+
+=over 4
+
+In most cases, you will not be interested in results which are
+found in messages flagged to be deleted.  However, with this option
+you can specify you want them to be searched too.
+
+=back
+
+. deliver undef|CODE|'DELETE'
+
+=over 4
+
+The exact functionality of this parameter differs per search method, so
+read the applicable man-page.  In any case C<undef> means that details
+are not collected for this search, which is the fastest search.
+
+C<DELETE> will flag the message to be flagged for deletion.
+You may also specify your own CODE reference.  With an reference
+to an array, the information about the matches is collected as a list
+of hashes, one hash per match.
+
+=back
+
+. in 'HEAD'|'BODY'|'MESSAGE'
+
+=over 4
+
+Where to look for the match.
+
+=back
+
+. label STRING
+
+=over 4
+
+Mark all selected messages with the specified STRING.  If this field is
+not specified, the message will not get a label; search() also returns
+a list of selected messages.
+
+=back
+
+. limit NUMBER
+
+=over 4
+
+Limit the search to the specified NUMBER of messages.  When the NUMBER
+is positive, the search starts at the first message in the folder or
+thread.  A negative NUMBER starts at the end of the folder.  If the limit
+is set to zero, there is no limit.
+
+=back
+
+. log LEVEL
+
+. logical 'REPLACE'|'AND'|'OR'|'NOT'|'AND NOT'|'OR NOT'
+
+=over 4
+
+Only applicable in combination with a C<label>.
+How to handle the existing labels.  In case of C<REPLACE>, messages
+which already are carrying the label are stripped from their
+selection (unless they match again).  With C<AND>, the message must
+be selected by this search and already carry the label, otherwise the
+label will not be set.  Specify C<OR> to have newly selected messages
+added to the set of already selected messages.
+
+C<NOT> is true for messages which do not fulfil the search.  The
+details output will still contain the places where the match was
+found, however those messages will complementary set of messages will
+be labeled and returned.
+
+=back
+
+. multiparts BOOLEAN
+
+=over 4
+
+Are multiparts to be included in the search results?  Some MUA have
+problems handling details received from the search.  When this flag
+is turned off, the body of multiparts will be ignored.  The parts
+search will include the preamble and epilogue.
+
+=back
+
+. trace LEVEL
+
+=back
+
+=head2 Searching
+
+
+$obj-E<gt>B<inBody>(PART, BODY)
+
+=over 4
+
+Tests whether body contains the requesting information.  See the
+specific search module for its parameters.
+
+=back
+
+$obj-E<gt>B<inHead>(PART, HEAD)
+
+=over 4
+
+Tests whether header contains the requesting information.  See the
+specific search module for its parameters.
+
+=back
+
+$obj-E<gt>B<search>(FOLDER|THREAD|MESSAGE|ARRAY-OF-MESSAGES)
+
+=over 4
+
+Check which messages from the FOLDER (Mail::Box) match the
+search parameters.  The matched messages are returned as list.  You
+can also specify a THREAD (a L<Mail::Box::Thread::Node|Mail::Box::Thread::Node>), one single
+MESSAGE (a L<Mail::Message|Mail::Message>), or an array of messages.
+
+Sometimes we know how only one match is needed.  In this case, this
+searching will stop at the first match.  For instance, when C<limit> is C<-1>
+or C<1>, or when the search in done in scalar context.
+
+I<Example:> 
+
+ my $grep = Mail::Box::Search::Grep->new
+  ( match   => 'My Name Is Nobody'
+  , deliver => 'PRINT'
+  );
+
+ $grep->search($folder);
+
+ my $message = $folder->message(3);
+ $grep->search($message);
+
+ my $thread  = $message->threadStart;
+ $grep->search($thread);
+
+=back
+
+$obj-E<gt>B<searchPart>(PART)
+
+=over 4
+
+Search this message PART for matches.
+
+=back
+
+=head2 The Results
+
+
+$obj-E<gt>B<printMatch>([FILEHANDLE], HASH)
+
+=over 4
+
+Print the information about the match (see L<new(deliver)|Mail::Box::Search/"METHODS">) in
+some understandable way.  If no file handle
+is specified, the output will go to the selected filehandle (see
+C<perldoc -f select>).
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Search-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Search-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Search-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot search in body.
+
+Th search object does not implement L<inBody()|Mail::Box::Search/"Searching">, and can therefore
+not search a message body.
+
+I<Error:> Cannot search in header.
+
+Th search object does not implement L<inHead()|Mail::Box::Search/"Searching">, and can therefore
+not search a message header.
+
+I<Error:> Don't know how to deliver via results in $way.
+
+The search results cannot be delivered in the specific way, because that is
+not a defined alternative.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Search in BODY, HEAD or MESSAGE not $in.
+
+The C<in> option defines only three names.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Thread/Manager.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Thread/Manager.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Thread/Manager.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,367 @@
+
+use strict;
+package Mail::Box::Thread::Manager;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Reporter';
+
+use Carp;
+use Mail::Box::Thread::Node;
+use Mail::Message::Dummy;
+
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    $self->{MBTM_manager} = $args->{manager}
+        or croak "Need a manager to work with.";
+
+    $self->{MBTM_thread_body}= $args->{thread_body}|| 0;
+    $self->{MBTM_thread_type}= $args->{thread_type}||'Mail::Box::Thread::Node';
+    $self->{MBTM_dummy_type} = $args->{dummy_type} ||'Mail::Message::Dummy';
+
+    for($args->{timespan} || '3 days')
+    {    $self->{MBTM_timespan} = $_ eq 'EVER' ? 'EVER'
+                               : Mail::Box->timespan2seconds($_);
+    }
+
+    for($args->{window} || 10)
+    {   $self->{MBTM_window} = $_ eq 'ALL'  ? 'ALL' : $_;
+    }
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub folders() { values %{shift->{MBTM_folders}} }
+
+#-------------------------------------------
+
+
+sub includeFolder(@)
+{   my $self = shift;
+
+    foreach my $folder (@_)
+    {   croak "Not a folder: $folder"
+            unless ref $folder && $folder->isa('Mail::Box');
+
+        my $name = $folder->name;
+        next if exists $self->{MBTM_folders}{$name};
+
+        $self->{MBTM_folders}{$name} = $folder;
+        foreach my $msg ($folder->messages)
+        {   $self->inThread($msg) unless $msg->head->isDelayed;
+        }
+    }
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub removeFolder(@)
+{   my $self = shift;
+
+    foreach my $folder (@_)
+    {   croak "Not a folder: $folder"
+            unless ref $folder && $folder->isa('Mail::Box');
+
+        my $name = $folder->name;
+        next unless exists $self->{MBTM_folders}{$name};
+
+        delete $self->{MBTM_folders}{$name};
+
+        $_->headIsRead && $self->outThread($_)
+            foreach $folder->messages;
+
+        $self->{MBTM_cleanup_needed} = 1;
+    }
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub thread($)
+{   my ($self, $message) = @_;
+    my $msgid     = $message->messageId;
+    my $timestamp = $message->timestamp;
+
+    $self->_process_delayed_nodes;
+    my $thread    = $self->{MBTM_ids}{$msgid} || return;
+
+    my @missing;
+    $thread->recurse
+       ( sub { my $node = shift;
+               push @missing, $node->messageId if $node->isDummy;
+               1;
+             }
+       );
+
+    return $thread unless @missing;
+
+    foreach my $folder ($self->folders)
+    {
+        # Pull-in all messages received after this-one, from any folder.
+        my @now_missing = $folder->scanForMessages
+          ( $msgid
+          , [ @missing ]
+          , $timestamp - 3600 # some clocks are wrong.
+          , 0
+          );
+
+        if(@now_missing != @missing)
+        {   $self->_process_delayed_nodes;
+            last unless @now_missing;
+            @missing = @now_missing;
+        }
+    }
+
+    $thread;
+}
+
+#-------------------------------------------
+
+
+sub threadStart($)
+{   my ($self, $message) = @_;
+
+    my $thread = $self->thread($message) || return;
+
+    while(my $parent = $thread->repliedTo)
+    {   unless($parent->isDummy)
+        {   # Message already found no special action to be taken.
+            $thread = $parent;
+            next;
+        }
+
+        foreach ($self->folders)
+        {   last unless $_->scanForMessages
+              ( $thread->messageId
+              , $parent->messageId
+              , $thread->message->timestamp - $self->{MBTM_timespan}
+              , $self->{MBTM_window}
+              );
+        }
+
+        $self->_process_delayed_nodes;
+        $thread = $parent;
+    }
+
+    $thread;
+}
+
+#-------------------------------------------
+
+
+sub all()
+{   my $self = shift;
+    $_->find('not-existing') for $self->folders;
+    $self->known;
+}
+
+#-------------------------------------------
+
+
+sub sortedAll(@)
+{   my $self = shift;
+    $_->find('not-existing') for $self->folders;
+    $self->sortedKnown(@_);
+}
+
+#-------------------------------------------
+
+
+sub known()
+{   my $self      = shift->_process_delayed_nodes->_cleanup;
+    grep {!defined $_->repliedTo} values %{$self->{MBTM_ids}};
+}
+
+#-------------------------------------------
+
+
+sub sortedKnown(;$$)
+{   my $self    = shift;
+    my $prepare = shift || sub {shift->startTimeEstimate||0};
+    my $compare = shift || sub {(shift) <=> (shift)};
+ 
+    # Special care for double keys.
+    my %value;
+    push @{$value{$prepare->($_)}}, $_  foreach $self->known; 
+    map { @{$value{$_}} } sort {$compare->($a, $b)} keys %value;
+}
+
+# When a whole folder is removed, many threads can become existing
+# only of dummies.  They must be removed.
+
+sub _cleanup()
+{   my $self = shift;
+    return $self unless $self->{MBTM_cleanup_needed};
+
+    foreach ($self->known)
+    {   my $real = 0;
+        $_->recurse
+          ( sub { my $node = shift;
+                  foreach ($node->messages)
+                  {   next if $_->isDummy;
+                      $real = 1;
+                      return 0;
+                  }
+                  1;
+                }
+          );
+
+        next if $real;
+
+        $_->recurse
+          ( sub { my $node  = shift;
+                  my $msgid = $node->messageId;
+                  delete $self->{MBTM_ids}{$msgid};
+                  1;
+                }
+          );
+    }
+
+    delete $self->{MBTM_cleanup_needed};
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub toBeThreaded($@)
+{   my ($self, $folder) = (shift, shift);
+    return $self unless exists $self->{MBTM_folders}{$folder->name};
+    $self->inThread($_) foreach @_;
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub toBeUnthreaded($@)
+{   my ($self, $folder) = (shift, shift);
+    return $self unless exists $self->{MBTM_folders}{$folder->name};
+    $self->outThread($_) foreach @_;
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub inThread($)
+{   my ($self, $message) = @_;
+    my $msgid = $message->messageId;
+    my $node  = $self->{MBTM_ids}{$msgid};
+
+    # Already known, but might reside in many folders.
+    if($node) { $node->addMessage($message) }
+    else
+    {   $node = Mail::Box::Thread::Node->new(message => $message
+           , msgid => $msgid, dummy_type => $self->{MBTM_dummy_type}
+           );
+        $self->{MBTM_ids}{$msgid} = $node;
+    }
+
+    $self->{MBTM_delayed}{$msgid} = $node; # removes doubles.
+}
+
+# The relation between nodes is delayed, to avoid that first
+# dummy nodes have to be made, and then immediately upgrades
+# to real nodes.  So: at first we inventory what we have, and
+# then build thread-lists.
+
+sub _process_delayed_nodes()
+{   my $self    = shift;
+    return $self unless $self->{MBTM_delayed};
+
+    foreach my $node (values %{$self->{MBTM_delayed}})
+    {   $self->_process_delayed_message($node, $_)
+            foreach $node->message;
+    }
+
+    delete $self->{MBTM_delayed};
+    $self;
+}
+
+sub _process_delayed_message($$)
+{   my ($self, $node, $message) = @_;
+    my $msgid = $message->messageId;
+    my $head  = $message->head;  # will force parsing of head when not
+                         # done yet.
+
+    my $replies;
+    if(my $irt  = $head->get('in-reply-to'))
+    {   for($irt =~ m/\<([^>]*)\>/)
+        {   my $msgid = $1;
+            $msgid    =~ s/\s+//g;
+            $replies  = $self->{MBTM_ids}{$msgid} || $self->createDummy($msgid);
+        }
+    }
+
+    my @refs;
+    if(my $refs = $head->get('references'))
+    {   while($refs =~ s/\<([^>]*)\>//s)
+        {   my $msgid = $1;
+            $msgid    =~ s/\s//gs;
+            push @refs, $self->{MBTM_ids}{$msgid} || $self->createDummy($msgid);
+        }
+    }
+
+    # Handle the `In-Reply-To' message header.
+    # This is the most secure relationship.
+
+    if($replies)
+    {   $node->follows($replies, 'REPLY')
+        and $replies->followedBy($node);
+    }
+
+    # Handle the `References' message header.
+    # The (ordered) list of message-IDs give an impression where this
+    # message resides in the thread.  There is a little less certainty
+    # that the list is correctly ordered and correctly maintained.
+
+    if(@refs)
+    {   push @refs, $node unless $refs[-1] eq $node;
+        my $from = shift @refs;
+
+        while(my $to = shift @refs)
+        {   $to->follows($from, 'REFERENCE')
+            and $from->followedBy($to);
+            $from = $to;
+        }
+    }
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub outThread($)
+{   my ($self, $message) = @_;
+    my $msgid = $message->messageId;
+    my $node  = $self->{MBTM_ids}{$msgid} or return $message;
+
+    $node->{MBTM_messages}
+        = [ grep {$_ ne $message} @{$node->{MBTM_messages}} ];
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub createDummy($)
+{   my ($self, $msgid) = @_;
+    $self->{MBTM_ids}{$msgid} = $self->{MBTM_thread_type}->new
+            (msgid => $msgid, dummy_type => $self->{MBTM_dummy_type});
+}
+
+#-------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Thread/Manager.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Thread/Manager.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Thread/Manager.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,579 @@
+
+=head1 NAME
+
+Mail::Box::Thread::Manager - maintain threads within a set of folders
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Thread::Manager
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my $mgr     = Mail::Box::Thread::Manager->new;
+ my $folder  = $mgr->open(folder => '/tmp/inbox');
+ my $threads = $mgr->threads(folder => $folder);
+ my $threads = $mgr->threads($folder);   # same
+
+ foreach my $thread ($threads->all) {
+     $thread->print;
+ }
+
+ $threads->includeFolder($folder);
+ $threads->removeFolder($folder);
+
+
+=head1 DESCRIPTION
+
+A (message-)I<thread> is a message with links to messages which followed in
+reply of that message.  And then the messages with replied to the messages,
+which replied the original message.  And so on.  Some threads are only
+one message long (never replied to), some threads are very long.
+
+The C<Mail::Box::Thread::Manager> is very powerful.  Not only is it able to
+do a descent job on MH-like folders (makes a trade-off between perfection
+and speed), it also can maintain threads from messages residing in different
+opened folders.  Both facilities are rare for mail-agents.  The manager
+creates flexible trees with L<Mail::Box::Thread::Node|Mail::Box::Thread::Node> objects.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Box::Thread::Manager-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+A C<Mail::Box::Thread::Manager> object is usually created by a
+L<Mail::Box::Manager|Mail::Box::Manager>.  One manager can produce more than one of these
+objects.  One thread manager can combine messages from a set of folders,
+which may be partially overlapping with other objects of the same type.
+
+ Option       Defined in       Default                                           
+ dummy_type                    L<Mail::Message::Dummy|Mail::Message::Dummy>      
+ folder                        C<[ ]>                                            
+ folders                       C<[ ]>                                            
+ log          L<Mail::Reporter>  C<'WARNINGS'>                                     
+ thread_body                   <false>                                           
+ thread_type                   L<Mail::Box::Thread::Node|Mail::Box::Thread::Node>
+ timespan                      C<'3 days'>                                       
+ trace        L<Mail::Reporter>  C<'WARNINGS'>                                     
+ window                        C<10>                                             
+
+. dummy_type CLASS
+
+=over 4
+
+The type of dummy messages.  Dummy messages are used to fill holes in
+detected threads: referred to by messages found in the folder, but itself
+not in the folder. 
+
+=back
+
+. folder FOLDER | REF-ARRAY-FOLDERS
+
+=over 4
+
+Specifies which folders are to be covered by the threads.  You can
+specify one or more open folders.  When you close a folder, the
+manager will automatically remove the messages of that folder from
+your threads.
+
+=back
+
+. folders FOLDER | REF-ARRAY-FOLDERS
+
+=over 4
+
+Equivalent to the C<folder> option.
+
+=back
+
+. log LEVEL
+
+. thread_body BOOLEAN
+
+=over 4
+
+May thread-detection be based on the content of a message?  This has
+a serious performance implication when there are many messages without
+C<In-Reply-To> and C<References> headers in the folder, because it
+will cause many messages to be parsed. NOT IMPLEMENTED YET.
+
+=back
+
+. thread_type CLASS
+
+=over 4
+
+Type of the thread nodes.
+
+=back
+
+. timespan TIME | 'EVER'
+
+=over 4
+
+Specify how fast threads usually work: the amount of time between an
+answer and a reply.  This is used in combination with the C<window>
+option to determine when to give-up filling the holes in threads.
+
+See Mail::Box::timespan2seconds() for the possibilities for TIME.
+With 'EVER', the search for messages in a thread
+will only be limited by the window-size.
+
+=back
+
+. trace LEVEL
+
+. window INTEGER|'ALL'
+
+=over 4
+
+The thread-window describes how many messages should be checked at
+maximum to fill `holes' in threads for folder which use delay-loading
+of message headers.
+
+The constant 'ALL' will cause thread-detection not to stop trying
+to fill holes, but continue looking until the first message of the folder
+is reached.  Gives the best quality results, but may perform bad.
+
+=back
+
+I<Example:> 
+
+ use Mail::Box::Manager;
+ my $mgr     = new Mail::Box::Manager;
+ my $inbox   = $mgr->open(folder => $ENV{MAIL});
+ my $read    = $mgr->open(folder => 'Mail/read');
+ my $threads = $mgr->threads(folders => [$inbox, $read]);
+
+ # longer alternative for last line:
+ my $threads = $mgr->threads;
+ $threads->includeFolder($inbox);
+ $threads->includeFolder($read);
+
+=back
+
+=head2 Grouping Folders
+
+
+$obj-E<gt>B<folders>
+
+=over 4
+
+Returns the folders as managed by this threader.
+
+=back
+
+$obj-E<gt>B<includeFolder>(FOLDERS)
+
+=over 4
+
+Add one or more folders to the list of folders whose messages are
+organized in the threads maintained by this object.  Duplicated
+inclusions will not cause any problems.
+
+From the folders, the messages which have their header lines parsed
+(see L<Mail::Box|Mail::Box> about lazy extracting) will be immediately scanned.
+Messages of which the header is known only later will have to report this
+(see L<toBeThreaded()|Mail::Box::Thread::Manager/"Internals">).
+
+I<Example:> 
+
+ $threads->includeFolder($inbox, $draft);
+
+=back
+
+$obj-E<gt>B<removeFolder>(FOLDERS)
+
+=over 4
+
+Remove one or more folders from the list of folders whose messages are
+organized in the threads maintained by this object.
+
+I<Example:> 
+
+ $threads->removeFolder($draft);
+
+=back
+
+=head2 The Threads
+
+
+$obj-E<gt>B<all>
+
+=over 4
+
+Returns all messages which start a thread.  The list may contain dummy
+messages and messages which are scheduled for deletion.
+
+To be able to return all threads, thread construction on each
+message is performed first, which may be slow for some folder-types
+because is will enforce parsing of message-bodies.
+
+=back
+
+$obj-E<gt>B<known>
+
+=over 4
+
+Returns the list of all messages which are known to be the start of
+a thread.  Threads containing messages which where not read from their
+folder (like often happens MH-folder messages) are not yet known, and
+hence will not be returned.
+
+The list may contain dummy messages, and messages which are scheduled
+for deletion.  Threads are detected based on explicitly calling
+L<inThread()|Mail::Box::Thread::Manager/"Internals"> and L<thread()|Mail::Box::Thread::Manager/"The Threads"> with a messages from the folder.
+
+Be warned that, each time a message's header is read from the folder,
+the return of the method can change.
+
+=back
+
+$obj-E<gt>B<sortedAll>([PREPARE [COMPARE]])
+
+=over 4
+
+Returns L<all()|Mail::Box::Thread::Manager/"The Threads"> the threads by default, but sorted on timestamp.
+
+=back
+
+$obj-E<gt>B<sortedKnown>([PREPARE [,COMPARE]])
+
+=over 4
+
+Returns all L<known()|Mail::Box::Thread::Manager/"The Threads"> threads, in sorted order.  By default, the threads
+will be sorted on timestamp, But a different COMPARE method can be
+specified.
+
+=back
+
+$obj-E<gt>B<thread>(MESSAGE)
+
+=over 4
+
+Returns the thread where this MESSAGE is the start of.  However, there
+is a possibility that this message is a reply itself.
+
+Usually, all messages which are in reply of this message are dated later
+than the specified one.  All headers of messages later than this one are
+getting parsed first, for each folder in this threads-object.
+
+I<Example:> 
+
+ my $threads = $mgr->threads(folder => $inbox);
+ my $thread  = $threads->thread($inbox->message(3));
+ print $thread->string;
+
+=back
+
+$obj-E<gt>B<threadStart>(MESSAGE)
+
+=over 4
+
+Based on a message, and facts from previously detected threads, try
+to build solid knowledge about the thread where this message is in.
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<createDummy>(MESSAGE-ID)
+
+=over 4
+
+Get a replacement message to be used in threads.  Be warned that a
+dummy is not a member of any folder, so the program working with
+threads must test with L<Mail::Message::isDummy()|Mail::Message/"The Message"> before trying things only
+available to real messages.
+
+=back
+
+$obj-E<gt>B<inThread>(MESSAGE)
+
+=over 4
+
+Collect the thread-information of one message.  The `In-Reply-To' and
+`Reference' header-fields are processed.  If this method is called on
+a message whose header was not read yet (as usual for MH-folders,
+for instance) the reading of that header will be triggered here.
+
+=back
+
+$obj-E<gt>B<outThread>(MESSAGE)
+
+=over 4
+
+Remove the message from the thread-infrastructure.  A message is
+replaced by a dummy.
+
+=back
+
+$obj-E<gt>B<toBeThreaded>(FOLDER, MESSAGES)
+
+=over 4
+
+Include the specified messages in/from the threads managed by
+this object, if this folder is maintained by this thread-manager.
+
+=back
+
+$obj-E<gt>B<toBeUnthreaded>(FOLDER, MESSAGES)
+
+=over 4
+
+Remove the specified messages in/from the threads managed by
+this object, if this folder is maintained by this thread-manager.
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Thread::Manager-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Thread::Manager-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Thread::Manager-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+=head1 DETAILS
+
+This module implements thread-detection on a folder.  Messages created
+by the better mailers will include C<In-Reply-To> and C<References>
+lines, which are used to figure out how messages are related.  If you
+prefer a better thread detection, they are implementable, but there
+may be a serious performance hit (depends on the type of folder used).
+
+=head2 Maintaining threads
+
+A C<Mail::Box::Thread::Manager> object is created by the
+L<Mail::Box::Manager|Mail::Box::Manager>, using L<Mail::Box::Manager::threads()|Mail::Box::Manager/"Manage message threads">.
+Each object can monitor the thread-relations between messages in one
+or more folders.  When more than one folder is specified, the messages
+are merged while reading the threads, although nothing changes in the
+folder-structure.  Adding and removing folders which have to be maintained
+is permitted at any moment, although may be quite costly in performance.
+
+An example of the maintained structure is shown below.  The
+L<Mail::Box::Manager|Mail::Box::Manager> has two open folders, and a thread-builder which
+monitors them both.  The combined folders have two threads, the second
+is two long (msg3 is a reply on msg2).  Msg2 is in two folders at once.
+
+       manager
+        |    \
+        |     `----------- threads
+        |                  |     |
+        |                thread thread---thread
+        |                  |    /|        /
+        |                  |   //        /
+        +---- folder1      |  //        /
+        |       |         /  //        /
+        |       `-----msg1  //        /
+        |       `-----msg2-'/        /
+        |                  /        /
+        `-----folder2     /        /
+                |        /        /
+                `-----msg2       /
+                `-----msg3------'
+
+=head2 Delayed thread detection
+
+With L<all()|Mail::Box::Thread::Manager/"The Threads"> you get the start-messages of each thread of this folder.
+When that message was not found in the folder (not saved or already
+removed), you get a message of the dummy-type.  These thread descriptions
+are in perfect state: all messages of the folder are included somewhere,
+and each missing message of the threads (I<holes>) are filled by dummies.
+
+However, to be able to detect all threads it is required to have the
+headers of all messages, which is very slow for some types of folders,
+especially MH and IMAP folders.
+
+For interactive mail-readers, it is preferred to detect threads only
+on messages which are in the viewport of the user.  This may be sloppy
+in some situations, but everything is preferable over reading an MH
+mailbox with 10k e-mails to read only the see most recent messages.
+
+In this object, we take special care not to cause unnecessary parsing
+(loading) of messages.  Threads will only be detected on command, and
+by default only the message headers are used.
+
+The following reports the L<Mail::Box::Thread::Node|Mail::Box::Thread::Node> which is
+related to a message:
+
+ my $thread = $message->thread;
+
+When the message was not put in a thread yet, it is done now.  But, more
+work is done to return the best thread.  Based on various parameters,
+which where specified when the folder was created, the method walks
+through the folder to fill the holes which are in this thread.
+
+Walking from back to front (recently arrived messages are usually in the back
+of the folder), message after message are triggered to be included in their
+thread.  At a certain moment, the whole thread of the requested method
+is found, a certain maximum number of messages was tried, but that
+didn't help (search window bound reached), or the messages within the
+folder are getting too old.  Then the search to complete the thread will
+end, although more messages of them might have been in the folder: we
+don't scan the whole folder for performance reasons.
+
+Finally, for each message where the head is known, for instance for
+all messages in mbox-folders, the correct thread is determined
+immediately.  Also, all messages where the head get loaded later, are
+automatically included.
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Thread/Node.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Thread/Node.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Thread/Node.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,338 @@
+
+use strict;
+package Mail::Box::Thread::Node;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Reporter';
+
+use Carp;
+
+
+sub new(@)
+{   my ($class, %args) = @_;
+    (bless {}, $class)->init(\%args);
+}
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    if(my $message = $args->{message})
+    {   push @{$self->{MBTN_messages}}, $message;
+        $self->{MBTN_msgid} = $args->{msgid} || $message->messageId;
+    }
+    elsif(my $msgid = $args->{msgid})
+    {   $self->{MBTN_msgid} = $msgid;
+    }
+    else
+    {   croak "Need to specify message or message-id";
+    }
+
+    $self->{MBTN_dummy_type} = $args->{dummy_type};
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub message()
+{   my $self = shift;
+
+    unless($self->{MBTN_messages})
+    {   return () if wantarray;
+
+        my $dummy = $self->{MBTN_dummy_type}->new
+          ( messageId =>$self->{MBTN_msgid}
+          );
+
+        push @{$self->{MBTN_messages}}, $dummy;
+        return $dummy;
+    }
+
+    my @messages = @{$self->{MBTN_messages}};
+    return @messages    if wantarray;
+    return $messages[0] if @messages==1;
+
+    foreach (@messages)
+    {   return $_ unless $_->isDeleted;
+    }
+
+    $messages[0];
+}
+
+#-------------------------------------------
+
+
+sub addMessage($)
+{   my ($self, $message) = @_;
+ 
+    return $self->{MBTN_messages} = [ $message ]
+        if $self->isDummy;
+
+    push @{$self->{MBTN_messages}}, $message;
+    $message;
+}
+
+#-------------------------------------------
+
+
+sub isDummy()
+{   my $self = shift;
+    !defined $self->{MBTN_messages} || $self->{MBTN_messages}[0]->isDummy;
+}
+
+#-------------------------------------------
+
+
+sub messageId() { shift->{MBTN_msgid} }
+
+#-------------------------------------------
+
+
+sub expand(;$)
+{   my $self = shift;
+    return $self->message->label('folded') || 0
+        unless @_;
+
+    my $fold = not shift;
+    $_->label(folded => $fold) foreach $self->message;
+    $fold;
+}
+
+sub folded(;$)    # compatibility <2.0
+{  @_ == 1 ? shift->expand : shift->expand(not shift) }
+
+#-------------------------------------------
+
+
+sub repliedTo()
+{   my $self = shift;
+
+    return wantarray
+         ? ($self->{MBTN_parent}, $self->{MBTN_quality})
+         : $self->{MBTN_parent};
+}
+
+#-------------------------------------------
+
+
+sub follows($$)
+{   my ($self, $thread, $how) = @_;
+    my $quality = $self->{MBTN_quality};
+
+    # Do not create cyclic constructs caused by erroneous refs.
+
+    my $msgid = $self->messageId;       # Look up for myself, upwards in thread
+    for(my $walker = $thread; defined $walker; $walker = $walker->repliedTo)
+    {   return undef if $walker->messageId eq $msgid;
+    }
+
+    my $threadid = $thread->messageId;  # a->b and b->a  (ref order reversed)
+    foreach ($self->followUps)
+    {   return undef if $_->messageId eq $threadid;
+    }
+
+    # Register
+
+    if($how eq 'REPLY' || !defined $quality)
+    {   $self->{MBTN_parent}  = $thread;
+        $self->{MBTN_quality} = $how;
+        return $self;
+    }
+    
+    return $self if $quality eq 'REPLY';
+
+    if($how eq 'REFERENCE' || ($how eq 'GUESS' && $quality ne 'REFERENCE'))
+    {   $self->{MBTN_parent}  = $thread;
+        $self->{MBTN_quality} = $how;
+    }
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub followedBy(@)
+{   my $self = shift;
+    $self->{MBTN_followUps}{$_->messageId} = $_ foreach @_;
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub followUps()
+{   my $self    = shift;
+    $self->{MBTN_followUps} ? values %{$self->{MBTN_followUps}} : ();
+}
+
+#-------------------------------------------
+
+
+sub sortedFollowUps()
+{   my $self    = shift;
+    my $prepare = shift || sub {shift->startTimeEstimate||0};
+    my $compare = shift || sub {(shift) <=> (shift)};
+
+    my %value   = map { ($prepare->($_) => $_) } $self->followUps;
+    map { $value{$_} } sort {$compare->($a, $b)} keys %value;
+}
+
+#-------------------------------------------
+
+
+#-------------------------------------------
+
+
+sub threadToString(;$$$)   # two undocumented parameters for layout args
+{   my $self    = shift;
+    my $code    = shift || sub {shift->head->get('subject')};
+    my ($first, $other) = (shift || '', shift || '');
+    my $message = $self->message;
+    my @follows = $self->sortedFollowUps;
+
+    my @out;
+    if($self->folded)
+    {   my $text = $code->($message) || '';
+        chomp $text;
+        return "    $first [" . $self->nrMessages . "] $text\n";
+    }
+    elsif($message->isDummy)
+    {   $first .= $first ? '-*-' : ' *-';
+        return (shift @follows)->threadToString($code, $first, "$other   " )
+            if @follows==1;
+
+        push @out, (shift @follows)->threadToString($code, $first, "$other | " )
+            while @follows > 1;
+    }
+    else
+    {   my $text  = $code->($message) || '';
+        chomp $text;
+        my $size  = $message->shortSize;
+        @out = "$size$first $text\n";
+        push @out, (shift @follows)
+                       ->threadToString($code, "$other |-", "$other | " )
+            while @follows > 1;
+    }
+
+    push @out, (shift @follows)->threadToString($code, "$other `-","$other   " )
+        if @follows;
+
+    join '', @out;
+}
+
+#-------------------------------------------
+
+
+sub startTimeEstimate()
+{   my $self = shift;
+
+    return $self->message->timestamp
+        unless $self->isDummy;
+
+    my $earliest;
+    foreach ($self->followUps)
+    {   my $stamp = $_->startTimeEstimate;
+
+        $earliest = $stamp
+	    if !defined $earliest || (defined $stamp && $stamp < $earliest);
+    }
+
+    $earliest;
+}
+
+#-------------------------------------------
+
+
+sub endTimeEstimate()
+{   my $self = shift;
+
+    my $latest;
+    $self->recurse
+     (  sub { my $node = shift;
+              unless($node->isDummy)
+              {   my $stamp = $node->message->timestamp;
+                  $latest = $stamp if !$latest || $stamp > $latest;
+              }
+            }
+     );
+
+    $latest;
+}
+
+#-------------------------------------------
+
+
+sub recurse($)
+{   my ($self, $code) = @_;
+
+    $code->($self) or return $self;
+
+    $_->recurse($code) or last
+        foreach $self->followUps;
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub totalSize()
+{   my $self  = shift;
+    my $total = 0;
+
+    $self->recurse
+     ( sub {
+          my @msgs = shift->messages;
+          $total += $msgs[0]->size if @msgs;
+          1;}
+     );
+
+    $total;
+}
+
+#-------------------------------------------
+
+
+sub numberOfMessages()
+{   my $self  = shift;
+    my $total = 0;
+    $self->recurse( sub {++$total unless shift->isDummy; 1} );
+    $total;
+}
+
+sub nrMessages() {shift->numberOfMessages}  # compatibility
+
+#-------------------------------------------
+
+
+sub threadMessages()
+{   my $self = shift;
+    my @messages;
+    $self->recurse
+     ( sub
+       { my $node = shift;
+         push @messages, $node->message unless $node->isDummy;
+         1;
+       }
+     );
+
+    @messages;
+}
+
+
+#-------------------------------------------
+
+
+sub ids()
+{   my $self = shift;
+    my @ids;
+    $self->recurse( sub {push @ids, shift->messageId} );
+    @ids;
+}
+
+#-------------------------------------------
+
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Thread/Node.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Thread/Node.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Thread/Node.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,541 @@
+
+=head1 NAME
+
+Mail::Box::Thread::Node - one node in a message thread
+
+
+=head1 INHERITANCE
+
+ Mail::Box::Thread::Node
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my $node = Mail::Box::Thread::Node->new;
+ $node->addMessage($message);
+ ...
+
+
+=head1 DESCRIPTION
+
+The C<Mail::Box::Thread::Node> maintains one node in the linked list of
+threads.  Each node contains one message, and a list of its follow-ups.
+Next to that, it refers to its own ancestor and contains information
+about the trustworthiness of that relationship.
+
+To complicate things a little, because the thread-manager can maintain
+multiple folders, and merge there content, you may find the same message
+in more folders.  All versions of the same message (based on message-id)
+are stored in the same node.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Box::Thread::Node-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+You will not call this method yourself. The L<Mail::Box::Thread::Manager|Mail::Box::Thread::Manager>
+object will call it to construct C<Mail::Box::Thread::Node> objects.
+Either a C<message> or a C<messageId> must be supplied.
+
+ Option      Defined in       Default      
+ dummy_type                   undef        
+ log         L<Mail::Reporter>  C<'WARNINGS'>
+ message                      undef        
+ messageId                    undef        
+ trace       L<Mail::Reporter>  C<'WARNINGS'>
+
+. dummy_type CLASS
+
+=over 4
+
+Indicates the class name of dummy messages. Dummy messages are
+placeholders in a L<Mail::Box::Thread::Manager|Mail::Box::Thread::Manager> data structure.
+
+=back
+
+. log LEVEL
+
+. message MESSAGE
+
+=over 4
+
+The MESSAGE which is stored in this node.  The message
+must be a Mail::Box::Message.
+
+=back
+
+. messageId MESSAGE-ID
+
+=over 4
+
+The MESSAGE-ID for the message which is stored in this node.  Only
+specify it when you don't have the message yet.
+
+=back
+
+. trace LEVEL
+
+=back
+
+=head2 The thread node
+
+
+$obj-E<gt>B<addMessage>(MESSAGE)
+
+=over 4
+
+Add one message to the thread node.  If the node contains a dummy, then
+the dummy is replaced. Otherwise, the messages is added to the end of the
+list.
+
+=back
+
+$obj-E<gt>B<expand>([BOOLEAN])
+
+=over 4
+
+Returns whether this (part of the) folder has to be shown expanded or not.
+This is simply done by a label, which means that most folder types can
+store this.
+
+=back
+
+$obj-E<gt>B<isDummy>
+
+=over 4
+
+Returns true if the message is a dummy. A dummy is a "hole" in a thread
+which has follow-ups but does not have a message.
+
+=back
+
+$obj-E<gt>B<message>
+
+=over 4
+
+Get the message which is stored in this thread node.  NOTE: the same
+message may be located in many folders at the same time, and these
+folders may be controlled by the same thread manager.
+
+In scalar context, this method returns the first instance of the
+message that is not deleted. If all instances are flagged for deletion,
+then you get the first deleted message. When the open folders only
+contain references to the message, but no instance, you get a dummy
+message (see L<Mail::Message::Dummy|Mail::Message::Dummy>).
+
+In list context, all instances of the message which have been found are
+returned.
+
+I<Example:> 
+
+ my $threads = $mgr->threads(folders => [$draft, $sent]);
+ my $node    = $draft->message(1)->thread;
+
+ foreach my $instance ($node->message) {
+    print "Found in ", $instance->folder, ".\n";
+ }
+
+ print "Subject is ", $node->message->subject, ".\n";
+
+=back
+
+$obj-E<gt>B<messageId>
+
+=over 4
+
+Return the message-id related to this thread node.  Each of the messages
+listed in this node will have the same ID.
+
+=back
+
+=head2 The thread order
+
+
+$obj-E<gt>B<followUps>
+
+=over 4
+
+Returns the list of follow-ups to this thread node.  This list
+may contain parsed, not-parsed, and dummy messages.
+
+=back
+
+$obj-E<gt>B<followedBy>(THREADS)
+
+=over 4
+
+Register that the THREADS are follow-ups to this message. These
+follow-ups need not be related to each other in any way other than
+sharing the same parent.
+
+Defining the same relation more than once will not cause information to
+be duplicated.
+
+=back
+
+$obj-E<gt>B<follows>(THREAD, QUALITY)
+
+=over 4
+
+Register that the current thread is a reply to the specified THREAD. The
+QUALITY of the relation is specified by the second argument.  The method
+returns C<undef> if the link is not accepted in order to avoid circular
+references.
+
+The relation may be specified more than once, but only the most confident
+relation is used. For example, if a reply (QUALITY equals C<REPLY>) is
+specified, later calls to the follow method will have no effect. If
+C<follows> is called with a QUALITY that matches the current quality, the
+new thread overrides the previous.
+
+=back
+
+$obj-E<gt>B<repliedTo>
+
+=over 4
+
+Returns the message(s) to which the message in this node replies. In
+scalar context, this method will return the message to which the message
+in this node replies. This message object may be a dummy message.
+
+If the message seems to be the first message of a thread, the value C<undef>
+is returned.  (Remember that some MUA are not adding reference information
+to the message's header, so you can never be sure a message is the
+start of a thread)
+
+In list context, this method returns a second string value indicating the
+confidence that the messages are related.  When extended thread discovery
+is enabled, then some heuristics are applied to determine if messages are
+related. Values for the STRING may be:
+
+=over 4
+
+=item * C<'REPLY'>
+
+This relation was directly derived from an `in-reply-to' message header
+field. The relation has a high confidence.
+
+=item * C<'REFERENCE'>
+
+This relation is based on information found in a `Reference' message
+header field.  One message may reference a list of messages which
+precede it in the thread. The heuristic attempts to determine
+relationships between messages assuming that the references are in order.
+This relation has a lower confidence.
+
+=item * C<'GUESS'>
+
+The relation is a big guess, with low confidence.  It may be based on
+a subject which seems to be related, or commonalities in the message's
+body.
+
+=back
+
+More constants may be added later.
+
+I<Example:> 
+
+ my $question = $answer->repliedTo;
+ my ($question, $quality) = $answer->repliedTo;
+ if($question && $quality eq 'REPLY') { ... };
+
+=back
+
+$obj-E<gt>B<sortedFollowUps>([PREPARE [,COMPARE]])
+
+=over 4
+
+Returns the list of L<followUps()|Mail::Box::Thread::Node/"The thread order">, but sorted.  By default
+sorting is based on the estimated time of the reply. See
+startTimeEstimate().
+
+=back
+
+=head2 On the whole thread
+
+Some convenience methods are added to threads, to simplify retrieving
+information from it.
+
+$obj-E<gt>B<endTimeEstimate>
+
+=over 4
+
+Returns a guess as to when the thread has ended (although you never
+know for sure whether there fill follow messages in the future).
+
+=back
+
+$obj-E<gt>B<ids>
+
+=over 4
+
+Returns all the ids in the thread starting at the current thread node.
+
+I<Example:> 
+
+ $newfolder->addMessages($folder->ids($thread->ids));
+ $folder->delete($thread->ids);
+
+=back
+
+$obj-E<gt>B<numberOfMessages>
+
+=over 4
+
+Number of messages in the thread starting at the current thread node, but
+not counting the dummies.
+
+=back
+
+$obj-E<gt>B<recurse>(CODE-REF)
+
+=over 4
+
+Execute a function for all sub-threads.  If the subroutine returns true,
+sub-threads are visited recursively. Otherwise, the current branch
+traversal is aborted. The routine is called with the thread-node as the
+only argument.
+
+=back
+
+$obj-E<gt>B<startTimeEstimate>
+
+=over 4
+
+Returns a guess as to when the thread was started.  Each message contains
+various date specifications (each with various uncertainties resulting
+from timezones and out-of-sync clocks). One of these date specifications
+is used as the timestamp for the message. If the node contains a dummy
+message the lowest timestamp of the replies is returned. Otherwise the
+estimated timestamp of the node's message is returned.
+
+=back
+
+$obj-E<gt>B<threadMessages>
+
+=over 4
+
+Returns all the messages in the thread starting at the current thread
+node.  This list will not include dummies.
+
+I<Example:> 
+
+ my @t = $folder->message(3)
+                ->threadStart
+                ->threadMessages;
+
+=back
+
+$obj-E<gt>B<threadToString>([CODE])
+
+=over 4
+
+Translate a thread into a string. The string will contain at least one
+line for each message which was found, but tries to fold dummies.  This
+is useful for debugging, but most message readers will prefer to
+implement their own thread printer.
+
+The optional CODE argument is a reference to a routine which will be called
+for each message in the thread.  The routine will be called with the
+message as the first argument.  The default shows the subject of the message.
+In the first example below, this routine is called seven times.
+
+I<Example:> 
+
+ print $node->threadToString;
+
+may result in
+
+ Subject of this message
+ |- Re: Subject of this message
+ |-*- Re: Re: Subject of this message
+ | |- Re(2) Subject of this message
+ | |- [3] Re(2) Subject of this message
+ | `- Re: Subject of this message (reply)
+ `- Re: Subject of this message
+
+The `*' represents a missing message (a "dummy" message).  The `[3]'
+presents a folded thread with three messages.
+
+ print $node->threadToString(\&show);
+
+ sub show($) {
+    my $message = shift;
+    my $subject = $message->head->get('subject');
+    length $subject ? $subject : '<no subject>';
+ }
+
+=back
+
+$obj-E<gt>B<totalSize>
+
+=over 4
+
+Returns the sum of the size of all the messages in the thread.
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box::Thread::Node-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box::Thread::Node-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box::Thread::Node-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie/ARRAY.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie/ARRAY.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie/ARRAY.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,76 @@
+
+use strict;
+package Mail::Box::Tie::ARRAY;
+use vars '$VERSION';
+$VERSION = '2.055';
+
+use Carp;
+
+
+sub TIEARRAY(@)
+{   my ($class, $folder) = @_;
+    croak "No folder specified to tie to."
+        unless ref $folder && $folder->isa('Mail::Box');
+
+    bless { MBT_folder => $folder }, $class;
+}
+
+#-------------------------------------------
+
+
+sub FETCH($)
+{   my ($self, $index) = @_;
+    my $msg = $self->{MBT_folder}->message($index);
+    $msg->isDeleted ? undef : $msg;
+}
+
+#-------------------------------------------
+
+
+sub STORE($$)
+{   my ($self, $index, $msg) = @_;
+    my $folder = $self->{MBT_folder};
+
+    croak "Cannot simply replace messages in a folder: use delete old, then push new."
+        unless $index == $folder->messages;
+
+    $folder->addMessages($msg);
+    $msg;
+}
+
+#-------------------------------------------
+
+
+sub FETCHSIZE()  { scalar shift->{MBT_folder}->messages }
+
+#-------------------------------------------
+
+
+sub PUSH(@)
+{   my $folder = shift->{MBT_folder};
+    $folder->addMessages(@_);
+    scalar $folder->messages;
+}
+ 
+
+#-------------------------------------------
+
+
+sub DELETE($) { shift->{MBT_folder}->message(shift)->delete }
+
+#-------------------------------------------
+
+
+sub STORESIZE($)
+{   my $folder = shift->{MBT_folder};
+    my $length = shift;
+    $folder->message($_) foreach $length..$folder->messages;
+    $length;
+}
+
+# DESTROY is implemented in Mail::Box
+
+#-------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie/ARRAY.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie/ARRAY.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie/ARRAY.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,191 @@
+
+=head1 NAME
+
+Mail::Box::Tie::ARRAY - access an existing message folder as array
+
+
+
+=head1 SYNOPSIS
+
+ use Mail::Box::Manager;
+ my $mgr    = Mail::Box::Manager->new;
+ my $folder = $mgr->open(folder => 'inbox');
+
+ use Mail::Box::Tie::ARRAY;
+ tie my(@inbox), 'Mail::Box::Tie::ARRAY', $folder;
+
+ # deprecated, but works too
+ use Mail::Box::Tie;
+ tie my(@inbox), 'Mail::Box::Tie', $folder;
+
+ foreach (@inbox) {print $_->short}
+ print $_->print foreach @inbox;
+ my $emails = @inbox;
+
+ print $inbox[3];
+ print scalar @inbox;
+ push @inbox, Mail::Box::Message->new(...);
+ delete $inbox[6];
+ print $inbox[0]->head->get('status');
+
+ my $folder = tied @inbox;
+ untie @inbox;
+
+
+=head1 DESCRIPTION
+
+Certainly when you look at a folder as a list of messages, it is logical to
+access the folder through an array.
+
+Not all operations on arrays are supported.  Actually, most functions which
+would reduce the size of the array are modified instead to mark messages for
+deletion.
+
+Examples what you I<cannot> do:
+
+ shift/unshift/pop/splice @inbox;
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+B<TIEARRAY>('Mail::Box::Tie::ARRAY', FOLDER)
+
+=over 4
+
+Create the tie on an existing folder.
+
+I<Example:> tie an array to a folder
+
+
+ my $mgr   = Mail::Box::Manager->new;
+ my $inbox = $mgr->new(folder => $ENV{MAIL});
+ tie my(@inbox), 'Mail::Box::Tie::Array', ref $inbox, $inbox;
+
+=back
+
+=head2 Tied Interface
+
+
+$obj-E<gt>B<DELETE>
+
+=over 4
+
+Flag a message to be removed.  Be warned that the message stays in
+the folder, and is not removed before the folder is written.
+
+I<Example:> 
+
+ delete $inbox[5];
+ $inbox[5]->delete;   #same
+
+=back
+
+$obj-E<gt>B<FETCH>(INDEX)
+
+=over 4
+
+Get the message which is at the indicated location in the list of
+messages contained in this folder.  Deleted messages will be returned
+as C<undef>.
+
+I<Example:> 
+
+ print $inbox[3];     # 4th message in the folder
+ print @inbox[3,0];   # 4th and first of the folder
+ print $inbox[-1];    # last message
+
+=back
+
+$obj-E<gt>B<FETCHSIZE>
+
+=over 4
+
+Return the total number of messages in a folder.  This is called when
+the folder-array is used in scalar context, for instance.
+
+I<Example:> 
+
+ if(@inbox > 10)    # contains more than 10 messages?
+ my $nrmsgs = @inbox;
+
+=back
+
+$obj-E<gt>B<PUSH>(MESSAGES)
+
+=over 4
+
+Add MESSAGES to the end of the folder.
+
+I<Example:> 
+
+    push @inbox, $newmsg;
+
+=back
+
+$obj-E<gt>B<STORE>(INDEX, MESSAGE)
+
+=over 4
+
+Random message replacement is not permitted --doing so would disturb threads
+etc.  An error occurs if you try to do this. The only thing which is allowed
+is to store a message at the first free index at the end of the folder (which
+is also achievable with L<PUSH()|Mail::Box::Tie::ARRAY/"Tied Interface">).
+
+I<Example:> 
+
+ $inbox[8] = $add;
+ $inbox[-1] = $add;
+ push @inbox, $add;
+
+=back
+
+$obj-E<gt>B<STORESIZE>(LENGTH)
+
+=over 4
+
+Sets all messages behind from LENGTH to the end of folder to be deleted.
+
+=back
+
+
+
+
+=head1 DETAILS
+
+
+=head2 Folder tied as array
+
+
+=head3 Limitations
+
+This module implements C<TIEARRAY>, C<FETCH>, C<STORE>, C<FETCHSIZE>,
+C<STORESIZE>, C<DELETE>, C<PUSH>, and C<DESTROY>.
+
+This module does not implement all other methods as described in
+the Tie::Array documentation, because the real array of messages
+is not permitted to shrink or be mutilated.
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie/HASH.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie/HASH.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie/HASH.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,94 @@
+
+use strict;
+package Mail::Box::Tie::HASH;
+use vars '$VERSION';
+$VERSION = '2.055';
+
+use Carp;
+
+
+sub TIEHASH(@)
+{   my ($class, $folder) = @_;
+    croak "No folder specified to tie to."
+        unless ref $folder && $folder->isa('Mail::Box');
+
+    bless { MBT_folder => $folder, MBT_type => 'HASH' }, $class;
+}
+
+#-------------------------------------------
+
+
+sub FETCH($) { shift->{MBT_folder}->messageId(shift) }
+
+#-------------------------------------------
+
+
+sub STORE($$)
+{   my ($self, $key, $basicmsg) = @_;
+
+    carp "Use undef as key, because the message-id of the message is used."
+        if defined $key && $key ne 'undef';
+
+    $self->{MBT_folder}->addMessages($basicmsg);
+}
+
+#-------------------------------------------
+
+
+sub FIRSTKEY()
+{   my $self   = shift;
+    my $folder = $self->{MBT_folder};
+
+    $self->{MBT_each_index} = 0;
+    $self->NEXTKEY();
+}
+
+#-------------------------------------------
+
+
+sub NEXTKEY($)
+{   my $self   = shift;
+    my $folder = $self->{MBT_folder};
+    my $nrmsgs = $folder->messages;
+
+    my $msg;
+    while(1)
+    {   my $index = $self->{MBT_each_index}++;
+        return undef if $index >= $nrmsgs;
+
+        $msg      = $folder->message($index);
+        last unless $msg->isDeleted;
+    }
+
+    $msg->messageId;
+}
+
+#-------------------------------------------
+
+
+sub EXISTS($)
+{   my $folder = shift->{MBT_folder};
+    my $msgid  = shift;
+    my $msg    = $folder->messageId($msgid);
+    defined $msg && ! $msg->isDeleted;
+}
+
+#-------------------------------------------
+
+
+sub DELETE($)
+{    my ($self, $msgid) = @_;
+     $self->{MBT_folder}->messageId($msgid)->delete;
+}
+
+#-------------------------------------------
+
+
+sub CLEAR()
+{   my $folder = shift->{MBT_folder};
+    $_->delete foreach $folder->messages;
+}
+
+#-------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie/HASH.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie/HASH.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie/HASH.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,181 @@
+
+=head1 NAME
+
+Mail::Box::Tie::HASH - access an existing message folder as a hash
+
+
+
+=head1 SYNOPSIS
+
+ tie my(%inbox), 'Mail::Box::Tie::HASH', $folder;
+
+ foreach my $msgid (keys %inbox)
+ {   print $inbox{$msgid};
+     delete $inbox{$msgid};
+ }
+
+ $inbox{$msg->messageId} = $msg;
+
+
+=head1 DESCRIPTION
+
+Certainly when you look at a folder as being a set of related messages
+based on message-id, it is logical to access the folder through a hash.
+
+For a tied hash, the message-id is used as the key.  The message-id is usually
+unique, but when two or more instances of the same message are in the same
+folder, one will be flagged for deletion and the other will be returned.
+
+This implementation uses basic folder access routines which are related
+to the message-id.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+B<TIEHASH>('Mail::Box::Tie::HASH', FOLDER)
+
+=over 4
+
+Connects the FOLDER object to a HASH.
+
+I<Example:> 
+
+ my $mgr    = Mail::Box::Manager->new;
+ my $folder = $mgr->open(access => 'rw');
+ tie my(%inbox), 'Mail::Box::Tie::HASH', $folder;
+
+=back
+
+=head2 Tied Interface
+
+
+$obj-E<gt>B<CLEAR>
+
+=over 4
+
+Remove the contents of the hash.  This is not really possible, but all
+the messages will be flagged for deletion.
+
+I<Example:> 
+
+ %inbox = ();
+ %inbox = ($msg->messageId, $msg); #before adding msg
+
+=back
+
+$obj-E<gt>B<DELETE>(MESSAGE-ID)
+
+=over 4
+
+Remove the message with the specified MESSAGE-ID.
+
+I<Example:> 
+
+ delete $inbox{$msgid};
+
+=back
+
+$obj-E<gt>B<EXISTS>(MESSAGE-ID)
+
+=over 4
+
+Check whether a message with a certain MESSAGE-ID exists.
+
+I<Example:> 
+
+ if(exists $inbox{$msgid}) ...
+
+=back
+
+$obj-E<gt>B<FETCH>(MESSAGEID)
+
+=over 4
+
+Get the message with the specified id.  The returned message may be
+a dummy if message thread detection is used.  Returns C<undef> when
+there is no message with the specified id.
+
+I<Example:> 
+
+ my $msg = $inbox{$msgid};
+ if($inbox{$msgid}->isDummy)  ...
+
+=back
+
+$obj-E<gt>B<FIRSTKEY>
+
+=over 4
+
+See L<NEXTKEY()|Mail::Box::Tie::HASH/"Tied Interface">.
+
+=back
+
+$obj-E<gt>B<NEXTKEY>(PREVIOUS)
+
+=over 4
+
+L<FIRSTKEY()|Mail::Box::Tie::HASH/"Tied Interface"> returns the first message-id/message pair from the folder,
+and NEXTKEY returns the message-id/message pair for the next message,
+in the order in which the message is stored in the folder.
+
+Messages flagged for deletion will B<not> be returned. See the
+L<Mail::Box::messages()|Mail::Box/"The messages"> method of the folder type for more information
+about the folder message order.
+
+I<Example:> 
+
+ foreach my $msgid (keys %inbox) ...
+ foreach my $msg (values %inbox) ...
+
+ while(my ($msgid, $msg) = each %inbox) {
+    $msg->print unless $msg->isDeleted;
+ }
+
+=back
+
+$obj-E<gt>B<STORE>(undef, MESSAGE)
+
+=over 4
+
+Store a message in the folder.  The key must be C<undef>, because the
+message-id of the specified message is taken.  This is shown in the
+first example.  However, as you see, it is a bit complicated to specify
+C<undef>, therefore the string C<"undef"> is accepted as well.
+
+The message may be converted into something which can be stored in the
+folder type which is at stake.  The added instance is returned.
+
+I<Example:> 
+
+ $inbox{ (undef) } = $msg;
+ $inbox{undef} = $msg;
+
+=back
+
+
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,33 @@
+
+package Mail::Box::Tie;
+use vars '$VERSION';
+$VERSION = '2.055';
+
+use strict;
+
+use Carp;
+
+
+#-------------------------------------------
+
+sub TIEHASH(@)
+{   my $class = (shift) . "::HASH";
+    eval "require $class";   # bootstrap
+
+    confess $@ if $@;
+    $class->TIEHASH(@_);
+}
+
+#-------------------------------------------
+
+sub TIEARRAY(@)
+{   my $class = (shift) . "::ARRAY";
+    eval "require $class";   # bootstrap
+
+    confess $@ if $@;
+    $class->TIEARRAY(@_);
+}
+
+#-------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box/Tie.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,62 @@
+
+=head1 NAME
+
+Mail::Box::Tie - access an existing message-folder as an array or hash
+
+
+
+=head1 SYNOPSIS
+
+As an array:
+
+ use Mail::Box::Tie;
+ tie my(@inbox), Mail::Box::Tie::ARRAY => $folder;
+ tie my(@inbox), Mail::Box::Tie => $folder;    # deprecated
+ print $inbox[3];
+
+or as hash:
+
+ tie my(%inbox), Mail::Box::Tie::HASH => $folder;
+ tie my(%inbox), Mail::Box::Tie => $folder;    # deprecated
+ print $inbox{'<12379.124879 at example.com>'};
+
+
+=head1 DESCRIPTION
+
+The use of C<Mail::Box::Tie> is B<deprecated>, because it is succeeded by two
+separate modules: L<Mail::Box::Tie::ARRAY|Mail::Box::Tie::ARRAY> and L<Mail::Box::Tie::HASH|Mail::Box::Tie::HASH>.
+However, this module still works.
+
+Folders certainly look like an array of messages, so why not just
+access them as one?  Or, the order is not important, but the
+message-ids are (give relations): why not access them from a hash
+based on this message-id?  Programs using one of these ties will
+look simpler than programs using the more traditional method calls.
+
+
+
+=head1 METHODS
+
+
+
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box-Cookbook.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box-Cookbook.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box-Cookbook.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,282 @@
+
+=head1 NAME
+
+Mail::Box-Cookbook - Examples how to use Mail::Box
+
+
+
+
+=head1 DESCRIPTION
+
+The Mail::Box package is a suite of classes for accessing and managing
+email folders in a folder-independent manner.  This manual demonstrates
+a few simple applications.  Please contribute with examples and fixes.
+It may also help to have a look at the programs included in the
+C<scripts/> and the C<examples/> directories of the distribution.
+
+=head2 The Manager
+
+For more details about all the packages which are involved in the
+Mail::Box suite you have to read L<Mail::Box-Overview|Mail::Box-Overview>.  But you
+do not need to know much if you want to use the Mail::Box suite.
+
+Please use the manager to open your folders.  You will certainly
+benefit from it.  The manager takes care of detecting which folder
+type you are using, and which folders are open.  The latter avoids
+the accidental re-opening of an already open folder.
+
+The C<examples/open.pl> script contains mainly
+
+ my $mgr    = Mail::Box::Manager->new;
+ my $folder = $mgr->open($filename);
+ foreach my $message ($folder->messages) {
+     print $message->get('Subject') || '<no subject>', "\n";
+ }
+ $folder->close;
+
+which shows all the most important functions.  It will cause all
+subjects of the messages in the indicated folder to be listed.  So:
+although the number of packages included in the Mail::Box module
+is huge, only little is needed for normal programs.
+
+In stead of calling C<close> on the folder, you may also call
+
+ $mgr->closeAllFolders;
+
+If you forget to close a folder, changes will not be written.  This
+may change in the future.
+
+=head2 Multi part messages
+
+In early days of Internet, multi-part messages where very rare.
+However, in recent years, a large deal of all transmitted message have
+attachments.  This makes handling of the bodies of messages a bit harder:
+when a message contains more than one part, which part is then the most
+important to read?
+
+To complicate life, multi-parts can be nested: each part may be a
+multi-part by itself.  This means that programs handling the message
+content must be recursive or skip multi-parts.
+
+The central part of the C<examples/multipart.pl> script reads:
+
+ foreach my $message ($folder->messages) {
+     show_type($message);
+ }
+
+ show_type($) {
+     my $msg = shift;
+     print $msg->get('Content-Type'), "\n";
+
+     if($msg->isMultipart) {
+         foreach my $part ($msg->parts) {
+             show_type($part);
+         }
+     }
+ }
+
+Each part is a message by itself. It has a header and a body.  A multipart
+message has a special body: it contains a list of parts and optionally
+also a preamble and an epilogue, which are respectively the lines before
+and after the parts.  These texts may be ignored, because they are only
+descriptive on how the multi-part was created.
+
+=head2 Filter
+
+The target is to select a few messages from one folder, to move them
+to an other.  The C<examples/takelarge.pl> script demonstrates how
+to achieve this.  B<Be warned:> it will replace your input folder!
+
+As abstract of the crucial part:
+
+ my $inbox = $mgr->open('inbox', access => 'rw');
+ my $large = $mgr->open('large', access => 'a', create => 1);
+
+ foreach my $message ($inbox->messages) {
+     next if $message->size < $size;
+     $mgr->moveMessage($large, $message);
+ }
+
+ $inbox->close;
+ $large->close;
+
+The C<inbox> is opened for read and write: first read all messages, and
+then write the smaller folder without moved messages back.  The C<large>
+folder is created if the file does not exist yet.  In any case, messages
+will be added to the end of the folder.
+
+The manager is needed to move the message: to unregister the message from
+the first folder, and reregister it in the second.  You can move more
+messages at once, if you like.  When you move to a folder which is not
+open, you even better do that: it will be faster:
+
+ my @move = grep {$_->size >= $size} $inbox->messages;
+ $mgr->moveMessage($large, @move);
+
+In this example, the C<size> of the message determines whether the message
+is moved or not.  Of course, there are many other criteria you can use.
+For instance, use C<timestamp> to find old messages:
+
+ use constant YEAR => 365 * 24 * 60 * 60;
+ my $now = time;
+ my @old = grep {$_->timestamp - $now > YEAR} $inbox->messages;
+ $mgr->moveMessage($oldbox, @old);
+
+=head2 Create a reply
+
+The complex message treatment is implemented in L<Mail::Message::Construct|Mail::Message::Construct>
+and automatically loaded when needed.  It is sufficient to simply call
+C<reply> on any message:
+
+ my $folder  = ...;
+ my $message = $folder->message(8);
+ my $reply   = $message->reply;
+
+ $folder->addMessage($reply);
+ $reply->print;
+
+The method is quite complex, as demonstrated by C<examples/reply.pl>, in
+which the construction of a reply-message is shown.
+
+Three kinds of reply messages can be made: one which does not include
+the original message at all (NO), then one which inlines the original
+message quoted (INLINE), and as third possibility the original message as
+attachment (ATTACH).
+
+The C<include> parameter selects the kind of reply.  When you reply
+to binary or multi-part messages, INLINE will automatically promoted
+to ATTACH.  By default text will be stripped from the original senders
+signature.  Multi-part messages are stripped from attachments which
+qualify as signature.  In case a multi-part (after stripping) only
+contains one part, and that INLINE is requested, it will be 'flattened':
+the reply may be a single-part.
+
+Have a look at the parameters which can be passed to reply in
+L<Mail::Message::Construct|Mail::Message::Construct>.  For a single-part reply, the return
+will be
+
+ prelude
+ quoted original
+ postlude
+ --
+ signature
+
+A multipart body will be
+
+ part 1: prelude
+         [ see attachment ]
+         postlude
+ part 2: stripped original multipart
+ part 3: signature
+
+=head2 Build a message
+
+There are three ways to create a message which is not a reply:
+
+=over 4
+
+=item * L<Mail::Message::buildFromBody()|Mail::Message::Construct::Build/"Constructing a message">
+
+Start with creating a body, and transform that into a message.
+
+=item * L<Mail::Message::build()|Mail::Message::Construct::Build/"Constructing a message">
+
+create the whole message at once.
+
+=item * L<Mail::Message::read()|Mail::Message::Construct::Read/"Constructing a message">
+
+read a message from a file-handle, scalar, or array of lines.
+
+=back
+
+All three methods are implemented in L<Mail::Message::Construct|Mail::Message::Construct>.  Please,
+do yourself a favor, and give preference to the C<build*> methods, over
+the C<read>, because they are much more powerful.  Use the C<read> only
+when you have the message on STDIN or an array of lines which is supplied
+by an external program.
+
+Very important to remember from now on: information about the content of
+the body (the C<Content-> lines in the header) is stored within the body
+object, for as long as the body is not contained with a message object.
+
+For instance, C<$message> method C<decoded> returns the decoded body of the
+C<$message>.  It is a body object by itself, however outside a real
+message.  Then you may want to play around with it, by concatenating
+some texts: again resulting in a new body.  Each body contains the
+right C<Content-> information.  Then, finally, you create a message
+specifying the body and extra header lines.  At that moment you need
+to specify the source and destination addresses (the C<From> and C<To> lines>).
+At that moment, the body will automatically be encoded to be acceptable for
+mail folders and transmission programs.
+
+ my $body = Mail::Message::Body->new
+  ( mime_type         => 'text/css'
+  , transfer_encoding => '8bit'
+  , data              => \@lines
+  );
+
+Above example creates a body, with explicitly stating what kind of data
+is stored in it.  The default mime type is C<text/plain>.  The transfer
+encoding defaults to C<none>.  Each message will get encoded on the moment
+it is added to a message.  The default encoding depends on the mime type.
+
+To start with the first way to create a message.  This solution provides
+maximum control over the message creation.  Quite some work is hidden for
+you when executing the next line.
+
+ my $message = Mail::Message->buildFromBody
+   ( $body
+   , From => 'me at example.com'
+   , To   => 'you at anywhere.net'
+   , Cc   => [ Mail::Address->parse($groupalias) ]
+   );
+
+For header lines, you may specify a string, an address object
+(Mail::Address), or an array of such addresses.  If you want to create
+multi-part messages, you need to create a multi-part body yourself first.
+
+The second way of constructing a message uses the C<build> method.  A
+demonstration can be found in C<examples/build.pl>.  In only one
+class method call the header and the (possible multi-parted) body
+is created.
+
+With the C<data> option, you can specify one scalar which
+contains a whole body or an array of lines.  Using the C<file> option,
+a file-handle or filename specifies a body.  The C<attach> option
+refers to construed bodies and messages.  Each option can be used as
+often as needed.  If more than one source of data is provided, a
+multi-part message is produced.
+
+ my $message = Mail::Message->build
+  ( From       => 'me at example.com'
+  , To         => 'you at anywhere.net'
+  , 'X-Mailer' => 'Automatic mailing system'
+  , data       => \@lines
+  , file       => 'logo.jpg'
+  , attach     => $signature_body
+  );
+
+
+
+
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box-Index.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box-Index.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box-Index.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,292 @@
+
+=head1 NAME
+
+Mail::Box-Index - list of all extended documentation
+
+
+
+
+=head1 DESCRIPTION
+
+All methods defined by MailBox are documented, but you still need to
+get a grip on the large picture: the relations between the modules
+and the methods.  These larger explanations are included in the
+DETAILS of the manual pages, and listed here below.  Of course, each
+page has a DESCRIPTION section as well, which tells some bare necessities
+about the module.
+
+Only the HTML version of this manual page will list the sections.
+
+=begin :html
+
+<ol>
+<li><strong><a name="general">General</a> sources of information</strong>
+  <ul>
+  <li>MailBox distribution overview (Mail::Box-Overview)
+      <ul>
+      <li>Introduction
+      <li>The class relations
+      <li>The Manager
+      <li>The Messages
+      <li>The Folder types
+      <li>Various Other Classes
+      </ul>
+  <li>MailBox simple recepies (Mail::Box-Cookbook)
+      <ul>
+      <li>The Manager
+      <li>Multi part messages
+      <li>Filter
+      <li>Create a reply
+      <li>Build a message
+      </ul>
+  </ul>
+
+<li><strong><a name="messages">Messages</a></strong> (L<Mail::Message|Mail::Message>)
+      See separate entries on header, body, fields
+      and construction in this index below.
+  <ul>
+  <li>Structure of a Message
+      <ul>
+      <li>The header 
+      <li>The body 
+      </ul>
+  <li>Coercing messages
+  <li>Message object implementation
+  <li>Message class implementation
+  </ul>
+
+<li><strong><a name="headers">Message headers</a></strong> (L<Mail::Message::Head|Mail::Message::Head>)
+  <ul>
+  <li>Ordered header fields
+  <li>Subsets of header fields
+  <li>Head class implementation
+  </ul>
+
+<li><strong><a name="fields">Message header fields</a></strong> (L<Mail::Message::Field|Mail::Message::Field>)
+  <ul>
+  <li>Field syntax
+      <ul>
+      <li>Folding fields
+      <li>Structured fields
+      <li>Comments in fields
+      </ul>
+  <li>Getting a field
+      <ul>
+      <li>Using get() field
+      <li>Using study() field
+      <li>Using resent groups (Mail::Message::Head::ResentGroup)
+      <li>Mailing list fields
+      <li>Spam fighting fields
+      </ul>
+  <li>The field's data
+      <ul>
+      <li>Access to the field
+      <li>Using simplified field access
+      <li>Specifying field data
+      </ul>
+  <li>Field class implementation
+  </ul>
+
+<li><strong><a name="bodies">Message bodies</a></strong> (L<Mail::Message::Body|Mail::Message::Body>)
+  <ul>
+  <li>Access to the body
+  <li>Body meta information
+      <ul>
+      <li>Content types (MIME::Types)
+      <li>Content transfer encoding (Mail::Message::TransferEnc)
+      </ul>
+  <li>Multipart bodies (Mail::Message::Body::Multipart)
+  <li>Nested (encapsulated) messages (Mail::Message::Body::Nested)
+  <li>Body class implementation
+      <ul>
+      <li>Data collector bodies
+      <li>Complex bodies
+      </ul>
+  </ul>
+
+<li><strong><a name="labels">Message labels</a></strong>
+  <ul>
+  <li>Labels (Mail::Message)
+      <ul>
+      <li>Predefined labels (Mail::Message)
+      <li>Storing labels folder dependent
+      <li>Flags in filename (Mail::Box::Maildir::Message)
+      <li>Status and X-Status fields (MBOX and POP3)
+      <li>The .mh_sequences file (Mail::Box::MH::Labels)
+      <li>IMAP protocol flags (Mail::Box::IMAP4::Message)
+      <li>Other labels (IMAP4)
+      <li>Caching labels (IMAP4)
+
+      </ul>
+  </ul>
+
+<li><strong><a name="process">Message processing</a></strong>
+  <ul>
+  <li>Reading a message (Mail::Message::Construct::Read)
+  <li>Building a message (Mail::Message::Construct::Build)
+  <li>Reply to a message (Mail::Message::Construct::Reply)
+  <li>Creating a forward
+  <li>Bounce a message (Mail::Message::Construct::Bounce)
+  <li>Rebuilding a message (Mail::Message::Construct::Rebuild)
+      <ul>
+      <li>General rules
+      <li>Conversion rules
+      <li>Adding your own rules
+      </ul>
+  <li>Convert messages
+      <ul>
+      <li>To and from Mail::Internet objects (Mail::Message::Convert::MailInternet)
+      <li>To and from MIME::Entity objects(Mail::Message::Convert::MimeEntity)
+      <li>Into HTML (Mail::Message::Convert::Html)
+      </ul>
+  <li>Convert body contents
+      <ul>
+      <li>From HTML to PostScript (Mail::Message::Convert::HtmlFormatPS)
+      <li>From HTML into plain text (Mail::Message::Convert::HtmlFormatText)
+      <li>Beautify text (Mail::Message::Convert::TextAutoformat)
+      </ul>
+  </ul>
+
+<li><strong><a name="folders">Folders</a></strong> (L<Mail::Box|Mail::Box>)
+      See separate section for type specifics below.
+  <ul>
+  <li>Folder types (Mail::Box)
+      <ul>
+      <li>Different kinds of folders
+      <li>Supported folder types
+      <li>Folder class implementation
+      </ul>
+  <li>The folder manager (Mail::Box::Manager)
+  <li>Folder tied as array (Mail::Box::Tie::ARRAY)
+      <ul>
+      <li>Limitations
+      </ul>
+  <li>Folder tied as hash (Mail::Box::Tie::HASH)
+  <li>Folder locking (Mail::Box::Locker)
+  <li>Searching folders (Mail::Box::Search)
+      <ul>
+      <li>scan header and body (Mail::Box::Search::Grep)
+      <li>check for spam (Mail::Box::Search::SpamAssassin) 
+      </ul>
+  </ul>
+
+<li><strong><a name="ftypes">Folder types</a></strong>
+  <ul>
+  <li>DBX folders (Mail::Box::Dbx, read only)
+      <ul>
+      <li>How DBX folders work
+      <li>This implementation
+      <li>Converting DBX folders to MBOX
+      </ul>
+  <li>IMAP4 folders (Mail::Box::IMAP4)
+      <ul>
+      <li>How IMAP4 folders work
+      </ul>
+  <li>MAILDIR folders (Mail::Box::Maildir)
+      <ul>
+      <li>How MAILDIR folders work
+      </ul>
+  <li>MBOX folders (Mail::Box::Mbox)
+      <ul>
+      <li>How MBOX folders work
+      <li>Simulation of sub-folders
+      </ul>
+  <li>MH folders (Mail::Box::MH)
+      <ul>
+      <li>How MH folders work
+      <li>This implementation
+      <li>An index-file
+      </ul>
+  <li>POP3 folders (Mail::Box::POP3)
+      <ul>
+      <li>How POP3 folders work
+      <li>This implementation
+      </ul>
+  </ul>
+
+<li><strong><a name="threads">Discussion threads</a></strong>
+  <ul>
+  <li>The thread manager (Mail::Box::Thread::Manager)
+      <ul>
+      <li>Maintaining threads
+      <li>Delayed thread detection
+      </ul>
+  <li>The thread node (Mail::Box::Thread::Node)
+  </ul>
+
+<li><strong><a name="send">Transmitting messages</a></strong> (L<Mail::Transport|Mail::Transport>)
+  <ul>
+  <li>Sending (Mail::Transport::Send)
+      <ul>
+      <li>Via Exim (Mail::Transport::Exim)
+      <li>Via Mailx (Mail::Transport::Mailx)
+      <li>Via Qmail (Mail::Transport::Qmail)
+      <li>Via Sendmail or Postfix (Mail::Transport::Sendmail)
+      <li>Via raw SMTP (Mail::Transport::SMTP)
+      </ul>
+  <li>Receiving (Mail::Transport::Receive)
+      <ul>
+      <li>Via POP3 (Mail::Transport::POP3)
+      </ul>
+  <li>Bi-directional
+      <ul>
+      <li>Via IMAP4 (Mail::Transport::IMAP4)
+      </ul>
+  </ul>
+
+<li><strong><a name="perform">Performance</a></strong>
+  <ul>
+  <li>Quality over performance
+  <li>Weak references
+  <li>Reducing memory consumption
+      <ul>
+      <li>Lazy extraction
+      <li>Picking the optimal body class
+      <li>Reducing the header size
+          (Mail::Message::Head::Partial)
+      <li>
+  <li>Destructing messages (Mail::Box::Message::Destructed)
+  </ul>
+<li><strong>Additional modules</strong>
+  <ul>
+  <li>Extensions
+      <ul>
+      <li>Mail::Box::Parser::C, a faster parser
+      <li>HTML::FromMail,
+          webmail applications builder
+      </ul>
+  <li>Helper modules
+      <ul>
+      <li>MIME::Types
+      <li>Object::Realize::Later
+      <li>User::Identity
+      </ul>
+  </ul>
+</ol>
+
+=end :html
+
+
+
+
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box-Overview.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box-Overview.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box-Overview.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,330 @@
+
+=head1 NAME
+
+Mail::Box-Overview - objects used by Mail::Box
+
+
+
+
+=head1 DESCRIPTION
+
+
+=head2 Introduction
+
+The MailBox package is a suite of classes for accessing and managing
+email folders in a folder-independent manner. This package is an
+alternative to the C<Mail::Folder> and C<MIME::*> packages. It abstracts the
+details of messages, message storage, and message threads, while
+providing better performance than older mail packages. It is meant to
+provide an object-oriented toolset for all kinds of e-mail applications,
+under which Mail User-Agents (MUA) and mail filtering programs.
+
+This package is modular --parts of it can be used independently of the
+rest. For example, the L<Mail::Box::Manager|Mail::Box::Manager> can automatically determine
+that a folder is in Mbox format and return an object of the
+L<Mail::Box::Mbox|Mail::Box::Mbox> class, or the user program can bypass the manager and
+create L<Mail::Box::Mbox|Mail::Box::Mbox> objects directly. Similarly, if the user program
+is only manipulating a single message, a L<Mail::Message|Mail::Message>.
+
+The Mail::Box package has special features to help MUA's access folder
+data quickly in random order.  You will not really benefit (neither
+slower) if you need the full folder sequentially.
+
+This code is beta, which means that there are no serious applications
+written with it yet.  Please inform the author when you have, so this
+module can be marked as stable.  Read the STATUS file enclosed in the package
+for more details.  You may also want to have a look at the sample
+scripts in the C<scripts> directory.
+
+=head2 The class relations
+
+L<Mail::Box::Manager|Mail::Box::Manager> objects play a central role in any program which
+is built with MailBox.  Each program will create one manager, and
+then open folders via that manager.  Besides folders, the manager can
+also be used to discover message threads: sequences of messages with
+their follow-ups.
+
+                       <has-a>      Mail::Box::Mbox
+  Mail::Box::Manager <---------*    (Mail::Box::MH)
+         ^                :         (Mail::Box::Maildir)
+         |           (maintains)    (Mail::Box::POP3)
+         |                :
+         |                :
+         `---------------------*  Mail::Box::Thread::Manager
+                      (<has-a>)
+
+Each folder maintains a list of messages.  Much effort is made to hide
+differences between folder types and kinds of messages.  Your program can
+be used for MBOX, MH, Maildir, and POP3 folders with no change at all (as
+long as you stick to the rules).
+
+ Mail::Box::Mbox  <-----------* Mail::Box::Mbox::Message
+        ^             <has-a>            ^
+        | <isa>                          | <isa>
+        |                                |
+    Mail::Box     ............. Mail::Box::Message
+                                         ^
+                                         | <isa>
+                                         |
+                                   Mail::Message
+                                        / \
+                                       <has-a>  
+                                      /     \
+                           Mail::Message   Mail::Message 
+                             ::Body            ::Head
+
+The situation for MH and Maildir folders is a little more complicated,
+because they have an extra intermediate level of abstraction: L<Mail::Box::Dir|Mail::Box::Dir>.
+The POP3 folder has an intermediate L<Mail::Box::Net|Mail::Box::Net>.
+
+In the future, when more Mbox-like folder types get implemented, there
+may be a L<Mail::Box::File|Mail::Box::File> level too.  The following is also true
+for the mail boxes
+
+ MB::MH::Message                 MB::POP3::Message
+       \  MB::Maildir::Message            /
+        \         /                      /
+         \       /   MB::Mbox::Message  /
+          \     /         |            /
+        MB::Dir::Message  |   MB::Net::Message
+                     \    |    /
+                      \   |   /
+                      MB::Message
+                          |
+                          |
+                     Mail::Message
+
+=head2 The Manager
+
+The mailbox manager L<Mail::Box::Manager|Mail::Box::Manager> encapsulates folder management
+issues. It maintains a set of open mail folders (mailboxes), and provides
+methods for opening and closing them, efficiently moving messages between
+folders, and efficiently appending messages to folders.  It contains
+L<Mail::Box|Mail::Box> objects which may be of different types.  Most folder types
+can be detected automatically.
+
+The main manager also manages message-thread detector objects, and informs them
+when the contents of a folder have changed. This manager class is the
+only one you instantiate yourself: objects of all other classes will be
+provided by your folder manager.
+
+You are strongly advised to use this object, but you can often do without it
+and open a specific folder-type directly.
+
+=head2 The Messages
+
+=over 4
+
+=item L<Mail::Message|Mail::Message>
+
+A base class that defines an interface for manipulating the head and
+body of a message.  There are various header object types
+(L<Mail::Message::Head|Mail::Message::Head>'s) and a bunch of body object types
+(L<Mail::Message::Body|Mail::Message::Body>'s).  
+
+The L<Mail::Message::Construct|Mail::Message::Construct> package is loaded when more complex tasks
+have to be performed on messages, like creating replies, bounces, or a
+forward message.  These
+functionalities are described and implemented in the ::Construct
+file, but are automatically added to the L<Mail::Message|Mail::Message> namespace when used.
+
+Message types which are foreign to MailBox can be used in the
+MailBox environment: there are some converters implemented via
+L<Mail::Message::Convert|Mail::Message::Convert>.  Particularly the popular Mail::Internet
+and MIME::Entity are supported.
+
+=item L<Mail::Box::Message|Mail::Box::Message>
+
+An abstract base class which defines an interface for mail messages
+which are stored in any folder.  It inherits from L<Mail::Message|Mail::Message>, and
+adds the basic idea of I<location> to a message.
+
+=item L<Mail::Message::Body|Mail::Message::Body>
+
+This is the base class for all message bodies.  It describes what you
+can do with any kind of body.  The body types differ on the way how the
+keep the body content during the run of your program.
+
+One special case of the body types is the L<Mail::Message::Body::Multipart|Mail::Message::Body::Multipart>, which
+contains a set of L<Mail::Message::Part|Mail::Message::Part> objects.  These are just like
+normal messages, except that they are contained in an other message.
+The L<Mail::Message::Body::Nested|Mail::Message::Body::Nested> body type is comparible, but contains only
+one message: they are used for C<message/rfc822> message encodings.
+
+When needed, the functionality of the body objects is extended with
+L<Mail::Message::Body::Construct|Mail::Message::Body::Construct> and L<Mail::Message::Body::Encode|Mail::Message::Body::Encode>.  The
+former package implements things like concatenation, the later controls message
+encoding and decoding.  In the current implementation this is limited to
+transfer encodings (implemented in the L<Mail::Message::TransferEnc|Mail::Message::TransferEnc> packages).
+Automatic character and mime recodings are on the wish-list.
+
+=item L<Mail::Message::Head|Mail::Message::Head>
+
+The header for a single message. Maintains a set of L<Mail::Message::Field|Mail::Message::Field>
+objects, each containing one header line.  Fields are the only
+objects which have no logging and tracing facilities, purely for reasons
+of performance.
+
+The header object has three sub-classes: the L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>
+version knows all lines for sure, L<Mail::Message::Head::Subset|Mail::Message::Head::Subset> maintains
+an unknown subset of lines, and the L<Mail::Message::Head::Delayed|Mail::Message::Head::Delayed> has no
+lines yet but knows where to get them.
+
+The latter two will automatically get the missing header lines from the
+mailbox files when needed, and so transform into a C<::Complete> header.
+It is fully transparent to the user of MailBox in which shape the
+header really is on the moment.
+
+=back
+
+=head2 The Folder types
+
+=over 4
+
+=item L<Mail::Box|Mail::Box>
+
+A base class that defines a standard interface for mail boxes which
+is independent of mailbox type. Objects of this class contain
+a L<Mail::Box::Locker|Mail::Box::Locker> and a list of L<Mail::Box::Message|Mail::Box::Message> objects.
+
+=item L<Mail::Box::Dir|Mail::Box::Dir>
+
+The base class for all folders which use a directory organization: each
+message is a separate entity (file) grouped in a directory.  Each
+L<Mail::Box::Dir::Message|Mail::Box::Dir::Message> represents one message, one such entity.
+
+=item L<Mail::Box::Net|Mail::Box::Net>
+
+The base class for all folders which have the messages outside direct
+reach of the MailBox library, for instance on a remote system, or in
+a database.
+
+=item L<Mail::Box::Mbox|Mail::Box::Mbox>
+
+This class derives from L<Mail::Box|Mail::Box>, and implements its interface for
+mbox-style folders. It maintains a set of L<Mail::Box::Mbox::Message|Mail::Box::Mbox::Message>
+objects, which are derived from a L<Mail::Box::Message|Mail::Box::Message>.
+
+Mbox-style folders have one file containing multiple messages per
+folder.  When folders get large, access tends to get slow.
+
+=item L<Mail::Box::MH|Mail::Box::MH>
+
+This class derives from L<Mail::Box::Dir|Mail::Box::Dir>, and implements its interface for
+MH-style folders. It maintains a set of L<Mail::Box::MH::Message|Mail::Box::MH::Message>
+objects, which are derived from a L<Mail::Box::Dir::Message|Mail::Box::Dir::Message>.
+
+MH-style folders are represented by a directory, where each message is
+stored in a separate file.  The message files are sequentially numbered.
+It is fast to open one single message, but hard to get an overview.
+
+=item L<Mail::Box::MH::Index|Mail::Box::MH::Index>
+
+The base class for MH mailbox indexes which provides methods for reading,
+writing, and managing message indexes.  These indexes are used to
+speed-up access to directory based folders.
+
+=item L<Mail::Box::MH::Labels|Mail::Box::MH::Labels>
+
+Also for efficiency reasons, a separate file is maintained which contains
+flags about the messages.  This file for instance lists new files.  This
+way, the MH message files do not have to be opened to find that out.
+
+=item L<Mail::Box::Maildir|Mail::Box::Maildir>
+
+Like the MH folder type, this class derives from L<Mail::Box::Dir|Mail::Box::Dir>.  It
+implements its interface for Maildir-style folders. It maintains a set
+of L<Mail::Box::Maildir::Message|Mail::Box::Maildir::Message> objects, which are derived from a
+L<Mail::Box::Dir::Message|Mail::Box::Dir::Message>.
+
+=item L<Mail::Box::POP3|Mail::Box::POP3>
+
+Implements the POP3 protocol based on L<Mail::Box::Net|Mail::Box::Net>.  The
+L<Mail::Transport::POP3|Mail::Transport::POP3> implementation handles the protocol details.  In this
+kind of folders, you can only read and delete messages.
+
+=back
+
+=head2 Various Other Classes
+
+=over 4
+
+=item L<Mail::Box::Thread::Manager|Mail::Box::Thread::Manager>
+
+Maintains a set of message-threads over one or more folders.  A
+message-thread is a start message with all the replies on it.  And the
+replies on replies, and so on.  This object is used to construct the
+thread for a set of open folders.
+
+This object maintains linked lists of L<Mail::Box::Thread::Node|Mail::Box::Thread::Node> objects.
+L<Mail::Message::Dummy|Mail::Message::Dummy>'s fill-up some holes.
+
+=item L<Mail::Box::Locker|Mail::Box::Locker>
+
+Provides a folder locking interface which is inherited by the L<Mail::Box|Mail::Box>
+class.  Currently it supports dot-file locking (C<filename.lock>),
+flock filehandle locking, and locking over NFS.  Each is implemented in a
+separate class.  A multi-locker, using a set of lock-methods at the
+same time is also available.
+
+=item L<Mail::Box::Search|Mail::Box::Search>
+
+The set of search packages implement various search techniques in an uniformal
+way.  Although implementing your own search algorithm is simple in general,
+in practice multiparts, encodings, and mime-types complicate things.
+
+=item L<Mail::Box::Parser|Mail::Box::Parser>
+
+The parser reads messages, and transforms them into data-structures such
+that the content of header and body can be used within the program.  The
+first parser is implemented in pure Perl.  A second parser is under development,
+and will written in C, to gain speed.
+
+=item L<Mail::Box::Tie|Mail::Box::Tie>
+
+Provides hash (L<Mail::Box::Tie::HASH|Mail::Box::Tie::HASH>) or array tied
+(L<Mail::Box::Tie::ARRAY|Mail::Box::Tie::ARRAY>) access to any mail folder derived from
+L<Mail::Box|Mail::Box>.  This beautifies your code in some applications.
+
+=item L<Mail::Transport|Mail::Transport>
+
+Various ways of sending and receiving messages are implemented.  Sending
+is possible via external programs, like C<mail>, C<Mailx>, C<sendmail>, or
+autonomously with direct SMTP.  Receiving is currently only implemented
+via POP3.
+
+=item L<Mail::Reporter|Mail::Reporter>
+
+A debugging and logging class which is inherited by most of the Mail::
+modules.  For each object, you can say what log and error reports must be
+kept or directly presented to the user.  This way you can decide to have
+Mail::Box report about problems, or do it all yourself.
+
+=back
+
+All classes are written to be extensible.  
+
+
+
+
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,916 @@
+
+use strict;
+use warnings;
+
+package Mail::Box;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Reporter';
+
+use Mail::Box::Message;
+use Mail::Box::Locker;
+use File::Spec;
+
+use Carp;
+use Scalar::Util 'weaken';
+use List::Util   qw/sum first/;
+
+#-------------------------------------------
+# Clean exist required to remove lockfiles and to save changes.
+
+$SIG{INT} = $SIG{QUIT} = $SIG{PIPE} = $SIG{TERM} = sub {exit 0};
+
+#-------------------------------------------
+
+
+#-------------------------------------------
+
+
+use overload '@{}' => sub { shift->{MB_messages} }
+           , '""'  => 'name'
+           , 'cmp' => sub {$_[0]->name cmp "${_[1]}"};
+
+#-------------------------------------------
+
+
+sub new(@)
+{   my $class        = shift;
+
+    if($class eq __PACKAGE__)
+    {   my $package = __PACKAGE__;
+
+        croak <<USAGE;
+You should not instantiate $package directly, but rather one of the
+sub-classes, such as Mail::Box::Mbox.  If you need automatic folder
+type detection then use Mail::Box::Manager.
+USAGE
+    }
+
+    my %args = @_;
+    weaken $args{manager};   # otherwise, the manager object may live too long
+
+    my $self = $class->SUPER::new
+      ( @_
+      , init_options => \%args     # for clone
+      ) or return;
+
+    $self->read or return
+        if $self->{MB_access} =~ /r|a/;
+
+    $self;
+}
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    return unless defined $self->SUPER::init($args);
+
+    my $class      = ref $self;
+    my $foldername = $args->{folder} || $ENV{MAIL};
+    unless($foldername)
+    {   $self->log(ERROR => "No folder name specified.");
+        return;
+    }
+
+    $self->{MB_foldername}   = $foldername;
+    $self->{MB_init_options} = $args->{init_options};
+    $self->{MB_coerce_opts}  = $args->{coerce_options} || [];
+    $self->{MB_access}       = $args->{access}         || 'r';
+    $self->{MB_remove_empty}
+         = defined $args->{remove_when_empty} ? $args->{remove_when_empty} : 1;
+
+    $self->{MB_save_on_exit}
+         = defined $args->{save_on_exit} ? $args->{save_on_exit} : 1;
+
+    $self->{MB_messages}     = [];
+    $self->{MB_msgid}        = {};
+    $self->{MB_organization} = $args->{organization}      || 'FILE';
+    $self->{MB_linesep}      = "\n";
+    $self->{MB_keep_dups}    = !$self->writable || $args->{keep_dups};
+    $self->{MB_fix_headers}  = $args->{fix_headers};
+
+    my $folderdir = $self->folderdir($args->{folderdir});
+    $self->{MB_trusted}      = exists $args->{trusted} ? $args->{trusted}
+      : substr($foldername, 0, 1) eq '='               ? 1
+      : !defined $folderdir                            ? 0
+      : substr($foldername, 0, length $folderdir) eq $folderdir;
+
+    if(exists $args->{manager})
+    {   $self->{MB_manager}  = $args->{manager};
+        weaken($self->{MB_manager});
+    }
+
+    my $message_type = $self->{MB_message_type}
+        = $args->{message_type}     || $class . '::Message';
+    $self->{MB_body_type}
+        = $args->{body_type}        || 'Mail::Message::Body::Lines';
+    $self->{MB_body_delayed_type}
+        = $args->{body_delayed_type}|| 'Mail::Message::Body::Delayed';
+    $self->{MB_head_delayed_type}
+        = $args->{head_delayed_type}|| 'Mail::Message::Head::Delayed';
+    $self->{MB_multipart_type}
+        = $args->{multipart_type}   || 'Mail::Message::Body::Multipart';
+    $self->{MB_field_type}          = $args->{field_type};
+
+    my $headtype     = $self->{MB_head_type}
+        = $args->{head_type}        || 'Mail::Message::Head::Complete';
+
+    my $extract  = $args->{extract} || 'extractDefault';
+    $self->{MB_extract}
+      = ref $extract eq 'CODE' ? $extract
+      : $extract eq 'ALWAYS'   ? sub {1}
+      : $extract eq 'LAZY'     ? sub {0}
+      : $extract eq 'NEVER'    ? sub {1}  # compatibility
+      : $extract =~ m/\D/      ? sub {no strict 'refs';shift->$extract(@_)}
+      :     sub { my $size = $_[1]->guessBodySize;
+                  defined $size && $size < $extract;
+                };
+
+    #
+    # Create a locker.
+    #
+
+    $self->{MB_locker}
+      = $args->{locker}
+      || Mail::Box::Locker->new
+          ( folder   => $self
+          , method   => $args->{lock_type}
+          , timeout  => $args->{lock_timeout}
+          , wait     => $args->{lock_wait}
+          , file     => ($args->{lockfile} || $args->{lock_file})
+          );
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub create($@) {shift->notImplemented}
+
+#-------------------------------------------
+
+
+sub folderdir(;$)
+{   my $self = shift;
+    $self->{MB_folderdir} = shift if @_;
+    $self->{MB_folderdir};
+}
+
+#-------------------------------------------
+
+
+sub foundIn($@) { shift->notImplemented }
+
+#-------------------------------------------
+
+
+sub name() {shift->{MB_foldername}}
+
+#-------------------------------------------
+
+
+sub type() {shift->notImplemented}
+
+#-------------------------------------------
+
+
+sub url()
+{   my $self = shift;
+    $self->type . ':' . $self->name;
+}
+
+#-------------------------------------------
+
+
+sub size() { sum map { $_->size } shift->messages('ACTIVE') }
+
+#-------------------------------------------
+
+
+sub update(@)
+{   my $self = shift;
+
+    $self->updateMessages
+      ( trusted      => $self->{MB_trusted}
+      , head_type    => $self->{MB_head_type}
+      , field_type   => $self->{MB_field_type}
+      , message_type => $self->{MB_message_type}
+      , body_delayed_type => $self->{MB_body_delayed_type}
+      , head_delayed_type => $self->{MB_head_delayed_type}
+      , @_
+      );
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub organization() { shift->notImplemented }
+
+#-------------------------------------------
+
+
+sub addMessage($)
+{   my $self    = shift;
+    my $message = shift or return $self;
+
+    confess <<ERROR if $message->can('folder') && $message->folder;
+You cannot add a message which is already part of a folder to a new
+one.  Please use moveMessage or copyMessage.
+ERROR
+
+    # Force the message into the right folder-type.
+    my $coerced = $self->coerce($message);
+    $coerced->folder($self);
+
+    unless($coerced->head->isDelayed)
+    {   # Do not add the same message twice, unless keep_dups.
+        my $msgid = $coerced->messageId;
+
+        unless($self->{MB_keep_dups})
+        {   if(my $found = $self->messageId($msgid))
+            {   $coerced->label(deleted => 1);
+                return $found;
+            }
+        }
+
+        $self->messageId($msgid, $coerced);
+        $self->toBeThreaded($coerced);
+    }
+
+    $self->storeMessage($coerced);
+    $coerced;
+}
+
+sub addMessages(@)
+{   my $self = shift;
+    map {$self->addMessage($_)} @_;
+}
+
+#-------------------------------------------
+
+
+sub copyTo($@)
+{   my ($self, $to, %args) = @_;
+
+    my $select      = $args{select} || 'ACTIVE';
+    my $subfolders  = exists $args{subfolders} ? $args{subfolders} : 1;
+    my $can_recurse = not $self->isa('Mail::Box::POP3');
+
+    my ($flatten, $recurse)
+       = $subfolders eq 'FLATTEN' ? (1, 0)
+       : $subfolders eq 'RECURSE' ? (0, 1)
+       : !$subfolders             ? (0, 0)
+       : $can_recurse             ? (0, 1)
+       :                            (1, 0);
+
+    my $delete = $args{delete_copied} || 0;
+
+    $self->_copy_to($to, $select, $flatten, $recurse, $delete);
+}
+
+# Interface may change without warning.
+sub _copy_to($@)
+{   my ($self, $to, @options) = @_;
+    my ($select, $flatten, $recurse, $delete) = @options;
+
+    $self->log(ERROR => "Destination folder $to is not writable."),
+        return unless $to->writable;
+
+    # Take messages from this folder.
+    my @select = $self->messages($select);
+    $self->log(PROGRESS =>
+        "Copying ". at select." messages from $self to $to.");
+
+    foreach my $msg (@select)
+    {   if($msg->copyTo($to)) { $msg->label(deleted => 1) if $delete }
+        else { $self->log(ERROR => "Copying failed for one message.") }
+    }
+
+    return $self unless $flatten || $recurse;
+
+    # Take subfolders
+
+  SUBFOLDER:
+    foreach ($self->listSubFolders(check => 1))
+    {   my $subfolder = $self->openSubFolder($_, access => 'r');
+        $self->log(ERROR => "Unable to open subfolder $_"), next
+            unless defined $subfolder;
+
+        if($flatten)   # flatten
+        {    unless($subfolder->_copy_to($to, @options))
+             {   $subfolder->close;
+                 return;
+             }
+        }
+        else           # recurse
+        {    my $subto = $to->openSubFolder($_, create => 1, access => 'rw');
+             unless($subto)
+             {   $self->log(ERROR => "Unable to create subfolder $_ of $to");
+                 next SUBFOLDER;
+             }
+
+             unless($subfolder->_copy_to($subto, @options))
+             {   $subfolder->close;
+                 $subto->close;
+                 return;
+             }
+
+             $subto->close;
+        }
+
+        $subfolder->close;
+    }
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub close(@)
+{   my ($self, %args) = @_;
+    my $force = $args{force} || 0;
+
+    return 1 if $self->{MB_is_closed};
+    $self->{MB_is_closed}++;
+
+    # Inform manager that the folder is closed.
+    my $manager = delete $self->{MB_manager};
+    $manager->close($self) if defined $manager && !$args{close_by_manager};
+
+    my $write;
+    for($args{write} || 'MODIFIED')
+    {   $write = $_ eq 'MODIFIED' ? $self->isModified
+               : $_ eq 'ALWAYS'   ? 1
+               : $_ eq 'NEVER'    ? 0
+               : croak "Unknown value to folder->close(write => $_).";
+    }
+
+    if($write && !$force && !$self->writable)
+    {   $self->log(WARNING => "Changes not written to read-only folder $self.
+Suggestion: \$folder->close(write => 'NEVER')");
+        $self->locker->unlock;
+        $self->{MB_messages} = [];    # Boom!
+        return 0;
+    }
+
+    my $rc = !$write
+          || $self->write
+               ( force => $force
+               , save_deleted => $args{save_deleted} || 0
+               );
+
+    $self->locker->unlock;
+    $self->{MB_messages} = [];    # Boom!
+    $rc;
+}
+
+#-------------------------------------------
+
+
+sub delete()
+{   my $self = shift;
+
+    # Extra protection: do not remove read-only folders.
+    unless($self->writable)
+    {   $self->log(ERROR => "Folder $self not deleted: not writable.");
+        $self->close(write => 'NEVER');
+        return;
+    }
+
+    # Sub-directories need to be removed first.
+    foreach ($self->listSubFolders)
+    {   my $sub = $self->openRelatedFolder(folder => "$self/$_",access => 'rw');
+        next unless defined $sub;
+        $sub->delete;
+    }
+
+    $_->delete foreach $self->messages;
+
+    $self->{MB_remove_empty} = 1;
+    $self->close(write => 'ALWAYS');
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub appendMessages(@) {shift->notImplemented}
+
+#-------------------------------------------
+
+
+sub writable()  {shift->{MB_access} =~ /w|a/ }
+sub writeable() {shift->writable}  # compatibility [typo]
+sub readable()  {1}  # compatibility
+
+#-------------------------------------------
+
+
+sub modified(;$)
+{   my $self = shift;
+    return $self->isModified unless @_;   # compat 2.036
+
+    return
+      if $self->{MB_modified} = shift;    # force modified flag
+
+    # unmodify all messages
+    $_->modified(0) foreach $self->messages;
+    0;
+}
+
+#-------------------------------------------
+
+
+sub isModified()
+{   my $self     = shift;
+    return 1 if $self->{MB_modified};
+
+    foreach (@{$self->{MB_messages}})
+    {    return $self->{MB_modified} = 1
+            if $_->isDeleted || $_->isModified;
+    }
+
+    0;
+}
+
+#-------------------------------------------
+
+
+sub message(;$$)
+{   my ($self, $index) = (shift, shift);
+    @_ ?  $self->{MB_messages}[$index] = shift : $self->{MB_messages}[$index];
+}
+
+#-------------------------------------------
+
+
+sub messageId($;$)
+{   my ($self, $msgid) = (shift, shift);
+
+    if($msgid =~ m/\<([^>]+)\>/s )
+    {   $msgid = $1;
+        $msgid =~ s/\s//gs;
+
+        $self->log(WARNING => "Message-id '$msgid' does not contain a domain.")
+            unless index($msgid, '@') >= 0;
+    }
+
+    return $self->{MB_msgid}{$msgid} unless @_;
+
+    my $message = shift;
+
+    # Undefine message?
+    unless($message)
+    {   delete $self->{MB_msgid}{$msgid};
+        return;
+    }
+
+    my $double = $self->{MB_msgid}{$msgid};
+    if(defined $double && !$self->{MB_keep_dups})
+    {   my $head1 = $message->head;
+        my $head2 = $double->head;
+
+        my $subj1 = $head1->get('subject') || '';
+        my $subj2 = $head2->get('subject') || '';
+
+        my $to1   = $head1->get('to') || '';
+        my $to2   = $head2->get('to') || '';
+
+        # Auto-delete doubles.
+        return $message->label(deleted => 1)
+            if $subj1 eq $subj2 && $to1 eq $to2;
+
+        $self->log(WARNING => "Different messages with id $msgid.");
+        $msgid = $message->takeMessageId(undef);
+    }
+
+    $self->{MB_msgid}{$msgid} = $message;
+}
+
+sub messageID(@) {shift->messageId(@_)} # compatibility
+
+#-------------------------------------------
+
+
+sub find($)
+{   my ($self, $msgid) = (shift, shift);
+    my $msgids = $self->{MB_msgid};
+
+    if($msgid =~ m/\<([^>]*)\>/s)
+    {   $msgid = $1;
+        $msgid =~ s/\s//gs;
+    }
+
+    $self->scanForMessages(undef, $msgid, 'EVER', 'ALL')
+        unless exists $msgids->{$msgid};
+
+    $msgids->{$msgid};
+}
+
+#-------------------------------------------
+
+
+sub messages($;$)
+{   my $self = shift;
+
+    return @{$self->{MB_messages}} unless @_;
+    my $nr = @{$self->{MB_messages}};
+
+    if(@_==2)   # range
+    {   my ($begin, $end) = @_;
+        $begin += $nr   if $begin < 0;
+        $begin  = 0     if $begin < 0;
+        $end   += $nr   if $end < 0;
+        $end    = $nr-1 if $end >= $nr;
+
+        return () if $begin > $end;
+
+        my @range = @{$self->{MB_messages}}[$begin..$end];
+        return @range;
+    }
+
+    my $what = shift;
+    my $action
+      = ref $what eq 'CODE'? $what
+      : $what eq 'DELETED' ? sub {$_[0]->isDeleted}
+      : $what eq 'ACTIVE'  ? sub {not $_[0]->isDeleted}
+      : $what eq 'ALL'     ? sub {1}
+      : $what =~ s/^\!//   ? sub {not $_[0]->label($what)}
+      :                      sub {$_[0]->label($what)};
+
+    grep {$action->($_)} @{$self->{MB_messages}};
+}
+
+#-------------------------------------------
+
+
+sub messageIds()    { map {$_->messageId} shift->messages }
+sub allMessageIds() {shift->messageIds}  # compatibility
+sub allMessageIDs() {shift->messageIds}  # compatibility
+
+#-------------------------------------------
+
+
+sub current(;$)
+{   my $self = shift;
+
+    unless(@_)
+    {   return $self->{MB_current}
+           if exists $self->{MB_current};
+	
+        # Which one becomes current?
+	my $current
+	  = $self->findFirstLabeled(current => 1)
+	 || $self->findFirstLabeled(seen    => 0)
+	 || $self->message(-1)
+	 || return undef;
+
+        $current->label(current => 1);
+        $self->{MB_current} = $current;
+	return $current;
+    }
+
+    my $next = shift;
+    if(my $previous = $self->{MB_current})
+    {    $previous->label(current => 0);
+    }
+
+    ($self->{MB_current} = $next)->label(current => 1);
+    $next;
+}
+
+#-------------------------------------------
+
+
+sub scanForMessages($$$$)
+{   my ($self, $startid, $msgids, $moment, $window) = @_;
+
+    # Set-up msgid-list
+    my %search = map {($_ => 1)} ref $msgids ? @$msgids : $msgids;
+    return () unless keys %search;
+
+    # do not run on empty folder
+    my $nr_messages = $self->messages
+        or return keys %search; 
+
+    my $startmsg = $self->messageId($startid)
+        if defined $startid;
+
+    # Set-up window-bound.
+    my $bound = 0;
+    if($window ne 'ALL' && defined $startmsg)
+    {   $bound = $startmsg->seqnr - $window;
+        $bound = 0 if $bound < 0;
+    }
+
+    my $last = ($self->{MBM_last} || $nr_messages) -1;
+    return keys %search if defined $bound && $bound > $last;
+
+    # Set-up time-bound
+    my $after = $moment eq 'EVER'   ? 0
+              : $moment =~ m/^\d+$/ ? $moment
+              : $startmsg->timestamp - $self->timespan2seconds($moment);
+
+    while($last >= $bound)
+    {   my $message = $self->message($last);
+        my $msgid   = $message->messageId; # triggers load
+
+        if(delete $search{$msgid})  # where we looking for this one?
+        {    last unless keys %search;
+        }
+
+        last if $message->timestamp < $after;
+        $last--;
+    }
+
+    $self->{MBM_last} = $last;
+    keys %search;
+}
+
+#-------------------------------------------
+
+
+sub findFirstLabeled($;$$)
+{   my ($self, $label, $set, $msgs) = @_;
+
+    if(!defined $set || $set)
+    {   my $f = first { $_->label($label) }
+           (defined $msgs ? @$msgs : $self->messages);
+    }
+    else
+    {   return first { not $_->label($label) }
+           (defined $msgs ? @$msgs : $self->messages);
+    }
+}
+
+#-------------------------------------------
+
+
+sub listSubFolders(@) { () }   # by default no sub-folders
+
+#-------------------------------------------
+
+
+sub openRelatedFolder(@)
+{   my $self    = shift;
+    my @options = (%{$self->{MB_init_options}}, @_);
+
+    $self->{MB_manager}
+    ? $self->{MB_manager}->open(@options)
+    : (ref $self)->new(@options);
+}
+
+#-------------------------------------------
+
+
+sub openSubFolder($@)
+{   my $self    = shift;
+    my $name    = $self->nameOfSubFolder(shift);
+    $self->openRelatedFolder(@_, folder => $name);
+}
+
+#-------------------------------------------
+
+
+sub nameOfSubFolder($)
+{   my ($self, $name)= @_;
+    "$self/$name";
+}
+
+#-------------------------------------------
+
+
+sub read(@)
+{   my $self = shift;
+    $self->{MB_open_time}    = time;
+
+    local $self->{MB_lazy_permitted} = 1;
+
+    # Read from existing folder.
+    return unless $self->readMessages
+      ( trusted      => $self->{MB_trusted}
+      , head_type    => $self->{MB_head_type}
+      , field_type   => $self->{MB_field_type}
+      , message_type => $self->{MB_message_type}
+      , body_delayed_type => $self->{MB_body_delayed_type}
+      , head_delayed_type => $self->{MB_head_delayed_type}
+      , @_
+      );
+
+    if($self->{MB_modified})
+    {   $self->log(INTERNAL => "Modified $self->{MB_modified}");
+        $self->{MB_modified} = 0;  #after reading, no changes found yet.
+    }
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub write(@)
+{   my ($self, %args) = @_;
+
+    unless($args{force} || $self->writable)
+    {   $self->log(ERROR => "Folder $self is opened read-only.\n");
+        return;
+    }
+
+    my (@keep, @destroy);
+    if($args{save_deleted}) {@keep = $self->messages }
+    else
+    {   foreach ($self->messages)
+        {   if($_->isDeleted)
+            {   push @destroy, $_;
+                $_->diskDelete;
+            }
+            else {push @keep, $_}
+        }
+    }
+
+    unless(@destroy || $self->isModified)
+    {   $self->log(PROGRESS => "Folder $self not changed, so not updated.");
+        return $self;
+    }
+
+    $args{messages} = \@keep;
+    unless($self->writeMessages(\%args))
+    {   $self->log(WARNING => "Writing folder $self failed.");
+        return undef;
+    }
+
+    $self->modified(0);
+    $self->{MB_messages} = \@keep;
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub determineBodyType($$)
+{   my ($self, $message, $head) = @_;
+
+    return $self->{MB_body_delayed_type}
+        if $self->{MB_lazy_permitted}
+        && ! $message->isPart
+        && ! $self->{MB_extract}->($self, $head);
+
+    my $bodytype = $self->{MB_body_type};
+    ref $bodytype ? $bodytype->($head) : $bodytype;
+}
+
+sub extractDefault($)
+{   my ($self, $head) = @_;
+    my $size = $head->guessBodySize;
+    defined $size ? $size < 10000 : 0  # immediately extract < 10kb
+}
+
+sub lazyPermitted($)
+{   my $self = shift;
+    $self->{MB_lazy_permitted} = shift;
+}
+
+#-------------------------------------------
+
+
+sub storeMessage($)
+{   my ($self, $message) = @_;
+
+    push @{$self->{MB_messages}}, $message;
+    $message->seqnr( @{$self->{MB_messages}} -1);
+    $message;
+}
+
+#-------------------------------------------
+
+
+my %seps = (CR => "\015", LF => "\012", CRLF => "\015\012");
+
+sub lineSeparator(;$)
+{   my $self = shift;
+    return $self->{MB_linesep} unless @_;
+
+   my $sep   = shift;
+   $sep = $seps{$sep} if exists $seps{$sep};
+
+   $self->{MB_linesep} = $sep;
+   $_->lineSeparator($sep) foreach $self->messages;
+   $sep;
+}
+
+#-------------------------------------------
+
+
+sub coerce($)
+{   my ($self, $message) = @_;
+    $self->{MB_message_type}->coerce($message);
+}
+
+
+#-------------------------------------------
+
+
+sub readMessages(@) {shift->notImplemented}
+
+#-------------------------------------------
+
+
+sub updateMessages(@) { shift }
+
+#-------------------------------------------
+
+
+sub writeMessages(@) {shift->notImplemented}
+
+#-------------------------------------------
+
+
+sub locker() { shift->{MB_locker} }
+
+#-------------------------------------------
+
+
+sub toBeThreaded(@)
+{   my $self = shift;
+
+    my $manager = $self->{MB_manager}
+       or return $self;
+
+    $manager->toBeThreaded($self, @_);
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub toBeUnthreaded(@)
+{   my $self = shift;
+
+    my $manager = $self->{MB_manager}
+       or return $self;
+
+    $manager->toBeThreaded($self, @_);
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub timespan2seconds($)
+{
+    if( $_[1] =~ /^\s*(\d+\.?\d*|\.\d+)\s*(hour|day|week)s?\s*$/ )
+    {     $2 eq 'hour' ? $1 * 3600
+        : $2 eq 'day'  ? $1 * 86400
+        :                $1 * 604800;  # week
+    }
+    else
+    {   $_[0]->log(ERROR => "Invalid timespan '$_' specified.\n");
+        undef;
+    }
+}
+
+#-------------------------------------------
+
+
+sub DESTROY
+{   my $self = shift;
+    $self->close unless $self->inGlobalDestruction || $self->{MB_is_closed};
+}
+
+
+#-------------------------------------------
+# Instance variables
+# MB_access: new(access)
+# MB_body_type: new(body_type)
+# MB_coerce_opts: Options which have to be applied to the messages which
+#    are coerced into this folder.
+# MB_current: Used by some mailbox-types to save last read message.
+# MB_field_type: new(field_type)
+# MB_folderdir: new(folderdir)
+# MB_foldername: new(folder)
+# MB_head_type: new(head_type)
+# MB_init_options: A copy of all the arguments given to the constructor
+# MB_is_closed: Whether or not the mailbox is closed
+# MB_extract: When to extract the body on the moment the header is read
+# MB_keep_dups: new(keep_dups)
+# MB_locker: A reference to the mail box locker.
+# MB_manager: new(manager)
+# MB_messages: A list of all the messages in the folder
+# MB_message_type: new(message_type)
+# MB_modified: true when the message is modified for sure
+# MB_msgid: A hash of all the messages in the mailbox, keyed on message ID
+# MB_open_time: The time at which a mail box is first opened
+# MB_organization: new(organization)
+# MB_remove_empty: new(remove_when_empty)
+# MB_save_on_exit: new(save_on_exit)
+
+#-------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Box.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,1791 @@
+
+=head1 NAME
+
+Mail::Box - manage a mailbox, a folder with messages
+
+
+=head1 INHERITANCE
+
+ Mail::Box
+   is a Mail::Reporter
+
+ Mail::Box is extended by
+   Mail::Box::Dir
+   Mail::Box::File
+   Mail::Box::Net
+
+
+=head1 SYNOPSIS
+
+ use Mail::Box::Manager;
+ my $mgr    = Mail::Box::Manager->new;
+ my $folder = $mgr->open(folder => $ENV{MAIL}, ...);
+ print $folder->name;
+
+ # Get the first message.
+ print $folder->message(0);
+
+ # Delete the third message
+ $folder->message(3)->delete;
+
+ # Get the number of messages in scalar context.
+ my $emails = $folder->messages;
+
+ # Iterate over the messages.
+ foreach ($folder->messages) {...} # all messages
+ foreach (@$folder) {...}          # all messages
+
+ $folder->addMessage(Mail::Box::Message->new(...));
+
+Tied-interface:
+
+ tie my(@inbox), 'Mail::Box::Tie::ARRAY', $inbox;
+
+ # Four times the same:
+ $inbox[3]->print;                 # tied
+ $folder->[3]->print;              # overloaded folder
+ $folder->message(3)->print;       # usual
+ print $folder->[3];               # overloaded message
+
+ tie my(%inbox), 'Mail::Box::Tie::HASH', $inbox;
+
+ # Twice times the same
+ $inbox{$msgid}->print;            # tied
+ $folder->messageId($msgid)->print;# usual
+
+
+=head1 DESCRIPTION
+
+A L<Mail::Box::Manager|Mail::Box::Manager> creates C<Mail::Box> objects.  But you already
+knew, because you started with the L<Mail::Box-Overview|Mail::Box-Overview> manual page.
+That page is obligatory reading, sorry!
+
+C<Mail::Box> is the base class for accessing various types of mailboxes
+(folders) in a uniform manner.  The various folder types vary on how
+they store their messages, but when some effort those differences could
+be hidden behind a general API. For example, some folders store many
+messages in one single file, where other store each message in a separate
+file withing the same directory.
+
+No object in your program will be of type C<Mail::Box>: it is only used
+as base class for the real folder types.  C<Mail::Box> is extended by
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+(stringification)
+The folder objects stringify to their name.  This simplifies especially
+print statements and sorting a lot.
+
+I<Example:> use overloaded folder as string
+
+
+ # Three lines with overloading: resp. cmp, @{}, and ""
+ foreach my $folder (sort @folders)
+ {   my $msgcount = @$folder;
+     print "$folder contains $msgcount messages\n";
+ }
+
+=back
+
+overload: B<@{}>
+
+=over 4
+
+When the folder is used as if it is a reference to an array, it will
+show the messages, like L<messages()|Mail::Box/"The messages"> and L<message()|Mail::Box/"The messages"> would do.
+
+I<Example:> use overloaded folder as array
+
+
+ my $msg = $folder->[3];
+ my $msg = $folder->message(3);          # same
+
+ foreach my $msg (@$folder) ...
+ foreach my $msg ($folder->messages) ... # same
+
+=back
+
+overload: B<cmp>
+
+=over 4
+
+(string comparison) folders are compared based on their name.  The sort
+rules are those of the build-in C<cmp>.
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<create>(FOLDERNAME, OPTIONS)
+
+Mail::Box-E<gt>B<create>(FOLDERNAME, OPTIONS)
+
+=over 4
+
+Create a folder.  If the folder already exists, it will
+be left unchanged.  As options, you may specify:
+
+ Option     Defined in  Default
+ folderdir              undef  
+
+. folderdir DIRECTORY
+
+=over 4
+
+When the foldername is preceded by a C<=>, the C<folderdir> directory
+will be searched for the named folder.
+
+=back
+
+=back
+
+Mail::Box-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+Open a new folder. A list of labeled OPTIONS
+for the mailbox can be supplied. Some options pertain to Mail::Box, and
+others are added by sub-classes. The list below describes all the options
+provided by any Mail::Box.
+
+To control delay-loading of messages, as well the headers as the bodies,
+a set of C<*_type> options are available. C<extract> determines whether
+we want delay-loading.
+
+ Option             Defined in       Default                                                         
+ access                              C<'r'>                                                          
+ body_delayed_type                   L<Mail::Message::Body::Delayed|Mail::Message::Body::Delayed>    
+ body_type                           <folder specific>                                               
+ coerce_options                      C<[]>                                                           
+ create                              <false>                                                         
+ extract                             C<10240>                                                        
+ field_type                          undef                                                           
+ fix_headers                         <false>                                                         
+ folder                              C<$ENV{MAIL}>                                                   
+ folderdir                           undef                                                           
+ head_delayed_type                   L<Mail::Message::Head::Delayed|Mail::Message::Head::Delayed>    
+ head_type                           L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>  
+ keep_dups                           <false>                                                         
+ lock_file                           undef                                                           
+ lock_timeout                        1 hour                                                          
+ lock_type                           L<Mail::Box::Locker::DotLock|Mail::Box::Locker::DotLock>        
+ lock_wait                           10 seconds                                                      
+ locker                              undef                                                           
+ log                L<Mail::Reporter>  C<'WARNINGS'>                                                   
+ manager                             undef                                                           
+ message_type                        L<Mail::Box::Message|Mail::Box::Message>                        
+ multipart_type                      L<Mail::Message::Body::Multipart|Mail::Message::Body::Multipart>
+ remove_when_empty                   <true>                                                          
+ save_on_exit                        <true>                                                          
+ trace              L<Mail::Reporter>  C<'WARNINGS'>                                                   
+ trusted                             <depends on folder location>                                    
+
+. access MODE
+
+=over 4
+
+Access-rights to the folder. MODE can be read-only (C<"r">), append (C<"a">),
+and read-write (C<"rw">).  Folders are opened for read-only (C<"r">)
+(which means write-protected) by default!
+
+These MODEs have no relation to the modes actually used to open the
+folder files within this module.  For instance, if you specify C<"rw">, and
+open the folder, only read permission on the folder-file is required.
+
+Be warned: writing a MBOX folder may create a new file to replace the
+old folder.  The permissions and owner of the file get changed by this.
+
+=back
+
+. body_delayed_type CLASS
+
+=over 4
+
+The bodies which are delayed: which will be read from file when it
+is needed, but not before.
+
+=back
+
+. body_type CLASS|CODE
+
+=over 4
+
+When messages are read from a folder-file, the headers will be stored in
+a C<head_type> object.  For the body, however, there is a range of
+choices about type, which are all described in L<Mail::Message::Body|Mail::Message::Body>.
+
+Specify a CODE-reference which produces the body-type to be created, or
+a CLASS of the body which is used when the body is not a multipart or
+nested.  In case of a code reference, the header structure is passed as
+first argument to the routine.
+
+Do I<not> return a delayed body-type (like C<::Delayed>), because that is
+determined by the C<extract> option while the folder is opened.  Even
+delayed message will require some real body type when they get parsed
+eventually.  Multiparts and nested messages are also outside your control.
+
+For instance:
+
+ $mgr->open('InBox', body_type => \&which_body);
+
+ sub which_body($) {
+     my $head = shift;
+     my $size = $head->guessBodySize || 0;
+     my $type = $size > 100000 ? 'File' : 'Lines';
+     "Mail::Message::Body::$type";
+ }
+
+The default depends on the mail-folder type, although the general default
+is L<Mail::Message::Body::Lines|Mail::Message::Body::Lines>.  Please check the applicable
+manual pages.
+
+=back
+
+. coerce_options ARRAY
+
+=over 4
+
+Keep configuration information for messages which are coerced into the
+specified folder type, starting with a different folder type (or even
+no folder at all).
+Messages which are coerced are always fully read, so this kind of information
+does not need to be kept here.
+
+=back
+
+. create BOOLEAN
+
+=over 4
+
+Automatically create the folder when it does not exist yet.  This will only
+work when access is granted for writing or appending to the folder.
+
+Be careful: you may create a different folder type than you expect unless you
+explicitly specify L<Mail::Box::Manager::open(type)|Mail::Box::Manager/"Manage folders">.
+
+=back
+
+. extract INTEGER | CODE | METHOD | 'LAZY'|'ALWAYS'
+
+=over 4
+
+Defines when to parse (process) the content of the message.
+When the header of a message is read, you may want to postpone the
+reading of the body: header information is more often needed than
+the body data, so why parse it always together?  The cost of delaying
+is not too high, and with some luck you may never need parsing the body.
+
+If you supply an INTEGER to this option, bodies of those messages with a
+total size less than that number will be extracted from the folder only
+when necessary.  Messages where the size (in the C<Content-Length> field)
+is not included in the header, like often the case for multiparts and nested
+messages, will not be extracted by default.
+
+If you supply a CODE reference, that subroutine is called every time
+that the extraction mechanism wants to determine whether to parse the
+body or not. The subroutine is called with the following arguments:
+
+ CODE->(FOLDER, HEAD)
+
+where FOLDER is a reference to the folder we are reading.  HEAD refers to the
+L<Mail::Message::Head::Complete|Mail::Message::Head::Complete> head of the message at hand.  The routine must
+return a C<true> value (extract now) or a C<false> value (be lazy, do not
+parse yet).  Think about using the L<Mail::Message::Head::guessBodySize()|Mail::Message::Head/"About the body"> and
+L<Mail::Message::guessTimestamp()|Mail::Message/"The header"> on the header to determine your choice.
+
+The third possibility is to specify the NAME of a method.  In that case,
+for each message is called:
+
+ FOLDER->NAME(HEAD)
+
+Where each component has the same meaning as described above.
+
+The fourth way to use this option involves constants: with C<LAZY>
+all messages will be delayed. With C<ALWAYS> you enforce unconditional
+parsing, no delaying will take place.  The latter is usuful when you are
+sure you always need all the messages in the folder.
+
+ $folder->new(extract => 'LAZY');  # Very lazy
+ $folder->new(extract => 10000);   # Less than 10kB
+
+ # same, but implemented yourself
+ $folder->new(extract => &large);
+ sub large($) {
+    my ($f, $head) = @_;
+    my $size = $head->guessBodySize;
+    defined $size ? $size < 10000 : 1
+ };
+
+ # method call by name, useful for Mail::Box
+ # extensions. The example selects all messages
+ # sent by you to be loaded without delay.
+ # Other messages will be delayed.
+ $folder->new(extract => 'sent_by_me');
+ sub Mail::Box::send_by_me($) {
+     my ($self, $header) = @_;
+     $header->get('from') =~ m/\bmy\@example.com\b/i;
+ }
+
+=back
+
+. field_type CLASS
+
+=over 4
+
+The type of the fields to be used in a header. Must extend
+L<Mail::Message::Field|Mail::Message::Field>.
+
+=back
+
+. fix_headers BOOLEAN
+
+=over 4
+
+Broken MIME headers usually stop the parser: all lines not parsed are
+added to the body of the message.  With this flag set, the erroneous line
+is added to the previous header field and parsing is continued.
+See L<Mail::Box::Parser::Perl::new(fix_header_errors)|Mail::Box::Parser::Perl/"METHODS">.
+
+=back
+
+. folder FOLDERNAME
+
+=over 4
+
+Which folder to open (for reading or writing). When used for reading (the
+C<access> option set to C<"r"> or C<"a">) the mailbox should already exist
+and must be readable. The file or directory of the mailbox need not exist if it
+is opened for reading and writing (C<"rw">).  Write-permission is checked when
+opening an existing mailbox.
+
+The folder name can be preceded by a C<"=">, to indicate that it is named
+relative to the directory specified in new(folderdir).  Otherwise, it is
+taken as relative or absolute path.
+
+=back
+
+. folderdir DIRECTORY
+
+=over 4
+
+Where are folders to be found by default?  A folder-name may be preceded by
+a equals-sign (C<=>, a C<mutt> convension) to explicitly state that the folder
+is located below the default directory.  For example: in case
+C<folderdir =E<gt> '/tmp'> and C<folder =E<gt> '=abc'>, the name of the
+folder-file is C<'/tmp/abc'>.  Each folder type has already some default set.
+
+=back
+
+. head_delayed_type CLASS
+
+=over 4
+
+The headers which are delayed: which will be read from file when it
+is needed, but not before.
+
+=back
+
+. head_type CLASS
+
+=over 4
+
+The type of header which contains all header information.  Must extend
+L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>.
+
+=back
+
+. keep_dups BOOLEAN
+
+=over 4
+
+Indicates whether or not duplicate messages within the folder should          
+be retained.  A message is considered to be a duplicate if its message-id      
+is the same as a previously parsed message within the same folder. If this         
+option is false (the default) such messages are automatically deleted,
+because it is considered useless to store the same message twice.
+
+=back
+
+. lock_file FILENAME
+
+=over 4
+
+The name of the file which is used to lock.  This must be specified when
+locking is to be used.
+
+=back
+
+. lock_timeout SECONDS
+
+=over 4
+
+When the lock file is older than the specified number of SECONDS, it is
+considered a mistake.  The original lock is released, and accepted for
+this folder.
+
+=back
+
+. lock_type CLASS|STRING|ARRAY
+
+=over 4
+
+The type of the locker object.  This may be the full name of a CLASS
+which extends Mail::Box::Locker, or one of the known locker types
+C<DotLock>, C<File>, C<Multi>, C<NFS>, C<POSIX>, or C<NONE>.  If an
+ARRAY is specified, then a Multi locker is built which uses the specified
+list.
+
+=back
+
+. lock_wait SECONDS
+
+=over 4
+
+SECONDS to wait before failing on opening this folder.
+
+=back
+
+. locker OBJECT
+
+=over 4
+
+An OBJECT which extends L<Mail::Box::Locker|Mail::Box::Locker>, and will handle folder locking
+replacing the default lock behavior.
+
+=back
+
+. log LEVEL
+
+. manager MANAGER
+
+=over 4
+
+A reference to the object which manages this folder -- typically an
+L<Mail::Box::Manager|Mail::Box::Manager> instance.
+
+=back
+
+. message_type CLASS
+
+=over 4
+
+What kind of message objects are stored in this type of folder.  The
+default is L<Mail::Box::Message|Mail::Box::Message> (which is a sub-class of L<Mail::Message|Mail::Message>).
+The class you offer must be an extension of L<Mail::Box::Message|Mail::Box::Message>.
+
+=back
+
+. multipart_type CLASS
+
+=over 4
+
+The default type of objects which are to be created for multipart message
+bodies.
+
+=back
+
+. remove_when_empty BOOLEAN
+
+=over 4
+
+Determines whether to remove the folder file or directory
+automatically when the write would result in a folder without
+messages nor sub-folders.
+
+=back
+
+. save_on_exit BOOLEAN
+
+=over 4
+
+Sets the policy for saving the folder when it is closed.
+A folder can be closed manually (see L<close()|Mail::Box/"The folder">) or in a number of
+implicit ways, including on the moment the program is terminated.
+
+=back
+
+. trace LEVEL
+
+. trusted BOOLEAN
+
+=over 4
+
+Flags whether to trust the data in the folder or not.  Folders which
+reside in your C<folderdir> will be trusted by default (even when the
+names if not specified staring with C<=>).  Folders which are outside
+the folderdir or read from STDIN (L<Mail::Message::Construct::read()|Mail::Message::Construct::Read/"Constructing a message">) are
+not trused by default, and require some extra checking.
+
+If you do not check encodings of received messages, you may print
+binary data to the screen, which is a security risk.
+
+=back
+
+=back
+
+=head2 The folder
+
+
+$obj-E<gt>B<addMessage>(MESSAGE)
+
+=over 4
+
+=back
+
+$obj-E<gt>B<addMessages>(MESSAGE [, MESSAGE, ...])
+
+=over 4
+
+Add a message to the folder.  A message is usually a
+L<Mail::Box::Message|Mail::Box::Message> object or a sub-class thereof.  The message
+shall not be in an other folder, when you use this method.
+In case it is, use L<Mail::Box::Manager::moveMessage()|Mail::Box::Manager/"Move messages to folders"> or
+L<Mail::Box::Manager::copyMessage()|Mail::Box::Manager/"Move messages to folders"> via the manager.
+
+Messages with id's which already exist in this folder are not added.
+
+I<Example:> 
+
+ $folder->addMessage($msg);
+ $folder->addMessages($msg1, $msg2, ...);
+
+=back
+
+Mail::Box-E<gt>B<appendMessages>(OPTIONS)
+
+=over 4
+
+Append one or more messages to an unopened folder.
+Usually, this method is called by the L<Mail::Box::Manager::appendMessage()|Mail::Box::Manager/"Move messages to folders">,
+in which case the correctness of the folder type is checked.
+
+This method takes a list of labeled parameters, which may contain
+any option which can be used when a folder is opened, most importantly
+L<new(folderdir)|Mail::Box/"Constructors">.
+
+ Option    Defined in       Default   
+ folder                     <required>
+ message                    undef     
+ messages                   undef     
+
+. folder FOLDERNAME
+
+=over 4
+
+The name of the folder to which the messages are to be appended.  The folder
+implementation will avoid opening the folder when possible, because this is
+resource consuming.
+
+=back
+
+. message MESSAGE
+
+. messages ARRAY-OF-MESSAGES
+
+=over 4
+
+One reference to a MESSAGE or a reference to an ARRAY of MESSAGEs, which may
+be of any type.  The messages will be first coerced into the correct
+message type to fit in the folder, and then will be added to it.
+
+=back
+
+I<Example:> 
+
+ my $message = Mail::Message->new(...);
+ Mail::Box::Mbox->appendMessages
+  ( folder    => '=xyz'
+  , message   => $message
+  , folderdir => $ENV{FOLDERS}
+  );
+
+better:
+
+ my Mail::Box::Manager $mgr;
+ $mgr->appendMessages($message, folder => '=xyz');
+
+=back
+
+$obj-E<gt>B<close>(OPTIONS)
+
+=over 4
+
+Close the folder, which usually implies writing the changes.  This will
+return C<false> when writing is required but fails.  Please do check this
+result.
+
+WARNING: When moving messages from one folder to another, be sure to
+write the destination folder before writing and closing the source
+folder.  Otherwise you may lose data if the system crashes or if there
+are software problems.
+
+ Option        Defined in       Default    
+ force                          <false>    
+ save_deleted                   C<false>   
+ write                          C<MODIFIED>
+
+. force BOOLEAN
+
+=over 4
+
+Override the L<new(access)|Mail::Box/"Constructors"> setting which was specified when the folder
+was opened. This option only has an effect if its value is TRUE. NOTE:
+Writing to the folder may not be permitted by the operating system,
+in which case even C<force> will not help.
+
+=back
+
+. save_deleted BOOLEAN
+
+=over 4
+
+Do also write messages which where flagged to be deleted to their folder.  The
+flag for deletion is conserved (when possible), which means that a re-open of
+the folder may remove the messages for real.  See L<write(save_deleted)|Mail::Box/"Internals">.
+
+=back
+
+. write 'ALWAYS'|'NEVER'|'MODIFIED'
+
+=over 4
+
+Specifies whether the folder should be written.  As could be expected,
+C<ALWAYS> means always (even if there are no changes), C<NEVER> means
+that changes to the folder will be lost, and C<MODIFIED> only saves the
+folder if there are any changes.
+
+=back
+
+I<Example:> 
+
+ my $f = $mgr->open('spam', access => 'rw')
+     or die "Cannot open spam: $!\n";
+
+ $f->message(0)->delete
+     if $f->messages;
+
+ $f->close
+     or die "Couldn't write $f: $!\n";
+
+=back
+
+$obj-E<gt>B<copyTo>(FOLDER, OPTIONS)
+
+=over 4
+
+Copy the folder's messages to a new folder.  The new folder may be of
+a different type.
+
+ Option         Defined in       Default                
+ delete_copied                   <false>                
+ select                          'ACTIVE'               
+ subfolders                      <folder type dependent>
+
+. delete_copied BOOLEAN
+
+=over 4
+
+Flag the messages from the source folder to be deleted, just after it
+was copied.  The deletion will only take effect when the originating
+folder is closed.
+
+=back
+
+. select 'ACTIVE'|'DELETED'|'ALL'|LABEL|!LABEL|FILTER
+
+=over 4
+
+Which messages are to be copied. See the description of L<messages()|Mail::Box/"The messages">
+about how this works.
+
+=back
+
+. subfolders BOOLEAN|'FLATTEN'|'RECURSE'
+
+=over 4
+
+How to handle sub-folders.  When false (C<0> or C<undef>), sub-folders
+are simply ignored.  With C<FLATTEN>, messages from sub-folders are
+included in the main copy.  C<RECURSE> recursively copies the
+sub-folders as well.  By default, when the destination folder
+supports sub-folders C<RECURSE> is used, otherwise C<FLATTEN>.  A value
+of true will select the default.
+
+=back
+
+I<Example:> 
+
+ my $mgr  = Mail::Box::Manager->new;
+ my $imap = $mgr->open(type => 'imap', host => ...);
+ my $mh   = $mgr->open(type => 'mh', folder => '/tmp/mh',
+     create => 1, access => 'w');
+
+ $imap->copyTo($mh, delete_copied => 1);
+ $mh->close; $imap->close;
+
+=back
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+Remove the specified folder file or folder directory (depending on
+the type of folder) from disk.  Of course, THIS IS DANGEROUS: you "may"
+lose data.
+
+WARNING: When moving messages from one folder to another, be sure to write the
+destination folder before deleting the source folder.  Otherwise you may lose
+data if the system crashes or if there are software problems.
+
+I<Example:> 
+
+ my $folder = Mail::Box::Mbox->new(folder => 'InBox');
+ $folder->delete;
+
+=back
+
+$obj-E<gt>B<folderdir>([DIRECTORY])
+
+=over 4
+
+Get or set the DIRECTORY which is used to store mail-folders by default.
+
+I<Example:> 
+
+ print $folder->folderdir;
+ $folder->folderdir("$ENV{HOME}/nsmail");
+
+=back
+
+Mail::Box-E<gt>B<foundIn>([FOLDERNAME], OPTIONS)
+
+=over 4
+
+Determine if the specified folder is of the type handled by the
+folder class. This method is extended by each folder sub-type.
+
+The FOLDERNAME specifies the name of the folder, as is specified by the
+application.  You need to specified the C<folder> option when you skip
+this first argument.
+
+OPTIONS is a list of extra information for the request.  Read
+the documentation for each type of folder for type specific options, but
+each folder class will at least support the C<folderdir> option:
+
+ Option     Defined in  Default
+ folderdir              undef  
+
+. folderdir DIRECTORY
+
+=over 4
+
+The location where the folders of this class are stored by default.  If the
+user specifies a name starting with a C<=>, that indicates that the folder is
+to be found in this default DIRECTORY.
+
+=back
+
+I<Example:> 
+
+ Mail::Box::Mbox->foundIn('=markov',
+     folderdir => "$ENV{HOME}/Mail");
+ Mail::Box::MH->foundIn(folder => '=markov');
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+Returns the name of the folder.  What the name represents depends on
+the actual type of mailbox used.
+
+I<Example:> 
+
+ print $folder->name;
+ print "$folder";       # overloaded stringification
+
+=back
+
+$obj-E<gt>B<organization>
+
+=over 4
+
+Returns how the folder is organized: as one C<FILE> with many messages,
+a C<DIRECTORY> with one message per file, or by a C<REMOTE> server.
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+Returns the size of the folder in bytes, not counting in the deleted
+messages.  The error in the presented result may be as large as 10%,
+because the in-memory representation of messages is not always the
+same as the size when they are written.
+
+=back
+
+$obj-E<gt>B<type>
+
+=over 4
+
+Returns a name for the type of mail box.  This can be C<mbox>, C<mh>,
+C<maildir>, or C<pop3>.
+
+=back
+
+$obj-E<gt>B<update>(OPTIONS)
+
+=over 4
+
+Read new messages from the folder, which where received after opening
+it.  This is quite dangerous and shouldn't be possible: folders which
+are open are locked.  However, some applications do not use locks or
+the wrong kind of locks.  This method reads the changes (not always
+failsafe) and incorporates them in the open folder administration.
+
+The OPTIONS are extra values which are passed to the
+L<updateMessages()|Mail::Box/"Internals"> method which is doing the actual work here.
+
+=back
+
+$obj-E<gt>B<url>
+
+=over 4
+
+Represent the folder as a URL (Universal Resource Locator) string.  You may
+pass such a URL as folder name to L<Mail::Box::Manager::open()|Mail::Box::Manager/"Manage folders">.
+
+I<Example:> 
+
+ print $folder->url;
+ # may result in
+ #   mbox:/var/mail/markov   or
+ #   pop3://user:password@pop.aol.com:101
+
+=back
+
+=head2 Folder flags
+
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+Checks if the folder, as stored in memory, is modified.  A true value is
+returned when any of the messages is to be deleted, has changed, or messages
+were added after the folder was read from file.
+
+WARNING: this flag is not related to an external change to the folder
+structure on disk.  Have a look at L<update()|Mail::Box/"The folder"> for that.
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+Sets whether the folder is modified or not.
+
+=back
+
+$obj-E<gt>B<writable>
+
+=over 4
+
+Checks whether the current folder is writable.
+
+I<Example:> 
+
+ $folder->addMessage($msg) if $folder->writable;
+
+=back
+
+=head2 The messages
+
+
+$obj-E<gt>B<current>([NUMBER|MESSAGE|MESSAGE-ID])
+
+=over 4
+
+Some mail-readers keep the I<current> message, which represents the last
+used message.  This method returns [after setting] the current message.
+You may specify a NUMBER, to specify that that message number is to be
+selected as current, or a MESSAGE/MESSAGE-ID (as long as you are sure
+that the header is already loaded, otherwise they are not recognized).
+
+I<Example:> 
+
+ $folder->current(0);
+ $folder->current($message);
+
+=back
+
+$obj-E<gt>B<find>(MESSAGE-ID)
+
+=over 4
+
+Like L<messageId()|Mail::Box/"The messages">, this method searches for a message with the
+MESSAGE-ID, returning the corresponding message object.  However, C<find>
+will cause unparsed message in the folder to be parsed until the message-id
+is found.  The folder will be scanned back to front.
+
+=back
+
+$obj-E<gt>B<findFirstLabeled>(LABEL, [BOOLEAN, [ARRAY-OF-MSGS]])
+
+=over 4
+
+Find the first message which has this LABEL with the correct setting. The
+BOOLEAN indicates whether any true value or any false value is to
+be found.  By default, a true value is searched for.  When a message
+does not have the requested label, it is taken as false.
+
+I<Example:> looking for a labeled message
+
+
+ my $current = $folder->findFirstLabeled('current');
+
+ my $first   = $folder->findFirstLabeled(seen => 0);
+
+ my $last    = $folder->findFirstLabeled(seen => 0,
+                 [ reverse $self->messages('ACTIVE') ] )
+
+=back
+
+$obj-E<gt>B<message>(INDEX [,MESSAGE])
+
+=over 4
+
+Get or set a message with on a certain index.  Messages which are flagged
+for deletion are counted.  Negative indexes start at the end of the folder.
+
+I<Example:> 
+
+ my $msg = $folder->message(3);
+ $folder->message(3)->delete;   # status changes to `deleted'
+ $folder->message(3, $msg);
+ print $folder->message(-1);    # last message.
+
+=back
+
+$obj-E<gt>B<messageId>(MESSAGE-ID [,MESSAGE])
+
+=over 4
+
+With one argument, returns the message in the folder with the specified
+MESSAGE-ID. If a reference to a message object is passed as the optional
+second argument, the message is first stored in the folder, replacing any
+existing message whose message ID is MESSAGE-ID. (The message ID of MESSAGE
+need not match MESSAGE-ID.)
+
+The MESSAGE-ID may still be in angles, which will be stripped.  In that
+case blanks (which origin from header line folding) are removed too.  Other
+info around the angles will be removed too.
+
+WARNING: when the message headers are delay-parsed, the message might be in
+the folder but not yet parsed into memory. In this case, use L<find()|Mail::Box/"The messages">
+instead of C<messageId()> if you really need a thorough search.
+
+I<Example:> 
+
+ my $msg = $folder->messageId('<complex-message.id>');
+ $folder->messageId("<complex-message\n.id>", $msg);
+ my $msg = $folder->messageId('complex-message.id');
+ my $msg = $folder->messageId('garbage <complex-message.id> trash');
+
+=back
+
+$obj-E<gt>B<messageIds>
+
+=over 4
+
+Returns a list of I<all> message-ids in the folder, including
+those of messages which are to be deleted.
+
+For some folder-types (like MH), this method may cause all message-files
+to be read.  See their respective manual pages.
+
+I<Example:> 
+
+ foreach my $id ($folder->messageIds) {
+    $folder->messageId($id)->print;
+ }
+
+=back
+
+$obj-E<gt>B<messages>(['ALL',RANGE,'ACTIVE','DELETED',LABEL,!LABEL,FILTER])
+
+=over 4
+
+Returns multiple messages from the folder.  The default is C<ALL>
+which will return (as expected maybe) all the messages in the
+folder.  The C<ACTIVE> flag will return the messages not flagged for
+deletion.  This is the opposite of C<DELETED>, which returns all
+messages from the folder which will be deleted when the folder is
+closed.
+
+You may also specify a RANGE: two numbers specifying begin and end
+index in the array of messages.  Negative indexes count from the
+end of the folder.  When an index is out-of-range, the returned
+list will be shorter without complaints.
+
+Everything else than the predefined names is seen as labels.  The messages
+which have that label set will be returned.  When the sequence starts
+with an exclamation mark (!), the search result is reversed.
+
+For more complex searches, you can specify a FILTER, which is
+simply a code reference.  The message is passed as only argument.
+
+I<Example:> 
+
+ foreach my $message ($folder->messages) {...}
+ foreach my $message (@$folder) {...}
+
+ # twice the same
+ my @messages   = $folder->messages;
+ my @messages   = $folder->messages('ALL');
+
+ # Selection based on a range (begin, end)
+ my $subset     = $folder->messages(10,-8);
+
+ # twice the same:
+ my @not_deleted= grep {not $_->isDeleted}
+                     $folder->messages;
+ my @not_deleted= $folder->messages('ACTIVE');
+
+ # scalar context the number of messages
+ my $nr_of_msgs = $folder->messages;
+
+ # third message, via overloading
+ $folder->[2];
+
+ # Selection based on labels
+ $mgr->moveMessages($spam, $inbox->message('spam'));
+ $mgr->moveMessages($archive, $inbox->message('seen'));
+
+=back
+
+$obj-E<gt>B<scanForMessages>(MESSAGE, MESSAGE-IDS, TIMESPAN, WINDOW)
+
+=over 4
+
+You start with a MESSAGE, and are looking for a set of messages
+which are related to it.  For instance, messages which appear in
+the 'In-Reply-To' and 'Reference' header fields of that message.
+These messages are known by their MESSAGE-IDS and you want to find
+them in the folder.
+
+When all message-ids are known, then looking-up messages is simple:
+they are found in a plain hash using L<messageId()|Mail::Box/"The messages">.  But Mail::Box
+is lazy where it can, so many messages may not have been read from
+file yet, and that's the prefered situation, because that saves
+time and memory.
+
+It is not smart to search for the messages from front to back in
+the folder: the chances are much higher that related message
+reside closely to each other.  Therefore, this method starts
+scanning the folder from the specified MESSAGE, back to the front
+of the folder.
+
+The TIMESPAN can be used to terminate the search based on the time
+enclosed in the message.  When the constant string C<EVER> is used as
+TIMESPAN, then the search is not limited by that.  When an integer
+is specified, it will be used as absolute time in time-ticks as
+provided by your platform dependent C<time> function.  In other cases,
+it is passed to L<timespan2seconds()|Mail::Box/"Other methods"> to determine the threshold
+as time relative to the message's time.
+
+The WINDOW is used to limit the search in number of messages to be
+scanned as integer or constant string C<ALL>.
+
+Returned are the message-ids which were not found during the scan.
+Be warned that a message-id could already be known and therefore not
+found: check that first.
+
+I<Example:> scanning through a folder for a message
+
+
+ my $refs   = $msg->get('References') or return;
+ my @msgids = $ref =~ m/\<([^>]+\>/g;
+ my @failed = $folder->scanForMessages($msg, \@msgids, '3 days', 50);
+
+=back
+
+=head2 Sub-folders
+
+
+$obj-E<gt>B<listSubFolders>(OPTIONS)
+
+Mail::Box-E<gt>B<listSubFolders>(OPTIONS)
+
+=over 4
+
+List the names of all sub-folders to this folder, not recursively
+decending.  Use these names as argument to L<openSubFolder()|Mail::Box/"Sub-folders">, to get
+access to that folder.
+
+For MBOX folders, sub-folders are simulated.
+
+ Option      Defined in       Default      
+ check                        <false>      
+ folder                       <required>   
+ folderdir                    <from folder>
+ skip_empty                   <false>      
+
+. check BOOLEAN
+
+=over 4
+
+Should all returned foldernames be checked to be sure that they are of
+the right type?  Each sub-folder may need to be opened to check this,
+with a folder type dependent penalty (in some cases very expensive).
+
+=back
+
+. folder FOLDERNAME
+
+=over 4
+
+The folder whose sub-folders should be listed.
+
+=back
+
+. folderdir DIRECTORY
+
+. skip_empty BOOL
+
+=over 4
+
+Shall empty folders (folders which currently do not contain any messages)
+be included?  Empty folders are not useful to open, but may be useful
+to save to.
+
+=back
+
+I<Example:> 
+
+ my $folder = $mgr->open('=in/new');
+ my @subs = $folder->listSubFolders;
+
+ my @subs = Mail::Box::Mbox->listSubFolders(folder => '=in/new');
+ my @subs = Mail::Box::Mbox->listSubFolders; # toplevel folders.
+
+=back
+
+$obj-E<gt>B<nameOfSubFolder>(NAME)
+
+=over 4
+
+Returns the constructed name of the folder with NAME, which is a
+sub-folder of this current one.
+
+=back
+
+$obj-E<gt>B<openRelatedFolder>(OPTIONS)
+
+=over 4
+
+Open a folder (usually a sub-folder) with the same options as this one.
+If there is a folder manager in use, it will be informed about this new
+folder.  OPTIONS overrule the options which where used for the folder
+this method is called upon.
+
+=back
+
+$obj-E<gt>B<openSubFolder>(NAME, OPTIONS)
+
+=over 4
+
+Open (or create, if it does not exist yet) a new subfolder in an
+existing folder.
+
+I<Example:> 
+
+ my $folder = Mail::Box::Mbox->new(folder => '=Inbox');
+ my $sub    = $folder->openSubFolder('read');
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<coerce>(MESSAGE)
+
+=over 4
+
+Coerce the MESSAGE to be of the correct type to be placed in the
+folder.  You can specify Mail::Internet and MIME::Entity objects
+here: they will be translated into Mail::Message messages first.
+
+=back
+
+$obj-E<gt>B<determineBodyType>(MESSAGE, HEAD)
+
+=over 4
+
+Determine which kind of body will be created for this message when
+reading the folder initially.
+
+=back
+
+$obj-E<gt>B<lineSeparator>([STRING|'CR'|'LF'|'CRLF'])
+
+=over 4
+
+Returns the character or characters used to separate lines in the folder
+file, optionally after setting it to STRING, or one of the constants.
+The first line of the folder sets the default.
+
+UNIX uses a LF character, Mac a CR, and Windows both a CR and a LF.  Each
+separator will be represented by a "\n" within your program.  However,
+when processing platform foreign folders, complications appear.  Think about
+the C<Size> field in the header.
+
+When the separator is changed, the whole folder me be rewritten.  Although,
+that may not be required.
+
+=back
+
+$obj-E<gt>B<locker>
+
+=over 4
+
+Returns the locking object.
+
+=back
+
+$obj-E<gt>B<read>(OPTIONS)
+
+=over 4
+
+Read messages from the folder into memory.  The OPTIONS are folder
+specific.  Do not call C<read()> yourself: it will be called for you
+when you open the folder via the manager or instantiate a folder
+object directly.
+
+NOTE: if you are copying messages from one folder to another, use
+L<addMessages()|Mail::Box/"The folder"> instead of C<read()>.
+
+I<Example:> 
+
+ my $mgr = Mail::Box::Manager->new;
+ my $folder = $mgr->open('InBox');             # implies read
+ my $folder = Mail::Box::Mbox->new(folder => 'Inbox'); # same
+
+=back
+
+$obj-E<gt>B<readMessages>(OPTIONS)
+
+=over 4
+
+Called by L<read()|Mail::Box/"Internals"> to actually read the messages from one specific
+folder type.  The L<read()|Mail::Box/"Internals"> organizes the general activities.
+
+The OPTIONS are C<trusted>, C<head_type>, C<field_type>,
+C<message_type>, C<body_delayed_type>, and C<head_delayed_type> as
+defined by the folder at hand.  The defaults are the constructor
+defaults (see L<new()|Mail::Box/"Constructors">).
+
+=back
+
+$obj-E<gt>B<storeMessage>(MESSAGE)
+
+=over 4
+
+Store the message in the folder without the checks as performed by
+L<addMessage()|Mail::Box/"The folder">.
+
+=back
+
+$obj-E<gt>B<toBeThreaded>(MESSAGES)
+
+=over 4
+
+The specified message is ready to be removed from a thread.
+This will be passed on to the mail-manager, which keeps an overview on
+which thread-detection objects are floating around.
+
+=back
+
+$obj-E<gt>B<toBeUnthreaded>(MESSAGES)
+
+=over 4
+
+The specified message is ready to be included in a thread.
+This will be passed on to the mail-manager, which keeps an overview on
+which thread-detection objects are floating around.
+
+=back
+
+$obj-E<gt>B<updateMessages>(OPTIONS)
+
+=over 4
+
+Called by L<update()|Mail::Box/"The folder"> to read messages which arrived in the folder
+after it was opened.  Sometimes, external applications dump messages
+in a folder without locking (or using a different lock than your
+application does).
+
+Although this is quite a dangerous, it only fails when a folder is
+updated (reordered or message removed) at exactly the same time as
+new messages arrive.  These collisions are sparse.
+
+The options are the same as for L<readMessages()|Mail::Box/"Internals">.
+
+=back
+
+$obj-E<gt>B<write>(OPTIONS)
+
+=over 4
+
+Write the data to disk.  The folder (a C<true> value) is returned if
+successful.  Deleted messages are transformed into destroyed messages:
+their memory is freed.
+
+WARNING: When moving messages from one folder to another, be sure to
+write (or L<close()|Mail::Box/"The folder">) the destination folder before writing (or closing)
+the source folder: otherwise you may lose data if the system crashes or
+if there are software problems.
+
+To write a folder to a different file, you must first create a new folder,
+then move all the messages, and then write or L<close()|Mail::Box/"The folder"> that new folder.
+
+ Option        Defined in       Default
+ force                          <false>
+ save_deleted                   <false>
+
+. force BOOLEAN
+
+=over 4
+
+Override write-protection with L<new(access)|Mail::Box/"Constructors"> while opening the folder
+(whenever possible, it may still be blocked by the operating system).
+
+=back
+
+. save_deleted BOOLEAN
+
+=over 4
+
+Do also write messages which where flagged to be deleted to their folder.  The
+flag for deletion is conserved (when possible), which means that a re-open of
+the folder may remove the messages for real.  See L<close(save_deleted)|Mail::Box/"The folder">.
+
+=back
+
+=back
+
+$obj-E<gt>B<writeMessages>(OPTIONS)
+
+=over 4
+
+Called by L<write()|Mail::Box/"Internals"> to actually write the messages from one specific
+folder type.  The C<write> organizes the general activities.  All options
+to L<write()|Mail::Box/"Internals"> are passed to C<writeMessages> as well.  Besides, a few extra
+are added by C<write> itself.
+
+ Option    Defined in  Default   
+ messages              <required>
+
+. messages ARRAY
+
+=over 4
+
+The messages to be written, which is a sub-set of all messages in the
+current folder.
+
+=back
+
+=back
+
+=head2 Other methods
+
+
+$obj-E<gt>B<timespan2seconds>(TIME)
+
+Mail::Box-E<gt>B<timespan2seconds>(TIME)
+
+=over 4
+
+TIME is a string, which starts with a float, and then one of the
+words 'hour', 'hours', 'day', 'days', 'week', or 'weeks'.  For instance:
+'1 hour' or '4 weeks'.
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Box-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Box-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Box-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+This method is called by Perl when an folder-object is no longer accessible
+by the rest of the program.
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> Changes not written to read-only folder $self.
+
+You have opened the folder read-only --which is the default set
+by L<new(access)|Mail::Box/"Constructors">--, made modifications, and now want to close it.
+Set L<close(force)|Mail::Box/"The folder"> if you want to overrule the access mode, or close
+the folder with L<close(write)|Mail::Box/"The folder"> set to C<NEVER>.
+
+I<Error:> Copying failed for one message.
+
+For some reason, for instance disc full, removed by external process, or
+read-protection, it is impossible to copy one of the messages.  Copying will
+proceed for the other messages.
+
+I<Error:> Destination folder $name is not writable.
+
+The folder where the messages are copied to is not opened with write
+access (see L<new(access)|Mail::Box/"Constructors">).  This has no relation with write permission
+to the folder which is controled by your operating system.
+
+I<Warning:> Different messages with id $msgid.
+
+The message id is discovered more than once within the same folder, but the
+content of the message seems to be different.  This should not be possible:
+each message must be unique.
+
+I<Error:> Folder $name is opened read-only
+
+You can not write to this folder unless you have opened the folder to
+write or append with L<new(access)|Mail::Box/"Constructors">, or the C<force> option is set true.
+
+I<Error:> Folder $name not deleted: not writable.
+
+The folder must be opened with write access via L<new(access)|Mail::Box/"Constructors">, otherwise
+removing it will be refused.  So, you may have write-access according to
+the operating system, but that will not automatically mean that this
+C<delete> method permits you to.  The reverse remark is valid as well.
+
+I<Error:> Invalid timespan '$timespan' specified.
+
+The string does not follow the strict rules of the time span syntax which
+is permitted as parameter.
+
+I<Warning:> Message-id '$msgid' does not contain a domain.
+
+According to the RFCs, message-ids need to contain a unique random part,
+then an C<@>, and then a domain name.  This is made to avoid the creation
+of two messages with the same id.  The warning emerges when the C<@> is
+missing from the string.
+
+I<Error:> No folder name specified.
+
+You did not specify the name of a folder to be opened.  Use the
+L<new(folder)|Mail::Box/"Constructors"> option or set the C<MAIL> environment variable.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Unable to create subfolder $name of $folder.
+
+The copy includes the subfolders, but for some reason it was not possible
+to copy one of these.  Copying will proceed for all other sub-folders.
+
+I<Error:> Writing folder $name failed
+
+For some reason (you probably got more error messages about this problem)
+it is impossible to write the folder, although you should because there
+were changes made.
+
+
+=head1 DETAILS
+
+
+=head2 Different kinds of folders
+
+In general, there are three classes of folders: those who group messages
+per file, those who group messages in a directory, and those do not
+provide direct access to the message data.  These folder types are
+each based on a different base class.
+
+=over 4
+
+=item * File based folders L<Mail::Box::File|Mail::Box::File>
+
+File based folders maintain a folder (a set of messages) in one
+single file.  The advantage is that your folder has only one
+single file to access, which speeds-up things when all messages
+must be accessed at once.
+
+One of the main disadvantages over directory based folders
+is that you have to construct some means to keep all message apart.
+For instance MBOX adds a message separator line between the messages
+in the file, and this line can cause confusion with the message's
+contents.
+
+Where access to all messages at once is faster in file based folders,
+access to a single message is (much) slower, because the whole folder
+must be read.  However, in directory based folders you have to figure-out
+which message you need, which may be a hassle as well.
+
+Examples of file based folders are MBOX, DBX, and NetScape.
+
+=item * Directory based folders L<Mail::Box::Dir|Mail::Box::Dir>
+
+In stead of collecting multiple messages in one file, you can also
+put each message in a separate file and collect those files in a
+directory to represent a folder.
+
+The main disadvantages of these folders are the enormous amount of
+tiny files you usually get in your file-system.  It is extremely
+slow to search through your whole folder, because many files have
+to be opened to do so.
+
+The best feature of this organization is that each message is kept
+exactly as it was received, and can be processed with external scripts
+as well: you do not need any mail user agent (MUA).
+
+Examples of directoy organized folders are MH, Maildir, EMH, and XMH.
+
+=item * Network (external) folders L<Mail::Box::Net|Mail::Box::Net>
+
+Where both types described before provide direct access to the
+message data, maintain these folder types the message data for you:
+you have to request for messages or parts of them.  These folders
+do not have a filename, file-system privileges and system locking
+to worry about, but typically require a hostname, folder and message
+IDs, and authorization.
+
+Examples of these folder types are the popular POP and IMAP, and
+database oriented message storage.
+
+=back
+
+=head2 Supported folder types
+
+=over 4
+
+=item * L<Mail::Box::Dbx|Mail::Box::Dbx> (read only)
+
+Dbx files are created by Outlook Express. Using the external (optional)
+Mail::Transport::Dbx module, you can read these folders, even
+when you are running MailBox on a UNIX/Linux platform.
+
+Writing and deleting messages is not supported by the library, and
+therefore not by MailBox. Read access is enough to do folder conversions,
+for instance.
+
+=item * L<Mail::Box::IMAP4|Mail::Box::IMAP4> (under development)
+
+=item * L<Mail::Box::Maildir|Mail::Box::Maildir>
+
+Maildir folders have a directory for each folder.  A folder directory
+contains C<tmp>, C<new>, and C<cur> sub-directories, each containting
+messages with a different purpose.  Files with new messages are created
+in C<tmp>, then moved to C<new> (ready to be accepted).  Later, they are
+moved to the C<cur> directory (accepted).  Each message is one file with
+a name starting with timestamp.  The name also contains flags about the
+status of the message.
+
+Maildir folders can not be used on Windows by reason of file-name
+limitations on that platform.
+
+=item * L<Mail::Box::Mbox|Mail::Box::Mbox>
+
+A folder type in which all related messages are stored in one file.  This
+is a very common folder type for UNIX.
+
+=item * L<Mail::Box::MH|Mail::Box::MH>
+
+This folder creates a directory for each folder, and a message is one
+file inside that directory.  The message files are numbered sequentially
+on order of arrival.  A special C<.mh_sequences> file maintains flags
+about the messages.
+
+=item * L<Mail::Box::POP3|Mail::Box::POP3> (read/delete only)
+
+POP3 is a protocol which can be used to retreive messages from a
+remote system.  After the connection to a POP server is made, the
+messages can be looked at and removed as if they are on the local
+system.
+
+=back
+
+Other folder types are on the (long) wishlist to get implemented.  Please,
+help implementing more of them.
+
+=head2 Folder class implementation
+
+The class structure of folders is very close to that of messages.  For
+instance, a L<Mail::Box::File::Message|Mail::Box::File::Message> relates to a L<Mail::Box::File|Mail::Box::File>
+folder.  The folder types are:
+
+ Mail::Box::Mbox    Mail::Box::Maildir  Mail::Box::POP3
+ |  Mail::Box::Dbx  |  Mail::Box::MH    |  Mail::Box::IMAP4
+ |  |               |  |                |  |
+ |  |               |  |                |  |
+ Mail::Box::File    Mail::Box::Dir      Mail::Box::Net
+       |                  |                   |
+       `--------------.   |   .---------------'
+                      |   |   |
+                      Mail::Box
+                          |
+                          |
+                    Mail::Reporter (general base class)
+
+By far most folder features are implemented in L<Mail::Box|Mail::Box>, so
+available to all folder types.  Sometimes, features which appear
+in only some of the folder types are simulated for folders that miss
+them, like sub-folder support for MBOX.
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Makefile.PL
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Makefile.PL	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Makefile.PL	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,6 @@
+use ExtUtils::MakeMaker;
+
+WriteMakefile
+   ( NAME      => 'Mail::Box'
+   , PMLIBDIRS => [ qw/Box Message Transport/ ]
+   );

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Construct.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Construct.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Construct.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,157 @@
+use strict;
+use warnings;
+
+# Mail::Message::Body::Construct adds functionality to Mail::Message::Body
+
+package Mail::Message::Body;
+use vars '$VERSION';
+$VERSION = '2.055';
+
+use Carp;
+use Mail::Message::Body::String;
+use Mail::Message::Body::Lines;
+
+
+sub foreachLine($)
+{   my ($self, $code) = @_;
+    my $changes = 0;
+    my @result;
+
+    foreach ($self->lines)
+    {   my $becomes = $code->();
+        if(defined $becomes)
+        {   push @result, $becomes;
+            $changes++ if $becomes ne $_;
+        }
+        else {$changes++}
+     }
+      
+     return $self unless $changes;
+
+     ref($self)->new
+      ( based_on => $self
+      , data     => \@result
+      );
+}
+
+#------------------------------------------
+
+
+sub concatenate(@)
+{   my $self = shift;
+
+    my @bodies;
+    foreach (@_)
+    {   next unless defined $_;
+        push @bodies
+         , !ref $_           ? Mail::Message::Body::String->new(data => $_)
+         : ref $_ eq 'ARRAY' ? Mail::Message::Body::Lines->new(data => $_)
+         : $_->isa('Mail::Message')       ? $_->body
+         : $_->isa('Mail::Message::Body') ? $_
+         : carp "Cannot concatenate element ". at bodies;
+    }
+
+    my @unified;
+
+    my $changes  = 0;
+    foreach my $body (@bodies)
+    {   my $unified = $self->unify($body);
+        if(defined $unified)
+        {   $changes++ unless $unified==$body;
+            push @unified, $unified;
+        }
+        elsif($body->mimeType->mediaType eq 'text')
+        {   # Text stuff can be unified anyhow, although we do not want to
+            # include postscript or such.
+            push @unified, $body;
+        }
+        else { $changes++ }
+    }
+
+    return $self if @bodies==1 && $bodies[0]==$self;  # unmodified, and single
+
+    ref($self)->new
+      ( based_on => $self
+      , data     => [ map {$_->lines} @unified ]
+      );
+}
+
+#------------------------------------------
+
+
+sub attach(@)
+{   my $self  = shift;
+
+    my @parts;
+    push @parts, shift while @_ && ref $_[0];
+
+    return $self unless @parts;
+    unshift @parts,
+      ( $self->isNested    ? $self->nested
+      : $self->isMultipart ? $self->parts
+      : $self
+      );
+
+    return $parts[0] if @parts==1;
+    Mail::Message::Body::Multipart->new(parts => \@parts, @_);
+}
+
+#------------------------------------------
+
+
+# tests in t/51stripsig.t
+
+sub stripSignature($@)
+{   my ($self, %args) = @_;
+
+    return $self if $self->mimeType->isBinary;
+
+    my $pattern = !defined $args{pattern} ? qr/^--\s?$/
+                : !ref $args{pattern}     ? qr/^\Q${args{pattern}}/
+                :                           $args{pattern};
+ 
+    my $lines   = $self->lines;   # no copy!
+    my $stop    = defined $args{max_lines}? @$lines - $args{max_lines}
+                : exists $args{max_lines} ? 0 
+                :                           @$lines-10;
+
+    $stop = 0 if $stop < 0;
+    my ($sigstart, $found);
+ 
+    if(ref $pattern eq 'CODE')
+    {   for($sigstart = $#$lines; $sigstart >= $stop; $sigstart--)
+        {   next unless $pattern->($lines->[$sigstart]);
+            $found = 1;
+            last;
+        }
+    }
+    else
+    {   for($sigstart = $#$lines; $sigstart >= $stop; $sigstart--)
+        {   next unless $lines->[$sigstart] =~ $pattern;
+            $found = 1;
+            last;
+        }
+    }
+ 
+    return $self unless $found;
+ 
+    my $bodytype = $args{result_type} || ref $self;
+
+    my $stripped = $bodytype->new
+      ( based_on => $self
+      , data     => [ @$lines[0..$sigstart-1] ]
+      );
+
+    return $stripped unless wantarray;
+
+    my $sig      = $bodytype->new
+      ( based_on => $self
+      , data     => [ @$lines[$sigstart..$#$lines] ]
+      );
+      
+    ($stripped, $sig);
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Construct.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Construct.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Construct.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,192 @@
+
+=head1 NAME
+
+Mail::Message::Body::Construct - adds functionality to Mail::Message::Body
+
+
+
+=head1 SYNOPSIS
+
+
+
+=head1 DESCRIPTION
+
+This package adds complex functionality to the L<Mail::Message::Body|Mail::Message::Body>
+class.  This functions less often used, so many programs will not
+compile this package.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructing a body
+
+
+$obj-E<gt>B<attach>(MESSAGES, OPTIONS)
+
+=over 4
+
+Make a multipart containing this body and the specified MESSAGES. The
+options are passed to the constructor of the multi-part body.  If you
+need more control, create the multi-part body yourself.  At least
+take a look at L<Mail::Message::Body::Multipart|Mail::Message::Body::Multipart>.
+
+The message-parts will be coerced into a L<Mail::Message::Part|Mail::Message::Part>, so you
+may attach Mail::Internet or MIME::Entity objects if you want --see
+L<Mail::Message::coerce()|Mail::Message/"Constructors">.  A new body with attached messages is
+returned.
+
+I<Example:> 
+
+ my $pgpkey = Mail::Message::Body::File->new(file => '.pgp');
+ my $msg    = Mail::Message->buildFromBody(
+    $message->decoded->attach($pgpkey));
+
+ # The last message of the $multi multiparted body becomes a coerced $entity.
+ my $entity  = MIME::Entity->new;
+ my $multi   = $msg->body->attach($entity);
+
+ # Now create a new message
+ my $msg     = Mail::Message->new(head => ..., body => $multi);
+
+=back
+
+$obj-E<gt>B<concatenate>(COMPONENTS)
+
+=over 4
+
+Concatenate a list of elements into one new body.  The encoding is defined by
+the body where this method is called upon (and which does not need to be
+included in the result).
+
+Specify a list of COMPONENTS.  Each component can be
+a message (L<Mail::Message|Mail::Message>, the body of the message is used),
+a plain body (L<Mail::Message::Body|Mail::Message::Body>), 
+C<undef> (which will be skipped),
+a scalar (which is split into lines), or
+an array of scalars (each providing one line).
+
+I<Example:> 
+
+ # all arguments are Mail::Message::Body's.
+ my $sum = $body->concatenate($preamble, $body, $epilogue, "-- \n" , $sig);
+
+=back
+
+$obj-E<gt>B<foreachLine>(CODE)
+
+=over 4
+
+Create a new body by performing an action on each of its lines.  If none
+of the lines change, the current body will be returned, otherwise a new
+body is created of the same type as the current.
+
+The CODE refers to a subroutine which is called, where C<$_> contains
+body's original line.  DO NOT CHANGE C<$_>!!!  The result of the routine
+is taken as new line.  When the routine returns C<undef>, the line will be
+skipped.
+
+I<Example:> 
+
+ my $content  = $msg->decoded;
+ my $reply    = $content->foreachLine( sub { '> '.$_ } );
+ my $rev      = $content->foreachLine( sub {reverse} );
+
+ sub filled() { length $_ > 1 ? $_ : undef }
+ my $nonempty = $content->foreachLine( \&filled );
+
+ my $wrong    = $content->foreachLine( sub {s/a/A/} );  # WRONG!!!
+ my $right    = $content->foreachLine(
+        sub {(my $x=$_) =~ s/a/A/; $x} );
+
+=back
+
+$obj-E<gt>B<stripSignature>(OPTIONS)
+
+=over 4
+
+Strip the signature from the body.  The body must already be decoded
+otherwise the wrong lines may get stripped.  Returned is the stripped
+version body, and in list context also the signature, encapsulated in
+its own body object.  The signature separator is the first line of the
+returned signature body.
+
+The signature is added by the sender to tell about him- or herself.
+It is superfluous in some situations, for instance if you want to create
+a reply to the person's message you do not need to include that signature.
+
+If the body had no signature, the original body object is returned,
+and C<undef> for the signature body.
+
+ Option       Defined in       Default          
+ max_lines                     C<10>            
+ pattern                       C<qr/^--\s?$/>   
+ result_type                   <same as current>
+
+. max_lines INTEGER|undef
+
+=over 4
+
+The maximum number of lines which can be the length of a signature.
+Specify C<undef> to remove the limit.
+
+=back
+
+. pattern REGEX|STRING|CODE
+
+=over 4
+
+Which pattern defines the line which indicates the separator between
+the message and the signature.  In case of a STRING, this is matched
+to the beginning of the line, and REGEX is a full regular expression.
+
+In case of CODE, each line (from last to front) is passed to the
+specified subroutine as first argument.  The subroutine must return
+TRUE when the separator is found.
+
+=back
+
+. result_type CLASS
+
+=over 4
+
+The type of body to be created for the stripped body (and maybe also to
+contain the stripped signature)
+
+=back
+
+I<Example:> 
+
+ my $start = $message->decoded;
+ my $start = $body->decoded;
+
+ my $stripped = $start->stripSignature;
+
+ my ($stripped, $sign) = $start->stripSignature
+     (max_lines => 5, pattern => '-*-*-');
+
+=back
+
+
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Delayed.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Delayed.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Delayed.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,131 @@
+use strict;
+use warnings;
+
+package Mail::Message::Body::Delayed;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Reporter';
+
+use Object::Realize::Later
+    becomes          => 'Mail::Message::Body',
+    realize          => 'load',
+    warn_realization => 0,
+    believe_caller   => 1;
+
+use Carp;
+use Scalar::Util 'weaken';
+
+
+use overload '""'    => 'string_unless_carp'
+           , bool    => sub {1}
+           , '@{}'   => sub {shift->load->lines};
+
+#------------------------------------------
+
+
+sub init($)
+{   my ($self, $args) = @_;
+    $self->SUPER::init($args);
+
+    $self->{MMB_seqnr}    = -1;  # for overloaded body comparison
+    $self->{MMBD_message} = $args->{message}
+        or $self->log(INTERNAL => "A message must be specified to a delayed body.");
+
+    weaken($self->{MMBD_message});
+    $self;
+}
+
+#------------------------------------------
+
+
+sub message() { shift->{MMBD_message} }
+
+#------------------------------------------
+
+
+sub modified(;$)
+{   return 0 if @_==1 || !$_[1];
+    shift->forceRealize(shift);
+}
+
+#------------------------------------------
+
+
+sub isModified() { 0 }
+
+#------------------------------------------
+
+
+sub isDelayed()   {1}
+
+#------------------------------------------
+
+
+sub isMultipart() {shift->message->head->isMultipart}
+
+#------------------------------------------
+
+
+sub guessSize()   {shift->{MMBD_size}}
+
+#------------------------------------------
+
+
+sub nrLines()
+{   my ($self) = @_;
+      defined $self->{MMBD_lines}
+    ? $self->{MMBD_lines}
+    : $_[0]->forceRealize->nrLines;
+}
+
+#------------------------------------------
+
+sub string_unless_carp()
+{   my $self = shift;
+    return $self->load->string unless (caller)[0] eq 'Carp';
+
+    (my $class = ref $self) =~ s/^Mail::Message/MM/g;
+    "$class object";
+}
+
+#------------------------------------------
+
+
+sub read($$;$@)
+{   my ($self, $parser, $head, $bodytype) = splice @_, 0, 4;
+    $self->{MMBD_parser} = $parser;
+
+    @$self{ qw/MMBD_begin MMBD_end MMBD_size MMBD_lines/ }
+        = $parser->bodyDelayed(@_);
+
+    $self;
+}
+
+#------------------------------------------
+
+
+sub fileLocation(;@) {
+   my $self = shift;
+   return @$self{ qw/MMBD_begin MMBD_end/ } unless @_;
+   @$self{ qw/MMBD_begin MMBD_end/ } = @_;
+}
+
+#------------------------------------------
+
+
+sub moveLocation($)
+{   my ($self, $dist) = @_;
+    $self->{MMBD_begin} -= $dist;
+    $self->{MMBD_end}   -= $dist;
+    $self;
+}
+
+#------------------------------------------
+
+
+sub load() {$_[0] = $_[0]->message->loadBody}
+
+#------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Delayed.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Delayed.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Delayed.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,329 @@
+
+=head1 NAME
+
+Mail::Message::Body::Delayed - body of a Mail::Message but not read yet.
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Body::Delayed realizes a Mail::Message::Body
+
+ Mail::Message::Body::Delayed
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ See Mail::Message::Body
+
+
+=head1 DESCRIPTION
+
+Message bodies of this type will be replaced by another type the moment you
+access the content.  In this documentation you will find the description of
+how a message body gets delay loaded.
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+(stringification) Returns the body as string --which will trigger
+completion-- unless called to produce a string for C<Carp>.  The latter
+to avoid deep recursions.
+
+I<Example:> stringification of delayed body
+
+
+ print $msg->body;   # implicit by print
+
+ my $body = $msg->body;
+ my $x    = "$body"; # explicit by interpolation
+
+=back
+
+overload: B<@{}>
+
+=over 4
+
+When a body object is used as being an array reference, the lines of
+the body are returned.  This is the same as using the C<lines> method.
+
+=back
+
+overload: B<bool>
+
+=over 4
+
+Always returns a true value, which is needed to have overloaded
+objects to be used as in C<if($body)>.  Otherwise, C<if(defined $body)>
+would be needed to avoid a runtime error.
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Message::Body::Delayed-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option   Defined in       Default      
+ log      L<Mail::Reporter>  C<'WARNINGS'>
+ message                   <required>   
+ trace    L<Mail::Reporter>  C<'WARNINGS'>
+
+. log LEVEL
+
+. message MESSAGE
+
+=over 4
+
+The MESSAGE object which contains this delayed body.
+
+=back
+
+. trace LEVEL
+
+=back
+
+=head2 The body
+
+
+$obj-E<gt>B<message>
+
+=over 4
+
+=back
+
+=head2 About to the payload
+
+
+$obj-E<gt>B<guessSize>
+
+=over 4
+
+=back
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+=back
+
+$obj-E<gt>B<modified>
+
+=over 4
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<fileLocation>(BEGIN, END)
+
+=over 4
+
+=back
+
+$obj-E<gt>B<load>
+
+=over 4
+
+Returns the loaded version of this body.
+
+=back
+
+$obj-E<gt>B<moveLocation>(DISTANCE)
+
+=over 4
+
+=back
+
+$obj-E<gt>B<read>(PARSER, HEAD, BODYTYPE)
+
+=over 4
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Body::Delayed-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Body::Delayed-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Body::Delayed-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Encode.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Encode.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Encode.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,250 @@
+
+use strict;
+use warnings;
+
+package Mail::Message::Body;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Reporter';
+
+use Carp;
+
+use MIME::Types;
+use File::Basename 'basename';
+
+my MIME::Types $mime_types;
+
+
+sub encode(@)
+{   my ($self, %args) = @_;
+
+    # simplify the arguments
+
+    my $type_from = $self->type;
+    my $type_to   = $args{mime_type} || $type_from->clone;
+    $type_to = Mail::Message::Field->new('Content-Type' => $type_to)
+        unless ref $type_to;
+
+    if(my $charset = delete $args{charset})
+    {   # Charset conversions are ignored for now.
+        $type_to->attribute(charset => $charset);
+    }
+
+    my $transfer = $args{transfer_encoding} || $self->transferEncoding->clone;
+    $transfer    = Mail::Message::Field->new('Content-Transfer-Encoding' =>
+         $transfer) unless ref $transfer;
+
+    # What will we do?
+#   my $mime_was  = lc $type_from;
+#   my $mime_to   = lc $type_to;
+
+# If possible, update unify() too.
+#   my $char_was  = $type_from->attribute('charset');
+#   my $char_to   = $type_to->attribute('charset');
+
+    my $trans_was = lc $self->transferEncoding;
+    my $trans_to  = lc $transfer;
+
+    #
+    # The only translations implemented now is content transfer encoding.
+    #
+
+#warn "Translate ($trans_was) -> ($trans_to)\n";
+    return $self if $trans_was eq $trans_to;
+
+    my $bodytype  = $args{result_type} || ref $self;
+
+    my $decoded;
+    if($trans_was eq 'none') {$decoded = $self}
+    elsif(my $decoder = $self->getTransferEncHandler($trans_was))
+    {   $decoded = $decoder->decode($self, result_type => $bodytype) }
+    else
+    {   $self->log(WARNING =>
+           "No decoder defined for transfer encoding $trans_was.");
+        return $self;
+    }
+
+    my $encoded;
+    if($trans_to eq 'none') {$encoded = $decoded}
+    elsif(my $encoder = $self->getTransferEncHandler($trans_to))
+    {   $encoded = $encoder->encode($decoded, result_type => $bodytype) }
+    else
+    {   $self->log(WARNING =>
+           "No encoder defined for transfer encoding $trans_to.");
+        return $decoded;
+    }
+    $encoded;
+}
+
+#------------------------------------------
+
+
+sub check()
+{   my $self     = shift;
+    return $self if $self->checked;
+    my $eol      = $self->eol;
+
+    my $encoding = $self->transferEncoding->body;
+    return $self->eol($eol)
+       if $encoding eq 'none';
+
+    my $encoder  = $self->getTransferEncHandler($encoding);
+
+    my $checked
+      = $encoder
+      ? $encoder->check($self)->eol($eol)
+      : $self->eol($eol);
+
+    $checked->checked(1);
+    $checked;
+}
+
+#------------------------------------------
+
+
+sub encoded()
+{   my $self = shift;
+
+    return $self->check
+        unless $self->transferEncoding eq 'none';
+
+    $mime_types ||= MIME::Types->new;
+
+    my $mime = $mime_types->type($self->type->body);
+    $self->encode(transfer_encoding =>
+         defined $mime ? $mime->encoding : 'base64');
+}
+
+#------------------------------------------
+
+
+sub unify($)
+{   my ($self, $body) = @_;
+    return $self if $self==$body;
+
+    my $mime     = $self->type;
+    my $transfer = $self->transferEncoding;
+
+    my $encoded  = $body->encode
+     ( mime_type         => $mime
+     , transfer_encoding => $transfer
+     );
+
+    # Encode makes the best of it, but is it good enough?
+
+    my $newmime     = $encoded->type;
+    return unless $newmime  eq $mime;
+    return unless $transfer eq $encoded->transferEncoding;
+
+# Character transformation not possible yet.
+#   my $want_charset= $mime->attribute('charset')    || '';
+#   my $got_charset = $newmime->attribute('charset') || '';
+#   return unless $want_charset eq $got_charset;
+
+    $encoded;
+}
+
+#------------------------------------------
+
+
+sub isBinary()
+{   my $self = shift;
+    $mime_types ||= MIME::Types->new(only_complete => 1);
+    my $type = $self->type                    or return 1;
+    my $mime = $mime_types->type($type->body) or return 1;
+    $mime->isBinary;
+}
+ 
+#------------------------------------------
+
+
+sub isText() { not shift->isBinary }
+
+#------------------------------------------
+
+
+sub dispositionFilename($)
+{   my ($self, $dir) = @_;
+    my $raw;
+
+    my $field;
+    if($field = $self->disposition)
+    {   $raw  = $field->attribute('filename')
+             || $field->attribute('file')
+             || $field->attribute('name');
+    }
+
+    if(!defined $raw && ($field = $self->type))
+    {   $raw  = $field->attribute('filename')
+             || $field->attribute('file')
+             || $field->attribute('name');
+    }
+
+    my $filename = '';
+    if(defined $raw)
+    {   $filename = basename $raw;
+        $filename =~ s/[^\w.-]//;
+    }
+
+    unless(length $filename)
+    {   my $ext    = ($self->mimeType->extensions)[0] || 'raw';
+        my $unique;
+        for($unique = 'part-0'; 1; $unique++)
+        {   my $out = File::Spec->catfile($dir, "$unique.$ext");
+            open IN, "<", $out or last;  # does not exist: can use it
+            close IN;
+        }
+        $filename = "$unique.$ext";
+    }
+    File::Spec->catfile($dir, $filename);
+}
+
+#------------------------------------------
+
+
+my %transfer_encoder_classes =
+ ( base64  => 'Mail::Message::TransferEnc::Base64'
+ , binary  => 'Mail::Message::TransferEnc::Binary'
+ , '8bit'  => 'Mail::Message::TransferEnc::EightBit'
+ , 'quoted-printable' => 'Mail::Message::TransferEnc::QuotedPrint'
+ , '7bit'  => 'Mail::Message::TransferEnc::SevenBit'
+ );
+
+my %transfer_encoders;   # they are reused.
+
+sub getTransferEncHandler($)
+{   my ($self, $type) = @_;
+
+    return $transfer_encoders{$type}
+        if exists $transfer_encoders{$type};   # they are reused.
+
+    my $class = $transfer_encoder_classes{$type};
+    return unless $class;
+
+    eval "require $class";
+    confess "Cannot load $class: $@\n" if $@;
+
+    $transfer_encoders{$type} = $class->new;
+}
+
+#------------------------------------------
+
+
+sub addTransferEncHandler($$)
+{   my ($this, $name, $what) = @_;
+
+    my $class;
+    if(ref $what)
+    {   $transfer_encoders{$name} = $what;
+        $class = ref $what;
+    }
+    else
+    {   delete $transfer_encoders{$name};
+        $class = $what;
+    }
+
+    $transfer_encoder_classes{$name} = $class;
+    $this;
+}
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Encode.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Encode.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Encode.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,247 @@
+
+=head1 NAME
+
+Mail::Message::Body::Encode - organize general message encodings
+
+
+
+=head1 SYNOPSIS
+
+ my Mail::Message $msg = ...;
+ my $decoded = $msg->decoded;
+ my $encoded = $msg->encode(mime_type => 'image/gif',
+     transfer_encoding => 'base64');
+
+ my $body = $msg->body;
+ my $decoded = $body->decoded;
+ my $encoded = $body->encode(transfer_encoding => '7bit');
+
+
+=head1 DESCRIPTION
+
+Manages the message's body encodings and decodings on request of the
+main program.  This package adds functionality to the L<Mail::Message::Body|Mail::Message::Body>
+class when the L<decoded()|Mail::Message::Body/"Constructing a body"> or L<encode()|Mail::Message::Body::Encode/"Constructing a body"> method is called.
+
+Four types of encodings are handled (in the right order)
+
+=over 4
+
+=item * eol encoding
+
+Various operating systems have different ideas about how to encode the
+line termination.  UNIX uses a LF character, MacOS uses a CR, and
+Windows uses a CR/LF combination.  Messages which are transported over
+Internet will always use the CRLF separator.
+
+=item * transfer encoding
+
+Messages transmitted over Internet have to be plain ASCII.  Complicated
+characters and binary files (like images and archives) must be encoded
+during transmission to an ASCII representation.
+
+The implementation of the required encoders and decoders is found in
+the L<Mail::Message::TransferEnc|Mail::Message::TransferEnc> set of packages.  The related
+manual page lists the transfer encodings which are supported.
+
+=item * mime-type translation
+
+NOT IMPLEMENTED YET
+
+=item * charset conversion
+
+NOT IMPLEMENTED YET
+
+=back
+
+
+
+=head1 METHODS
+
+
+=head2 Constructing a body
+
+
+$obj-E<gt>B<check>
+
+=over 4
+
+Check the content of the body not to include illegal characters.  Which
+characters are considered illegal depends on the encoding of this body.
+
+A body is returned which is checked.  This may be the body where this
+method is called upon, but also a new object, when serious changes had
+to be made.  If the check could not be made, because the decoder is not
+defined, then C<undef> is returned.
+
+=back
+
+$obj-E<gt>B<encode>(OPTIONS)
+
+=over 4
+
+Encode (translate) a L<Mail::Message::Body|Mail::Message::Body> into a different format.
+See the DESCRIPTION above.  Options which are not specified will not trigger
+conversions.
+
+ Option             Defined in       Default         
+ charset                             undef           
+ mime_type                           undef           
+ result_type                         <same as source>
+ transfer_encoding                   undef           
+
+. charset STRING
+
+. mime_type STRING|FIELD
+
+=over 4
+
+Convert into the specified mime type, which can be specified as STRING
+or FIELD.  The FIELD is a L<Mail::Message::Field|Mail::Message::Field>, and the STRING is
+converted in such object before use.
+
+=back
+
+. result_type CLASS
+
+=over 4
+
+The type of body to be created when the body is changed to fulfill the request
+on re-coding.  Also the intermediate stages in the translation process (if
+needed) will use this type. CLASS must extend L<Mail::Message::Body|Mail::Message::Body>.
+
+=back
+
+. transfer_encoding STRING|FIELD
+
+=back
+
+$obj-E<gt>B<encoded>
+
+=over 4
+
+Encode the body to a format what is acceptable to transmit or write to
+a folder file.  This returns the body where this method was called
+upon when everything was already prepared, or a new encoded body
+otherwise.  In either case, the body is checked.
+
+=back
+
+$obj-E<gt>B<unify>(BODY)
+
+=over 4
+
+Unify the type of the given BODY objects with the type of the called
+body.  C<undef> is returned when unification is impossible.  If the
+bodies have the same settings, the BODY object is returned unchanged.
+
+Examples:
+
+ my $bodytype = Mail::Message::Body::Lines;
+ my $html  = $bodytype->new(mime_type=>'text/html', data => []);
+ my $plain = $bodytype->new(mime_type=>'text/plain', ...);
+
+ my $unified = $html->unify($plain);
+ # $unified is the data of plain translated to html (if possible).
+
+=back
+
+=head2 About the payload
+
+
+$obj-E<gt>B<dispositionFilename>(DIRECTORY)
+
+=over 4
+
+Returns the name which can be used as filename to store the information
+in the indicated DIRECTORY. To get a filename, various fields are searched
+for C<filename> and C<name> attributes.
+
+Only the basename of the found name will be used, for security reasons:
+otherwise, it may be possible to access other directories than the
+one indicated.  If no name was found, or the name is already in use,
+then an unique name is generated.
+
+=back
+
+$obj-E<gt>B<isBinary>
+
+=over 4
+
+Returns true when the un-encoded message is binary data.  This information
+is retrieved from knowledge provided by L<MIME::Types|MIME::Types>.
+
+=back
+
+$obj-E<gt>B<isText>
+
+=over 4
+
+Returns true when the un-encoded message contains printable
+text.
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<addTransferEncHandler>(NAME, CLASS|OBJECT)
+
+Mail::Message::Body-E<gt>B<addTransferEncHandler>(NAME, CLASS|OBJECT)
+
+=over 4
+
+Relate the NAMEd transfer encoding to an OBJECTs or object of the specified
+CLASS.  In the latter case, an object of that CLASS will be created on the
+moment that one is needed to do encoding or decoding.
+
+The CLASS or OBJECT must extend L<Mail::Message::TransferEnc|Mail::Message::TransferEnc>.  It will
+replace existing class and object for this NAME.
+
+Why aren't you contributing this class to MailBox?
+
+=back
+
+$obj-E<gt>B<getTransferEncHandler>(TYPE)
+
+=over 4
+
+Get the transfer encoder/decoder which is able to handle TYPE, or return
+undef if there is no such handler.
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> No decoder defined for transfer encoding $name.
+
+The data (message body) is encoded in a way which is not currently understood,
+therefore no decoding (or recoding) can take place.
+
+I<Warning:> No encoder defined for transfer encoding $name.
+
+The data (message body) has been decoded, but the required encoding is
+unknown.  The decoded data is returned.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/File.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/File.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/File.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,291 @@
+use strict;
+use warnings;
+
+package Mail::Message::Body::File;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Body';
+
+use Mail::Box::Parser;
+use Mail::Message;
+
+use Carp;
+use POSIX 'tmpnam';
+use File::Copy;
+
+
+sub _data_from_filename(@)
+{   my ($self, $filename) = @_;
+
+    local $_;
+    local (*IN, *OUT);
+
+    unless(open IN, '<', $filename)
+    {   $self->log(ERROR =>
+            "Unable to read file $filename for message body file: $!");
+        return;
+    }
+
+    my $file   = $self->tempFilename;
+    unless(open OUT, '>', $file)
+    {   $self->log(ERROR => "Cannot write to temporary body file $file: $!\n");
+        return;
+    }
+
+    my $nrlines = 0;
+    while(<IN>) { print OUT; $nrlines++ }
+
+    close OUT;
+    close IN;
+
+    $self->{MMBF_nrlines} = $nrlines;
+    $self;
+}
+
+sub _data_from_filehandle(@)
+{   my ($self, $fh) = @_;
+    my $file    = $self->tempFilename;
+    my $nrlines = 0;
+
+    local *OUT;
+
+    unless(open OUT, '>', $file)
+    {   $self->log(ERROR => "Cannot write to temporary body file $file: $!\n");
+        return;
+    }
+
+    while(my $l = $fh->getline)
+    {   print OUT $l;
+        $nrlines++;
+    }
+    close OUT;
+
+    $self->{MMBF_nrlines} = $nrlines;
+    $self;
+}
+
+sub _data_from_glob(@)
+{   my ($self, $fh) = @_;
+    my $file    = $self->tempFilename;
+    my $nrlines = 0;
+
+    local $_;
+    local *OUT;
+
+    unless(open OUT, '>', $file)
+    {   $self->log(ERROR => "Cannot write to temporary body file $file: $!\n");
+        return;
+    }
+
+    while(<$fh>)
+    {   print OUT;
+        $nrlines++;
+    }
+    close OUT;
+
+    $self->{MMBF_nrlines} = $nrlines;
+    $self;
+}
+
+sub _data_from_lines(@)
+{   my ($self, $lines)  = @_;
+    my $file = $self->tempFilename;
+
+    local *OUT;
+
+    unless(open OUT, '>', $file)
+    {   $self->log(ERROR => "Cannot write to $file: $!\n");
+        return;
+    }
+
+    print OUT @$lines;
+    close OUT;
+
+    $self->{MMBF_nrlines} = @$lines;
+    $self;
+}
+
+#------------------------------------------
+
+sub clone()
+{   my $self  = shift;
+    my $clone = ref($self)->new(based_on => $self);
+
+    copy($self->tempFilename, $clone->tempFilename)
+       or return;
+
+    $clone->{MMBF_nrlines} = $self->{MMBF_nrlines};
+    $clone->{MMBF_size}    = $self->{MMBF_size};
+    $self;
+}
+
+#------------------------------------------
+
+sub nrLines()
+{   my $self    = shift;
+
+    return $self->{MMBF_nrlines}
+        if defined $self->{MMBF_nrlines};
+
+    my $file    = $self->tempFilename;
+    my $nrlines = 0;
+
+    local $_;
+    local *IN;
+
+    open IN, '<', $file
+        or die "Cannot read from $file: $!\n";
+
+    $nrlines++ while <IN>;
+    close IN;
+
+    $self->{MMBF_nrlines} = $nrlines;
+}
+
+#------------------------------------------
+
+sub size()
+{   my $self = shift;
+
+    return $self->{MMBF_size}
+       if exists $self->{MMBF_size};
+
+    my $size = -s $self->tempFilename;
+
+    $size   -= $self->nrLines
+        if $Mail::Message::crlf_platform;   # remove count for extra CR's
+
+    $self->{MMBF_size} = $size;
+}
+
+
+#------------------------------------------
+
+sub string()
+{   my $self = shift;
+
+    my $file = $self->tempFilename;
+
+    local *IN;
+
+    open IN, '<', $file
+        or die "Cannot read from $file: $!\n";
+
+    my $return = join '', <IN>;
+    close IN;
+
+    $return;
+}
+
+#------------------------------------------
+
+sub lines()
+{   my $self = shift;
+
+    my $file = $self->tempFilename;
+
+    local *IN;
+    open IN, '<', $file
+        or die "Cannot read from $file: $!\n";
+
+    my @r = <IN>;
+    close IN;
+
+    $self->{MMBF_nrlines} = @r;
+    wantarray ? @r: \@r;
+}
+
+#------------------------------------------
+
+sub file()
+{   open my $tmp, '<', shift->tempFilename;
+    $tmp;
+}
+
+#------------------------------------------
+
+sub print(;$)
+{   my $self = shift;
+    my $fh   = shift || select;
+    my $file = $self->tempFilename;
+
+    local $_;
+    local *IN;
+
+    open IN, '<', $file
+        or croak "Cannot read from $file: $!\n";
+
+    if(ref $fh eq 'GLOB') {print $fh $_ while <IN>}
+    else                  {$fh->print($_) while <IN>}
+    close IN;
+
+    $self;
+}
+
+#------------------------------------------
+
+sub printEscapedFrom($)
+{   my ($self, $fh) = @_;
+    my $file = $self->tempFilename;
+
+    local $_;
+    local *IN;
+
+    open IN, '<', $file
+        or croak "Cannot read from $file: $!\n";
+
+    if(ref $fh eq 'GLOB')
+    {   while( <IN> )
+        {   s/^(?=\>*From )/>/;
+            print $fh;
+        }
+    }
+    else
+    {   while( <IN> )
+        {   s/^(?=\>*From )/>/;
+            $fh->print($_);
+        }
+    }
+
+    close IN;
+
+    $self;
+}
+
+#------------------------------------------
+
+sub read($$;$@)
+{   my ($self, $parser, $head, $bodytype) = splice @_, 0, 4;
+    my $file = $self->tempFilename;
+
+    local *OUT;
+
+    open OUT, '>', $file
+        or die "Cannot write to $file: $!.\n";
+
+    (my $begin, my $end, $self->{MMBF_nrlines}) = $parser->bodyAsFile(\*OUT, at _);
+    close OUT;
+
+    $self->fileLocation($begin, $end);
+    $self;
+}
+
+#------------------------------------------
+
+
+sub tempFilename(;$)
+{   my $self = shift;
+
+      @_                     ? ($self->{MMBF_filename} = shift)
+    : $self->{MMBF_filename} ? $self->{MMBF_filename}
+    :                          ($self->{MMBF_filename} = tmpnam);
+}
+
+#------------------------------------------
+
+
+sub DESTROY { unlink shift->tempFilename }
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/File.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/File.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/File.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,659 @@
+
+=head1 NAME
+
+Mail::Message::Body::File - body of a message temporarily stored in a file
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Body::File
+   is a Mail::Message::Body
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ See Mail::Message::Body
+
+
+=head1 DESCRIPTION
+
+The body (content) of a message can be stored in various ways.  In this
+documentation you find the description of extra functionality you have
+when a message is stored in a file.
+
+Storing a whole message is a file is useful when the body is large.  Although
+access through a file is slower, it is saving a lot of memory.
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Message::Body/"OVERLOADED">
+
+=back
+
+overload: B<'==' and '!='>
+
+=over 4
+
+See L<Mail::Message::Body/"OVERLOADED">
+
+=back
+
+overload: B<@{}>
+
+=over 4
+
+See L<Mail::Message::Body/"OVERLOADED">
+
+=back
+
+overload: B<bool>
+
+=over 4
+
+See L<Mail::Message::Body/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message::Body/"Constructors">
+
+=back
+
+Mail::Message::Body::File-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option             Defined in       Default        
+ based_on           L<Mail::Message::Body>  undef          
+ charset            L<Mail::Message::Body>  C<'us-ascii'>  
+ checked            L<Mail::Message::Body>  <false>        
+ data               L<Mail::Message::Body>  undef          
+ disposition        L<Mail::Message::Body>  undef          
+ eol                L<Mail::Message::Body>  C<'NATIVE'>    
+ file               L<Mail::Message::Body>  undef          
+ log                L<Mail::Reporter>  C<'WARNINGS'>  
+ message            L<Mail::Message::Body>  undef          
+ mime_type          L<Mail::Message::Body>  C<'text/plain'>
+ modified           L<Mail::Message::Body>  <false>        
+ trace              L<Mail::Reporter>  C<'WARNINGS'>  
+ transfer_encoding  L<Mail::Message::Body>  C<'none'>      
+
+. based_on BODY
+
+. charset STRING
+
+. checked BOOLEAN
+
+. data ARRAY-OF-LINES | STRING
+
+. disposition STRING|FIELD
+
+. eol 'CR'|'LF'|'CRLF'|'NATIVE'
+
+. file FILENAME|FILEHANDLE|IOHANDLE
+
+. log LEVEL
+
+. message MESSAGE
+
+. mime_type STRING|FIELD|MIME
+
+. modified BOOLEAN
+
+. trace LEVEL
+
+. transfer_encoding STRING|FIELD
+
+=back
+
+=head2 Constructing a body
+
+
+$obj-E<gt>B<attach>(MESSAGES, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body::Construct/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<check>
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<concatenate>(COMPONENTS)
+
+=over 4
+
+See L<Mail::Message::Body::Construct/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<decoded>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<encode>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<encoded>
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<eol>(['CR'|'LF'|'CRLF'|'NATIVE'])
+
+=over 4
+
+See L<Mail::Message::Body/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<foreachLine>(CODE)
+
+=over 4
+
+See L<Mail::Message::Body::Construct/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<stripSignature>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body::Construct/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<unify>(BODY)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Constructing a body">
+
+=back
+
+=head2 The body
+
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+See L<Mail::Message::Body/"The body">
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+See L<Mail::Message::Body/"The body">
+
+=back
+
+$obj-E<gt>B<isNested>
+
+=over 4
+
+See L<Mail::Message::Body/"The body">
+
+=back
+
+$obj-E<gt>B<message>([MESSAGE])
+
+=over 4
+
+See L<Mail::Message::Body/"The body">
+
+=back
+
+=head2 About the payload
+
+
+$obj-E<gt>B<charset>
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<checked>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<disposition>([STRING|FIELD])
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<dispositionFilename>(DIRECTORY)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"About the payload">
+
+=back
+
+$obj-E<gt>B<isBinary>
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"About the payload">
+
+=back
+
+$obj-E<gt>B<isText>
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"About the payload">
+
+=back
+
+$obj-E<gt>B<mimeType>
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<transferEncoding>([STRING|FIELD])
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<type>([STRING|FIELD])
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+=head2 Access to the payload
+
+
+$obj-E<gt>B<file>
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+$obj-E<gt>B<lines>
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+$obj-E<gt>B<printEscapedFrom>(FILEHANDLE)
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+$obj-E<gt>B<write>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<addTransferEncHandler>(NAME, CLASS|OBJECT)
+
+Mail::Message::Body::File-E<gt>B<addTransferEncHandler>(NAME, CLASS|OBJECT)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Internals">
+
+=back
+
+$obj-E<gt>B<contentInfoFrom>(HEAD)
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<contentInfoTo>(HEAD)
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<fileLocation>([BEGIN,END])
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<getTransferEncHandler>(TYPE)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Internals">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<load>
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<moveLocation>([DISTANCE])
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<read>(PARSER, HEAD, BODYTYPE [,CHARS [,LINES]])
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<tempFilename>([FILENAME])
+
+=over 4
+
+Returns the name of the temporary file which is used to store this body.
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Message::Body/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Body::File-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Body::File-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Body::File-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+The temporary file is automatically removed when the body is
+not required anymore.
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot write to temporary body file $filename: $!
+
+The message body is to be stored in a temporary file (probably because it is a
+large body), but for the indicated reason, this file cannot be created.
+
+I<Warning:> No decoder defined for transfer encoding $name.
+
+The data (message body) is encoded in a way which is not currently understood,
+therefore no decoding (or recoding) can take place.
+
+I<Warning:> No encoder defined for transfer encoding $name.
+
+The data (message body) has been decoded, but the required encoding is
+unknown.  The decoded data is returned.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Unable to read file $filename for message body file: $!
+
+A L<Mail::Message::Body::File|Mail::Message::Body::File> object is to be created from a named file, but
+it is impossible to read that file to retrieve the lines within.  Therefore,
+no copy to a temporary file can be made.
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Lines.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Lines.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Lines.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,133 @@
+use strict;
+use warnings;
+
+package Mail::Message::Body::Lines;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Body';
+
+use Mail::Box::Parser;
+use IO::Lines;
+
+use Carp;
+
+
+sub _data_from_filename(@)
+{   my ($self, $filename) = @_;
+
+    local *IN;
+
+    unless(open IN, '<', $filename)
+    {   $self->log(ERROR =>
+             "Unable to read file $filename for message body lines: $!");
+        return;
+    }
+
+    $self->{MMBL_array} = [ <IN> ];
+
+    close IN;
+    $self;
+}
+
+sub _data_from_filehandle(@)
+{   my ($self, $fh) = @_;
+    $self->{MMBL_array} = [ $fh->getlines ];
+    $self
+}
+
+sub _data_from_glob(@)
+{   my ($self, $fh) = @_;
+    $self->{MMBL_array} = [ <$fh> ];
+    $self;
+}
+
+sub _data_from_lines(@)
+{   my ($self, $lines)  = @_;
+    $lines = [ split /^/, $lines->[0] ]    # body passed in one string.
+        if @$lines==1;
+
+    $self->{MMBL_array} = $lines;
+    $self;
+}
+
+#------------------------------------------
+
+sub clone()
+{   my $self  = shift;
+    ref($self)->new(data => [ $self->lines ], based_on => $self);
+}
+
+#------------------------------------------
+
+sub nrLines() { scalar @{shift->{MMBL_array}} }
+
+#------------------------------------------
+# Optimized to be computed only once.
+
+sub size()
+{   my $self = shift;
+    return $self->{MMBL_size} if exists $self->{MMBL_size};
+
+    my $size = 0;
+    $size += length $_ foreach @{$self->{MMBL_array}};
+    $self->{MMBL_size} = $size;
+}
+
+#------------------------------------------
+
+sub string() { join '', @{shift->{MMBL_array}} }
+
+#------------------------------------------
+
+sub lines()  { wantarray ? @{shift->{MMBL_array}} : shift->{MMBL_array} }
+
+#------------------------------------------
+
+sub file() { IO::Lines->new(shift->{MMBL_array}) }
+
+#------------------------------------------
+
+sub print(;$)
+{   my $self = shift;
+    my $fh   = shift || select;
+    if(ref $fh eq 'GLOB') { print $fh @{$self->{MMBL_array}}   }
+    else                  { $fh->print(@{$self->{MMBL_array}}) }
+    $self;
+}
+
+#------------------------------------------
+
+sub printEscapedFrom($)
+{   my ($self, $fh) = @_;
+
+    if(ref $fh eq 'GLOB')
+    {   foreach ( @{$self->{MMBL_array}} )
+        {   s/^(?=\>*From )/>/;
+            print $fh;
+        }
+    }
+    else
+    {   foreach ( @{$self->{MMBL_array}} )
+        {   s/^(?=\>*From )/>/;
+            $fh->print($_);
+        }
+    }
+
+    $self;
+}
+
+#------------------------------------------
+
+sub read($$;$@)
+{   my ($self, $parser, $head, $bodytype) = splice @_, 0, 4;
+    my @lines = $parser->bodyAsList(@_);
+    return undef unless @lines;
+
+    $self->fileLocation(shift @lines, shift @lines);
+    $self->{MMBL_array} = \@lines;
+    $self;
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Lines.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Lines.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Lines.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,645 @@
+
+=head1 NAME
+
+Mail::Message::Body::Lines - body of a Mail::Message stored as array of lines
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Body::Lines
+   is a Mail::Message::Body
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ See Mail::Message::Body
+
+
+=head1 DESCRIPTION
+
+The body (content) of a message can be stored in various ways.  In this
+documentation you find the description of extra functionality you have
+when a message is stored in an array of lines.
+
+Storing a whole message as an array of lines is useful when the data is not
+encoded, and you want to process it on a line-by-line basis (a common practice
+for inspecting message bodies).
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Message::Body/"OVERLOADED">
+
+=back
+
+overload: B<'==' and '!='>
+
+=over 4
+
+See L<Mail::Message::Body/"OVERLOADED">
+
+=back
+
+overload: B<@{}>
+
+=over 4
+
+See L<Mail::Message::Body/"OVERLOADED">
+
+=back
+
+overload: B<bool>
+
+=over 4
+
+See L<Mail::Message::Body/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message::Body/"Constructors">
+
+=back
+
+Mail::Message::Body::Lines-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option             Defined in       Default        
+ based_on           L<Mail::Message::Body>  undef          
+ charset            L<Mail::Message::Body>  C<'us-ascii'>  
+ checked            L<Mail::Message::Body>  <false>        
+ data               L<Mail::Message::Body>  undef          
+ disposition        L<Mail::Message::Body>  undef          
+ eol                L<Mail::Message::Body>  C<'NATIVE'>    
+ file               L<Mail::Message::Body>  undef          
+ log                L<Mail::Reporter>  C<'WARNINGS'>  
+ message            L<Mail::Message::Body>  undef          
+ mime_type          L<Mail::Message::Body>  C<'text/plain'>
+ modified           L<Mail::Message::Body>  <false>        
+ trace              L<Mail::Reporter>  C<'WARNINGS'>  
+ transfer_encoding  L<Mail::Message::Body>  C<'none'>      
+
+. based_on BODY
+
+. charset STRING
+
+. checked BOOLEAN
+
+. data ARRAY-OF-LINES | STRING
+
+. disposition STRING|FIELD
+
+. eol 'CR'|'LF'|'CRLF'|'NATIVE'
+
+. file FILENAME|FILEHANDLE|IOHANDLE
+
+. log LEVEL
+
+. message MESSAGE
+
+. mime_type STRING|FIELD|MIME
+
+. modified BOOLEAN
+
+. trace LEVEL
+
+. transfer_encoding STRING|FIELD
+
+=back
+
+=head2 Constructing a body
+
+
+$obj-E<gt>B<attach>(MESSAGES, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body::Construct/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<check>
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<concatenate>(COMPONENTS)
+
+=over 4
+
+See L<Mail::Message::Body::Construct/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<decoded>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<encode>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<encoded>
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<eol>(['CR'|'LF'|'CRLF'|'NATIVE'])
+
+=over 4
+
+See L<Mail::Message::Body/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<foreachLine>(CODE)
+
+=over 4
+
+See L<Mail::Message::Body::Construct/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<stripSignature>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body::Construct/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<unify>(BODY)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Constructing a body">
+
+=back
+
+=head2 The body
+
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+See L<Mail::Message::Body/"The body">
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+See L<Mail::Message::Body/"The body">
+
+=back
+
+$obj-E<gt>B<isNested>
+
+=over 4
+
+See L<Mail::Message::Body/"The body">
+
+=back
+
+$obj-E<gt>B<message>([MESSAGE])
+
+=over 4
+
+See L<Mail::Message::Body/"The body">
+
+=back
+
+=head2 About the payload
+
+
+$obj-E<gt>B<charset>
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<checked>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<disposition>([STRING|FIELD])
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<dispositionFilename>(DIRECTORY)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"About the payload">
+
+=back
+
+$obj-E<gt>B<isBinary>
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"About the payload">
+
+=back
+
+$obj-E<gt>B<isText>
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"About the payload">
+
+=back
+
+$obj-E<gt>B<mimeType>
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<transferEncoding>([STRING|FIELD])
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<type>([STRING|FIELD])
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+=head2 Access to the payload
+
+
+$obj-E<gt>B<file>
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+$obj-E<gt>B<lines>
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+$obj-E<gt>B<printEscapedFrom>(FILEHANDLE)
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+$obj-E<gt>B<write>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<addTransferEncHandler>(NAME, CLASS|OBJECT)
+
+Mail::Message::Body::Lines-E<gt>B<addTransferEncHandler>(NAME, CLASS|OBJECT)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Internals">
+
+=back
+
+$obj-E<gt>B<contentInfoFrom>(HEAD)
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<contentInfoTo>(HEAD)
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<fileLocation>([BEGIN,END])
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<getTransferEncHandler>(TYPE)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Internals">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<load>
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<moveLocation>([DISTANCE])
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<read>(PARSER, HEAD, BODYTYPE [,CHARS [,LINES]])
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Message::Body/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Body::Lines-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Body::Lines-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Body::Lines-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> No decoder defined for transfer encoding $name.
+
+The data (message body) is encoded in a way which is not currently understood,
+therefore no decoding (or recoding) can take place.
+
+I<Warning:> No encoder defined for transfer encoding $name.
+
+The data (message body) has been decoded, but the required encoding is
+unknown.  The decoded data is returned.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Unable to read file $filename for message body lines: $!
+
+A L<Mail::Message::Body::Lines|Mail::Message::Body::Lines> object is to be created from a named file,
+but it is impossible to read that file to retrieve the lines within.
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Multipart.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Multipart.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Multipart.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,428 @@
+use strict;
+use warnings;
+
+package Mail::Message::Body::Multipart;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Body';
+
+use Mail::Message::Body::Lines;
+use Mail::Message::Part;
+
+use Mail::Box::FastScalar;
+
+
+#------------------------------------------
+
+sub init($)
+{   my ($self, $args) = @_;
+    my $based = $args->{based_on};
+    $args->{mime_type} ||=
+        defined $based ? $based->mimeType : 'multipart/mixed';
+
+    $self->SUPER::init($args);
+
+    my @parts;
+    if($args->{parts})
+    {   foreach my $raw (@{$args->{parts}})
+        {   next unless defined $raw;
+            my $cooked = Mail::Message::Part->coerce($raw, $self);
+
+            $self->log(ERROR => 'Data not convertible to a message (type is '
+                      , ref $raw,")\n"), next unless defined $cooked;
+
+            push @parts, $cooked;
+        }
+    }
+
+    my $preamble = $args->{preamble};
+    $preamble    = Mail::Message::Body->new(data => $preamble)
+       if defined $preamble && ! ref $preamble;
+    
+    my $epilogue = $args->{epilogue};
+    $epilogue    = Mail::Message::Body->new(data => $epilogue)
+       if defined $epilogue && ! ref $epilogue;
+    
+    if($based)
+    {   $self->boundary($args->{boundary} || $based->boundary);
+        $self->{MMBM_preamble}
+            = defined $preamble ? $preamble : $based->preamble;
+
+        $self->{MMBM_parts}
+            = @parts              ? \@parts
+            : $based->isMultipart ? [ $based->parts('ACTIVE') ]
+            : [];
+
+        $self->{MMBM_epilogue}
+            = defined $epilogue ? $epilogue : $based->epilogue;
+    }
+    else
+    {   $self->boundary($args->{boundary} ||$self->type->attribute('boundary'));
+        $self->{MMBM_preamble} = $preamble;
+        $self->{MMBM_parts}    = \@parts;
+        $self->{MMBM_epilogue} = $epilogue;
+    }
+
+    $self;
+}
+
+#------------------------------------------
+
+sub isMultipart() {1}
+
+#------------------------------------------
+
+# A multipart body is never binary itself.  The parts may be.
+sub isBinary() {0}
+
+#------------------------------------------
+
+sub clone()
+{   my $self     = shift;
+    my $preamble = $self->preamble;
+    my $epilogue = $self->epilogue;
+
+    my $body     = ref($self)->new
+     ( $self->logSettings
+     , based_on => $self
+     , preamble => ($preamble ? $preamble->clone : undef)
+     , epilogue => ($epilogue ? $epilogue->clone : undef)
+     , parts    => [ map {$_->clone} $self->parts('ACTIVE') ]
+     );
+
+}
+
+#------------------------------------------
+
+sub nrLines()
+{   my $self   = shift;
+    my $nr     = 1;     # trailing boundary
+
+    if(my $preamble = $self->preamble) { $nr += $preamble->nrLines }
+    $nr += 2 + $_->nrLines foreach $self->parts('ACTIVE');
+    if(my $epilogue = $self->epilogue) { $nr += $epilogue->nrLines }
+    $nr;
+}
+
+#------------------------------------------
+
+sub size()
+{   my $self   = shift;
+    my $bbytes = length($self->boundary) +3;
+
+    my $bytes  = 0;
+    if(my $preamble = $self->preamble) { $bytes += $preamble->size }
+    $bytes     += $bbytes + 2;  # last boundary
+    $bytes += $bbytes + 1 + $_->size foreach $self->parts('ACTIVE');
+    if(my $epilogue = $self->epilogue) { $bytes += $epilogue->size }
+
+    $bytes;
+}
+
+#------------------------------------------
+
+sub string() { join '', shift->lines }
+
+#------------------------------------------
+
+sub lines()
+{   my $self     = shift;
+
+    my $boundary = $self->boundary;
+    my @lines;
+
+    my $preamble = $self->preamble;
+    push @lines, $preamble->lines if $preamble;
+
+    push @lines, "--$boundary\n", $_->lines
+        foreach $self->parts('ACTIVE');
+
+    push @lines, "--$boundary--\n";
+
+    my $epilogue = $self->epilogue;
+    push @lines, $epilogue->lines if $epilogue;
+
+    wantarray ? @lines : \@lines;
+}
+
+#------------------------------------------
+
+sub file()                    # It may be possible to speed-improve the next
+{   my $self   = shift;       # code, which first produces a full print of
+    my $text;                 # the message in memory...
+    my $dump   = Mail::Box::FastScalar->new(\$text);
+    $self->print($dump);
+    $dump->seek(0,0);
+    $dump;
+}
+
+#------------------------------------------
+
+sub print(;$)
+{   my $self = shift;
+    my $out  = shift || select;
+
+    my $boundary = $self->boundary;
+    if(my $preamble = $self->preamble) { $preamble->print($out) }
+
+    if(ref $out eq 'GLOB')
+    {   foreach my $part ($self->parts('ACTIVE'))
+        {   print $out "--$boundary\n";
+            $part->print($out);
+        }
+        print $out "--$boundary--\n";
+    }
+    else
+    {   foreach my $part ($self->parts('ACTIVE'))
+        {   $out->print("--$boundary\n");
+            $part->print($out);
+        }
+        $out->print("--$boundary--\n");
+    }
+
+    if(my $epilogue = $self->epilogue) { $epilogue->print($out) }
+
+    $self;
+}
+
+#------------------------------------------
+
+sub printEscapedFrom($)
+{   my ($self, $out) = @_;
+
+    my $boundary = $self->boundary;
+    if(my $preamble = $self->preamble) { $preamble->printEscapedFrom($out) }
+
+    if(ref $out eq 'GLOB')
+    {   foreach my $part ($self->parts('ACTIVE'))
+        {   print $out "--$boundary\n";
+            $part->printEscapedFrom($out);
+            print $out "\n";
+        }
+        print $out "--$boundary--\n";
+    }
+    else
+    {   foreach my $part ($self->parts('ACTIVE'))
+        {   $out->print("--$boundary\n");
+            $part->printEscapedFrom($out);
+            $out->print("\n");
+        }
+        $out->print("--$boundary--\n");
+    }
+
+    if(my $epilogue = $self->epilogue) { $epilogue->printEscapedFrom($out) }
+
+    $self;
+}
+
+#------------------------------------------
+
+sub check()
+{   my $self = shift;
+    $self->foreachComponent( sub {$_[1]->check} );
+}
+
+#------------------------------------------
+
+sub encode(@)
+{   my ($self, %args) = @_;
+    $self->foreachComponent( sub {$_[1]->encode(%args)} );
+}
+
+#------------------------------------------
+
+sub encoded()
+{   my $self = shift;
+    $self->foreachComponent( sub {$_[1]->encoded} );
+}
+
+#------------------------------------------
+
+sub read($$$$)
+{   my ($self, $parser, $head, $bodytype) = @_;
+
+    my $boundary = $self->boundary;
+
+    $parser->pushSeparator("--$boundary");
+    my @msgopts  = ($self->logSettings);
+
+    my @sloppyopts = 
+      ( mime_type         => 'text/plain'
+      , transfer_encoding => ($head->get('Content-Transfer-Encoding') || undef)
+      );
+
+    # Get preamble.
+    my $headtype = ref $head;
+
+    my $begin    = $parser->filePosition;
+    my $preamble = Mail::Message::Body::Lines->new(@msgopts, @sloppyopts)
+       ->read($parser, $head);
+
+    $self->{MMBM_preamble} = $preamble if defined $preamble;
+
+    # Get the parts.
+
+    my @parts;
+    while(my $sep = $parser->readSeparator)
+    {   last if $sep eq "--$boundary--\n";
+
+        my $part = Mail::Message::Part->new
+         ( @msgopts
+         , container => $self
+         );
+
+        last unless $part->readFromParser($parser, $bodytype);
+        push @parts, $part;
+    }
+    $self->{MMBM_parts} = \@parts;
+
+    # Get epilogue
+
+    $parser->popSeparator;
+    my $epilogue = Mail::Message::Body::Lines->new(@msgopts, @sloppyopts)
+        ->read($parser, $head);
+
+    $self->{MMBM_epilogue} = $epilogue if defined $epilogue;
+    my $end = defined $epilogue ? ($epilogue->fileLocation)[1]
+            : @parts            ? ($parts[-1]->fileLocation)[1]
+            : defined $preamble ? ($preamble->fileLocation)[1]
+            :                      $begin;
+
+    $self->fileLocation($begin, $end);
+
+    $self;
+}
+
+#------------------------------------------
+
+
+sub foreachComponent($)
+{   my ($self, $code) = @_;
+    my $changes  = 0;
+
+    my $new_preamble;
+    if(my $preamble = $self->preamble)
+    {   $new_preamble = $code->($self, $preamble);
+        $changes++ unless $preamble == $new_preamble;
+    }
+
+    my $new_epilogue;
+    if(my $epilogue = $self->epilogue)
+    {   $new_epilogue = $code->($self, $epilogue);
+        $changes++ unless $epilogue == $new_epilogue;
+    }
+
+    my @new_bodies;
+    foreach my $part ($self->parts('ACTIVE'))
+    {   my $part_body = $part->body;
+        my $new_body  = $code->($self, $part_body);
+
+        $changes++ if $new_body != $part_body;
+        push @new_bodies, [$part, $new_body];
+    }
+
+    return $self unless $changes;
+
+    my @new_parts;
+    foreach (@new_bodies)
+    {   my ($part, $body) = @$_;
+        my $new_part = Mail::Message::Part->new
+           ( head      => $part->head->clone,
+             container => undef
+           );
+        $new_part->body($body);
+        push @new_parts, $new_part;
+    }
+
+    my $constructed = (ref $self)->new
+      ( preamble => $new_preamble
+      , parts    => \@new_parts
+      , epilogue => $new_epilogue
+      , based_on => $self
+      );
+
+    $_->container($constructed)
+       foreach @new_parts;
+
+    $constructed;
+}
+
+#------------------------------------------
+
+
+sub attach(@)
+{   my $self  = shift;
+    my $new   = ref($self)->new
+      ( based_on => $self
+      , parts    => [$self->parts, @_]
+      );
+}
+
+#-------------------------------------------
+
+
+sub stripSignature(@)
+{   my $self  = shift;
+
+    my @allparts = $self->parts;
+    my @parts    = grep {! $_->body->mimeType->isSignature} @allparts;
+
+    @allparts==@parts ? $self
+    : (ref $self)->new(based_on => $self, parts => \@parts);
+}
+
+#------------------------------------------
+
+
+sub preamble() {shift->{MMBM_preamble}}
+
+#------------------------------------------
+
+
+sub epilogue() {shift->{MMBM_epilogue}}
+
+#------------------------------------------
+
+
+sub parts(;$)
+{   my $self  = shift;
+    return @{$self->{MMBM_parts}} unless @_;
+
+    my $what  = shift;
+    my @parts = @{$self->{MMBM_parts}};
+
+      $what eq 'RECURSE' ? (map {$_->parts('RECURSE')} @parts)
+    : $what eq 'ALL'     ? @parts
+    : $what eq 'DELETED' ? (grep {$_->isDeleted} @parts)
+    : $what eq 'ACTIVE'  ? (grep {not $_->isDeleted} @parts)
+    : ref $what eq 'CODE'? (grep {$what->($_)} @parts)
+    : ($self->log(ERROR => "Unknown criterium $what to select parts."), return ());
+}
+
+#-------------------------------------------
+
+
+sub part($) { shift->{MMBM_parts}[shift] }
+
+#-------------------------------------------
+
+
+my $unique_boundary = time;
+
+sub boundary(;$)
+{   my $self  = shift;
+    my $mime  = $self->type;
+
+    unless(@_)
+    {   my $boundary = $mime->attribute('boundary');
+        return $boundary if defined $boundary;
+    }
+
+    my $boundary = @_ && defined $_[0] ? (shift) : "boundary-".$unique_boundary++;
+    $self->type->attribute(boundary => $boundary);
+}
+
+#-------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Multipart.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Multipart.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Multipart.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,828 @@
+
+=head1 NAME
+
+Mail::Message::Body::Multipart - body of a message with attachments
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Body::Multipart
+   is a Mail::Message::Body
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ See Mail::Message::Body
+
+ if($body->isMultipart) {
+    my @attachments = $body->parts;
+    my $attachment3 = $body->part(2);
+    my $before      = $body->preamble;
+    my $after       = $body->epilogue;
+    $body->part(1)->delete;
+ }
+
+
+=head1 DESCRIPTION
+
+The body (content) of a message can be stored in various ways.  In this
+manual-page you find the description of extra functionality you have
+when a message contains attachments (parts).
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Message::Body/"OVERLOADED">
+
+=back
+
+overload: B<'==' and '!='>
+
+=over 4
+
+See L<Mail::Message::Body/"OVERLOADED">
+
+=back
+
+overload: B<@{}>
+
+=over 4
+
+See L<Mail::Message::Body/"OVERLOADED">
+
+=back
+
+overload: B<bool>
+
+=over 4
+
+See L<Mail::Message::Body/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message::Body/"Constructors">
+
+=back
+
+Mail::Message::Body::Multipart-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option             Defined in       Default             
+ based_on           L<Mail::Message::Body>  undef               
+ boundary                            undef               
+ charset            L<Mail::Message::Body>  C<'us-ascii'>       
+ checked            L<Mail::Message::Body>  <false>             
+ data               L<Mail::Message::Body>  undef               
+ disposition        L<Mail::Message::Body>  undef               
+ eol                L<Mail::Message::Body>  C<'NATIVE'>         
+ epilogue                            undef               
+ file               L<Mail::Message::Body>  undef               
+ log                L<Mail::Reporter>  C<'WARNINGS'>       
+ message            L<Mail::Message::Body>  undef               
+ mime_type          L<Mail::Message::Body>  C<'multipart/mixed'>
+ modified           L<Mail::Message::Body>  <false>             
+ parts                               undef               
+ preamble                            undef               
+ trace              L<Mail::Reporter>  C<'WARNINGS'>       
+ transfer_encoding  L<Mail::Message::Body>  C<'none'>           
+
+. based_on BODY
+
+. boundary STRING
+
+=over 4
+
+Separator to be used between parts of the message.  This separator must
+be unique in case the message contains nested multiparts (which are not
+unusual).  If C<undef>, a nice unique boundary will be generated.
+
+=back
+
+. charset STRING
+
+. checked BOOLEAN
+
+. data ARRAY-OF-LINES | STRING
+
+. disposition STRING|FIELD
+
+. eol 'CR'|'LF'|'CRLF'|'NATIVE'
+
+. epilogue BODY|STRING
+
+=over 4
+
+The text which is included in the main body after the final boundary.  This
+is usually empty, and has no meaning.
+
+Provide a BODY object or a STRING which will automatically translated
+into a C<text/plain> body.
+
+=back
+
+. file FILENAME|FILEHANDLE|IOHANDLE
+
+. log LEVEL
+
+. message MESSAGE
+
+. mime_type STRING|FIELD|MIME
+
+. modified BOOLEAN
+
+. parts ARRAY-OF-(MESSAGES|BODIES)
+
+=over 4
+
+Specifies an initial list of parts in this body.  These may be full
+MESSAGES, or BODIES which transformed into messages before use.  Each
+message is coerced into a L<Mail::Message::Part|Mail::Message::Part> object.
+
+MIME::Entity and Mail::Internet objects are acceptable in the
+list, because they are coercible into L<Mail::Message::Part|Mail::Message::Part>'s.  Values
+of C<undef> will be skipped silently.
+
+=back
+
+. preamble BODY|STRING
+
+=over 4
+
+The text which is included in the body before the first part.  It is
+common use to include a text to warn the user that the message is a
+multipart.  However, this was useful in earlier days: most mail
+agents are very capable in warning the user themselves.
+
+Provide a BODY object or a STRING which will automatically translated
+into a text/plain body.
+
+=back
+
+. trace LEVEL
+
+. transfer_encoding STRING|FIELD
+
+I<Example:> 
+
+ my $intro = Mail::Message::Body->new(data => ['part one']);
+ my $pgp   = Mail::Message::Body->new(data => ['part three']);
+
+ my $body  = Mail::Message::Body::Multipart->new
+   ( boundary => time . '--it-s-mine'
+   , preamble => "This is a multi-part message in MIME format.\n\n"
+   , parts    => [ $intro, $folder->message(3)->decoded, $pgp ]
+   );
+
+=back
+
+=head2 Constructing a body
+
+
+$obj-E<gt>B<attach>(MESSAGES|BODIES)
+
+=over 4
+
+Attach a list of MESSAGES to this multipart.  A new body is returned.
+When you specify BODIES, they will first be translated into
+real messages.  MIME::Entity and Mail::Internet objects may be
+specified too.  In any case, the parts will be coerced into
+L<Mail::Message::Part|Mail::Message::Part>'s.
+
+=back
+
+$obj-E<gt>B<check>
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<concatenate>(COMPONENTS)
+
+=over 4
+
+See L<Mail::Message::Body::Construct/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<decoded>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<encode>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<encoded>
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<eol>(['CR'|'LF'|'CRLF'|'NATIVE'])
+
+=over 4
+
+See L<Mail::Message::Body/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<foreachComponent>(CODE)
+
+=over 4
+
+Execute the CODE for each component of the message: the preamble, the
+epilogue, and each of the parts.
+
+Each component is a body and is passed as second argument to the CODE.
+The first argument is a reference to this multi-parted body.  The CODE
+returns a body object.  When any of the returned bodies differs from
+the body which was passed, then a new multi-part body will be returned.
+Reference to the not-changed bodies and the changed bodies will be
+included in that new multi-part.
+
+I<Example:> 
+
+ my $checked = $multi->foreachComponent(sub {$_[1]->check});
+
+=back
+
+$obj-E<gt>B<foreachLine>(CODE)
+
+=over 4
+
+See L<Mail::Message::Body::Construct/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<stripSignature>(OPTIONS)
+
+=over 4
+
+Removes all parts which contains data usually defined as being signature.
+The L<MIME::Type|MIME::Type> module provides this knowledge.  A new multipart is
+returned, containing the remaining parts.  No OPTIONS are defined yet,
+although some may be specified, because this method overrules the
+C<stripSignature> method for normal bodies.
+
+ Option       Defined in       Default          
+ max_lines    L<Mail::Message::Body::Construct>  C<10>            
+ pattern      L<Mail::Message::Body::Construct>  C<qr/^--\s?$/>   
+ result_type  L<Mail::Message::Body::Construct>  <same as current>
+
+. max_lines INTEGER|undef
+
+. pattern REGEX|STRING|CODE
+
+. result_type CLASS
+
+=back
+
+$obj-E<gt>B<unify>(BODY)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Constructing a body">
+
+=back
+
+=head2 The body
+
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+See L<Mail::Message::Body/"The body">
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+See L<Mail::Message::Body/"The body">
+
+=back
+
+$obj-E<gt>B<isNested>
+
+=over 4
+
+See L<Mail::Message::Body/"The body">
+
+=back
+
+$obj-E<gt>B<message>([MESSAGE])
+
+=over 4
+
+See L<Mail::Message::Body/"The body">
+
+=back
+
+=head2 About the payload
+
+
+$obj-E<gt>B<charset>
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<checked>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<disposition>([STRING|FIELD])
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<dispositionFilename>(DIRECTORY)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"About the payload">
+
+=back
+
+$obj-E<gt>B<isBinary>
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"About the payload">
+
+=back
+
+$obj-E<gt>B<isText>
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"About the payload">
+
+=back
+
+$obj-E<gt>B<mimeType>
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<transferEncoding>([STRING|FIELD])
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<type>([STRING|FIELD])
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+=head2 Access to the payload
+
+
+$obj-E<gt>B<boundary>([STRING])
+
+=over 4
+
+Returns the boundary which is used to separate the parts in this
+body.  If none was read from file, then one will be assigned.  With
+STRING you explicitly set the boundary to be used.
+
+=back
+
+$obj-E<gt>B<epilogue>
+
+=over 4
+
+Returns the epilogue; the text after the last message part (after the
+last real attachment).
+The epilogue is stored in a BODY object, and its encoding is taken
+from the general multipart header.
+
+=back
+
+$obj-E<gt>B<file>
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+$obj-E<gt>B<lines>
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+$obj-E<gt>B<part>(INDEX)
+
+=over 4
+
+Returns only the part with the specified INDEX.  You may use a negative
+value here, which counts from the back in the list.  Parts which are
+flagged to be deleted are included in the count.
+
+I<Example:> 
+
+ $message->body->part(2)->print;
+ $body->part(1)->delete;
+
+=back
+
+$obj-E<gt>B<parts>(['ALL'|'ACTIVE'|'DELETED'|'RECURSE'|FILTER])
+
+=over 4
+
+Return all parts by default, or when ALL is specified.  C<ACTIVE> returns
+the parts which are not flagged for deletion, as opposite to C<DELETED>.
+C<RECURSE> descents into all nested multiparts to collect all parts.
+
+You may also specify a code reference which is called for each nested
+part.  The first argument will be the message part.  When the code
+returns true, the part is incorporated in the return list.
+
+I<Example:> 
+
+ print "Number of attachments: ",
+     scalar $message->body->parts('ACTIVE');
+
+ foreach my $part ($message->body->parts) {
+     print "Type: ", $part->get('Content-Type');
+ }
+
+=back
+
+$obj-E<gt>B<preamble>
+
+=over 4
+
+Returns the preamble; the text before the first message part (before the
+first real attachment).
+The preamble is stored in a BODY object, and its encoding is taken
+from the multipart header.
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+$obj-E<gt>B<printEscapedFrom>(FILEHANDLE)
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+$obj-E<gt>B<write>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<addTransferEncHandler>(NAME, CLASS|OBJECT)
+
+Mail::Message::Body::Multipart-E<gt>B<addTransferEncHandler>(NAME, CLASS|OBJECT)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Internals">
+
+=back
+
+$obj-E<gt>B<contentInfoFrom>(HEAD)
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<contentInfoTo>(HEAD)
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<fileLocation>([BEGIN,END])
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<getTransferEncHandler>(TYPE)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Internals">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<load>
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<moveLocation>([DISTANCE])
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<read>(PARSER, HEAD, BODYTYPE [,CHARS [,LINES]])
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Message::Body/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Body::Multipart-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Body::Multipart-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Body::Multipart-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Data not convertible to a message (type is $type)
+
+An object which is not coercable into a L<Mail::Message::Part|Mail::Message::Part> object was
+passed to the initiation.  The data is ignored.
+
+I<Warning:> No decoder defined for transfer encoding $name.
+
+The data (message body) is encoded in a way which is not currently understood,
+therefore no decoding (or recoding) can take place.
+
+I<Warning:> No encoder defined for transfer encoding $name.
+
+The data (message body) has been decoded, but the required encoding is
+unknown.  The decoded data is returned.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Unknown criterium $what to select parts.
+
+Valid choices fdr part selections are C<ALL>, C<ACTIVE>, C<DELETED>,
+C<RECURSE> or a code reference.  However, some other argument was passed.
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Nested.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Nested.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Nested.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,181 @@
+use strict;
+use warnings;
+
+package Mail::Message::Body::Nested;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Body';
+
+use Mail::Message::Body::Lines;
+use Mail::Message::Part;
+
+use Carp;
+
+
+sub init($)
+{   my ($self, $args) = @_;
+    $args->{mime_type} ||= 'message/rfc822';
+
+    $self->SUPER::init($args);
+
+    my $nested;
+    if(my $raw = $args->{nested})
+    {   $nested = Mail::Message::Part->coerce($raw, $self);
+
+        croak 'Data not convertible to a message (type is ', ref $raw,")\n"
+            unless defined $nested;
+    }
+
+    $self->{MMBN_nested} = $nested;
+    $self;
+}
+
+#------------------------------------------
+
+sub isNested() {1}
+
+#------------------------------------------
+
+sub isBinary() {shift->nested->body->isBinary}
+
+#------------------------------------------
+
+sub clone()
+{   my $self     = shift;
+
+    ref($self)->new
+     ( $self->logSettings
+     , based_on => $self
+     , nested   => $self->nested->clone
+     );
+}
+
+#------------------------------------------
+
+sub nrLines() { shift->nested->nrLines }
+
+#------------------------------------------
+
+sub size()    { shift->nested->size }
+
+#------------------------------------------
+
+sub string()
+{    my $nested = shift->nested;
+     defined $nested ? $nested->string : '';
+}
+
+#------------------------------------------
+
+sub lines()
+{    my $nested = shift->nested;
+     defined $nested ? ($nested->lines) : ();
+}
+
+#------------------------------------------
+
+sub file()
+{    my $nested = shift->nested;
+     defined $nested ? $nested->file : undef;
+}
+
+#------------------------------------------
+
+sub print(;$)
+{   my $self = shift;
+    $self->nested->print(shift || select);
+}
+
+#------------------------------------------
+
+sub printEscapedFrom($)
+{   my $self = shift;
+    $self->nested->printEscapedFrom(shift);
+}
+
+sub check() { shift->forNested( sub {$_[1]->check} ) }
+
+#------------------------------------------
+
+sub encode(@)
+{   my ($self, %args) = @_;
+    $self->forNested( sub {$_[1]->encode(%args)} );
+}
+
+#------------------------------------------
+
+sub encoded() { shift->forNested( sub {$_[1]->encoded} ) }
+
+#------------------------------------------
+
+sub read($$$$)
+{   my ($self, $parser, $head, $bodytype) = @_;
+
+    my $nest = Mail::Message::Part->new(container => undef);
+    $nest->readFromParser($parser, $bodytype)
+       or return;
+
+    $nest->container($self);
+    $self->{MMBN_nested} = $nest;
+    $self;
+}
+
+#-------------------------------------------
+
+sub fileLocation()
+{   my $nested   = shift->nested;
+
+    ( ($nested->head->fileLocation)[0]
+    , ($nested->body->fileLocation)[1]
+    );
+}
+
+#------------------------------------------
+
+sub moveLocation($)
+{   my $self   = shift;
+    my $nested = $self->nested;
+    my $dist   = shift or return $self;  # no move
+
+    $nested->head->moveLocation($dist);
+    $nested->body->moveLocation($dist);
+    $self;
+}
+
+#------------------------------------------
+
+
+sub nested() { shift->{MMBN_nested} }
+
+#------------------------------------------
+
+
+sub forNested($)
+{   my ($self, $code) = @_;
+    my $nested    = $self->nested;
+    my $body      = $nested->body;
+
+    my $new_body  = $code->($self, $body)
+       or return;
+
+    return $self if $new_body == $body;
+
+    my $new_nested  = Mail::Message::Part->new
+       ( head      => $nested->head->clone
+       , container => undef
+       );
+
+    $new_nested->body($new_body);
+
+    my $created = (ref $self)->new
+      ( based_on => $self
+      , nested   => $new_nested
+      );
+
+    $new_nested->container($created);
+    $created;
+}
+
+#-------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Nested.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Nested.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/Nested.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,684 @@
+
+=head1 NAME
+
+Mail::Message::Body::Nested - body of a message which contains a message
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Body::Nested
+   is a Mail::Message::Body
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ See Mail::Message::Body
+
+ if($body->isNested) {
+    my $nest = $body->nested;
+    $nest->delete;
+ }
+
+
+=head1 DESCRIPTION
+
+The body (content) of a message can be stored in various ways.  In this
+manual-page you find the description of extra functionality you have
+when a message contains a nested message, like C<message/rfc822>.
+
+A nested message is different from a multipart message which contains
+only one element, because a nested message has a full set of message
+header fields defined by the RFC882, where a part of a multipart has
+only a few.  But because we do not keep track whether all fields are
+presented, a C<Mail::Message::Part> is used anyway.
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Message::Body/"OVERLOADED">
+
+=back
+
+overload: B<'==' and '!='>
+
+=over 4
+
+See L<Mail::Message::Body/"OVERLOADED">
+
+=back
+
+overload: B<@{}>
+
+=over 4
+
+See L<Mail::Message::Body/"OVERLOADED">
+
+=back
+
+overload: B<bool>
+
+=over 4
+
+See L<Mail::Message::Body/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message::Body/"Constructors">
+
+=back
+
+Mail::Message::Body::Nested-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option             Defined in       Default            
+ based_on           L<Mail::Message::Body>  undef              
+ charset            L<Mail::Message::Body>  C<'us-ascii'>      
+ checked            L<Mail::Message::Body>  <false>            
+ data               L<Mail::Message::Body>  undef              
+ disposition        L<Mail::Message::Body>  undef              
+ eol                L<Mail::Message::Body>  C<'NATIVE'>        
+ file               L<Mail::Message::Body>  undef              
+ log                L<Mail::Reporter>  C<'WARNINGS'>      
+ message            L<Mail::Message::Body>  undef              
+ mime_type          L<Mail::Message::Body>  C<'message/rfc822'>
+ modified           L<Mail::Message::Body>  <false>            
+ nested                              undef              
+ trace              L<Mail::Reporter>  C<'WARNINGS'>      
+ transfer_encoding  L<Mail::Message::Body>  C<'none'>          
+
+. based_on BODY
+
+. charset STRING
+
+. checked BOOLEAN
+
+. data ARRAY-OF-LINES | STRING
+
+. disposition STRING|FIELD
+
+. eol 'CR'|'LF'|'CRLF'|'NATIVE'
+
+. file FILENAME|FILEHANDLE|IOHANDLE
+
+. log LEVEL
+
+. message MESSAGE
+
+. mime_type STRING|FIELD|MIME
+
+. modified BOOLEAN
+
+. nested MESSAGE
+
+=over 4
+
+The message which is encapsulated within this body.
+
+=back
+
+. trace LEVEL
+
+. transfer_encoding STRING|FIELD
+
+I<Example:> 
+
+ my $msg   = $folder->message(3);
+ my $encaps= Mail::Message::Body::Nested->new(nested => $msg);
+
+ # The body will be coerced into a message, which lacks a few
+ # lines but we do not bother.
+ my $intro = Mail::Message::Body->new(data => ...);
+ my $body  = Mail::Message::Body::Nested->new(nested  => $intro);
+
+=back
+
+=head2 Constructing a body
+
+
+$obj-E<gt>B<attach>(MESSAGES, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body::Construct/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<check>
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<concatenate>(COMPONENTS)
+
+=over 4
+
+See L<Mail::Message::Body::Construct/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<decoded>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<encode>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<encoded>
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<eol>(['CR'|'LF'|'CRLF'|'NATIVE'])
+
+=over 4
+
+See L<Mail::Message::Body/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<foreachLine>(CODE)
+
+=over 4
+
+See L<Mail::Message::Body::Construct/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<stripSignature>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body::Construct/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<unify>(BODY)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Constructing a body">
+
+=back
+
+=head2 The body
+
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+See L<Mail::Message::Body/"The body">
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+See L<Mail::Message::Body/"The body">
+
+=back
+
+$obj-E<gt>B<isNested>
+
+=over 4
+
+See L<Mail::Message::Body/"The body">
+
+=back
+
+$obj-E<gt>B<message>([MESSAGE])
+
+=over 4
+
+See L<Mail::Message::Body/"The body">
+
+=back
+
+=head2 About the payload
+
+
+$obj-E<gt>B<charset>
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<checked>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<disposition>([STRING|FIELD])
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<dispositionFilename>(DIRECTORY)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"About the payload">
+
+=back
+
+$obj-E<gt>B<isBinary>
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"About the payload">
+
+=back
+
+$obj-E<gt>B<isText>
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"About the payload">
+
+=back
+
+$obj-E<gt>B<mimeType>
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<transferEncoding>([STRING|FIELD])
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<type>([STRING|FIELD])
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+=head2 Access to the payload
+
+
+$obj-E<gt>B<file>
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+$obj-E<gt>B<forNested>(CODE)
+
+=over 4
+
+Execute the CODE for the nested message.  This returns a new
+nested body object.  Returns C<undef> when the CODE returns C<undef>.
+
+=back
+
+$obj-E<gt>B<lines>
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+$obj-E<gt>B<nested>
+
+=over 4
+
+Returns the L<Mail::Message::Part|Mail::Message::Part> message which is enclosed within
+this body.
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+$obj-E<gt>B<printEscapedFrom>(FILEHANDLE)
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+$obj-E<gt>B<write>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<addTransferEncHandler>(NAME, CLASS|OBJECT)
+
+Mail::Message::Body::Nested-E<gt>B<addTransferEncHandler>(NAME, CLASS|OBJECT)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Internals">
+
+=back
+
+$obj-E<gt>B<contentInfoFrom>(HEAD)
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<contentInfoTo>(HEAD)
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<fileLocation>([BEGIN,END])
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<getTransferEncHandler>(TYPE)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Internals">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<load>
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<moveLocation>([DISTANCE])
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<read>(PARSER, HEAD, BODYTYPE [,CHARS [,LINES]])
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Message::Body/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Body::Nested-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Body::Nested-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Body::Nested-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> No decoder defined for transfer encoding $name.
+
+The data (message body) is encoded in a way which is not currently understood,
+therefore no decoding (or recoding) can take place.
+
+I<Warning:> No encoder defined for transfer encoding $name.
+
+The data (message body) has been decoded, but the required encoding is
+unknown.  The decoded data is returned.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/String.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/String.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/String.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,138 @@
+use strict;
+use warnings;
+
+package Mail::Message::Body::String;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Body';
+
+use Carp;
+use Mail::Box::FastScalar;
+
+
+#------------------------------------------
+# The scalar is stored as reference to avoid a copy during creation of
+# a string object.
+
+sub _data_from_filename(@)
+{   my ($self, $filename) = @_;
+
+    delete $self->{MMBS_nrlines};
+
+    local *IN;
+    unless(open IN, '<', $filename)
+    {   $self->log(ERROR =>
+            "Unable to read file $filename for message body scalar: $!");
+        return;
+    }
+
+    my @lines = <IN>;
+    close IN;
+
+    $self->{MMBS_nrlines} = @lines;
+    $self->{MMBS_scalar}  = join '', @lines;
+    $self;
+}
+
+sub _data_from_filehandle(@)
+{   my ($self, $fh) = @_;
+    my @lines = $fh->getlines;
+    $self->{MMBS_nrlines} = @lines;
+    $self->{MMBS_scalar}  = join '', @lines;
+    $self;
+}
+
+sub _data_from_glob(@)
+{   my ($self, $fh) = @_;
+    my @lines = <$fh>;
+    $self->{MMBS_nrlines} = @lines;
+    $self->{MMBS_scalar}  = join '', @lines;
+    $self;
+}
+
+sub _data_from_lines(@)
+{   my ($self, $lines) = @_;
+    $self->{MMBS_nrlines} = @$lines unless @$lines==1;
+    $self->{MMBS_scalar}  = @$lines==1 ? shift @$lines : join('', @$lines);
+    $self;
+}
+
+#------------------------------------------
+
+sub clone()
+{   my $self = shift;
+    ref($self)->new(data => $self->string, based_on => $self);
+}
+
+#------------------------------------------
+# Only compute it once, if needed.  The scalar contains lines, so will
+# have a \n even at the end.
+
+sub nrLines()
+{   my $self = shift;
+    return $self->{MMBS_nrlines} if defined $self->{MMBS_nrlines};
+
+    my $nrlines = 0;
+    for($self->{MMBS_scalar})
+    {   $nrlines++ while /\n/g;
+    }
+
+    $self->{MMBS_nrlines} = $nrlines;
+}
+
+#------------------------------------------
+
+sub size() { length shift->{MMBS_scalar} }
+
+#------------------------------------------
+
+sub string() { shift->{MMBS_scalar} }
+
+#------------------------------------------
+
+sub lines()
+{   my @lines = split /^/, shift->{MMBS_scalar};
+    wantarray ? @lines : \@lines;
+}
+
+#------------------------------------------
+
+sub file() { Mail::Box::FastScalar->new(shift->{MMBS_scalar}) }
+
+#------------------------------------------
+
+sub print(;$)
+{   my $self = shift;
+    my $fh   = shift || select;
+    if(ref $fh eq 'GLOB') { print $fh $self->{MMBS_scalar} }
+    else                  { $fh->print($self->{MMBS_scalar}) }
+    $self;
+}
+
+#------------------------------------------
+
+sub printEscapedFrom($)
+{   my ($self, $fh) = @_;
+
+    my $text = $self->{MMBS_scalar};    # copy required
+    $text    =~ s/^(?=\>*From )/>/;
+    if(ref $fh eq 'GLOB') { print $fh $text   }
+    else                  { $fh->print($text) }
+    $self;
+}
+
+#------------------------------------------
+
+sub read($$;$@)
+{   my ($self, $parser, $head, $bodytype) = splice @_, 0, 4;
+    delete $self->{MMBS_nrlines};
+
+    (my $begin, my $end, $self->{MMBS_scalar}) = $parser->bodyAsString(@_);
+    $self->fileLocation($begin, $end);
+
+    $self;
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/String.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/String.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body/String.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,646 @@
+
+=head1 NAME
+
+Mail::Message::Body::String - body of a Mail::Message stored as single string
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Body::String
+   is a Mail::Message::Body
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ See Mail::Message::Body
+
+
+=head1 DESCRIPTION
+
+The body (content) of a message can be stored in various ways.  In this
+documentation you will find the description of extra functionality you have
+when a message is stored as a single scalar.  
+
+Storing a whole message in one string is only a smart choice when the content
+is small or encoded. Even when stored as a scalar, you can still treat the
+body as if the data is stored in lines or an external file, but this will be
+slower.
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Message::Body/"OVERLOADED">
+
+=back
+
+overload: B<'==' and '!='>
+
+=over 4
+
+See L<Mail::Message::Body/"OVERLOADED">
+
+=back
+
+overload: B<@{}>
+
+=over 4
+
+See L<Mail::Message::Body/"OVERLOADED">
+
+=back
+
+overload: B<bool>
+
+=over 4
+
+See L<Mail::Message::Body/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message::Body/"Constructors">
+
+=back
+
+Mail::Message::Body::String-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option             Defined in       Default        
+ based_on           L<Mail::Message::Body>  undef          
+ charset            L<Mail::Message::Body>  C<'us-ascii'>  
+ checked            L<Mail::Message::Body>  <false>        
+ data               L<Mail::Message::Body>  undef          
+ disposition        L<Mail::Message::Body>  undef          
+ eol                L<Mail::Message::Body>  C<'NATIVE'>    
+ file               L<Mail::Message::Body>  undef          
+ log                L<Mail::Reporter>  C<'WARNINGS'>  
+ message            L<Mail::Message::Body>  undef          
+ mime_type          L<Mail::Message::Body>  C<'text/plain'>
+ modified           L<Mail::Message::Body>  <false>        
+ trace              L<Mail::Reporter>  C<'WARNINGS'>  
+ transfer_encoding  L<Mail::Message::Body>  C<'none'>      
+
+. based_on BODY
+
+. charset STRING
+
+. checked BOOLEAN
+
+. data ARRAY-OF-LINES | STRING
+
+. disposition STRING|FIELD
+
+. eol 'CR'|'LF'|'CRLF'|'NATIVE'
+
+. file FILENAME|FILEHANDLE|IOHANDLE
+
+. log LEVEL
+
+. message MESSAGE
+
+. mime_type STRING|FIELD|MIME
+
+. modified BOOLEAN
+
+. trace LEVEL
+
+. transfer_encoding STRING|FIELD
+
+=back
+
+=head2 Constructing a body
+
+
+$obj-E<gt>B<attach>(MESSAGES, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body::Construct/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<check>
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<concatenate>(COMPONENTS)
+
+=over 4
+
+See L<Mail::Message::Body::Construct/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<decoded>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<encode>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<encoded>
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<eol>(['CR'|'LF'|'CRLF'|'NATIVE'])
+
+=over 4
+
+See L<Mail::Message::Body/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<foreachLine>(CODE)
+
+=over 4
+
+See L<Mail::Message::Body::Construct/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<stripSignature>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body::Construct/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<unify>(BODY)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Constructing a body">
+
+=back
+
+=head2 The body
+
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+See L<Mail::Message::Body/"The body">
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+See L<Mail::Message::Body/"The body">
+
+=back
+
+$obj-E<gt>B<isNested>
+
+=over 4
+
+See L<Mail::Message::Body/"The body">
+
+=back
+
+$obj-E<gt>B<message>([MESSAGE])
+
+=over 4
+
+See L<Mail::Message::Body/"The body">
+
+=back
+
+=head2 About the payload
+
+
+$obj-E<gt>B<charset>
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<checked>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<disposition>([STRING|FIELD])
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<dispositionFilename>(DIRECTORY)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"About the payload">
+
+=back
+
+$obj-E<gt>B<isBinary>
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"About the payload">
+
+=back
+
+$obj-E<gt>B<isText>
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"About the payload">
+
+=back
+
+$obj-E<gt>B<mimeType>
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<transferEncoding>([STRING|FIELD])
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+$obj-E<gt>B<type>([STRING|FIELD])
+
+=over 4
+
+See L<Mail::Message::Body/"About the payload">
+
+=back
+
+=head2 Access to the payload
+
+
+$obj-E<gt>B<file>
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+$obj-E<gt>B<lines>
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+$obj-E<gt>B<printEscapedFrom>(FILEHANDLE)
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+$obj-E<gt>B<write>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body/"Access to the payload">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<addTransferEncHandler>(NAME, CLASS|OBJECT)
+
+Mail::Message::Body::String-E<gt>B<addTransferEncHandler>(NAME, CLASS|OBJECT)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Internals">
+
+=back
+
+$obj-E<gt>B<contentInfoFrom>(HEAD)
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<contentInfoTo>(HEAD)
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<fileLocation>([BEGIN,END])
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<getTransferEncHandler>(TYPE)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Internals">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<load>
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<moveLocation>([DISTANCE])
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+$obj-E<gt>B<read>(PARSER, HEAD, BODYTYPE [,CHARS [,LINES]])
+
+=over 4
+
+See L<Mail::Message::Body/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Message::Body/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Body::String-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Body::String-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Body::String-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> No decoder defined for transfer encoding $name.
+
+The data (message body) is encoded in a way which is not currently understood,
+therefore no decoding (or recoding) can take place.
+
+I<Warning:> No encoder defined for transfer encoding $name.
+
+The data (message body) has been decoded, but the required encoding is
+unknown.  The decoded data is returned.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Unable to read file $filename for message body scalar: $!
+
+A L<Mail::Message::Body::String|Mail::Message::Body::String> object is to be created from a named
+file, but it is impossible to read that file to retrieve the lines within.
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,454 @@
+use strict;
+use warnings;
+
+package Mail::Message::Body;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Reporter';
+
+use Mail::Message::Field;
+use Mail::Message::Body::Lines;
+use Mail::Message::Body::File;
+
+use Carp;
+use Scalar::Util 'weaken';
+
+use MIME::Types;
+my $mime_types = MIME::Types->new;
+my $mime_plain = $mime_types->type('text/plain');
+
+
+use overload bool  => sub {1}   # $body->print if $body
+           , '""'  => 'string_unless_carp'
+           , '@{}' => 'lines'
+           , '=='  => sub {$_[0]->{MMB_seqnr}==$_[1]->{MMB_seqnr}}
+           , '!='  => sub {$_[0]->{MMB_seqnr}!=$_[1]->{MMB_seqnr}};
+
+#------------------------------------------
+
+
+my $body_count = 0;  # to be able to compare bodies for equivalence.
+
+sub new(@)
+{   my $class = shift;
+
+    return $class->SUPER::new(@_)
+         unless $class eq __PACKAGE__;
+
+    my %args  = @_;
+
+      exists $args{file}
+    ? Mail::Message::Body::File->new(@_)
+    : Mail::Message::Body::Lines->new(@_);
+}
+
+# All body implementations shall implement all of the following!!
+
+sub _data_from_filename(@)   {shift->notImplemented}
+sub _data_from_filehandle(@) {shift->notImplemented}
+sub _data_from_glob(@)       {shift->notImplemented}
+sub _data_from_lines(@)      {shift->notImplemented}
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    $self->SUPER::init($args);
+
+    $self->{MMB_modified} = $args->{modified} || 0;
+
+    my $filename;
+    if(defined(my $file = $args->{file}))
+    {
+        if(!ref $file)
+        {    $self->_data_from_filename($file) or return;
+             $filename = $file;
+        }
+        elsif(ref $file eq 'GLOB')
+        {    $self->_data_from_glob($file) or return }
+        elsif($file->isa('IO::Handle'))
+        {    $self->_data_from_filehandle($file) or return }
+        else
+        {    croak "Illegal datatype for file option." }
+    }
+    elsif(defined(my $data = $args->{data}))
+    {
+        if(!ref $data)
+        {   my @lines = split /^/, $data;
+            $self->_data_from_lines(\@lines)
+        }
+        elsif(ref $data eq 'ARRAY')
+        {   $self->_data_from_lines($data) or return;
+        }
+        else
+        {   croak "Illegal datatype for data option." }
+    }
+    elsif(! $self->isMultipart && ! $self->isNested)
+    {   # Neither 'file' nor 'data', so empty body.
+        $self->_data_from_lines( [] ) or return;
+    }
+
+    # Set the content info
+
+    my ($mime, $transfer, $disp, $charset)
+      = @$args{ qw/mime_type transfer_encoding disposition charset/ };
+
+    if(defined $filename)
+    {   unless(defined $disp)
+        {   $disp = Mail::Message::Field->new
+              ('Content-Disposition' => (-T $filename ? 'inline':'attachment'));
+            (my $abbrev = $filename) =~ s!.*[/\\]!!;
+            $disp->attribute(filename => $abbrev);
+        }
+
+        unless(defined $mime)
+        {   $mime = $mime_types->mimeTypeOf($filename);
+            $mime = -T $filename ? 'text/plain' : 'application/octet-stream'
+                unless defined $mime;
+        }
+    }
+
+    if(ref $mime && $mime->isa('MIME::Type'))
+    {   $mime    = $mime->type;
+    }
+
+    if(defined(my $based = $args->{based_on}))
+    {   $mime     = $based->type             unless defined $mime;
+        $transfer = $based->transferEncoding unless defined $transfer;
+        $disp     = $based->disposition      unless defined $disp;
+        $charset  = $based->charset          unless defined $charset;
+
+        $self->{MMB_checked}
+               = defined $args->{checked} ? $args->{checked} : $based->checked;
+    }
+    else
+    {   $transfer = $args->{transfer_encoding};
+        $self->{MMB_checked} = $args->{checked}|| 0;
+    }
+
+    if(defined $mime)
+    {   #$charset ||= 'us-ascii' if $mime =~ m!^text/!i;
+        $mime = $self->type($mime);
+        $mime->attribute(charset => $charset) if defined $charset;
+    }
+
+    $self->transferEncoding($transfer) if defined $transfer;
+    $self->disposition($disp)          if defined $disp;
+
+    $self->{MMB_eol}   = $args->{eol} || 'NATIVE';
+
+    # Set message where the body belongs to.
+
+    $self->message($args->{message})
+        if defined $args->{message};
+
+    $self->{MMB_seqnr} = $body_count++;
+    $self;
+}
+
+#------------------------------------------
+
+
+sub clone() {shift->notImplemented}
+
+#------------------------------------------
+
+
+sub decoded(@)
+{   my $self = shift;
+    $self->encode
+     ( mime_type         => 'text/plain'
+     , charset           => 'us-ascii'
+     , transfer_encoding => 'none'
+     , @_
+     );
+}
+
+#------------------------------------------
+
+
+sub eol(;$)
+{   my $self = shift;
+    return $self->{MMB_eol} unless @_;
+
+    my $eol  = shift;
+    if($eol eq 'NATIVE')
+    {   $eol = $^O =~ m/^win/i ? 'CRLF'
+             : $^O =~ m/^mac/i ? 'CR'
+             :                   'LF';
+    }
+
+    return $eol if $eol eq $self->{MMB_eol} && $self->checked;
+    my $lines = $self->lines;
+
+       if($eol eq 'CR')    {s/[\015\012]+$/\015/     foreach @$lines}
+    elsif($eol eq 'LF')    {s/[\015\012]+$/\012/     foreach @$lines}
+    elsif($eol eq 'CRLF')  {s/[\015\012]+$/\015\012/ foreach @$lines}
+    else
+    {   carp "Unknown line terminator $eol ignored.";
+        return $self->eol('NATIVE');
+    }
+
+    (ref $self)->new
+      ( based_on => $self
+      , eol      => $eol
+      , data     => $lines
+      );
+}
+
+#------------------------------------------
+
+
+sub message(;$)
+{   my $self = shift;
+    if(@_)
+    {   $self->{MMB_message} = shift;
+        weaken($self->{MMB_message});
+    }
+    $self->{MMB_message};
+}
+
+#------------------------------------------
+
+
+sub isDelayed() {0}
+
+#------------------------------------------
+
+
+sub isMultipart() {0}
+
+#------------------------------------------
+
+
+sub isNested() {0}
+
+#------------------------------------------
+
+
+sub type(;$)
+{   my $self = shift;
+    return $self->{MMB_type} if !@_ && defined $self->{MMB_type};
+
+    delete $self->{MMB_mime};
+    my $type = defined $_[0] ? shift : 'text/plain';
+
+    $self->{MMB_type}
+      = ref $type ? $type->clone
+      : Mail::Message::Field->new('Content-Type' => $type);
+}
+
+#------------------------------------------
+
+
+sub mimeType()
+{   my $self  = shift;
+    return $self->{MMB_mime} if exists $self->{MMB_mime};
+
+    my $field = $self->{MMB_type};
+    my $body  = defined $field ? $field->body : '';
+
+    return $self->{MMB_mime} = $mime_plain
+       unless length $body;
+
+    $self->{MMB_mime}
+       = $mime_types->type($body) || MIME::Type->new(type => $body);
+}
+
+#------------------------------------------
+
+
+sub charset() { shift->type->attribute('charset') }
+
+#------------------------------------------
+
+
+sub transferEncoding(;$)
+{   my $self = shift;
+    return $self->{MMB_transfer} if !@_ && defined $self->{MMB_transfer};
+
+    my $set = defined $_[0] ? shift : 'none';
+    $self->{MMB_transfer} = ref $set ? $set->clone
+       : Mail::Message::Field->new('Content-Transfer-Encoding' => $set);
+}
+
+#------------------------------------------
+
+
+sub disposition(;$)
+{   my $self = shift;
+    return $self->{MMB_disposition} if !@_ && $self->{MMB_disposition};
+
+    my $disp = defined $_[0] ? shift : 'none';
+    $self->{MMB_disposition} = ref $disp ? $disp->clone
+       : Mail::Message::Field->new('Content-Disposition' => $disp);
+}
+
+#------------------------------------------
+
+
+sub checked(;$)
+{   my $self = shift;
+    @_ ? ($self->{MMB_checked} = shift) : $self->{MMB_checked};
+}
+
+#------------------------------------------
+
+
+sub nrLines(@)  {shift->notImplemented}
+
+#------------------------------------------
+
+
+sub size(@)  {shift->notImplemented}
+
+#------------------------------------------
+
+
+sub string() {shift->notImplemented}
+
+sub string_unless_carp()
+{   my $self  = shift;
+    return $self->string unless (caller)[0] eq 'Carp';
+
+    (my $class = ref $self) =~ s/^Mail::Message/MM/;
+    "$class object";
+}
+
+#------------------------------------------
+
+
+sub lines() {shift->notImplemented}
+
+#------------------------------------------
+
+
+sub file(;$) {shift->notImplemented}
+
+#------------------------------------------
+
+
+sub print(;$) {shift->notImplemented}
+
+#------------------------------------------
+
+
+sub printEscapedFrom($) {shift->notImplemented}
+
+#------------------------------------------
+
+
+sub write(@)
+{   my ($self, %args) = @_;
+    my $filename = $args{filename};
+    die "No filename for write() body" unless defined $filename;
+
+    open OUT, '>', $filename or return;
+    $self->print(\*OUT);
+    close OUT or return undef;
+    $self;
+}
+
+#------------------------------------------
+
+
+sub read(@) {shift->notImplemented}
+
+#------------------------------------------
+
+
+sub contentInfoTo($)
+{   my ($self, $head) = @_;
+    return unless defined $head;
+
+    my $lines  = $self->nrLines;
+    my $size   = $self->size;
+    $size     += $lines if $Mail::Message::crlf_platform;
+
+    $head->set($self->type);
+    $head->set('Content-Length' => $size);
+    $head->set(Lines            => $lines);
+
+    $head->set($self->transferEncoding);
+    $head->set($self->disposition);
+    $self;
+}
+
+#------------------------------------------
+
+
+sub contentInfoFrom($)
+{   my ($self, $head) = @_;
+
+    $self->type($head->get('Content-Type'));
+    $self->transferEncoding($head->get('Content-Transfer-Encoding'));
+    $self->disposition($head->get('Content-Disposition'));
+
+    delete $self->{MMB_mime};
+    $self;
+
+}
+#------------------------------------------
+
+
+sub modified(;$)
+{  my $self = shift;
+   return $self->isModified unless @_;  # compat 2.036
+   $self->{MMB_modified} = shift;
+}
+
+#------------------------------------------
+
+
+sub isModified() {  shift->{MMB_modified} }
+
+#------------------------------------------
+
+
+sub fileLocation(;@) {
+    my $self = shift;
+    return @$self{ qw/MMB_begin MMB_end/ } unless @_;
+    @$self{ qw/MMB_begin MMB_end/ } = @_;
+}
+
+#------------------------------------------
+
+
+sub moveLocation($)
+{   my ($self, $dist) = @_;
+    $self->{MMB_begin} -= $dist;
+    $self->{MMB_end}   -= $dist;
+    $self;
+}
+
+#------------------------------------------
+
+
+sub load() {shift}
+
+#------------------------------------------
+
+
+my @in_encode = qw/check encode encoded eol isBinary isText unify
+                   dispositionFilename/;
+my %in_module = map { ($_ => 'encode') } @in_encode;
+
+sub AUTOLOAD(@)
+{   my $self  = shift;
+    our $AUTOLOAD;
+    (my $call = $AUTOLOAD) =~ s/.*\:\://g;
+
+    my $mod = $in_module{$call} || 'construct';
+    if($mod eq 'encode'){ require Mail::Message::Body::Encode    }
+    else                { require Mail::Message::Body::Construct }
+
+    no strict 'refs';
+    return $self->$call(@_) if $self->can($call);  # now loaded
+
+    # Try parental AUTOLOAD
+    Mail::Reporter->$call(@_);
+}   
+
+#------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Body.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,1099 @@
+
+=head1 NAME
+
+Mail::Message::Body - the data of a body in a message
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Body has extra code in
+   Mail::Message::Body::Construct
+   Mail::Message::Body::Encode
+
+ Mail::Message::Body
+   is a Mail::Reporter
+
+ Mail::Message::Body is extended by
+   Mail::Message::Body::File
+   Mail::Message::Body::Lines
+   Mail::Message::Body::Multipart
+   Mail::Message::Body::Nested
+   Mail::Message::Body::String
+
+ Mail::Message::Body is realized by
+   Mail::Message::Body::Delayed
+
+
+=head1 SYNOPSIS
+
+ my Mail::Message $msg = ...;
+ my $body  = $msg->body;
+ my @text  = $body->lines;
+ my $text  = $body->string;
+ my IO::Handle $file = $body->file;
+ $body->print(\*FILE);
+
+ my $content_type = $body->type;
+ my $transfer_encoding = $body->transferEncoding;
+ my $encoded  = $body->encode(mime_type => 'text/html',
+    charset => 'us-ascii', transfer_encoding => 'none');\n";
+ my $decoded  = $body->decoded;
+
+
+=head1 DESCRIPTION
+
+The encoding and decoding functionality of a L<Mail::Message::Body|Mail::Message::Body> is
+implemented in the L<Mail::Message::Body::Encode|Mail::Message::Body::Encode> package.  That package is
+automatically loaded when encoding and decoding of messages needs to take
+place.  Methods to simply build an process body objects are implemented
+in L<Mail::Message::Body::Construct|Mail::Message::Body::Construct>.
+
+The body of a message (a L<Mail::Message|Mail::Message> object) is stored in one of the
+many body types.  The functionality of each body type is equivalent, but there
+are performance differences.  Each body type has its own documentation
+with details about its implementation.
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+(stringification) Returns the body as string --which will trigger
+completion-- unless called to produce a string for C<Carp>.  The latter
+to avoid deep recursions.
+
+I<Example:> stringification of body
+
+
+ print $msg->body;   # implicit by print
+
+ my $body = $msg->body;
+ my $x    = "$body"; # explicit by interpolation
+
+=back
+
+overload: B<'==' and '!='>
+
+=over 4
+
+(numeric comparison) compares if two references point to the
+same message.  This only produces correct results is both arguments
+are message references B<within the same folder>.
+
+I<Example:> use of numeric comparison on a body
+
+
+ my $skip = $folder->message(3);
+ foreach my $msg (@$folder)
+ {   next if $msg == $skip;
+     $msg->send;
+ }
+
+=back
+
+overload: B<@{}>
+
+=over 4
+
+When a body object is used as being an array reference, the lines of
+the body are returned.  This is the same as using L<lines()|Mail::Message::Body/"Access to the payload">.
+
+I<Example:> using a body as array
+
+
+ print $body->lines->[1];  # second line
+ print $body->[1];         # same
+
+ my @lines = $body->lines;
+ my @lines = @$body;       # same
+
+=back
+
+overload: B<bool>
+
+=over 4
+
+Always returns a true value, which is needed to have overloaded
+objects to be used as in C<if($body)>.  Otherwise, C<if(defined $body)>
+would be needed to avoid a runtime error.
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+Return a copy of this body, usually to be included in a cloned
+message. Use L<Mail::Message::clone()|Mail::Message/"Constructors"> for a whole message.
+
+=back
+
+Mail::Message::Body-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+BE WARNED that, what you specify here are encodings and such which are
+already in place.  The options will not trigger conversions.  When you
+need conversions, first create a body with options which tell what you've
+got, and then call L<encode()|Mail::Message::Body::Encode/"Constructing a body"> for what you need.
+
+ Option             Defined in       Default        
+ based_on                            undef          
+ charset                             C<'us-ascii'>  
+ checked                             <false>        
+ data                                undef          
+ disposition                         undef          
+ eol                                 C<'NATIVE'>    
+ file                                undef          
+ log                L<Mail::Reporter>  C<'WARNINGS'>  
+ message                             undef          
+ mime_type                           C<'text/plain'>
+ modified                            <false>        
+ trace              L<Mail::Reporter>  C<'WARNINGS'>  
+ transfer_encoding                   C<'none'>      
+
+. based_on BODY
+
+=over 4
+
+The information about encodings must be taken from the specified BODY,
+unless specified differently.
+
+=back
+
+. charset STRING
+
+=over 4
+
+Defines the character-set which is used in the data.  Only useful in
+combination with a C<mime_type> which refers to C<text> in any shape.
+This field is case-insensitive.
+
+=back
+
+. checked BOOLEAN
+
+=over 4
+
+Whether the added information has been check not to contain illegal
+octets with respect to the transfer encoding and mime type.  If not
+checked, and then set as body for a message, it will be.
+
+=back
+
+. data ARRAY-OF-LINES | STRING
+
+=over 4
+
+The content of the body.  The only way to set the content of a body
+is during the creation of the body.  So if you want to modify the content
+of a message, you need to create a new body with the new content and
+add that to the body.  The reason behind this, is that correct encodings
+and body information must be guaranteed.  It avoids your hassle in
+calculating the number of lines in the body, and checking whether bad
+characters are enclosed in text.
+
+Specify a reference to an ARRAY of lines, each terminated by a newline.
+Or one STRING which may contain multiple lines, separated and terminated
+by a newline.
+
+=back
+
+. disposition STRING|FIELD
+
+=over 4
+
+How this message can be decomposed.  The data relates to the
+C<Content-Disposition> field.  Specify a STRING which will become the
+field content, or a real FIELD.
+
+The content of this field is specified in RFC 1806.  The body of the
+field can be C<inline>, to indicate that the body is intended to be
+displayed automatically upon display of the message. Use C<attachment>
+to indicate that they are separate from the main body of the mail
+message, and that their display should not be automatic, but contingent
+upon some further action of the user.
+
+The C<filename> attribute specifies a name to which is suggested to the
+reader of the message when it is extracted.
+
+=back
+
+. eol 'CR'|'LF'|'CRLF'|'NATIVE'
+
+=over 4
+
+Convert the message into having the specified string as line terminator
+for all lines in the body.  C<NATIVE> is used to represent the C<\n>
+on the current platform and will be translated in the applicable one.
+
+BE WARNED that folders with a non-native encoding may appear on your
+platform, for instance in Windows folders handled from a UNIX system.
+The eol encoding has effect on the size of the body!
+
+=back
+
+. file FILENAME|FILEHANDLE|IOHANDLE
+
+=over 4
+
+Read the data from the specified file, file handle, or object of
+type C<IO::Handle>.
+
+=back
+
+. log LEVEL
+
+. message MESSAGE
+
+=over 4
+
+The message where this body belongs to.
+
+=back
+
+. mime_type STRING|FIELD|MIME
+
+=over 4
+
+The type of data which is added.  You may specify a content of a header
+line as STRING, or a FIELD object.  You may also specify a L<MIME::Type|MIME::Type>
+object.  In any case, it will be kept internally as
+a real field (a L<Mail::Message::Field|Mail::Message::Field> object).  This relates to the
+C<Content-Type> header field.
+
+A mime-type specification consists of two parts: a general class (C<text>,
+C<image>, C<application>, etc) and a specific sub-class.  Examples for
+specific classes with C<text> are C<plain>, C<html>, and C<xml>.  This
+field is case-insensitive but case preserving.  The default mime-type
+is C<text/plain>,
+
+=back
+
+. modified BOOLEAN
+
+=over 4
+
+Whether the body is flagged modified, directly from its creation.
+
+=back
+
+. trace LEVEL
+
+. transfer_encoding STRING|FIELD
+
+=over 4
+
+The encoding that the data has.  If the data is to be encoded, than you
+will have to call L<encode()|Mail::Message::Body::Encode/"Constructing a body"> after the body is created.  That will
+return a new encoded body.  This field is case-insensitive and relates
+to the C<Content-Transfer-Encoding> field in the header.
+
+=back
+
+I<Example:> 
+
+ my $body = Mail::Message::Body::String->new(file => \*IN,
+    mime_type => 'text/html; charset="ISO-8859-1"');
+
+ my $body = Mail::Message::Body::Lines->new(data => ['first', $second],
+    charset => 'ISO-10646', transfer_encoding => 'none');
+
+ my $body = Mail::Message::Body::Lines->new(data => \@lines,
+    transfer_encoding => 'base64');
+
+ my $body = Mail::Message::Body::Lines->new(file => 'picture.gif',
+    mime_type => 'image/gif');
+
+=back
+
+=head2 Constructing a body
+
+
+$obj-E<gt>B<attach>(MESSAGES, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body::Construct/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<check>
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<concatenate>(COMPONENTS)
+
+=over 4
+
+See L<Mail::Message::Body::Construct/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<decoded>(OPTIONS)
+
+=over 4
+
+Returns a body, an object which is (a sub-)class of a L<Mail::Message::Body|Mail::Message::Body>,
+which contains a simplified representation of textual data.  The returned
+object may be the object where this is called on, but may also be a new
+body of any type.
+
+ my $dec = $body->decoded;
+ 
+is equivalent with
+
+ my $dec = $body->encode(mime_type => 'text/plain', charset => 'us-ascii',
+    transfer_encoding => 'none');
+
+The C<$dec> which is returned is a body.  Ask with the L<mimeType()|Mail::Message::Body/"About the payload"> method
+what is produced.  This C<$dec> body is B<not related to a header>.
+
+ Option       Defined in  Default          
+ result_type              <same as current>
+
+. result_type CLASS
+
+=back
+
+$obj-E<gt>B<encode>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<encoded>
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<eol>(['CR'|'LF'|'CRLF'|'NATIVE'])
+
+=over 4
+
+Returns the character (or characters) which are used to separate lines
+within this body.  When a kind of separator is specified, the body
+is translated to contain the specified line endings.
+
+=back
+
+$obj-E<gt>B<foreachLine>(CODE)
+
+=over 4
+
+See L<Mail::Message::Body::Construct/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<stripSignature>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Body::Construct/"Constructing a body">
+
+=back
+
+$obj-E<gt>B<unify>(BODY)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Constructing a body">
+
+=back
+
+=head2 The body
+
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+Returns a true or false value, depending on whether the body of this
+message has been read from file.  This can only false for a
+L<Mail::Message::Body::Delayed|Mail::Message::Body::Delayed>.
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+Returns whether this message-body contains parts which are messages
+by themselves.
+
+=back
+
+$obj-E<gt>B<isNested>
+
+=over 4
+
+Only true for a message body which contains exactly one sub-message:
+the C<Mail::Message::Body::Nested> body type.
+
+=back
+
+$obj-E<gt>B<message>([MESSAGE])
+
+=over 4
+
+Returns the message where this body belongs to, optionally setting it
+to a new MESSAGE first.  If C<undef> is passed, the body will be
+disconnected from the message.
+
+=back
+
+=head2 About the payload
+
+
+$obj-E<gt>B<charset>
+
+=over 4
+
+Returns the character set which is used in the text body as string.  This
+is part of the result of what the C<type> method returns.
+
+=back
+
+$obj-E<gt>B<checked>([BOOLEAN])
+
+=over 4
+
+Returns whether the body encoding has been checked or not (optionally
+after setting the flag to a new value).
+
+=back
+
+$obj-E<gt>B<disposition>([STRING|FIELD])
+
+=over 4
+
+Returns (optionally after setting) how the message can be disposed
+(unpacked).  The related header field is C<Content-Disposition>.
+A L<Mail::Message::Field|Mail::Message::Field> object is returned (which stringifies into
+the field content).  The field content will be C<none> if no disposition
+was specified.
+
+The argument can be a STRING (which is converted into a field), or a
+fully prepared header field.
+
+=back
+
+$obj-E<gt>B<dispositionFilename>(DIRECTORY)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"About the payload">
+
+=back
+
+$obj-E<gt>B<isBinary>
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"About the payload">
+
+=back
+
+$obj-E<gt>B<isText>
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"About the payload">
+
+=back
+
+$obj-E<gt>B<mimeType>
+
+=over 4
+
+Returns a L<MIME::Type|MIME::Type> object which is related to this body's type.  This
+differs from the C<type> method, which results in a L<Mail::Message::Field|Mail::Message::Field>.
+
+I<Example:> 
+
+ if($body->mimeType eq 'text/html') {...}
+ print $body->mimeType->simplified;
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+Returns the number of lines in the message body.  For multi-part messages,
+this includes the header lines and boundaries of all the parts.
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+The total number of bytes in the message body. The size of the body
+is computed in the shape it is in. For example, if this is a base64
+encoded message, the size of the encoded data is returned; you may
+want to call L<Mail::Message::decoded()|Mail::Message/"The body"> first.
+
+=back
+
+$obj-E<gt>B<transferEncoding>([STRING|FIELD])
+
+=over 4
+
+Returns the transfer-encoding of the data within this body as
+L<Mail::Message::Field|Mail::Message::Field> (which stringifies to its content).  If it
+needs to be changed, call the L<encode()|Mail::Message::Body::Encode/"Constructing a body"> or L<decoded()|Mail::Message::Body/"Constructing a body"> method.
+When no encoding is present, the field contains the text C<none>.
+
+The optional STRING or FIELD enforces a new encoding to be set, without the
+actual required translations.
+
+I<Example:> 
+
+ my $transfer = $msg->decoded->transferEncoding;
+ $transfer->print;   # --> Content-Encoding: base64
+ print $transfer;    # --> base64
+
+ if($msg->body->transferEncoding eq 'none') {...}
+
+=back
+
+$obj-E<gt>B<type>([STRING|FIELD])
+
+=over 4
+
+Returns the type of information the body contains as
+L<Mail::Message::Field|Mail::Message::Field> object.  The type is taken from the header
+field C<Content-Type>. If the header did not contain that field,
+then you will get a default field containing C<text/plain>.
+
+You usually can better use L<mimeType()|Mail::Message::Body/"About the payload">, because that will return a
+clever object with type information.
+
+I<Example:> 
+
+ my $msg     = $folder->message(6);
+ $msg->get('Content-Type')->print;
+    # --> Content-Type: text/plain; charset="us-ascii"
+
+ my $content = $msg->decoded;
+ my $type    = $content->type;
+
+ print "This is a $type message\n";
+    # --> This is a text/plain; charset="us-ascii" message
+
+ print "This is a ", $type->body, "message\n";
+    # --> This is a text/plain message
+
+ print "Comment: ", $type->comment, "\n";
+    # --> Comment: charset="us-ascii"
+
+=back
+
+=head2 Access to the payload
+
+
+$obj-E<gt>B<file>
+
+=over 4
+
+Return the content of the body as a file handle.  The returned stream may
+be a real file, or a simulated file in any form that Perl supports.  While
+you may not be able to write to the file handle, you can read from it.
+
+WARNING: Even if the file handle supports writing, do not write
+to the file handle. If you do, some of the internal values of the
+L<Mail::Message::Body|Mail::Message::Body> may not be updated.
+
+=back
+
+$obj-E<gt>B<lines>
+
+=over 4
+
+Return the content of the body as a list of lines (in LIST context) or a
+reference to an array of lines (in SCALAR context).  In scalar context the
+array of lines is cached to avoid needless copying and therefore provide
+much faster access for large messages.
+
+To just get the number of lines in the body, use the L<nrLines()|Mail::Message::Body/"About the payload"> method,
+which is usually much more efficient.
+
+BE WARNED: For some types of bodies the reference will refer to the
+original data. You must not change the referenced data! If you do, some of
+the essential internal variables of the L<Mail::Message::Body|Mail::Message::Body> may not be
+updated.
+
+I<Example:> 
+
+ my @lines    = $body->lines;     # copies lines
+ my $line3    = ($body->lines)[3] # only one copy
+ print $lines[0];
+
+ my $linesref = $body->lines;     # reference to originals
+ my $line3    = $body->lines->[3] # only one copy (faster)
+ print $linesref->[0];
+
+ print $body->[0];                # by overloading
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+Print the body to the specified FILEHANDLE (defaults to the selected handle).
+The handle may be a GLOB, an IO::File object, or... any object with a
+C<print()> method will do.  Nothing useful is returned.
+
+=back
+
+$obj-E<gt>B<printEscapedFrom>(FILEHANDLE)
+
+=over 4
+
+Print the body to the specified FILEHANDLE but all lines which start
+with 'From ' (optionally already preceded by E<gt>'s) will habe an E<gt>
+added in front.  Nothing useful is returned.
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+Return the content of the body as a scalar (a single string).  This is
+a copy of the internally kept information.
+
+I<Example:> 
+
+ my $text = $body->string;
+ print "Body: $body\n";     # by overloading
+
+=back
+
+$obj-E<gt>B<write>(OPTIONS)
+
+=over 4
+
+Write the content of the body to a file.  Be warned that you may want to
+decode the body before writing it!
+
+ Option    Defined in  Default   
+ filename              <required>
+
+. filename FILENAME
+
+I<Example:> write the data to a file
+
+
+ use File::Temp;
+ my $fn = tempfile;
+ $message->decoded->write(filename => $fn)
+    or die "Couldn't write to $fn: $!\n";
+
+I<Example:> using the content-disposition information to write
+
+
+ use File::Temp;
+ my $dir = tempdir; mkdir $dir or die;
+ my $fn  = $message->body->dispositionFilename($dir);
+ $message->decoded->write(filename => $fn)
+    or die "Couldn't write to $fn: $!\n";
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<addTransferEncHandler>(NAME, CLASS|OBJECT)
+
+Mail::Message::Body-E<gt>B<addTransferEncHandler>(NAME, CLASS|OBJECT)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Internals">
+
+=back
+
+$obj-E<gt>B<contentInfoFrom>(HEAD)
+
+=over 4
+
+Transfer the body related info from the header into this body.
+
+=back
+
+$obj-E<gt>B<contentInfoTo>(HEAD)
+
+=over 4
+
+Copy the content information (the C<Content-*> fields) into the specified
+HEAD.  The body was created from raw data without the required information,
+which must be added.  See also L<contentInfoFrom()|Mail::Message::Body/"Internals">.
+
+=back
+
+$obj-E<gt>B<fileLocation>([BEGIN,END])
+
+=over 4
+
+The location of the body in the file.  Returned a list containing begin and
+end.  The begin is the offsets of the first byte if the folder used for
+this body.  The end is the offset of the first byte of the next message.
+
+=back
+
+$obj-E<gt>B<getTransferEncHandler>(TYPE)
+
+=over 4
+
+See L<Mail::Message::Body::Encode/"Internals">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+Returns whether the body has changed.
+
+=back
+
+$obj-E<gt>B<load>
+
+=over 4
+
+Be sure that the body is loaded.  This returns the loaded body.
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+Change the body modification flag.  This will force a re-write of the body
+to a folder file when it is closed.  It is quite dangerous to change the
+body: the same body may be shared between messages within your program.
+
+Especially be warned that you have to change the message-id when you
+change the body of the message: no two messages should have the same id.
+
+Without value, the current setting is returned, although you can better use
+L<isModified()|Mail::Message::Body/"Internals">.
+
+=back
+
+$obj-E<gt>B<moveLocation>([DISTANCE])
+
+=over 4
+
+Move the registration of the message to a new location over DISTANCE.  This
+is called when the message is written to a new version of the same
+folder-file.
+
+=back
+
+$obj-E<gt>B<read>(PARSER, HEAD, BODYTYPE [,CHARS [,LINES]])
+
+=over 4
+
+Read the body with the PARSER from file. The implementation of this method
+will differ between types of bodies.  The BODYTYPE argument is a class name
+or a code reference of a routine which can produce a class name, and is
+used in multipart bodies to determine the type of the body for each part.
+
+The CHARS argument is the estimated number of bytes in the body, or
+C<undef> when this is not known.  This data can sometimes be derived from
+the header (the C<Content-Length> line) or file-size.
+
+The second argument is the estimated number of LINES of the body.  It is less
+useful than the CHARS but may be of help determining whether the message
+separator is trustworthy.  This value may be found in the C<Lines> field
+of the header.
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+When an unknown method is called on a message body object, this may
+not be problematic.  For performance reasons, some methods are
+implemented in separate files, and only demand-loaded.  If this
+delayed compilation of additional modules does not help, an error
+will be produced.
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Body-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Body-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Body-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> No decoder defined for transfer encoding $name.
+
+The data (message body) is encoded in a way which is not currently understood,
+therefore no decoding (or recoding) can take place.
+
+I<Warning:> No encoder defined for transfer encoding $name.
+
+The data (message body) has been decoded, but the required encoding is
+unknown.  The decoded data is returned.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+=head1 DETAILS
+
+
+=head2 Access to the body
+
+A body can be contained in a message, but may also live without a message.
+In both cases it stores data, and the same questions can be asked: what
+type of data it is, how many bytes and lines, what encoding is used.  Any
+body can be encoded and decoded, returning a new body object.  However, 
+bodies which are part of a message will always be in a shape that they can
+be written to a file or send to somewhere: they will be encoded if needed.
+
+I<Example:> 
+
+ my $body    = Mail::Message::Body::String->new(mime_type => 'image/gif');
+ $body->print(\*OUT);    # this is binary image data...
+
+ my $encoded = $message->body($body);
+ $encoded->print(\*OUT); # ascii data, encoded image
+
+Now encoded refers to the body of the C<$message> which is the content of
+C<$body> in a shape that it can be transmitted.  Usually C<base64> encoding
+is used.
+
+=head2 Body class implementation
+
+The body of a message can be stored in many ways.  Roughtly, the
+implementations can be split in two groups: the data collectors and
+the complex bodies.  The primer implement various ways to access data,
+and are full compatible: they only differ in performance and memory
+footprint under different circumstances.  The latter are created to
+handle complex multiparts and lazy extraction.
+
+=head3 Data collector bodies
+
+=over 4
+
+=item * L<Mail::Message::Body::String|Mail::Message::Body::String>
+
+The whole message body is stored in one scalar.  Small messages can be
+contained this way without performance penalties.
+
+=item * L<Mail::Message::Body::Lines|Mail::Message::Body::Lines>
+
+Each line of the message body is stored as single scalar.  This is a
+useful representation for a detailed look in the message body, which is
+usually line-organized.
+
+=item * L<Mail::Message::Body::File|Mail::Message::Body::File>
+
+The message body is stored in an external temporary file.  This type of
+storage is especially useful when the body is large, the total folder is
+large, or memory is limited.
+
+=item * Mail::Message::Body::InFolder
+
+NOT IMPLEMENTED YET.
+The message is kept in the folder, and is only taken out when the
+content is changed.
+
+=item * Mail::Message::Body::External
+
+NOT IMPLEMENTED YET.
+The message is kept in a separate file, usually because the message body
+is large.  The difference with the C<::External> object is that this external
+storage stays this way between closing and opening of a folder. The
+C<::External> object only uses a file when the folder is open.
+
+=back
+
+=head3 Complex bodies
+
+=over 4
+
+=item * L<Mail::Message::Body::Delayed|Mail::Message::Body::Delayed>
+
+The message-body is not yet read, but the exact location of the
+body is known so the message can be read when needed.  This is part of
+the lazy extraction mechanism.  Once extracted, the object can become
+any simple or complex body.
+
+=item * L<Mail::Message::Body::Multipart|Mail::Message::Body::Multipart>
+
+The message body contains a set of sub-messages (which can contain
+multipart bodies themselves).  Each sub-message is an instance
+of L<Mail::Message::Part|Mail::Message::Part>, which is an extension of L<Mail::Message|Mail::Message>.
+
+=item * L<Mail::Message::Body::Nested|Mail::Message::Body::Nested>
+
+Nested messages, like C<message/rfc822>: they contain a message in
+the body.  For most code, they simply behave like multiparts.
+
+=back
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Bounce.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Bounce.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Bounce.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,52 @@
+
+use strict;
+
+package Mail::Message;
+use vars '$VERSION';
+$VERSION = '2.055';
+
+use Mail::Message::Head::Complete;
+use Mail::Message::Field;
+
+
+sub bounce(@)
+{   my $self   = shift;
+    my $bounce = $self->clone;
+    my $head   = $bounce->head;
+
+    if(@_==1 && ref $_[0] && $_[0]->isa('Mail::Message::Head::ResentGroup' ))
+    {    $head->addResentGroup(shift);
+         return $bounce;
+    }
+
+    my @rgs    = $head->resentGroups;  # No groups yet, then require Received
+    my $rg     = $rgs[0];
+
+    if(defined $rg)
+    {   $rg->delete;     # Remove group to re-add it later: others field order
+        while(@_)        #  in header would be disturbed.
+        {   my $field = shift;
+            ref $field ? $rg->set($field) : $rg->set($field, shift);
+        }
+    }
+    else
+    {   $rg = Mail::Message::Head::ResentGroup->new(@_);
+    }
+ 
+    #
+    # Add some nice extra fields.
+    #
+
+    $rg->set(Date => Mail::Message::Field->toDate)
+        unless defined $rg->date;
+
+    unless(defined $rg->messageId)
+    {   my $msgid = $head->createMessageId;
+        $rg->set('Message-ID' => "<$msgid>");
+    }
+
+    $head->addResentGroup($rg);
+    $bounce;
+}
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Bounce.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Bounce.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Bounce.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,84 @@
+
+=head1 NAME
+
+Mail::Message::Construct::Bounce - bounce a Mail::Message
+
+
+
+=head1 SYNOPSIS
+
+ $message->bounce(To => 'you')->send;
+
+
+=head1 DESCRIPTION
+
+Complex functionality on L<Mail::Message|Mail::Message> objects is implemented in
+different files which are autoloaded.  This file implements the
+functionality related to bouncing messages off to other destinations.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructing a message
+
+
+$obj-E<gt>B<bounce>([RG-OBJECT|OPTIONS])
+
+=over 4
+
+The program calling this method considers itself as an intermediate step
+in the message delivery process; it therefore leaves a resent group
+of header fields as trace.
+
+When a message is received, the Mail Transfer Agent (MTA) adds a
+C<Received> field to the header.  As OPTIONS, you may specify lines
+which are added to the resent group of that received field.  C<Resent->
+is prepended before the field-names automatically, unless already present.
+
+You may also specify an instantiated L<Mail::Message::Head::ResentGroup|Mail::Message::Head::ResentGroup> (RG)
+object.  See L<Mail::Message::Head::ResentGroup::new()|Mail::Message::Head::ResentGroup/"METHODS"> for the available
+options.  This is required if you want to add a new resent group: create
+a new C<Received> line in the header as well.
+
+If you are planning to change the body of a bounce message, don't!  Bounced
+messages have the same message-id as the original message, and therefore
+should have the same content (message-ids are universally unique).  If you
+still insist, use L<Mail::Message::body()|Mail::Message/"The body">.
+
+I<Example:> 
+
+ my $bounce = $folder->message(3)->bounce(To => 'you', Bcc => 'everyone');
+
+ $bounce->send;
+ $outbox->addMessage($bounce);
+
+ my $rg     = Mail::Message::Head::ResentGroup->new(To => 'you',
+    Received => 'from ... by ...');
+ $msg->bounce($rg)->send;
+
+=back
+
+
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Build.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Build.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Build.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,112 @@
+
+use strict;
+
+package Mail::Message;
+use vars '$VERSION';
+$VERSION = '2.055';
+
+use Mail::Message::Head::Complete;
+use Mail::Message::Body::Lines;
+use Mail::Message::Body::Multipart;
+use Mail::Message::Field;
+
+use Mail::Address;
+use Carp;
+use Scalar::Util 'blessed';
+use IO::Lines;
+
+
+sub build(@)
+{   my $class = shift;
+
+    my @parts
+      = ! ref $_[0] ? ()
+      : $_[0]->isa('Mail::Message')       ? shift
+      : $_[0]->isa('Mail::Message::Body') ? shift
+      :               ();
+
+    my ($head, $type, @headerlines);
+    while(@_)
+    {   my $key = shift;
+        if(ref $key && $key->isa('Mail::Message::Field'))
+        {   if($key->name eq 'content-type') { $type = $key }
+            else { push @headerlines, $key }
+            next;
+        }
+
+        my $value = shift;
+        next unless defined $value;
+
+        my @data;
+
+        if($key eq 'head')
+        {   $head = $value }
+        elsif($key eq 'data')
+        {   @data = Mail::Message::Body->new(data => $value) }
+        elsif($key eq 'file')
+        {   @data = Mail::Message::Body->new(file => $value) }
+        elsif($key eq 'files')
+        {   @data = map {Mail::Message::Body->new(file => $_) } @$value }
+        elsif($key eq 'attach')
+        {   @data = ref $value eq 'ARRAY' ? @$value : $value }
+        elsif(lc $key eq 'content-type')
+        {   $type = Mail::Message::Field->new($key, $value) }
+        elsif($key =~ m/^[A-Z]/)
+        {   push @headerlines, $key, $value }
+        else
+        {   croak "Skipped unknown key $key in build." } 
+
+        push @parts, grep {defined $_} @data if @data;
+    }
+
+    my $body
+       = @parts==0 ? Mail::Message::Body::Lines->new()
+       : @parts==1 ? $parts[0]
+       : Mail::Message::Body::Multipart->new(parts => \@parts);
+
+    # Setting the type explicitly, only after the body object is finalized
+    $body->type($type) if defined $type;
+
+    $class->buildFromBody($body, $head, @headerlines);
+}
+
+#------------------------------------------
+
+
+sub buildFromBody(@)
+{   my ($class, $body) = (shift, shift);
+    my @log     = $body->logSettings;
+
+    my $head;
+    if(ref $_[0] && $_[0]->isa('Mail::Message::Head')) { $head = shift }
+    else
+    {   shift unless defined $_[0];   # undef as head
+        $head = Mail::Message::Head::Complete->new(@log);
+    }
+
+    while(@_)
+    {   if(ref $_[0]) {$head->add(shift)}
+        else          {$head->add(shift, shift)}
+    }
+
+    my $message = $class->new
+     ( head => $head
+     , @log
+     );
+
+    $message->body($body);
+
+    # be sure the message-id is actually stored in the header.
+    $head->add('Message-Id' => '<'.$message->messageId.'>')
+        unless defined $head->get('message-id');
+
+    $head->add(Date => Mail::Message::Field->toDate)
+        unless defined $head->get('Date');
+
+    $head->add('MIME-Version' => '1.0')  # required by rfc2045
+        unless defined $head->get('MIME-Version');
+
+    $message;
+}
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Build.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Build.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Build.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,205 @@
+
+=head1 NAME
+
+Mail::Message::Construct::Build - building a Mail::Message from components
+
+
+
+=head1 SYNOPSIS
+
+ my $msg3 = Mail::Message->build
+   (From => 'me', data => "only two\nlines\n");
+
+ my $msg4 = Mail::Message->buildFromBody($body);
+
+
+=head1 DESCRIPTION
+
+Complex functionality on L<Mail::Message|Mail::Message> objects is implemented in
+different files which are autoloaded.  This file implements the
+functionality related to building of messages from various components.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructing a message
+
+
+Mail::Message-E<gt>B<build>([MESSAGE|BODY], CONTENT)
+
+=over 4
+
+Simplified message object builder.  In case a MESSAGE is
+specified, a new message is created with the same body to start with, but
+new headers.  A BODY may be specified as well.  However, there are more
+ways to add data simply.
+
+The CONTENT is a list of key-value pairs and header field objects.
+The keys which start with a capital are used as header-lines.  Lower-cased
+fields are used for other purposes as listed below.  Each field may be used
+more than once.  Pairs where the value is C<undef> are ignored.
+
+If more than one C<data>, C<file>, and C<attach> is specified, a multi-parted
+message is created.  The C<Content-Type> field is treated separately: to
+set the type of the produced message body after it has been created.  For
+instance, to explicitly state that you wish a C<multipart/alternative>
+in stead of the default C<multipart/mixed>.  If
+you wish to specify the type per datum, you need to start playing with
+L<Mail::Message::Body|Mail::Message::Body> objects yourself.
+
+This C<build> method will use L<buildFromBody()|Mail::Message::Construct::Build/"Constructing a message"> when the body object has
+been constructed.  Together, they produce your message.
+
+ Option  Defined in       Default
+ attach                   undef  
+ data                     undef  
+ file                     undef  
+ files                    C<[ ]> 
+ head                     undef  
+
+. attach BODY|MESSAGE|ARRAY-OF-BODY
+
+=over 4
+
+One attachment to the message.  Each attachment can be full MESSAGE or a BODY.
+
+ attach => $folder->message(3)->decoded  # body
+ attach => $folder->message(3)           # message
+
+=back
+
+. data STRING|ARRAY-OF-LINES
+
+=over 4
+
+The text for one part, specified as one STRING, or an ARRAY of lines.  Each
+line, including the last, must be terminated by a newline.  This argument
+is passed to L<Mail::Message::Body::new(data)|Mail::Message::Body/"Constructors"> to
+construct one.
+
+  data => [ "line 1\n", "line 2\n" ]     # array of lines
+  data => <<'TEXT'                       # string
+ line 1
+ line 2
+ TEXT
+
+=back
+
+. file FILENAME|FILEHANDLE|IOHANDLE
+
+=over 4
+
+Create a body where the data is read from the specified FILENAME,
+FILEHANDLE, or object of type IO::Handle.  Also this body is used
+to create a L<Mail::Message::Body|Mail::Message::Body>.
+
+ my $in = IO::File->new('/etc/passwd', 'r');
+
+ file => 'picture.jpg'                   # filename
+ file => \*MYINPUTFILE                   # file handle
+ file => $in                             # any IO::Handle
+
+ open my $in, '<', '/etc/passwd';        # alternative for IO::File
+
+=back
+
+. files ARRAY-OF-FILE
+
+=over 4
+
+See option file, but then an array reference collection more of them.
+
+=back
+
+. head HEAD
+
+=over 4
+
+Start with a prepared header, otherwise one is created.
+
+=back
+
+I<Example:> 
+
+ my $msg = Mail::Message->build
+  ( From   => 'me at home.nl'
+  , To     => Mail::Address->new('your name', 'you at yourplace.aq')
+  , Cc     => 'everyone at example.com'
+  , $other_message->get('Bcc')
+
+  , data   => [ "This is\n", "the first part of\n", "the message\n" ]
+  , file   => 'myself.gif'
+  , file   => 'you.jpg'
+  , attach => $signature
+  );
+
+ my $msg = Mail::Message->build
+  ( To     => 'you'
+  , 'Content-Type' => 'text/html'
+  , data   => "<html></html>"
+  );
+
+=back
+
+Mail::Message-E<gt>B<buildFromBody>(BODY, [HEAD], HEADERS)
+
+=over 4
+
+Shape a message around a BODY.  Bodies have information about their
+content in them, which is used to construct a header for the message.
+You may specify a HEAD object which is pre-initialized, or one is
+created for you (also when HEAD is C<undef>).
+Next to that, more HEADERS can be specified which are stored in that
+header.
+
+Header fields are added in order, and before the header lines as
+defined by the body are taken.  They may be supplied as key-value
+pairs or L<Mail::Message::Field|Mail::Message::Field> objects.  In case of a key-value
+pair, the field's name is to be used as key and the value is a
+string, address (Mail::Address object), or array of addresses.
+
+A C<Date>, C<Message-Id>, and C<MIME-Version> field are added unless
+supplied.
+
+I<Example:> 
+
+ my $type = Mail::Message::Field->new('Content-Type', 'text/html'
+   , 'charset="us-ascii"');
+
+ my @to   = ( Mail::Address->new('Your name', 'you at example.com')
+            , 'world at example.info'
+            );
+
+ my $msg  = Mail::Message->buildFromBody
+   ( $body
+   , From => 'me at example.nl'
+   , To   => \@to
+   , $type
+   );
+
+=back
+
+
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Forward.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Forward.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Forward.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,254 @@
+
+use strict;
+
+package Mail::Message;
+use vars '$VERSION';
+$VERSION = '2.055';
+
+use Mail::Message::Body::Multipart;
+use Mail::Message::Body::Nested;
+use Scalar::Util 'blessed';
+
+
+# tests in t/57forw1f.t
+
+sub forward(@)
+{   my $self    = shift;
+    my %args    = @_;
+
+    return $self->forwardNo(@_) if exists $args{body};
+
+    my $include = $args{include} || 'INLINE';
+    return $self->forwardInline(@_) if $include eq 'INLINE';
+
+    my $preamble = $args{preamble};
+    push @_, preamble => Mail::Message::Body->new(data => $preamble)
+        if defined $preamble && ! ref $preamble;
+
+    return $self->forwardAttach(@_)      if $include eq 'ATTACH';
+    return $self->forwardEncapsulate(@_) if $include eq 'ENCAPSULATE';
+
+    $self->log(ERROR => 'Cannot include forward source as $include.');
+    undef;
+}
+
+#------------------------------------------
+
+
+sub forwardNo(@)
+{   my ($self, %args) = @_;
+
+    my $body = $args{body};
+    $self->log(INTERNAL => "No body supplied for forwardNo()")
+       unless defined $body;
+
+    #
+    # Collect header info
+    #
+
+    my $mainhead = $self->toplevel->head;
+
+    # Where it comes from
+    my $from = $args{From};
+    unless(defined $from)
+    {   my @from = $self->to;
+        $from    = \@from if @from;
+    }
+
+    # To whom to send
+    my $to = $args{To};
+    $self->log(ERROR => "No address to create forwarded to."), return
+       unless $to;
+
+    # Create a subject
+    my $srcsub  = $args{Subject};
+    my $subject
+     = ! defined $srcsub ? $self->forwardSubject($self->subject)
+     : ref $srcsub       ? $srcsub->($self->subject)
+     :                     $srcsub;
+
+    # Create a nice message-id
+    my $msgid   = $args{'Message-ID'} || $mainhead->createMessageId;
+    $msgid      = "<$msgid>" if $msgid && $msgid !~ /^\s*\<.*\>\s*$/;
+
+    # Thread information
+    my $origid  = '<'.$self->messageId.'>';
+    my $refs    = $mainhead->get('references');
+
+    my $forward = Mail::Message->buildFromBody
+      ( $body
+      , From        => ($from || '(undisclosed)')
+      , To          => $to
+      , Subject     => $subject
+      , References  => ($refs ? "$refs $origid" : $origid)
+      );
+
+    my $newhead = $forward->head;
+    $newhead->set(Cc   => $args{Cc}  ) if $args{Cc};
+    $newhead->set(Bcc  => $args{Bcc} ) if $args{Bcc};
+    $newhead->set(Date => $args{Date}) if $args{Date};
+
+    # Ready
+
+    $self->log(PROGRESS => "Forward created from $origid");
+    $forward;
+}
+
+#------------------------------------------
+
+
+sub forwardInline(@)
+{   my ($self, %args) = @_;
+
+    my $body     = $self->body;
+
+    while(1)    # simplify
+    {   if($body->isMultipart && $body->parts==1)
+                               { $body = $body->part(0)->body }
+        elsif($body->isNested) { $body = $body->nested->body }
+        else                   { last }
+    }
+
+    # Prelude must be a real body, otherwise concatenate will not work
+    my $prelude = exists $args{prelude} ? $args{prelude}
+       : $self->forwardPrelude;
+
+    $prelude     = Mail::Message::Body->new(data => $prelude)
+        if defined $prelude && ! blessed $prelude;
+ 
+    # Postlude
+    my $postlude = exists $args{postlude} ? $args{postlude}
+       : $self->forwardPostlude;
+ 
+    # Binary bodies cannot be inlined, therefore they will be rewritten
+    # into a forwardAttach... preamble must replace prelude and postlude.
+
+    if($body->isMultipart || $body->isBinary)
+    {   $args{preamble} ||= $prelude->concatenate
+           ( $prelude
+           , ($args{is_attached} || "[The forwarded message is attached]\n")
+           , $postlude
+           );
+        return $self->forwardAttach(%args);
+    }
+    
+    $body        = $body->decoded;
+    my $strip    = (!exists $args{strip_signature} || $args{strip_signature})
+                && !$body->isNested;
+
+    $body        = $body->stripSignature
+      ( pattern     => $args{strip_signature}
+      , max_lines   => $args{max_signature}
+      ) if $strip;
+
+    if(defined(my $quote = $args{quote}))
+    {   my $quoting = ref $quote ? $quote : sub {$quote . $_};
+        $body = $body->foreachLine($quoting);
+    }
+
+    #
+    # Create the message.
+    #
+
+    my $signature = $args{signature};
+    $signature = $signature->body
+        if defined $signature && $signature->isa('Mail::Message');
+
+    my $composed  = $body->concatenate
+      ( $prelude, $body, $postlude
+      , (defined $signature ? "-- \n" : undef), $signature
+      );
+
+    $self->forwardNo(%args, body => $composed);
+}
+
+#------------------------------------------
+
+
+sub forwardAttach(@)
+{   my ($self, %args) = @_;
+
+    my $body  = $self->body;
+    my $strip = !exists $args{strip_signature} || $args{strip_signature};
+
+    if($body->isMultipart)
+    {   $body = $body->stripSignature if $strip;
+        $body = $body->part(0)->body  if $body->parts == 1;
+    }
+
+    my $preamble = $args{preamble};
+    $self->log(ERROR => 'forwardAttach requires a preamble object'), return
+       unless ref $preamble;
+
+    my @parts = ($preamble, $body);
+    push @parts, $args{signature} if defined $args{signature};
+    my $multi = Mail::Message::Body::Multipart->new(parts => \@parts);
+
+    $self->forwardNo(%args, body => $multi);
+}
+
+#------------------------------------------
+
+
+sub forwardEncapsulate(@)
+{   my ($self, %args) = @_;
+
+    my $preamble = $args{preamble};
+    $self->log(ERROR => 'forwardEncapsulate requires a preamble object'), return
+       unless ref $preamble;
+
+    my $nested= Mail::Message::Body::Nested->new(nested => $self->clone);
+    my @parts = ($preamble, $nested);
+    push @parts, $args{signature} if defined $args{signature};
+
+    my $multi = Mail::Message::Body::Multipart->new(parts => \@parts);
+
+    $self->forwardNo(%args, body => $multi);
+}
+
+#------------------------------------------
+
+
+# tests in t/57forw0s.t
+
+sub forwardSubject($)
+{   my ($self, $subject) = @_;
+    defined $subject && length $subject ? "Forw: $subject" : "Forwarded";
+}
+
+#------------------------------------------
+
+
+sub forwardPrelude()
+{   my $head  = shift->head;
+
+    my @lines = "---- BEGIN forwarded message\n";
+    my $from  = $head->get('from');
+    my $to    = $head->get('to');
+    my $cc    = $head->get('cc');
+    my $date  = $head->get('date');
+
+    push @lines, $from->string if defined $from;
+    push @lines,   $to->string if defined $to;
+    push @lines,   $cc->string if defined $cc;
+    push @lines, $date->string if defined $date;
+    push @lines, "\n";
+
+    \@lines;
+}
+
+#------------------------------------------
+
+
+sub forwardPostlude()
+{   my $self = shift;
+    my @lines = ("---- END forwarded message\n");
+    \@lines;
+}
+
+#------------------------------------------
+
+
+#------------------------------------------
+ 
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Forward.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Forward.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Forward.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,509 @@
+
+=head1 NAME
+
+Mail::Message::Construct::Forward - forwarding a Mail::Message
+
+
+
+=head1 SYNOPSIS
+
+ my Mail::Message $forward = $message->forward(To => 'you');
+ $forward->send;
+
+
+=head1 DESCRIPTION
+
+Complex functionality on L<Mail::Message|Mail::Message> objects is implemented in
+different files which are autoloaded.  This file implements the
+functionality related to creating forwarded messages.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructing a message
+
+
+$obj-E<gt>B<forward>(OPTIONS)
+
+=over 4
+
+Forward the content of this message.  The body of the message to be forwarded
+is encapsulated in some accompanying text (if you have no wish for that, than
+C<bounce> is your choice).  A L<Mail::Message|Mail::Message> object is returned on success.
+
+You may forward a whole message, but also message parts.
+You may wish to overrule some of the default header settings for the
+reply immediately, or you may do that later with C<set> on the header.
+
+When a multi-part body is encountered, and the message is included to
+ATTACH, the parts which look like signatures will be removed.  If only
+one message remains, it will be the added as single attachment, otherwise
+a nested multipart will be the result.  The value of this option does not
+matter, as long as it is present.  See C<Mail::Message::Body::Multipart>.
+
+ Option      Defined in       Default                                                                       
+ Bcc                          undef                                                                         
+ Cc                           undef                                                                         
+ Date                         <now>                                                                         
+ From                         <'to' in current>                                                             
+ Message-ID                   <uniquely generated>                                                          
+ Subject                      L<forwardSubject()|Mail::Message::Construct::Forward/"Constructing a message">
+ To                           <required>                                                                    
+ body                         undef                                                                         
+ include                      <if body then C<'NO'> else C<'INLINE'>>                                       
+ preamble                     C<constructed from prelude and postlude>                                      
+ signature                    undef                                                                         
+
+. Bcc ADDRESSES
+
+=over 4
+
+Receivers of blind carbon copies: their names will not be published to
+other message receivers.
+
+=back
+
+. Cc ADDRESSES
+
+=over 4
+
+The carbon-copy receivers, by default none.
+
+=back
+
+. Date DATE
+
+=over 4
+
+The date to be used in the message sent.
+
+=back
+
+. From ADDRESSES
+
+=over 4
+
+Your identification, by default taken from the C<To> field of the
+source message.
+
+=back
+
+. Message-ID STRING
+
+=over 4
+
+Supply a STRING as specific message-id for the forwarded message.
+By default, one is generated for you.  If there are no angles around
+your id, they will be added.
+
+=back
+
+. Subject STRING|CODE
+
+=over 4
+
+Force the subject line to the specific STRING, or the result of the
+subroutine specified by CODE.  The subroutine will be called passing
+the subject of the original message as only argument.  By default,
+the L<forwardSubject()|Mail::Message::Construct::Forward/"Constructing a message"> method is used.
+
+=back
+
+. To ADDRESSES
+
+=over 4
+
+The destination of your message. Obligatory.  The ADDRESSES may be
+specified as string, a Mail::Address object, or as array of
+Mail::Address objects.
+
+=back
+
+. body OBJECT
+
+=over 4
+
+If you specify a fully prepared body OBJECT, it will be used as forwarded
+message contents.  In this case, only the headers are constructed for you.
+
+=back
+
+. include 'NO'|'INLINE'|'ATTACH'|'ENCAPSULATE'
+
+=over 4
+
+Must the message where this is a reply to be included in the message?
+When C<INLINE> is given, you may pass the options of L<forwardInline()|Mail::Message::Construct::Forward/"Constructing a message">
+as well.
+
+In many applications, the forward option C<as attachment> results in a
+structure which is produced when this option is set to C<ENCAPSULATE>.
+Their default behavior is usually C<INLINE>.
+
+It is only possible to inline textual messages, therefore binary or
+multi-part messages will always be enclosed as attachment.
+Read the details about this choice in section L</Creating a forward>
+subsection L</Including the original message>.
+
+=back
+
+. preamble STRING|BODY
+
+=over 4
+
+Part which is attached before the forwarded message.  If no preamble
+is given, then it is constructed from the prelude and postlude.  When
+these are also not present, you will still get a one liner: the result
+of L<forwardPrelude()|Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+. signature BODY|MESSAGE
+
+=over 4
+
+The signature to be added in case of a multi-part forward.  The mime-type
+of the signature body should indicate this is a used as such.  However,
+in INLINE mode, the body will be taken, a line containing C<'-- '> added
+before it, and added behind the epilogue.
+
+=back
+
+=back
+
+$obj-E<gt>B<forwardAttach>(OPTIONS)
+
+=over 4
+
+Forward the message as I<flat> attachment to the specified C<preamble>.  You
+can specify all options available to C<forward()>, although a C<preamble>
+which is provided as body object is required, and any specified C<body>
+is ignored.
+
+ Option    Defined in  Default   
+ preamble              <required>
+
+. preamble BODY|PART
+
+=back
+
+$obj-E<gt>B<forwardEncapsulate>(OPTIONS)
+
+=over 4
+
+Like L<forwardAttach()|Mail::Message::Construct::Forward/"Constructing a message">, but in this case the original message is first
+encapsulated as nested message in a L<Mail::Message::Body::Nested|Mail::Message::Body::Nested>, and
+then joint into a multipart.
+
+You can specify all options available to C<forward()>, although a C<preamble>
+which is provided as body object is required, and any specified C<body>
+is ignored.  Signatures are not stripped.  Signatures are not stripped.
+
+ Option    Defined in  Default   
+ preamble              <required>
+
+. preamble BODY|PART
+
+=back
+
+$obj-E<gt>B<forwardInline>(OPTIONS)
+
+=over 4
+
+This method is equivalent in behavior to L<forward()|Mail::Message::Construct::Forward/"Constructing a message"> with the
+option C<include> set to C<'INLINE'>.  You can specify most of
+the fields which are available to L<forward()|Mail::Message::Construct::Forward/"Constructing a message"> except
+C<include> and C<body>.
+
+ Option           Defined in       Default                                   
+ is_attached                       C<"[The forwarded message is attached]\n">
+ max_signature                     C<10>                                     
+ postlude                          undef                                     
+ prelude                           undef                                     
+ quote                             undef                                     
+ strip_signature                   C<qr/^--\s/>                              
+
+. is_attached STRING
+
+=over 4
+
+A forward on binary messages can not be inlined.  Therefore, they are
+automatically translated into an attachment, as made by L<forwardAttach()|Mail::Message::Construct::Forward/"Constructing a message">.
+The obligatory preamble option to that method may be specified as option
+to this method, to be used in case of such a forward of a binary, but
+is otherwise constructed from the prelude, the value of this option, and
+the postlude.
+
+=back
+
+. max_signature INTEGER
+
+=over 4
+
+Passed to L<Mail::Message::Body::stripSignature(max_lines)|Mail::Message::Body::Construct/"Constructing a body">.  Only
+effective for single-part messages.
+
+=back
+
+. postlude BODY
+
+=over 4
+
+The line(s) which to be added after the quoted reply lines.  Create a
+body for it first.  This should not include the signature, which has its
+own option.  The signature will be added after the postlude when the
+forwarded message is C<INLINE>d.
+
+=back
+
+. prelude BODY
+
+=over 4
+
+The line(s) which will be added before the quoted forwarded lines.
+If nothing is specified, the result of the L<forwardPrelude()|Mail::Message::Construct::Forward/"Constructing a message"> method
+is used.  When C<undef> is specified, no prelude will be added.
+
+=back
+
+. quote CODE|STRING
+
+=over 4
+
+Mangle the lines of an C<INLINE>d reply with CODE, or by prepending a
+STRING to each line.  The routine specified by CODE is called when the
+line is in C<$_>.
+
+By default, nothing is added before each line.  This option is processed
+after the body has been decoded.
+
+=back
+
+. strip_signature REGEXP|STRING|CODE
+
+=over 4
+
+Remove the signature of the sender.  The value of this parameter is
+passed to L<Mail::Message::Body::stripSignature(pattern)|Mail::Message::Body::Construct/"Constructing a body">, unless the
+source text is not included.  The signature is stripped from the message
+before quoting.
+
+=back
+
+=back
+
+$obj-E<gt>B<forwardNo>(OPTIONS)
+
+=over 4
+
+Construct a forward, where the whole body of the message is already
+constructed.  That complex body is usually produced in L<forwardInline()|Mail::Message::Construct::Forward/"Constructing a message">,
+L<forwardAttach()|Mail::Message::Construct::Forward/"Constructing a message">, or L<forwardEncapsulate()|Mail::Message::Construct::Forward/"Constructing a message">.
+
+The OPTIONS are the same as for C<forward()> except that C<body> is
+required.  Some other options, like C<preamble>, are ignored.
+
+ Option  Defined in  Default   
+ body                <required>
+
+. body BODY
+
+=back
+
+$obj-E<gt>B<forwardPostlude>
+
+=over 4
+
+Added after the forwarded message.
+
+I<Example:> 
+
+ ---- END forwarded message
+
+=back
+
+$obj-E<gt>B<forwardPrelude>
+
+=over 4
+
+Create a few lines to be included before the forwarded message
+content.  The return is an array of lines.
+
+I<Example:> 
+
+ ---- BEGIN forwarded message
+ From: him at somewhere.else.nl (Original Sender)
+ To: me at example.com (Me the receiver)
+ Cc: the.rest at world.net
+ Date: Wed, 9 Feb 2000 15:44:05 -0500
+ <blank line>
+
+=back
+
+$obj-E<gt>B<forwardSubject>(STRING)
+
+=over 4
+
+Create a subject for a message which is a forward from this one.  This routine
+tries to count the level of reply in subject field, and transform it into
+a standard form.  Please contribute improvements.
+
+I<Example:> 
+
+ subject                 --> Forw: subject
+ Re: subject             --> Forw: Re: subject
+ Re[X]: subject          --> Forw: Re[X]: subject
+ <blank>                 --> Forwarded
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot include forward source as $include.
+
+Unknown alternative for the L<forward(include)|Mail::Message::Construct::Forward/"Constructing a message">.  Valid choices are
+C<NO>, C<INLINE>, C<ATTACH>, and C<ENCAPSULATE>.
+
+I<Error:> No address to create forwarded to.
+
+If a forward message is created, a destination address must be specified.
+
+I<Error:> forwardAttach requires a preamble object
+
+
+I<Error:> forwardEncapsulate requires a preamble object
+
+
+
+=head1 DETAILS
+
+
+=head2 Creating a forward
+
+
+=head3 Including the original message
+
+The main difference between L<bounce()|Mail::Message::Construct::Bounce/"Constructing a message"> and L<forward()|Mail::Message::Construct::Forward/"Constructing a message"> is the reason
+for message processing.  The I<bounce> has no intention to modify the
+content of message: the same information is passed-on to someplace else.
+This may mean some conversions, but for instance, the Message-ID does
+not need to be changed.
+
+The purpose of I<forward()> is to pass on information which is
+modified: annotated or reduced.  The information is not sent back
+to the author of the original message (which is implemented by L<reply()|Mail::Message::Construct::Reply/"Constructing a message">),
+but to someone else.
+
+So: some information comes in, is modified, and than forwarded to someone
+else.  Currently, there are four ways to get the original information
+included:
+
+=over 4
+
+=item * specify a body
+
+When you specify L<forward(body)|Mail::Message::Construct::Forward/"Constructing a message">, you have created your own body object to
+be used as content of the forwarded message.  This implies that
+L<forward(include)|Mail::Message::Construct::Forward/"Constructing a message"> is C<'NO'>: no automatic generation of the forwarded
+body.
+
+=item * inline the original
+
+The L<forward(include)|Mail::Message::Construct::Forward/"Constructing a message"> is set to C<'INLINE'> (the default)
+This is the most complicated situation, but most often used by MUAs:
+the original message is inserted textually in the new body.  You can
+set-up automatic stripping of signatures, the way of encapsulation,
+and texts which should be added before and after the encapsulated part.
+
+However, the result may not always be what you expect.  For instance,
+some people use very long signatures which will not be automatically
+stripped because the pass the threshold.  So, you probably need some
+manual intervention after the message is created and before it is sent.
+
+When a binary message is encountered, inlining is impossible.  In that
+case, the message is treated as if C<'ENCAPSULATE'> was requested.
+
+=item * attach the original
+
+When L<forward(include)|Mail::Message::Construct::Forward/"Constructing a message"> is explicitly set to C<'ATTACH'> the result
+will be a multipart which contains two parts.  The first part will
+be your message, and the second the body of the original message.
+
+This means that the headers of the forwarded message are used for
+the new message, and detached from the part which now contains the
+original body information.  Content related headers will (of course)
+still be part of that part, but lines line C<To> and C<Subject> will
+not be stored with that part.
+
+As example of the structural transformation:
+
+ # code: $original->printStructure;
+ multipart/alternative: The source message
+   text/plain: content in raw text
+   text/html: content as html
+
+ # code: $fwd = $original->forward(include => 'ATTACH');
+ # code: $fwd->printStructure
+ multipart/mixed: The source message
+   text/plain: prelude/postlude/signature
+   multipart/alternative
+     text/plain: content in raw text
+     text/html: content as html
+
+=item * encapsulate the original
+
+When L<forward(include)|Mail::Message::Construct::Forward/"Constructing a message"> is explicitly set to C<'ENCAPSULATE'>, then
+the original message is left in-tact as good as possible.  The lines
+of the original message are used in the main message header but also
+enclosed in the part header.
+
+The encapsulation is implemented using a nested message, content type
+C<message/rfc822>.  As example of the structural transformation:
+
+ # code: $original->printStructure;
+ multipart/alternative: The source message
+   text/plain: content in raw text
+   text/html: content as html
+
+ # code: $fwd = $original->forward(include => 'ENCAPSULATE');
+ # code: $fwd->printStructure
+ multipart/mixed: The source message
+   text/plain: prelude/postlude/signature
+   message/rfc822
+      multipart/alternative: The source message
+         text/plain: content in raw text
+         text/html: content as html
+
+The message structure is much more complex, but no information is lost.
+This is probably the reason why many MUAs use this when the forward
+an original message as attachment.
+
+=back
+
+After the creation of the forward, you may want to L<rebuild()|Mail::Message::Construct::Rebuild/"Constructing a message"> the
+message to remove unnecessary complexities.  Of course, that is not
+required.
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Read.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Read.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Read.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,72 @@
+
+use strict;
+
+package Mail::Message;
+use vars '$VERSION';
+$VERSION = '2.055';
+
+use Mail::Box::FastScalar;
+
+
+sub read($@)
+{   my ($class, $from, %args) = @_;
+    my ($filename, $file);
+    my $ref       = ref $from;
+
+    if(!$ref)
+    {   $filename = 'scalar';
+        $file     = Mail::Box::FastScalar->new(\$from);
+    }
+    elsif($ref eq 'SCALAR')
+    {   $filename = 'ref scalar';
+        $file     = Mail::Box::FastScalar->new($from);
+    }
+    elsif($ref eq 'ARRAY')
+    {   $filename = 'array of lines';
+        my $buffer= join '', @$from;
+        $file     = Mail::Box::FastScalar->new(\$buffer);
+    }
+    elsif($ref eq 'GLOB')
+    {   $filename = 'file (GLOB)';
+        local $/;
+        my $buffer= <$from>;
+        $file     = Mail::Box::FastScalar->new(\$buffer);
+    }
+    elsif($ref && $from->isa('IO::Handle'))
+    {   $filename = 'file ('.ref($from).')';
+        my $buffer= join '', $from->getlines;
+        $file     = Mail::Box::FastScalar->new(\$buffer);
+    }
+    else
+    {   croak "Cannot read from $from";
+    }
+
+    my $strip_status = exists $args{strip_status_fields}
+                     ? delete $args{strip_status_fields}
+                     : 1;
+
+    require Mail::Box::Parser::Perl;  # not parseable by C parser
+
+    my $parser = Mail::Box::Parser::Perl->new
+     ( %args
+     , filename  => $filename
+     , file      => $file
+     , trusted   => 1
+     );
+
+    my $self = $class->new(%args);
+    $self->readFromParser($parser, $args{body_type});
+    $self->addReport($parser);
+
+    $parser->stop;
+
+    my $head = $self->head;
+    $head->set('Message-ID' => $self->messageId)
+        unless $head->get('Message-ID');
+
+    $head->delete('Status', 'X-Status') if $strip_status;
+
+    $self;
+}
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Read.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Read.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Read.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,120 @@
+
+=head1 NAME
+
+Mail::Message::Construct::Read - read a Mail::Message from a file handle
+
+
+
+=head1 SYNOPSIS
+
+ my $msg1 = Mail::Message->read(\*STDIN);
+ my $msg2 = Mail::Message->read(\@lines);
+
+
+=head1 DESCRIPTION
+
+When complex methods are called on a C<Mail::Message> object, this package
+is autoloaded to support the reading of messages directly from any file
+handle.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructing a message
+
+
+Mail::Message-E<gt>B<read>(FILEHANDLE|SCALAR|REF-SCALAR|ARRAY-OF-LINES, OPTIONS)
+
+=over 4
+
+Read a message from a FILEHANDLE, SCALAR, a reference to a SCALAR, or
+a reference to an array of LINES.  Most OPTIONS are passed to the L<new()|Mail::Message/"Constructors">
+of the message which is created, but a few extra are defined.
+
+Please have a look at L<build()|Mail::Message::Construct::Build/"Constructing a message"> and L<buildFromBody()|Mail::Message::Construct::Build/"Constructing a message"> before thinking about
+this C<read> method.  Use this C<read> only when you have a file-handle
+like STDIN to parse from, or some external source of message lines.
+When you already have a separate set of head and body lines, then C<read>
+is certainly B<not> your best choice.
+
+Some people use this method in a procmail script: the message arrives
+at stdin, so we only have a filehandle.  In this case, you are stuck
+with this method.  The message is preceeded by a line which can be used
+as message separator in mbox folders.  See the example how to handle
+that one.
+
+This method will remove C<Status> and C<X-Status> fields when they appear
+in the source, to avoid the risk that these fields accidentally interfere
+with your internal administration, which may have security implications.
+
+ Option               Defined in       Default 
+ body_type                             C<undef>
+ strip_status_fields                   <true>  
+
+. body_type CLASS
+
+=over 4
+
+Force a body type (any specific implementation of a L<Mail::Message::Body|Mail::Message::Body>)
+to be used to store the message content.  When the body is a multipart or
+nested, this will be overruled.
+
+=back
+
+. strip_status_fields BOOLEAN
+
+=over 4
+
+Remove the C<Status> and C<X-Status> fields from the message after
+reading, to lower the risk that received messages from external
+sources interfere with your internal administration.  If you want
+fields not to be stripped (you would like to disable the stripping)
+you probably process folders yourself, which is a Bad Thing!
+
+=back
+
+I<Example:> 
+
+ my $msg1 = Mail::Message->read(\*STDIN);
+ my $msg2 = Mail::Message->read(\@lines, log => 'PROGRESS');
+ $folder->addMessages($msg1, $msg2);
+
+ my $msg3 = Mail::Message->read(<<MSG);
+ Subject: hello world
+ To: you at example.com
+                      # warning: empty line required !!!
+ Hi, greetings!
+ MSG
+
+ # promail example
+ my $fromline = <STDIN>;
+ my $msg      = Mail::Message->read(\*STDIN);
+ my $coerced  = $mboxfolder->addMessage($msg);
+ $coerced->fromLines($fromline);
+
+=back
+
+
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Rebuild.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Rebuild.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Rebuild.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,285 @@
+
+use strict;
+
+package Mail::Message;
+use vars '$VERSION';
+$VERSION = '2.055';
+
+use Mail::Message::Head::Complete;
+use Mail::Message::Body::Lines;
+use Mail::Message::Body::Multipart;
+
+use Mail::Address;
+use Carp;
+use Scalar::Util 'blessed';
+use List::Util   'first';
+use Mail::Box::FastScalar;
+
+
+my @default_rules =
+  qw/replaceDeletedParts descendMultiparts descendNested
+     flattenMultiparts flattenEmptyMultiparts/;
+
+sub rebuild(@)
+{   my ($self, %args) = @_;
+ 
+    # Collect the rules to be run
+
+    my @rules   = $args{rules} ? @{$args{rules}} : @default_rules;
+    unshift @rules, @{$args{extraRules}} if $args{extraRules};
+
+    foreach my $rule (@rules)
+    {   next if ref $rule;
+        croak "ERROR: no rebuild rule '$rule' defined.\n"
+           unless $self->can($rule);
+    }
+
+    # Start off with the message
+
+    my $rebuild = $self->recursiveRebuildPart($self, rules => \@rules)
+        or return;
+
+    # Be sure we end-up with a message
+
+    if($rebuild->isa('Mail::Message::Part'))
+    {   # a bit too much information is lost: we are left without the
+        # main message headers....
+        my $clone = Mail::Message->new(head => $self->head->clone);
+        $clone->body($rebuild->body);  # to update the Content lines
+        $rebuild = $clone;
+    }
+
+    $rebuild->takeMessageId unless $args{keep_message_id};
+    $rebuild;
+}
+
+#------------------------------------------
+# The general rules
+
+sub flattenNesting($@)
+{   my ($self, $part) = @_;
+    $part->isNested ?  $part->body->nested : $part;
+}
+
+sub flattenMultiparts($@)
+{   my ($self, $part) = @_;
+    return $part unless $part->isMultipart;
+    my @active = $part->parts('ACTIVE');
+    @active==1 ? $active[0] : $part;
+}
+
+sub removeEmptyMultiparts($@)
+{   my ($self, $part) = @_;
+    $part->isMultipart && $part->body->parts==0 ? undef : $part;
+}
+
+sub flattenEmptyMultiparts($@)
+{   my ($self, $part) = @_;
+    return $part unless $part->isMultipart && $part->parts('ACTIVE')==0;
+
+    my $body     = $part->body;
+    my $preamble = $body->preamble
+                 || Mail::Message::Body::Lines->new(data => '');
+    my $epilogue = $body->epilogue;
+    my $newbody  = $preamble->concatenate($preamble, <<NO_PARTS, $epilogue);
+
+  * This multipart did not contain any parts (anymore)
+  * and was therefore flattened.
+
+NO_PARTS
+
+    my $rebuild  = Mail::Message::Part->new
+     ( head      => $part->head->clone
+     , container => undef
+     );
+    $rebuild->body($newbody);
+    $rebuild;
+}
+
+sub removeEmptyBodies($@)
+{   my ($self, $part) = @_;
+    $part->body->lines==0 ? undef : $part;
+}
+
+sub descendMultiparts($@)
+{   my ($self, $part, %args) = @_;
+    return $part unless $part->isMultipart;
+
+    my $body    = $part->body;
+    my $changed = 0;
+    my @newparts;
+
+    foreach my $part ($body->parts)
+    {   my $new = $self->recursiveRebuildPart($part, %args);
+
+        if(!defined $new)  { $changed++ }
+	elsif($new==$part) { push @newparts, $part }
+	else               { push @newparts, $new; $changed++ }
+    }
+
+    return $part unless $changed;
+
+    my $newbody = ref($body)->new
+     ( based_on  => $body
+     , parts     => \@newparts
+     );
+
+    my $rebuild = ref($part)->new
+     ( head      => $part->head->clone
+     , container => undef
+     );
+
+    $rebuild->body($newbody);   # update Content-* lines
+    $rebuild;
+ }
+
+sub descendNested($@)
+{   my ($self, $part, %args) = @_;
+
+    return $part unless $part->isNested;
+
+    my $body      = $part->body;
+    my $srcnested = $body->nested;
+    my $newnested = $self->recursiveRebuildPart($srcnested, %args);
+
+    return undef      unless defined $newnested;
+    return $part if $newnested==$srcnested;
+
+    # Changes in the encapsulated message
+    my $newbody   = ref($body)->new
+      ( based_on => $body
+      , nested   => $newnested
+      );
+
+   my $rebuild    = ref($part)->new(head => $part->head->clone);
+   $rebuild->body($newbody);
+   $rebuild;
+}
+
+sub removeDeletedParts($@)
+{   my ($self, $part) = @_;
+    $part->isDeleted ? undef : $part;
+}
+
+sub replaceDeletedParts($@)
+{   my ($self, $part) = @_;
+
+    return $part
+       unless ($part->isNested && $part->body->nested->isDeleted)
+            || $part->isDeleted;
+
+    my $structure = '';
+    my $output    = Mail::Box::FastScalar->new(\$structure, '  ');
+    $part->printStructure($output);
+
+    Mail::Message::Part->build
+     ( data      => "Removed content:\n\n$structure"
+     );
+}
+
+#------------------------------------------
+# The more complex rules
+
+sub removeHtmlAlternativeToText($@)
+{   my ($self, $part, %args) = @_;
+    return $part unless $part->body->mimeType eq 'text/html';
+
+    my $container = $part->container;
+
+    return $part
+       unless defined $container
+           && $container->mimeType eq 'multipart/alternative';
+
+    foreach my $subpart ($container->parts)
+    {   return undef if $subpart->body->mimeType eq 'text/plain';
+    }
+
+    $part;
+}
+
+my $has_hft;
+
+sub textAlternativeForHtml($@)
+{   my ($self, $part, %args) = @_;
+
+    my $hft = 'Mail::Message::Convert::HtmlFormatText';
+    unless(defined $has_hft)
+    {   eval "require Mail::Message::Convert::HtmlFormatText";
+        $has_hft = $hft->can('format');
+    }
+
+    return $part
+        unless $has_hft && $part->body->mimeType eq 'text/html';
+
+    my $container = $part->container;
+    my $in_alt    = defined $container
+                    && $container->mimeType eq 'multipart/alternative';
+
+    return $part
+        if $in_alt
+        && first { $_->body->mimeType eq 'text/plain' } $container->parts;
+
+
+    # Create the plain part
+
+    my $html_body  = $part->body;
+    my $plain_body = $hft->new->format($html_body);
+
+    my $plain_part = Mail::Message::Part->new(container => undef);
+    $plain_part->body($plain_body);
+
+    return $container->attach($plain_part)
+       if $in_alt;
+
+    # Recreate the html part to loose some header lines
+
+    my $html_part = Mail::Message::Part->new(container => undef);
+    $html_part->body($html_body);
+
+    # Create the new part, with the headers of the html part
+
+    my $mp = Mail::Message::Body::Multipart->new
+     ( mime_type => 'multipart/alternative'
+     , parts     => [ $plain_part, $html_part ]
+     );
+
+    my $newpart  = ref($part)->new
+     ( head      => $part->head->clone   # Subject field, and such
+     , container => undef
+     );
+    $newpart->body($mp);
+    $newpart;
+}
+
+#------------------------------------------
+
+
+sub recursiveRebuildPart($@)
+{   my ($self, $part, %args) = @_;
+
+  RULES:
+    for(1)
+    {
+        foreach my $rule ( @{$args{rules}} )
+        {
+            my $rebuild
+               = ref $rule ? $rule->($self, $part, %args)
+               :             $self->$rule($part, %args);
+
+            return undef unless defined $rebuild;
+
+            if($part != $rebuild)
+            {   $part = $rebuild;
+                redo RULES;
+            }
+	}
+    }
+
+   $part;
+}
+
+#------------------------------------------
+
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Rebuild.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Rebuild.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Rebuild.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,307 @@
+
+=head1 NAME
+
+Mail::Message::Construct::Rebuild - modify a Mail::Message
+
+
+
+=head1 SYNOPSIS
+
+ my $cleanup = $msg->rebuild;
+
+
+=head1 DESCRIPTION
+
+Modifying existing messages is a pain, certainly if this has to be
+done in an automated fashion.  The problems are especially had when
+multiparts have to be created or removed.  The L<rebuild()|Mail::Message::Construct::Rebuild/"Constructing a message"> method
+tries to simplify this task and add some standard features.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructing a message
+
+
+$obj-E<gt>B<rebuild>(OPTIONS)
+
+=over 4
+
+Reconstruct an existing message into something new.  Returned is a new
+message when there were modifications made, C<undef> if the message has
+no body left, or the original message when no modifications had to be
+made.
+
+Examples of use: you have a message which only contains html, and you
+want to translate it into a multipart which contains the original html
+and the textual translation of it.  Or, you have a message with parts
+flagged to be deleted, and you want those changes be incorparted in the
+memory structure.  Another possibility: clear all the resent groups
+(see L<Mail::Message::Head::ResentGroup|Mail::Message::Head::ResentGroup>) from the header, before it is
+written to file.
+
+Reconstructing is a hazardous task, where multi level multiparts and
+nested messages come into play.  The rebuild method tries to simplify
+handing these messages for you.
+
+ Option           Defined in       Default   
+ extraRules                        []        
+ keep_message_id                   <false>   
+ rules                             <see text>
+
+. extraRules ARRAY
+
+=over 4
+
+The standard set of rules, which is the default for the C<rules> option,
+is a moderest setting.  In stead of copying that list into a full set
+of rules of your own, you can also specify only some additional rules
+which will be prependend to the default rule set.
+
+The order of the rules is respected, which means that you do not always
+need to rewrite the whole rule is (see C<rule> option).  For instance,
+the extra rule of C<removeDeletedParts> returns an C<undef>, which
+means that it cancels the effect of the default rule C<replaceDeletedParts>.
+
+=back
+
+. keep_message_id BOOLEAN
+
+=over 4
+
+The message-id is an unique identification of the message: no two messages
+with different content shall exist anywhere.  However in practice, when
+a message is changed during transmission, the id is often incorrectly
+not changed.  This may lead to complications in application which see
+both messages with the same id.
+
+=back
+
+. rules ARRAY
+
+=over 4
+
+The ARRAY is a list of rules, which each describe an action which will
+be called on each part which is found in the message.  Most rules
+probably won't match, but some will bring changes to the content.
+Rules can be specified as method name, or as code reference.  See the
+DETAILS chapter in this manual page, and L<recursiveRebuildPart()|Mail::Message::Construct::Rebuild/"Internals">.
+
+By default, only the relatively safe transformations are performed:
+C<replaceDeletedParts>, C<descendMultiparts>, C<descendNested>,
+C<flattenMultiparts>, C<flattenEmptyMultiparts>.  In the future, more
+safe transformations may be added to this list.
+
+=back
+
+I<Example:> 
+
+ # remove all deleted parts
+ my $cleaned = $msg->rebuild(keep_message_id => 1);
+ $folder->addMessage($cleaned) if defined $cleaned;
+
+ # Replace deleted parts by a place-holder
+ my $cleaned = $msg->rebuild
+   ( keep_message_id => 1
+   , extraRules => [ 'removeEmpty', 'flattenMultiparts' ]
+   );
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<recursiveRebuildPart>(PART, OPTIONS)
+
+=over 4
+
+ Option  Defined in  Default   
+ rules               <required>
+
+. rules ARRAY-OF-RULES
+
+=over 4
+
+Rules are method names which can be called on messages and message parts
+objects.  The ARRAY can also list code references which can be called.
+In any case, each rule will be called the same way:
+
+ $code->(MESSAGE, PART)
+
+The return can be C<undef> or any complex construct based on a
+L<Mail::Message::Part|Mail::Message::Part> or coerceable into such a part.  For each part,
+all rules are called in sequence.  When a rule returns a changed object,
+the rules will start all over again, however C<undef> will immediately
+stop it.
+
+=back
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> no rebuild rule $name defined.
+
+
+
+=head1 DETAILS
+
+
+=head2 Rebuilding a message
+
+Modifying an existing message is a complicated job.  Not only do you need
+to know what you are willing to change, but you have to take care about
+multiparts (possibly nested in multiple levels), rfc822 encapsulated
+messages, header field consistency, and so on.  The L<rebuild()|Mail::Message::Construct::Rebuild/"Constructing a message"> method
+let you focus on the task, and takes care of the rest.
+
+The L<rebuild()|Mail::Message::Construct::Rebuild/"Constructing a message"> method uses rules to transform the one message into an
+other.  If one or more of the rules apply, a new message will be returned.
+A simple numeric comparison tells whether the message has changed.  For
+example
+
+ print "No change"
+    if $message == $message->rebuild;
+
+Transformation is made with a set of rules.  Each rule performs only a
+small step, which makes is easily configurable.  The rules are ordered,
+and when one makes a change to the result, the result will be passed
+to all the rules again until no rule makes a change on the part anymore.
+A rule may also return C<undef> in which case the part will be removed
+from the (resulting) message.
+
+=head3 General rules
+
+This sections describes the general configuration rules: all quite straight
+forward transformations on the message structure.  The rules marked with (*)
+are used by default.
+
+=over 4
+
+=item * descendMultiparts (*)
+
+Apply the rules to the parts of (possibly nested) multiparts, not only to
+the top-level message.
+
+=item * descendNested (*)
+
+Apply the rules to the C<message/rfc822> encapsulated message as well.
+
+=item * flattenEmptyMultiparts (*)
+
+Multipart messages which do not have any parts left are replaced by
+a single part which contains the preamble, epilogue and a brief
+explanation.
+
+=item * flattenMultiparts (*)
+
+When a multipart contains only one part, that part will take the place of
+the multipart: the removal of a level of nesting.  This way, the preamble
+and epilogue of the multipart (which do not have a meaning, officially)
+are lost.
+
+=item * flattenNesting
+
+Remove the C<message/rfc822> encapsulation.  Only the content related
+lines of the encapsulated body are preserved one level higher.  Other
+information will be lost, which is often not too bad.
+
+=item * removeDeletedParts
+
+All parts which are flagged for deletion are removed from the message
+without leaving a trace.  If a nested message is encountered which has
+its encapsulated content flagged for deletion, it will be removed as
+a whole.
+
+=item * removeEmptyMultiparts
+
+Multipart messages which do not have any parts left are removed.  The
+information in preamble and epiloge is lost.
+
+=item * removeEmptyBodies
+
+Simple message bodies which do not contain any lines of content are
+removed.  This will loose the information which is stored in the
+headers of these bodies.
+
+=item * replaceDeletedParts (*)
+
+All parts of the message which are flagged for deletion are replace
+by a message which says that the part is deleted.
+
+=back
+
+You can specify a selection of these rules with L<rebuild(rules)|Mail::Message::Construct::Rebuild/"Constructing a message"> and
+L<rebuild(extraRules)|Mail::Message::Construct::Rebuild/"Constructing a message">.
+
+=head3 Conversion rules
+
+This section describes the rules which try to be smart with the
+content.  Please contribute with ideas and implementations.
+
+=over 4
+
+=item * removeHtmlAlternativeToText
+
+When a multipart alternative is encountered, which contains both a
+plain text and an html part, then the html part is flagged for
+deletion.  Especially useful in combination with the C<removeDeletedParts>
+and C<flattenMultiparts> rules.
+
+=item * textAlternativeForHtml
+
+Any C<text/html> part which is not accompanied by an alternative
+plain text part will have one added.  You must have a working
+L<Mail::Message::Convert::HtmlFormatText|Mail::Message::Convert::HtmlFormatText>, which means that
+HTML::TreeBuilder and HTML::FormatText  must be installed on
+your system.
+
+=back
+
+=head3 Adding your own rules
+
+If you have designed your own rule, please consider contributing this
+to Mail::Box; it may be useful for other people as well.
+
+Each rule is called
+
+ my $new = $code->($message, $part, %options)
+
+where the C<%options> are defined by the C<rebuild()> method internals. At
+least the C<rules> option is passed, which is a full expansion of all
+the rules which will be applied.
+
+Your subroutine shall return C<$part> if no changes are needed,
+C<undef> if the part should be removed, and any newly constructed
+C<Mail::Message::Part> when a change is required.  It is easiest to
+start looking at the source code of this package, and copy from a
+comparible routine.
+
+When you have your own routine, you simply call:
+
+ my $rebuild_message = $message->rebuild
+  ( extraRules => [ \&my_own_rule, 'other_rule' ] );
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Reply.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Reply.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Reply.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,243 @@
+
+use strict;
+
+package Mail::Message;
+use vars '$VERSION';
+$VERSION = '2.055';
+
+use Mail::Message::Body::Multipart;
+use Mail::Address;
+use Scalar::Util 'blessed';
+
+
+# tests in t/55reply1r.t, demo in the examples/ directory
+
+sub reply(@)
+{   my ($self, %args) = @_;
+
+    my $body   = $args{body};
+    my $strip  = !exists $args{strip_signature} || $args{strip_signature};
+    my $include  = $args{include}   || 'INLINE';
+
+    if($include eq 'NO')
+    {   # Throw away real body.
+        $body    = Mail::Message::Body->new
+           (data => ["\n[The original message is not included]\n\n"])
+               unless defined $body;
+    }
+    elsif($include eq 'INLINE' || $include eq 'ATTACH')
+    {
+        unless(defined $body)
+        {   # text attachment
+            $body = $self->body;
+            $body = $body->part(0)->body if $body->isMultipart && $body->parts==1;
+            $body = $body->nested->body  if $body->isNested;
+
+            $body
+             = $strip && ! $body->isMultipart && !$body->isBinary
+             ? $body->decoded->stripSignature
+                 ( pattern   => $args{strip_signature}
+                 , max_lines => $args{max_signature}
+                 )
+             : $body->decoded;
+        }
+
+        if($include eq 'INLINE' && $body->isMultipart) { $include = 'ATTACH' }
+        elsif($include eq 'INLINE' && $body->isBinary)
+        {   $include = 'ATTACH';
+            $body    = Mail::Message::Body::Multipart->new(parts => [$body]);
+        }
+
+        if($include eq 'INLINE')
+        {   my $quote
+              = defined $args{quote} ? $args{quote}
+              : exists $args{quote}  ? undef
+              :                        '> ';
+
+            if(defined $quote)
+            {   my $quoting = ref $quote ? $quote : sub {$quote . $_};
+                $body = $body->foreachLine($quoting);
+            }
+        }
+    }
+    else
+    {   $self->log(ERROR => "Cannot include reply source as $include.");
+        return;
+    }
+
+    #
+    # Collect header info
+    #
+
+    my $mainhead = $self->toplevel->head;
+
+    # Where it comes from
+    my $from = $args{From};
+    unless(defined $from)
+    {   my @from = $self->to;
+        $from    = \@from if @from;
+    }
+
+    # To whom to send
+    my $to = $args{To};
+    unless(defined $to)
+    {   my $reply = $mainhead->get('reply-to');
+        $to       = [ $reply->addresses ] if defined $reply;
+    }
+    $to  ||= $self->sender || return;
+
+    # Add Cc
+    my $cc = $args{Cc};
+    if(!defined $cc && $args{group_reply})
+    {   my @cc = $self->cc;
+        $cc    = [ $self->cc ] if @cc;
+    }
+
+    # Add Bcc
+    my $bcc = $args{Bcc};
+
+    # Create a subject
+    my $srcsub  = $args{Subject};
+    my $subject
+     = ! defined $srcsub ? $self->replySubject($self->subject)
+     : ref $srcsub       ? $srcsub->($self->subject)
+     :                     $srcsub;
+
+    # Create a nice message-id
+    my $msgid   = $args{'Message-ID'};
+    $msgid      = "<$msgid>" if $msgid && $msgid !~ /^\s*\<.*\>\s*$/;
+
+    # Thread information
+    my $origid  = '<'.$self->messageId.'>';
+    my $refs    = $mainhead->get('references');
+
+    # Prelude
+    my $prelude
+      = defined $args{prelude} ? $args{prelude}
+      : exists $args{prelude}  ? undef
+      :                          [ $self->replyPrelude($to) ];
+
+    $prelude     = Mail::Message::Body->new(data => $prelude)
+        if defined $prelude && ! blessed $prelude;
+ 
+    my $postlude = $args{postlude};
+    $postlude    = Mail::Message::Body->new(data => $postlude)
+        if defined $postlude && ! blessed $postlude;
+
+    #
+    # Create the message.
+    #
+
+    my $total;
+    if($include eq 'NO') {$total = $body}
+    elsif($include eq 'INLINE')
+    {   my $signature = $args{signature};
+        $signature = $signature->body
+           if defined $signature && $signature->isa('Mail::Message');
+
+        $total = $body->concatenate
+          ( $prelude, $body, $postlude
+          , (defined $signature ? "-- \n" : undef), $signature
+          );
+    }
+    if($include eq 'ATTACH')
+    {
+         my $intro = $prelude->concatenate
+           ( $prelude
+           , [ "\n", "[Your message is attached]\n" ]
+           , $postlude
+           );
+
+        $total = Mail::Message::Body::Multipart->new
+         ( parts => [ $intro, $body, $args{signature} ]
+        );
+    }
+
+    my $msgtype = $args{message_type} || 'Mail::Message';
+
+    my $reply   = $msgtype->buildFromBody
+      ( $total
+      , From    => $from || 'Undisclosed senders:;'
+      , To      => $to
+      , Subject => $subject
+      , 'In-Reply-To' => $origid
+      , References    => ($refs ? "$refs $origid" : $origid)
+      );
+
+    my $newhead = $reply->head;
+    $newhead->set(Cc  => $cc)  if $cc;
+    $newhead->set(Bcc => $args{Bcc}) if $args{Bcc};
+
+    # Ready
+
+    $self->log(PROGRESS => 'Reply created from '.$origid);
+    $self->label(replied => 1);
+    $reply;
+}
+
+#------------------------------------------
+
+
+# tests in t/35reply1rs.t
+
+sub replySubject($)
+{   my ($thing, $subject) = @_;
+    $subject     = 'your mail' unless defined $subject && length $subject;
+    my @subject  = split /\:/, $subject;
+    my $re_count = 1;
+
+    # Strip multiple Re's from the start.
+
+    while(@subject)
+    {   last if $subject[0] =~ /[A-QS-Za-qs-z][A-DF-Za-df-z]/;
+
+        for(shift @subject)
+        {   while( /\bRe(?:\[\s*(\d+)\s*\]|\b)/g )
+            {   $re_count += defined $1 ? $1 : 1;
+            }
+        }
+    }
+
+    # Strip multiple Re's from the end.
+
+    if(@subject)
+    {   for($subject[-1])
+        {   $re_count++ while s/\s*\(\s*(re|forw)\W*\)\s*$//i;
+        }
+    }
+
+    # Create the new subject string.
+
+    my $text = (join ':', @subject) || 'your mail';
+    for($text)
+    {  s/^\s+//;
+       s/\s+$//;
+    }
+
+    $re_count==1 ? "Re: $text" : "Re[$re_count]: $text";
+}
+
+#------------------------------------------
+
+
+sub replyPrelude($)
+{   my ($self, $who) = @_;
+ 
+    $who = $who->[0] if ref $who eq 'ARRAY';
+
+    my $user
+     = !defined $who                     ? undef
+     : !ref $who                         ? (Mail::Address->parse($who))[0]
+     : $who->isa('Mail::Message::Field') ? ($who->addresses)[0]
+     :                                     $who;
+
+    my $from
+     = ref $user && $user->isa('Mail::Address')
+     ? ($user->name || $user->address || $user->format)
+     : 'someone';
+
+    my $time = gmtime $self->timestamp;
+    "On $time, $from wrote:\n";
+}
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Reply.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Reply.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Reply.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,315 @@
+
+=head1 NAME
+
+Mail::Message::Construct::Reply - reply to a Mail::Message
+
+
+
+=head1 SYNOPSIS
+
+ my Mail::Message $reply = $message->reply;
+ my $quoted  = $message->replyPrelude($head->get('From'));
+
+
+=head1 DESCRIPTION
+
+Complex functionality on L<Mail::Message|Mail::Message> objects is implemented in
+different files which are autoloaded.  This file implements the
+functionality related to creating message replies.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructing a message
+
+
+$obj-E<gt>B<reply>(OPTIONS)
+
+=over 4
+
+Start a reply to this message.  Some of the header-lines of the original
+message will be taken.  A message-id will be assigned.  Some header lines
+will be updated to facilitate message-thread detection
+(see L<Mail::Box::Thread::Manager|Mail::Box::Thread::Manager>).
+
+You may reply to a whole message or a message part.
+You may wish to overrule some of the default header settings for the
+reply immediately, or you may do that later with C<set> on the header.
+
+ADDRESSES may be specified as string, or
+a Mail::Address object, or as array of Mail::Address objects.
+
+ Option           Defined in       Default                                                                   
+ Bcc                               undef                                                                     
+ Cc                                <'cc' in current>                                                         
+ From                              <'to' in current>                                                         
+ Message-ID                        <uniquely generated>                                                      
+ Subject                           L<replySubject()|Mail::Message::Construct::Reply/"Constructing a message">
+ To                                <sender in current>                                                       
+ body                              undef                                                                     
+ group_reply                       <true>                                                                    
+ include                           C<'INLINE'>                                                               
+ max_signature                     C<10>                                                                     
+ message_type                      L<Mail::Message|Mail::Message>                                            
+ postlude                          undef                                                                     
+ prelude                           undef                                                                     
+ quote                             'E<gt> '                                                                  
+ signature                         undef                                                                     
+ strip_signature                   C<qr/^--\s/>                                                              
+
+. Bcc ADDRESSES
+
+=over 4
+
+Receivers of blind carbon copies: their names will not be published to
+other message receivers.
+
+=back
+
+. Cc ADDRESSES
+
+=over 4
+
+The carbon-copy receivers, by default a copy of the C<Cc> field of
+the source message.
+
+=back
+
+. From ADDRESSES
+
+=over 4
+
+Your identification, by default taken from the C<To> field of the
+source message.
+
+=back
+
+. Message-ID STRING
+
+=over 4
+
+Supply a STRING as specific message-id for the reply.  By default, one is
+generated for you.  If there are no angles around your id, they will be
+added.
+
+=back
+
+. Subject STRING|CODE
+
+=over 4
+
+Force the subject line to the specific STRING, or the result of the
+subroutine specified by CODE.  The subroutine will be called passing
+the subject of the original message as only argument.  By default,
+L<Mail::Message::replySubject()|Mail::Message::Construct::Reply/"Constructing a message"> is used.
+
+=back
+
+. To ADDRESSES
+
+=over 4
+
+The destination of your message.  By default taken from the C<Reply-To>
+field in the source message.  If that field is not present, the C<Sender>
+field is taken.  If that field is not present as well, the C<From> line
+is scanned.  If they all fail, C<undef> is returned.
+
+=back
+
+. body BODY
+
+=over 4
+
+Usually, the reply method can create a nice, sufficient message from the
+source message's body.  In case you like more complicated reformatting,
+you may also create a body yourself first, and pass this on to this
+C<reply> method. Some of the other options to this method will be ingored
+in this case.
+
+=back
+
+. group_reply BOOLEAN
+
+=over 4
+
+Will the people listed in the C<Cc> headers (those who received the
+message where you reply to now) also receive this message as carbon
+copy?
+
+=back
+
+. include 'NO'|'INLINE'|'ATTACH'
+
+=over 4
+
+Must the message where this is a reply to be included in the message?
+If C<NO> then not.  With C<INLINE> a reply body is composed. C<ATTACH>
+will create a multi-part body, where the original message is added
+after the specified body.  It is only possible to inline textual
+messages, therefore binary or multipart messages will always be
+enclosed as attachment.
+
+=back
+
+. max_signature INTEGER
+
+=over 4
+
+Passed to C<stripSignature> on the body as parameter C<max_lines>.  Only
+effective for single-part messages.
+
+=back
+
+. message_type CLASS
+
+=over 4
+
+Create a message with the requested type.  By default, it will be a
+Mail::Message.  This is correct, because it will be coerced into
+the correct folder message type when it is added to that folder.
+
+=back
+
+. postlude BODY|LINES
+
+=over 4
+
+The line(s) which to be added after the quoted reply lines.  Create a
+body for it first.  This should not include the signature, which has its
+own option.  The signature will be added after the postlude when the
+reply is INLINEd.
+
+=back
+
+. prelude BODY|LINES
+
+=over 4
+
+The line(s) which will be added before the quoted reply lines.  If nothing
+is specified, the result of the L<replyPrelude()|Mail::Message::Construct::Reply/"Constructing a message"> method
+is taken.  When C<undef> is specified, no prelude will be added.
+
+=back
+
+. quote CODE|STRING
+
+=over 4
+
+Mangle the lines of an C<INLINE>d reply with CODE, or by prepending a
+STRING to each line.  The routine specified by CODE is called when the
+line is in C<$_>.
+
+By default, C<'E<gt> '> is added before each line.  Specify C<undef> to
+disable quoting.  This option is processed after the body has been decoded.
+
+=back
+
+. signature BODY|MESSAGE
+
+=over 4
+
+The signature to be added in case of a multi-part reply.  The mime-type
+of the signature body should indicate this is a used as such.  However,
+in INLINE mode, the body will be taken, a line containing C<'-- '> added
+before it, and added behind the epilogue.
+
+=back
+
+. strip_signature REGEXP|STRING|CODE
+
+=over 4
+
+Remove the signature of the sender.  The value of this parameter is
+passed to L<Mail::Message::Body::stripSignature(pattern)|Mail::Message::Body::Construct/"Constructing a body"> unless the
+source text is not included.  The signature is stripped from the message
+before quoting.
+
+When a multipart body is encountered, and the message is included to
+ATTACH, the parts which look like signatures will be removed.  If only
+one message remains, it will be the added as single attachment, otherwise
+a nested multipart will be the result.  The value of this option does not
+matter, as long as it is present.  See L<Mail::Message::Body::Multipart|Mail::Message::Body::Multipart>.
+
+=back
+
+I<Example:> 
+
+  my $reply = $msg->reply
+   ( prelude         => "No spam, please!\n\n"
+   , postlude        => "\nGreetings\n"
+   , strip_signature => 1
+   , signature       => $my_pgp_key
+   , group_reply     => 1
+   );
+
+=back
+
+$obj-E<gt>B<replyPrelude>([STRING|FIELD|ADDRESS|ARRAY-OF-THINGS])
+
+=over 4
+
+Produces a list of lines (usually only one), which will preceded the
+quoted body of the message.  STRING must comply to the RFC822 email
+address specification, and is usually the content of a C<To> or C<From>
+header line.  If a FIELD is specified, the field's body must be
+compliant.  Without argument -or when the argument is C<undef>- a
+slightly different line is produced.
+
+An characteristic example of the output is
+
+ On Thu Oct 13 04:54:34 1995, him at example.com wrote:
+
+=back
+
+$obj-E<gt>B<replySubject>(STRING)
+
+Mail::Message-E<gt>B<replySubject>(STRING)
+
+=over 4
+
+Create a subject for a message which is a reply for this one.  This routine
+tries to count the level of reply in subject field, and transform it into
+a standard form.  Please contribute improvements.
+
+I<Example:> 
+
+ subject                 --> Re: subject
+ Re: subject             --> Re[2]: subject
+ Re[X]: subject          --> Re[X+1]: subject
+ subject (Re)            --> Re[2]: subject
+ subject (Forw)          --> Re[2]: subject
+ <blank>                 --> Re: your mail
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot include reply source as $include.
+
+Unknown alternative for the C<include> option of L<reply()|Mail::Message::Construct::Reply/"Constructing a message">.  Valid
+choices are C<NO>, C<INLINE>, and C<ATTACH>.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Text.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Text.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Text.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,66 @@
+
+use strict;
+
+package Mail::Message;
+use vars '$VERSION';
+$VERSION = '2.055';
+
+use IO::Lines;
+
+
+sub string()
+{   my $self = shift;
+    $self->head->string . $self->body->string;
+}
+
+#------------------------------------------
+
+
+sub lines()
+{   my $self = shift;
+    my @lines;
+    my $file = IO::Lines->new(\@lines);
+    $self->print($file);
+    wantarray ? @lines : \@lines;
+}
+
+#------------------------------------------
+
+
+sub file()
+{   my $self = shift;
+    my @lines;
+    my $file = IO::Lines->new(\@lines);
+    $self->print($file);
+    $file->seek(0,0);
+    $file;
+}
+
+#------------------------------------------
+
+
+sub printStructure(;$$)
+{   my $self    = shift;
+    my $indent  = @_ && !ref $_[-1] && substr($_[-1], -1, 1) eq ' ' ? pop : '';
+    my $fh      = @_ ? shift : select;
+
+    my $subject = $self->get('Subject') || '';
+    $subject    = ": $subject" if length $subject;
+
+    my $type    = $self->get('Content-Type') || '';
+    my $size    = $self->size;
+    my $deleted = $self->label('deleted') ? ', deleted' : '';
+
+    my $text    = "$indent$type$subject ($size bytes$deleted)\n";
+    ref $fh eq 'GLOB' ? (print $fh $text) : $fh->print($text);
+
+    my $body    = $self->body;
+    my @parts
+      = $body->isMultipart ? $body->parts
+      : $body->isNested    ? ($body->nested)
+      :                      ();
+
+    $_->printStructure($fh, $indent.'   ') foreach @parts;
+}
+    
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Text.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Text.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct/Text.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,110 @@
+
+=head1 NAME
+
+Mail::Message::Construct::Text - capture a Mail::Message as text
+
+
+
+=head1 SYNOPSIS
+
+ my $text = $msg->string;
+ my $text = "$msg";   # via overload
+
+ my @text = $msg->lines;
+ my @text = @$lines;  # via overload
+
+ my $fh   = $msg->file;
+ my $line = <$fh>;
+
+ $msg->printStructure;
+
+
+=head1 DESCRIPTION
+
+Complex functionality on L<Mail::Message|Mail::Message> objects is implemented in
+different files which are autoloaded.  This file implements the
+functionality related to creating message replies.
+
+
+
+=head1 METHODS
+
+
+=head2 The whole message as text
+
+
+$obj-E<gt>B<file>
+
+=over 4
+
+Returns the message as file-handle.
+
+=back
+
+$obj-E<gt>B<lines>
+
+=over 4
+
+Returns the whole message as set of lines.  In LIST context, copies of the
+lines are returned.  In SCALAR context, a reference to an array of lines
+is returned.
+
+=back
+
+$obj-E<gt>B<printStructure>([FILEHANDLE][, INDENT])
+
+=over 4
+
+Print the structure of a message to the selected filehandle.
+The message's subject and the types of all composing parts are
+displayed.
+
+INDENT specifies the initial indentation string: it is added in
+front of each line, and SHALL end with a blank, if specified.
+
+I<Example:> 
+
+ my $msg = ...;
+ $msg->printStructure(\*OUTPUT);
+ $msg->printStructure;
+
+ # Possible output for one message:
+ multipart/mixed: forwarded message from Pietje Puk (1550 bytes)
+    text/plain (164 bytes)
+    message/rfc822 (1043 bytes)
+       multipart/alternative: A multipart alternative (942 bytes)
+          text/plain (148 bytes, deleted)
+          text/html (358 bytes)
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+Returns the whole message as string.
+
+=back
+
+
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,64 @@
+
+use strict;
+
+package Mail::Message;
+use vars '$VERSION';
+$VERSION = '2.055';
+
+use Mail::Message::Head::Complete;
+use Mail::Message::Body::Lines;
+use Mail::Message::Body::Multipart;
+
+use Mail::Address;
+use Carp;
+use Scalar::Util 'blessed';
+use IO::Lines;
+
+
+our %locations =
+(
+  bounce             => 'Bounce'
+
+, build              => 'Build'
+, buildFromBody      => 'Build'
+
+, forward            => 'Forward'
+, forwardNo          => 'Forward'
+, forwardInline      => 'Forward'
+, forwardAttach      => 'Forward'
+, forwardEncapsulate => 'Forward'
+, forwardSubject     => 'Forward'
+, forwardPrelude     => 'Forward'
+, forwardPostlude    => 'Forward'
+
+, read               => 'Read'
+
+, rebuild            => 'Rebuild'
+
+, reply              => 'Reply'
+, replySubject       => 'Reply'
+, replyPrelude       => 'Reply'
+
+, string             => 'Text'
+, lines              => 'Text'
+, file               => 'Text'
+, printStructure     => 'Text'
+);
+
+sub AUTOLOAD(@)
+{   my $self  = shift;
+    our $AUTOLOAD;
+    (my $call = $AUTOLOAD) =~ s/.*\:\://g;
+
+    if(my $mod = $locations{$call})
+    {   eval "require Mail::Message::Construct::$mod";
+        die $@ if $@;
+        return $self->$call(@_);
+    }
+
+    our @ISA;                    # produce error via Mail::Reporter
+    $call = "${ISA[0]}::$call";
+    $self->$call(@_);
+}
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Construct.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,57 @@
+
+=head1 NAME
+
+Mail::Message::Construct - extends the functionality of a Mail::Message
+
+
+
+=head1 SYNOPSIS
+
+ # See Mail::Message
+
+
+=head1 DESCRIPTION
+
+Complex functionality on L<Mail::Message|Mail::Message> objects is implemented in
+different files which are autoloaded.  This file implements the
+functionality related to creating message replies.
+
+
+
+=head1 METHODS
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+When an unknown method is called on this message, this may mean that
+not all code is compiled.  For performance reasons, most of the
+complex activities on messages are dynamically loaded from other
+packages.  An error will be produced when loading does not help resolving
+the requested method.
+
+=back
+
+
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/Html.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/Html.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/Html.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,142 @@
+use strict;
+use warnings;
+
+package Mail::Message::Convert::Html;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Convert';
+
+use Carp;
+
+
+sub init($)
+{   my ($self, $args)  = @_;
+
+    $self->SUPER::init($args);
+
+    my $produce = $args->{produce} || 'HTML';
+
+    $self->{MMCH_tail}
+     = $produce eq 'HTML'  ?   '>'
+     : $produce eq 'XHTML' ? ' />'
+     : carp "Produce XHTML or HTML, not $produce.";
+
+    $self;
+}
+
+#------------------------------------------
+
+
+sub textToHtml(@)
+{   my $self  = shift;
+
+    my @lines = @_;    # copy is required
+    foreach (@lines)
+    {   s/\&/&amp;/gs; s/\</&lt;/gs;
+        s/\>/&gt;/gs;  s/\"/&quot;/gs;
+    }
+    wantarray ? @lines : join('', @lines);
+}
+
+#------------------------------------------
+
+
+sub fieldToHtml($;$)
+{   my ($self, $field, $subject) = @_;
+    '<strong>'. $self->textToHtml($field->wellformedName)
+    .': </strong>' . $self->fieldContentsToHtml($field,$subject);
+}
+
+#------------------------------------------
+
+
+sub headToHtmlTable($;$)
+{   my ($self, $head) = (shift, shift);
+    my $tp      = @_ ? ' '.shift : '';
+
+    my $subject;
+    if($self->{MMHC_mailto_subject})
+    {   my $s = $head->get('subject');
+
+        use Mail::Message::Construct;
+        $subject = Mail::Message::Construct->replySubject($s)
+            if defined $subject;
+    }
+
+    my @lines = "<table $tp>\n";
+    foreach my $f ($self->selectedFields($head))
+    {   my $name_html = $self->textToHtml($f->wellformedName);
+        my $cont_html = $self->fieldContentsToHtml($f, $subject);
+        push @lines, qq(<tr><th valign="top" align="left">$name_html:</th>\n)
+                   , qq(    <td valign="top">$cont_html</td></tr>\n);
+    }
+
+    push @lines, "</table>\n";
+    wantarray ? @lines : join('', at lines);
+}
+
+#------------------------------------------
+
+
+sub headToHtmlHead($@)
+{   my ($self, $head) = (shift,shift);
+    my %meta;
+    while(@_) {my $k = shift; $meta{lc $k} = shift }
+
+    my $title = delete $meta{title} || $head->get('subject') || '<no subject>';
+
+    my @lines =
+     ( "<head>\n"
+     , "<title>".$self->textToHtml($title) . "</title>\n"
+     );
+
+    my $author = delete $meta{author};
+    unless(defined $author)
+    {   my $from = $head->get('from');
+        my @addr = defined $from ? $from->addresses : ();
+        $author  = @addr ? $addr[0]->format : undef;
+    }
+
+    push @lines, '<meta name="Author" content="'
+               . $self->textToHtml($author) . "\"$self->{MMCH_tail}\n"
+        if defined $author;
+
+    foreach my $f (map {lc} keys %meta)
+    {   next if $meta{$f} eq '';     # empty is skipped.
+        push @lines, '<meta name="'. ucfirst lc $self->textToHtml($f)
+                   . '" content="'. $self->textToHtml($meta{$f})
+                   ."\"$self->{MMCH_tail}\n";
+    }
+
+    foreach my $f ($self->selectedFields($head))
+    {   next if exists $meta{$f->name};
+        push @lines, '<meta name="' . $self->textToHtml($f->wellformedName)
+                   . '" content="'  . $self->textToHtml($f->content)
+                   . "\"$self->{MMCH_tail}\n";
+    }
+
+    push @lines, "</head>\n";
+    wantarray ? @lines : join('', at lines);
+}
+    
+#------------------------------------------
+
+
+my $atom          = qr/[^()<>@,;:\\".\[\]\s[:cntrl:]]+/;
+my $email_address = qr/(($atom(?:\.$atom)*)\@($atom(?:\.$atom)+))/o;
+
+sub fieldContentsToHtml($;$)
+{   my ($self, $field) = (shift,shift);
+    my $subject = defined $_[0] ? '?subject='.$self->textToHtml(shift) : '';
+
+    my ($body, $comment) = ($self->textToHtml($field->body), $field->comment);
+
+    $body =~ s#$email_address#<a href="mailto:$1$subject">$1</a>#gx
+        if $field->name =~ m/^(resent-)?(to|from|cc|bcc|reply\-to)$/;
+
+    $body . ($comment ? '; '.$self->textToHtml($comment) : '');
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/Html.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/Html.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/Html.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,318 @@
+
+=head1 NAME
+
+Mail::Message::Convert::Html - Format messages in HTML
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Convert::Html
+   is a Mail::Message::Convert
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ use Mail::Message::Convert::Html;
+ my $Html = Mail::Message::Convert::Html->new;
+
+ print $html->fieldToHtml($head);
+ print $html->headToHtmlHead($head);
+ print $html->headToHtmlTable($head);
+ print $html->textToHtml($text);
+
+
+=head1 DESCRIPTION
+
+The package contains various translators which handle HTML or XHTML
+without the help of external modules.  There are more HTML related modules,
+which do require extra packages to be installed.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Message::Convert::Html-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option       Defined in       Default          
+ fields       L<Mail::Message::Convert>  <see description>
+ head_mailto                   <true>           
+ log          L<Mail::Reporter>  C<'WARNINGS'>    
+ produce                       C<HTML>          
+ trace        L<Mail::Reporter>  C<'WARNINGS'>    
+
+. fields NAMES|ARRAY-OF-NAMES|REGEXS
+
+. head_mailto BOOLEAN
+
+=over 4
+
+Whether to replace e-mail addresses in some header lines with links.
+
+=back
+
+. log LEVEL
+
+. produce 'HTML'|'XHTML'
+
+=over 4
+
+Produce HTML or XHTML output.  The output is slightly different, even
+html browsers will usually accept the XHTML data.
+
+=back
+
+. trace LEVEL
+
+=back
+
+=head2 Converting
+
+
+$obj-E<gt>B<fieldContentsToHtml>(FIELD, [SUBJECT])
+
+=over 4
+
+Format one field from the header to HTML.  When the header line usually
+contains e-mail addresses, the line is scanned and valid addresses
+are linked with an C<mailto:> anchor.  The SUBJECT can be specified to
+be included in that link.
+
+=back
+
+$obj-E<gt>B<fieldToHtml>(FIELD, [SUBJECT])
+
+=over 4
+
+Reformat one header line field to HTML.  The FIELD's name
+is printed in bold, followed by the formatted field content,
+which is produced by L<fieldContentsToHtml()|Mail::Message::Convert::Html/"Converting">.
+
+=back
+
+$obj-E<gt>B<headToHtmlHead>(HEAD, META)
+
+=over 4
+
+Translate the selected header lines (fields) to an html page header.  Each
+selected field will get its own meta line with the same name as the line.
+Furthermore, the C<Subject> field will become the C<title>,
+and C<From> is used for the C<Author>.
+
+Besides, you can specify your own meta fields, which will overrule header
+fields.  Empty fields will not be included.  When a C<title> is specified,
+this will become the html title, otherwise the C<Subject> field is
+taken.  In list context, the lines are separately, where in scalar context
+the whole text is returned as one.
+
+If you need to add lines to the head (for instance, http-equiv lines), then
+splice them before the last element in the returned list.
+
+I<Example:> 
+
+ my @head = $html->headToHtmlHead
+     ( $head
+     , description => 'This is a message'
+     , generator   => 'Mail::Box'
+     );
+ splice @head, -1, 0, '<meta http-equiv=...>';
+ print @head;
+
+=back
+
+$obj-E<gt>B<headToHtmlTable>(HEAD, [TABLE-PARAMS])
+
+=over 4
+
+Produce a display of the L<selectedFields()|Mail::Message::Convert/"Converting"> of the header in a
+table shape.  The optional TABLE-PARAMS are added as parameters to the
+produced TABLE tag.  In list context, the separate lines are returned.
+In scalar context, everything is returned as one.
+
+I<Example:> 
+
+ print $html->headToHtmlTable($head, 'width="50%"');
+
+=back
+
+$obj-E<gt>B<selectedFields>(HEAD)
+
+=over 4
+
+See L<Mail::Message::Convert/"Converting">
+
+=back
+
+$obj-E<gt>B<textToHtml>(LINES)
+
+=over 4
+
+Translate one or more LINES from text into HTML.  Each line is taken one
+after the other, and only simple things are translated.  C<textToHtml>
+is able to convert large plain texts in a descent fashion.  In scalar
+context, the resulting lines are returned as one.
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Convert::Html-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Convert::Html-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Convert::Html-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/HtmlFormatPS.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/HtmlFormatPS.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/HtmlFormatPS.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,45 @@
+use strict;
+use warnings;
+
+package Mail::Message::Convert::HtmlFormatPS;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Convert';
+
+use Mail::Message::Body::String;
+
+use HTML::TreeBuilder;
+use HTML::FormatText;
+
+
+sub init($)
+{   my ($self, $args)  = @_;
+
+    my @formopts = map { ($_ => delete $args->{$_} ) }
+                       grep m/^[A-Z]/, keys %$args;
+
+    $self->SUPER::init($args);
+
+    $self->{MMCH_formatter} = HTML::FormatPS->new(@formopts);
+    $self;
+}
+
+#------------------------------------------
+
+
+sub format($)
+{   my ($self, $body) = @_;
+
+    my $dec  = $body->encode(transfer_encoding => 'none');
+    my $tree = HTML::TreeBuilder->new_from_file($dec->file);
+
+    (ref $body)->new
+      ( based_on  => $body
+      , mime_type => 'application/postscript'
+      , data     => [ $self->{MMCH_formatter}->format($tree) ]
+      );
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/HtmlFormatPS.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/HtmlFormatPS.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/HtmlFormatPS.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,233 @@
+
+=head1 NAME
+
+Mail::Message::Convert::HtmlFormatPS - Convert HTML into PostScript
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Convert::HtmlFormatPS
+   is a Mail::Message::Convert
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ use Mail::Message::Convert::HtmlFormatPS;
+ my $af = Mail::Message::Convert::HtmlFormatPS->new;
+
+ my $postscript = $af->format($body);
+
+
+=head1 DESCRIPTION
+
+Translate an HTML/XHTML message body into a postscript body
+using HTML::FormatPS.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Message::Convert::HtmlFormatPS-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+OPTIONS which start with capitals are blindly passed to HTML::FormatPS.
+As of this writing, that package
+defines BottomMargin, FontFamily, FontScale, HorizontalMargin, Leading,
+LeftMargin, PageNo, PaperHeight, PaperSize, PaperWidth, RightMargin,
+TopMargin, and VerticalMargin.
+
+ Option  Defined in       Default      
+ fields  L<Mail::Message::Convert>  <not used>   
+ log     L<Mail::Reporter>  C<'WARNINGS'>
+ trace   L<Mail::Reporter>  C<'WARNINGS'>
+
+. fields NAMES|ARRAY-OF-NAMES|REGEXS
+
+. log LEVEL
+
+. trace LEVEL
+
+=back
+
+=head2 Converting
+
+
+$obj-E<gt>B<format>(BODY)
+
+=over 4
+
+Pass an html/xhtml encoded body, and a plain text body is returned.
+Characters are translated into Latin1.
+
+=back
+
+$obj-E<gt>B<selectedFields>(HEAD)
+
+=over 4
+
+See L<Mail::Message::Convert/"Converting">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Convert::HtmlFormatPS-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Convert::HtmlFormatPS-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Convert::HtmlFormatPS-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/HtmlFormatText.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/HtmlFormatText.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/HtmlFormatText.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,47 @@
+use strict;
+use warnings;
+
+package Mail::Message::Convert::HtmlFormatText;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Convert';
+
+use Mail::Message::Body::String;
+
+use HTML::TreeBuilder;
+use HTML::FormatText;
+
+
+sub init($)
+{   my ($self, $args)  = @_;
+
+    $self->SUPER::init($args);
+
+    $self->{MMCH_formatter} = HTML::FormatText->new
+     ( leftmargin  => (defined $args->{leftmargin}  ? $args->{leftmargin}  : 3)
+     , rightmargin => (defined $args->{rightmargin} ? $args->{rightmargin} : 72)
+     );
+      
+    $self;
+}
+
+#------------------------------------------
+
+
+sub format($)
+{   my ($self, $body) = @_;
+
+    my $dec  = $body->encode(transfer_encoding => 'none');
+    my $tree = HTML::TreeBuilder->new_from_file($dec->file);
+
+    (ref $body)->new
+      ( based_on  => $body
+      , mime_type => 'text/plain'
+      , charset   => 'iso-8859-1'
+      , data     => [ $self->{MMCH_formatter}->format($tree) ]
+      );
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/HtmlFormatText.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/HtmlFormatText.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/HtmlFormatText.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,248 @@
+
+=head1 NAME
+
+Mail::Message::Convert::HtmlFormatText - Convert HTML into Text
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Convert::HtmlFormatText
+   is a Mail::Message::Convert
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ use Mail::Message::Convert::HtmlFormatText;
+ my $af = Mail::Message::Convert::HtmlFormatText->new;
+
+ my $plain_body = $af->format($body);
+
+
+=head1 DESCRIPTION
+
+Convert HTML/XHTML message body objects into plain text bodies using
+HTML::FormatText.  This package requires HTML::TreeBuilder and
+HTML::FormatText which are not installed by default together with
+Mail::Box.  See also L<Mail::Message::rebuild()|Mail::Message::Construct::Rebuild/"Constructing a message"> with rule
+C<text_alternative_for_html>.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Message::Convert::HtmlFormatText-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option       Defined in       Default          
+ fields       L<Mail::Message::Convert>  <see description>
+ leftmargin                    C<3>             
+ log          L<Mail::Reporter>  C<'WARNINGS'>    
+ rightmargin                   C<72>            
+ trace        L<Mail::Reporter>  C<'WARNINGS'>    
+
+. fields NAMES|ARRAY-OF-NAMES|REGEXS
+
+. leftmargin INTEGER
+
+=over 4
+
+The column of the left margin, passed to the formatter.
+
+=back
+
+. log LEVEL
+
+. rightmargin INTEGER
+
+=over 4
+
+The column of the right margin, passed to the formatter.
+
+=back
+
+. trace LEVEL
+
+=back
+
+=head2 Converting
+
+
+$obj-E<gt>B<format>(BODY)
+
+=over 4
+
+Pass an html/xhtml encoded body, and a plain text body is returned.
+Characters are translated into Latin1.
+
+=back
+
+$obj-E<gt>B<selectedFields>(HEAD)
+
+=over 4
+
+See L<Mail::Message::Convert/"Converting">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Convert::HtmlFormatText-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Convert::HtmlFormatText-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Convert::HtmlFormatText-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/MailInternet.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/MailInternet.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/MailInternet.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,74 @@
+
+use strict;
+use warnings;
+
+package Mail::Message::Convert::MailInternet;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Convert';
+
+use Mail::Internet;
+use Mail::Header;
+use Mail::Message;
+use Mail::Message::Head::Complete;
+use Mail::Message::Body::Lines;
+
+use Carp;
+
+
+sub export($@)
+{   my ($thing, $message) = (shift, shift);
+
+    croak "Export message must be a Mail::Message, but is a ".ref($message)."."
+        unless $message->isa('Mail::Message');
+
+    my $mi_head = Mail::Header->new;
+
+    my $head    = $message->head;
+    foreach my $field ($head->orderedFields)
+    {   $mi_head->add($field->Name, scalar $field->foldedBody);
+    }
+
+    Mail::Internet->new
+     ( Header => $mi_head
+     , Body   => [ $message->body->lines ]
+     , @_
+     );
+}
+
+#------------------------------------------
+
+
+my @pref_order = qw/From To Cc Subject Date In-Reply-To References
+    Content-Type Lines Content-Length/;
+
+sub from($@)
+{   my ($thing, $mi) = (shift, shift);
+
+    croak "Converting from Mail::Internet but got a ".ref($mi).'.'
+        unless $mi->isa('Mail::Internet');
+
+    my $head = Mail::Message::Head::Complete->new;
+    my $body = Mail::Message::Body::Lines->new(data => [ @{$mi->body} ]);
+
+    my $mi_head = $mi->head;
+
+    # The tags of Mail::Header are unordered, but we prefer some ordering.
+    my %tags = map {lc $_ => ucfirst $_} $mi_head->tags;
+    my @tags;
+    foreach (@pref_order)
+    {   push @tags, $_ if delete $tags{lc $_};
+    }
+    push @tags, sort values %tags;
+    
+    foreach my $name (@tags)
+    {   $head->add($name, $_)
+            foreach $mi_head->get($name);
+    }
+
+    Mail::Message->new(head => $head, body => $body, @_);
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/MailInternet.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/MailInternet.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/MailInternet.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,252 @@
+
+=head1 NAME
+
+Mail::Message::Convert::MailInternet - translate Mail::Message to Mail::Internet vv
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Convert::MailInternet
+   is a Mail::Message::Convert
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ use Mail::Message::Convert::MailInternet;
+ my $convert = Mail::Message::Convert::MailInternet->new;
+
+ my Mail::Message  $msg    = Mail::Message->new;
+ my Mail::Internet $intern = $convert->export($msg);
+
+ my Mail::Internet $intern = Mail::Internet->new;
+ my Mail::Message  $msg    = $convert->from($intern);
+
+ use Mail::Box::Manager;
+ my $mgr     = Mail::Box::Manager->new;
+ my $folder  = $mgr->open(folder => 'Outbox');
+ $folder->addMessage($intern);
+
+
+=head1 DESCRIPTION
+
+The Mail::Internet class of message is very popular for all
+kinds of message applications written in Perl.  However, the
+format was developed when e-mail messages where still small and
+attachments where rare; Mail::Message is much more flexible in
+this respect.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Message::Convert::MailInternet-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Convert/"METHODS">
+
+=back
+
+=head2 Converting
+
+
+$obj-E<gt>B<export>(MESSAGE, OPTIONS)
+
+=over 4
+
+Returns a new message object based on the information from
+a L<Mail::Message|Mail::Message> object.  The MESSAGE specified is an
+instance of a Mail::Message.
+
+I<Example:> 
+
+ my $convert = Mail::Message::Convert::MailInternet->new;
+ my Mail::Message  $msg   = Mail::Message->new;
+ my Mail::Internet $copy  = $convert->export($msg);
+
+=back
+
+$obj-E<gt>B<from>(OBJECT, OPTIONS)
+
+=over 4
+
+Returns a new Mail::Message object based on the information from
+an message-type which is foreign to the Mail::Box set of modules.
+
+I<Example:> 
+
+ my $convert = Mail::Message::Convert::MailInternet->new;
+ my Mail::Internet $msg  = Mail::Internet->new;
+ my Mail::Message  $copy = $convert->from($msg);
+
+=back
+
+$obj-E<gt>B<selectedFields>(HEAD)
+
+=over 4
+
+See L<Mail::Message::Convert/"Converting">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Convert::MailInternet-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Convert::MailInternet-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Convert::MailInternet-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/MimeEntity.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/MimeEntity.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/MimeEntity.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,44 @@
+
+use strict;
+use warnings;
+
+package Mail::Message::Convert::MimeEntity;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Convert';
+
+use MIME::Entity;
+use MIME::Parser;
+use Mail::Message;
+
+
+sub export($$;$)
+{   my ($self, $message, $parser) = @_;
+    return () unless defined $message;
+
+    $self->log(ERROR =>
+       "Export message must be a Mail::Message, but is a ".ref($message)."."),
+           return
+              unless $message->isa('Mail::Message');
+
+    $parser ||= MIME::Parser->new;
+    $parser->parse($message->file);
+}
+
+#------------------------------------------
+
+
+sub from($)
+{   my ($self, $mime_ent) = @_;
+    return () unless defined $mime_ent;
+
+    $self->log(ERROR =>
+       'Converting from MIME::Entity but got a '.ref($mime_ent).'.'), return
+            unless $mime_ent->isa('MIME::Entity');
+
+    Mail::Message->read($mime_ent->as_string);
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/MimeEntity.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/MimeEntity.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/MimeEntity.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,263 @@
+
+=head1 NAME
+
+Mail::Message::Convert::MimeEntity - translate Mail::Message to MIME::Entity vv
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Convert::MimeEntity
+   is a Mail::Message::Convert
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ use Mail::Message::Convert::MimeEntity;
+ my $convert = Mail::Message::Convert::MimeEntity->new;
+
+ my Mail::Message $msg    = Mail::Message->new;
+ my MIME::Entity  $entity = $convert->export($msg);
+
+ my MIME::Entity  $entity = MIME::Entity->new;
+ my Mail::Message $msg    = $convert->from($entity);
+
+ use Mail::Box::Manager;
+ my $mgr     = Mail::Box::Manager->new;
+ my $folder  = $mgr->open(folder => 'Outbox');
+ $folder->addMessage($entity);
+
+
+=head1 DESCRIPTION
+
+The MIME::Entity extends Mail::Internet message with multiparts
+and more methods.  The L<Mail::Message|Mail::Message> objects are more flexible
+in how the message parts are stored, and uses separate header and body
+objects.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Message::Convert::MimeEntity-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Convert/"METHODS">
+
+=back
+
+=head2 Converting
+
+
+$obj-E<gt>B<export>(MESSAGE, [PARSER])
+
+=over 4
+
+Returns a new L<MIME::Entity> message object based on the
+information from the MESSAGE, which is a L<Mail::Message|Mail::Message> object.
+
+You may want to supply your own PARSER, which is a MIME::Parser
+object, to change the parser flags.  Without a PARSER object, one
+is created for you, with all the default settings.
+
+If C<undef> is passed, in place of a MESSAGE, then an empty list is
+returned.  When the parsing failes, then L<MIME::Parser> throws an
+exception.
+
+I<Example:> 
+
+ my $convert = Mail::Message::Convert::MimeEntity->new;
+ my Mail::Message $msg  = Mail::Message->new;
+ my manual MIME::Entity  $copy = $convert->export($msg);
+
+=back
+
+$obj-E<gt>B<from>(MIME-OBJECT)
+
+=over 4
+
+Returns a new L<Mail::Message|Mail::Message> object based on the information from
+the specified L<MIME::Entity>.  If the conversion fails, the C<undef>
+is returned.  If C<undef> is passed in place of an OBJECT, then an
+empty list is returned.
+
+I<Example:> 
+
+ my $convert = Mail::Message::Convert::MimeEntity->new;
+ my MIME::Entity  $msg  = MIME::Entity->new;
+ my Mail::Message $copy = $convert->from($msg);
+
+=back
+
+$obj-E<gt>B<selectedFields>(HEAD)
+
+=over 4
+
+See L<Mail::Message::Convert/"Converting">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Convert::MimeEntity-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Convert::MimeEntity-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Convert::MimeEntity-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Converting from MIME::Entity but got a $type, return
+
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/TextAutoformat.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/TextAutoformat.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/TextAutoformat.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,36 @@
+use strict;
+use warnings;
+
+package Mail::Message::Convert::TextAutoformat;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Convert';
+
+use Mail::Message::Body::String;
+use Text::Autoformat;
+
+
+sub init($)
+{   my ($self, $args)  = @_;
+
+    $self->SUPER::init($args);
+
+    $self->{MMCA_options} = $args->{autoformat} || { all => 1 };
+    $self;
+}
+
+#------------------------------------------
+
+
+sub autoformatBody($)
+{   my ($self, $body) = @_;
+
+    ref($body)->new
+       ( based_on => $body
+       , data     => autoformat($body->string, $self->{MMCA_options})
+       );
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/TextAutoformat.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/TextAutoformat.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert/TextAutoformat.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,238 @@
+
+=head1 NAME
+
+Mail::Message::Convert::TextAutoformat - Reformat plain text messages
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Convert::TextAutoformat
+   is a Mail::Message::Convert
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ use Mail::Message::Convert::TextAutoformat;
+ my $af = Mail::Message::Convert::TextAutoformat->new;
+
+ my $beautified_body = $af->autoformatBody($body);
+
+
+=head1 DESCRIPTION
+
+Play trics with plain text, for instance bodies with type C<text/plain>
+using Damian Conway's Text::Autoformat.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Message::Convert::TextAutoformat-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option   Defined in       Default          
+ fields   L<Mail::Message::Convert>  <see description>
+ log      L<Mail::Reporter>  C<'WARNINGS'>    
+ options                   C<{ (all, 1) }>  
+ trace    L<Mail::Reporter>  C<'WARNINGS'>    
+
+. fields NAMES|ARRAY-OF-NAMES|REGEXS
+
+. log LEVEL
+
+. options HASH-REF
+
+=over 4
+
+Options to pass to Text::Autoformat, when its C<autoformat> method
+is called.
+
+=back
+
+. trace LEVEL
+
+=back
+
+=head2 Converting
+
+
+$obj-E<gt>B<autoformatBody>(BODY)
+
+=over 4
+
+Formats a single message body (a L<Mail::Message::Body|Mail::Message::Body> object)
+into a new body object using Text::Autoformat.  If the
+Text::Autoformat is not installed, C<undef> is returned.
+
+=back
+
+$obj-E<gt>B<selectedFields>(HEAD)
+
+=over 4
+
+See L<Mail::Message::Convert/"Converting">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Convert::TextAutoformat-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Convert::TextAutoformat-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Convert::TextAutoformat-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,32 @@
+
+use strict;
+use warnings;
+
+package Mail::Message::Convert;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Reporter';
+
+
+sub init($)
+{   my ($self, $args) = @_;
+    $self->SUPER::init($args);
+
+    $self->{MMC_fields}          = $args->{fields}    ||
+       qr#^(Resent\-)?(To|From|Cc|Bcc|Subject|Date)\b#i;
+
+    $self;
+}
+
+#------------------------------------------
+
+
+sub selectedFields($)
+{   my ($self, $head) = @_;
+    $head->grepNames($self->{MMC_fields});
+}
+
+#------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Convert.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,277 @@
+
+=head1 NAME
+
+Mail::Message::Convert - conversions between message types
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Convert
+   is a Mail::Reporter
+
+ Mail::Message::Convert is extended by
+   Mail::Message::Convert::Html
+   Mail::Message::Convert::HtmlFormatPS
+   Mail::Message::Convert::HtmlFormatText
+   Mail::Message::Convert::MailInternet
+   Mail::Message::Convert::MimeEntity
+   Mail::Message::Convert::TextAutoformat
+
+
+=head1 SYNOPSIS
+
+Available methods are very converter-specific.
+
+
+=head1 DESCRIPTION
+
+This class is the base for various message (and message parts) converters.
+When the conversion does not change the contents of the body, most of
+the converters will return the source object.  In any case, an
+L<Mail::Message::Body|Mail::Message::Body> is returned with the conversion applied but as
+much of the other meta data stored in the source body unchanged.
+
+In most cases, converters are created by Mail::Message when they are
+needed; have a look at the C<encode> and C<decoded> methods on message
+objects.
+
+The following converters are currently available:
+
+=over 4
+
+=item * L<Mail::Message::Convert::Html|Mail::Message::Convert::Html>
+
+Plays tricks with HTML/XMHTML without help of external modules.
+
+=item * L<Mail::Message::Convert::HtmlFormatText|Mail::Message::Convert::HtmlFormatText>
+
+Converts HTML body objects to plain text objects using the
+HTML::FormatText module.
+
+=item * L<Mail::Message::Convert::HtmlFormatPS|Mail::Message::Convert::HtmlFormatPS>
+
+Converts HTML body objects to Postscript objects using the
+HTML::FormatPS module.
+
+=item * L<Mail::Message::Convert::MailInternet|Mail::Message::Convert::MailInternet>
+
+Converts the simple Mail::Internet messages into L<Mail::Message|Mail::Message>
+objects.
+
+=item * L<Mail::Message::Convert::MimeEntity|Mail::Message::Convert::MimeEntity>
+
+Converts the more complicated MIME::Entity messages into
+L<Mail::Message|Mail::Message> objects.
+
+=item * L<Mail::Message::Convert::TextAutoformat|Mail::Message::Convert::TextAutoformat>
+
+Converts a text message into text using Text::Autoformat.
+
+=back
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Message::Convert-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option  Defined in       Default          
+ fields                   <see description>
+ log     L<Mail::Reporter>  C<'WARNINGS'>    
+ trace   L<Mail::Reporter>  C<'WARNINGS'>    
+
+. fields NAMES|ARRAY-OF-NAMES|REGEXS
+
+=over 4
+
+Select the fields of a header which are to be handled.  Other
+fields will not be used.  The value of this option is passed to
+L<Mail::Message::Head::Complete::grepNames()|Mail::Message::Head::Complete/"Access to the header"> whenever converters feel
+a need for header line selection.
+By default, the C<To>, C<From>, C<Cc>, C<Bcc>, C<Date>, C<Subject>, and their
+C<Resent-> counterparts will be selected.  Specify an empty list to get all
+fields.
+
+=back
+
+. log LEVEL
+
+. trace LEVEL
+
+=back
+
+=head2 Converting
+
+
+$obj-E<gt>B<selectedFields>(HEAD)
+
+=over 4
+
+Returns a list of fields to be included in the format.  The list is
+an ordered selection of the fields in the actual header, and filtered
+through the information as specified with L<new(fields)|Mail::Message::Convert/"METHODS">.
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Convert-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Convert-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Convert-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Dummy.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Dummy.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Dummy.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,45 @@
+
+use strict;
+
+package Mail::Message::Dummy;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message';
+
+use Carp;
+
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    @$args{ qw/modified trusted/ } = (0, 1);
+    $self->SUPER::init($args);
+
+    $self->log(ERROR => "Message-Id is required for a dummy.")
+       unless exists $args->{messageId};
+
+    $self;
+}
+ 
+#-------------------------------------------
+
+sub isDummy()    { 1 }
+
+#-------------------------------------------
+
+
+sub head()
+{    shift->log(ERROR => "You cannot take the head of a dummy message");
+     ();
+}
+
+#-------------------------------------------
+
+sub body()
+{    shift->log(ERROR => "You cannot take the body of a dummy message");
+     ();
+}
+
+#-------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Dummy.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Dummy.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Dummy.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,874 @@
+
+=head1 NAME
+
+Mail::Message::Dummy - a placeholder for a missing messages
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Dummy
+   is a Mail::Message
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+
+
+=head1 DESCRIPTION
+
+Dummy messages are used by modules which maintain ordered lists
+of messages, usually based on message-id.  A good example is
+L<Mail::Box::Thread::Manager|Mail::Box::Thread::Manager>, which detects related messages by
+scanning the known message headers for references to other messages.
+As long as the referenced messages are not found inside the mailbox,
+their place is occupied by a dummy.
+
+Be careful when using modules which may create dummies.  Before trying to
+access the header or body use L<isDummy()|Mail::Message/"The Message"> to check if the message is a
+dummy message.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message/"Constructors">
+
+=back
+
+Mail::Message::Dummy-E<gt>B<coerce>(MESSAGE)
+
+=over 4
+
+See L<Mail::Message/"Constructors">
+
+=back
+
+Mail::Message::Dummy-E<gt>B<new>(MESSAGE-ID, OPTIONS)
+
+=over 4
+
+Create a new dummy message to occupy the space for
+a real message with the specified MESSAGE-ID.
+
+ Option      Defined in       Default                                                 
+ body        L<Mail::Message>  <not used>                                              
+ body_type   L<Mail::Message>  L<Mail::Message::Body::Lines|Mail::Message::Body::Lines>
+ deleted     L<Mail::Message>  <false>                                                 
+ field_type  L<Mail::Message>  <not used>                                              
+ head        L<Mail::Message>  <not used>                                              
+ head_type   L<Mail::Message>  <not used>                                              
+ labels      L<Mail::Message>  {}                                                      
+ log         L<Mail::Reporter>  C<'WARNINGS'>                                           
+ messageId   L<Mail::Message>  <required>                                              
+ modified    L<Mail::Message>  <always false>                                          
+ trace       L<Mail::Reporter>  C<'WARNINGS'>                                           
+ trusted     L<Mail::Message>  <always true>                                           
+
+. body OBJECT
+
+. body_type CLASS
+
+. deleted BOOLEAN
+
+. field_type CLASS
+
+. head OBJECT
+
+. head_type CLASS
+
+. labels ARRAY|HASH
+
+. log LEVEL
+
+. messageId STRING
+
+. modified BOOLEAN
+
+. trace LEVEL
+
+. trusted BOOLEAN
+
+I<Example:> 
+
+ my $message = Mail::Message::Dummy->new($msgid);
+ if($message->isDummy) {...}
+
+=back
+
+=head2 Constructing a message
+
+
+$obj-E<gt>B<bounce>([RG-OBJECT|OPTIONS])
+
+=over 4
+
+See L<Mail::Message::Construct::Bounce/"Constructing a message">
+
+=back
+
+Mail::Message::Dummy-E<gt>B<build>([MESSAGE|BODY], CONTENT)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+Mail::Message::Dummy-E<gt>B<buildFromBody>(BODY, [HEAD], HEADERS)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forward>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardAttach>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardEncapsulate>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardInline>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardNo>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPostlude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPrelude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardSubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+Mail::Message::Dummy-E<gt>B<read>(FILEHANDLE|SCALAR|REF-SCALAR|ARRAY-OF-LINES, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Read/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<rebuild>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<reply>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replyPrelude>([STRING|FIELD|ADDRESS|ARRAY-OF-THINGS])
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replySubject>(STRING)
+
+Mail::Message::Dummy-E<gt>B<replySubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+=head2 The Message
+
+
+$obj-E<gt>B<container>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isDummy>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isPart>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<messageId>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<send>([MAILER], OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<toplevel>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<write>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<bcc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<cc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<date>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<destinations>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<from>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<get>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<guessTimestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<head>(...)
+
+=over 4
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<sender>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<study>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<subject>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<timestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<to>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+=head2 The body
+
+
+$obj-E<gt>B<body>([BODY])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<decoded>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<encode>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isNested>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<parts>(['ALL'|'ACTIVE'|'DELETED'|'RECURSE'|FILTER])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+=head2 Flags
+
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<deleted>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isDeleted>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<label>(LABEL|PAIRS)
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<labels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<labelsToStatus>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<statusToLabels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+=head2 The whole message as text
+
+
+$obj-E<gt>B<file>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<lines>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<printStructure>([FILEHANDLE][, INDENT])
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readBody>(PARSER, HEAD [, BODYTYPE])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readFromParser>(PARSER, [BODYTYPE])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readHead>(PARSER [,CLASS])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<recursiveRebuildPart>(PART, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Internals">
+
+=back
+
+$obj-E<gt>B<storeBody>(BODY)
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<takeMessageId>([STRING])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Message::Construct/"METHODS">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Dummy-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Dummy-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Dummy-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortSize>([VALUE])
+
+Mail::Message::Dummy-E<gt>B<shortSize>([VALUE])
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortString>
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<destruct>
+
+=over 4
+
+See L<Mail::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot include forward source as $include.
+
+Unknown alternative for the L<forward(include)|Mail::Message::Construct::Forward/"Constructing a message">.  Valid choices are
+C<NO>, C<INLINE>, C<ATTACH>, and C<ENCAPSULATE>.
+
+I<Error:> Cannot include reply source as $include.
+
+Unknown alternative for the C<include> option of L<reply()|Mail::Message::Construct::Reply/"Constructing a message">.  Valid
+choices are C<NO>, C<INLINE>, and C<ATTACH>.
+
+I<Error:> Message-Id is required for a dummy.
+
+A dummy message occupies the place for a real message.  When a dummy is created,
+the id of the message which place it is holding must be known.
+
+I<Error:> No address to create forwarded to.
+
+If a forward message is created, a destination address must be specified.
+
+I<Error:> No default mailer found to send message.
+
+The message L<send()|Mail::Message/"The Message"> mechanism had not enough information to automatically
+find a mail transfer agent to sent this message.  Specify a mailer
+explicitly using the C<via> options.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> You cannot take the head/body of a dummy message
+
+Dummy messages are place-holders in message threads: the thread detected
+the existence of the message, because it found the message-id in a
+Reply-To or References field, however it did not find the header and
+body of the message yet.  Use L<isDummy()|Mail::Message/"The Message"> to check whether the thread
+node returned a dummy or not.
+
+I<Error:> forwardAttach requires a preamble object
+
+
+I<Error:> forwardEncapsulate requires a preamble object
+
+
+I<Error:> no rebuild rule $name defined.
+
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/AddrGroup.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/AddrGroup.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/AddrGroup.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,72 @@
+use strict;
+use warnings;
+
+package Mail::Message::Field::AddrGroup;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'User::Identity::Collection::Emails';
+
+
+use overload '""' => 'string';
+
+#------------------------------------------
+
+
+sub string()
+{   my $self = shift;
+    my $name = $self->name;
+    my @addr = sort map {$_->string} $self->addresses;
+
+    local $" = ', ';
+
+      length $name  ? "$name: @addr;"
+    : @addr         ? "@addr"
+    :                 '';
+}
+
+#------------------------------------------
+
+
+sub coerce($@)
+{  my ($class, $addr, %args) = @_;
+
+   return () unless defined $addr;
+
+   if(ref $addr)
+   {  return $addr if $addr->isa($class);
+
+      return bless $addr, $class
+          if $addr->isa('User::Identity::Collection::Emails');
+   }
+
+   $class->log(ERROR => "Cannot coerce a ".(ref($addr)|'string').
+                        " into a $class");
+   ();
+}
+
+
+#------------------------------------------
+
+
+sub addAddress(@)
+{   my $self  = shift;
+
+    my $addr
+     = @_ > 1    ? Mail::Message::Field::Address->new(@_)
+     : !$_[0]    ? return ()
+     :             Mail::Message::Field::Address->coerce(shift);
+
+    $self->addRole($addr);
+    $addr;
+}
+
+#------------------------------------------
+
+
+# roles are stored in a hash, so produce
+sub addresses() { shift->roles }
+
+#------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/AddrGroup.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/AddrGroup.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/AddrGroup.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,298 @@
+
+=head1 NAME
+
+Mail::Message::Field::AddrGroup - A group of Mail::Message::Field::Address objects
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Field::AddrGroup
+   is a User::Identity::Collection::Emails
+   is a User::Identity::Collection
+   is a User::Identity::Item
+
+
+=head1 SYNOPSIS
+
+ my $g = Mail::Message::Field::AddrGroup->new(name => 'name');
+
+ my $a = Mail::Message::Field::Address->new(...);
+ $g->addAddress($a);
+ 
+ my $f = Mail::Message::Field::Addresses->new;
+ $f->addGroup($g);
+
+
+=head1 DESCRIPTION
+
+An address group collects a set of e-mail addresses (in this case they
+are L<Mail::Message::Field::Address|Mail::Message::Field::Address> objects).
+
+
+=head1 OVERLOADED
+
+
+overload: B<@{}>
+
+=over 4
+
+See L<User::Identity::Collection/"OVERLOADED">
+
+=back
+
+overload: B<stringification>
+
+=over 4
+
+Returns the L<string()|Mail::Message::Field::AddrGroup/"METHODS"> value.
+
+=back
+
+
+=head1 METHODS
+
+
+$obj-E<gt>B<string>
+
+=over 4
+
+Returns the address group as string.  When no name is specified, it will
+only be a comma separated list of addresses.  With a name, the groups
+name will be prepended and a semi-colon appended.  When no addresses
+where included and there is no name, then C<undef> is returned.
+
+=back
+
+=head2 Initiation
+
+
+Mail::Message::Field::AddrGroup-E<gt>B<new>([NAME], OPTIONS)
+
+=over 4
+
+See L<User::Identity::Collection::Emails/"Initiation">
+
+=back
+
+=head2 Attributes
+
+
+$obj-E<gt>B<addRole>(ROLE| ( [NAME],OPTIONS ) | ARRAY-OF-OPTIONS)
+
+=over 4
+
+See L<User::Identity::Collection/"Attributes">
+
+=back
+
+$obj-E<gt>B<description>
+
+=over 4
+
+See L<User::Identity::Item/"Attributes">
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<User::Identity::Item/"Attributes">
+
+=back
+
+$obj-E<gt>B<roles>
+
+=over 4
+
+See L<User::Identity::Collection/"Attributes">
+
+=back
+
+=head2 Collections
+
+
+$obj-E<gt>B<add>(COLLECTION, ROLE)
+
+=over 4
+
+See L<User::Identity::Item/"Collections">
+
+=back
+
+$obj-E<gt>B<addCollection>(OBJECT | ([TYPE], OPTIONS))
+
+=over 4
+
+See L<User::Identity::Item/"Collections">
+
+=back
+
+$obj-E<gt>B<collection>(NAME)
+
+=over 4
+
+See L<User::Identity::Item/"Collections">
+
+=back
+
+$obj-E<gt>B<parent>([PARENT])
+
+=over 4
+
+See L<User::Identity::Item/"Collections">
+
+=back
+
+$obj-E<gt>B<type>
+
+Mail::Message::Field::AddrGroup-E<gt>B<type>
+
+=over 4
+
+See L<User::Identity::Item/"Collections">
+
+=back
+
+$obj-E<gt>B<user>
+
+=over 4
+
+See L<User::Identity::Item/"Collections">
+
+=back
+
+=head2 Searching
+
+
+$obj-E<gt>B<find>(NAME|CODE|undef)
+
+=over 4
+
+See L<User::Identity::Collection/"Searching">
+
+=back
+
+=head2 Constructors
+
+
+$obj-E<gt>B<coerce>(OBJECT)
+
+=over 4
+
+Coerce an OBJECT into a L<Mail::Message::Field::AddrGroup|Mail::Message::Field::AddrGroup>.  Currently,
+you can only coerce L<User::Identity::Collection::Emails|User::Identity::Collection::Emails> (which is
+the base class for this one) into this one.
+
+=back
+
+=head2 Addresses
+
+
+$obj-E<gt>B<addAddress>(STRING|ADDRESS|OPTIONS)
+
+=over 4
+
+Add one e-mail address to the list which is maintained in the group. This
+is a wrapper around L<addRole()|User::Identity::Collection/"Attributes"> adding flexibility on how addresses
+are specified.  An ADDRESS can be anything which is acceptable for
+L<Mail::Message::Field::Address::coerce()|Mail::Message::Field::Address/"Constructors"> or a list of options which
+will create such an object.
+
+I<Example:> of adding an address to an address group
+
+
+ my @data = (full_name => "Myself", address => 'me at tux.org');
+ $group->addAddress(@data);
+
+ my $addr = Mail::Message::Field::Address->new(@data);
+ $group->addAddress(@data);
+
+ my $ma = Mail::Address->new(...);
+ $group->addAddress($ma);
+
+=back
+
+$obj-E<gt>B<addresses>
+
+=over 4
+
+Returns all addresses defined in this group.  The addresses will be
+ordered alphabetically to make automated testing possible: roles are
+stored in a hash, so have an unpredictable order by default.
+
+I<Example:> getting all addresses from a group
+
+
+ my @addrs = $group->addresses;
+ my @addrs = map { $_->address } $self->roles; #same
+
+=back
+
+=head2 Error handling
+
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> $object is not a collection.
+
+The first argument is an object, but not of a class which extends
+L<User::Identity::Collection|User::Identity::Collection>.
+
+I<Error:> Cannot coerce a $type into a Mail::Message::Field::AddrGroup
+
+
+I<Error:> Cannot create a $type to add this to my collection.
+
+Some options are specified to create a $type object, which is native to
+this collection.  However, for some reason this failed.
+
+I<Error:> Cannot load collection module for $type ($class).
+
+Either the specified $type does not exist, or that module named $class returns
+compilation errors.  If the type as specified in the warning is not
+the name of a package, you specified a nickname which was not defined.
+Maybe you forgot the 'require' the package which defines the nickname.
+
+I<Error:> Creation of a collection via $class failed.
+
+The $class did compile, but it was not possible to create an object
+of that class using the options you specified.
+
+I<Error:> Don't know what type of collection you want to add.
+
+If you add a collection, it must either by a collection object or a
+list of options which can be used to create a collection object.  In
+the latter case, the type of collection must be specified.
+
+I<Warning:> No collection $name
+
+The collection with $name does not exist and can not be created.
+
+I<Error:> Wrong type of role for $collection: requires a $expect but got a $type
+
+Each $collection groups sets of roles of one specific type ($expect).  You
+cannot add objects of a different $type.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Address.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Address.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Address.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,68 @@
+use strict;
+use warnings;
+
+package Mail::Message::Field::Address;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Identity';
+
+use Mail::Message::Field::Addresses;
+use Mail::Message::Field::Full;
+my $format = 'Mail::Message::Field::Full';
+
+
+use overload '""' => 'string'
+           , bool => sub {1}
+           ;
+
+#------------------------------------------
+
+
+sub coerce($@)
+{  my ($class, $addr, %args) = @_;
+   return () unless defined $addr;
+
+   return $class->parse($addr) unless ref $addr;
+
+   return $addr if $addr->isa($class);
+
+   my $from = $class->from($addr);
+
+   Mail::Reporter->log(ERROR => "Cannot coerce a ".ref($addr)." into a $class"),
+      return () unless defined $from;
+
+   bless $from, $class;
+}
+
+#------------------------------------------
+
+
+sub parse($)
+{   my $self   = shift;
+    my $parsed = Mail::Message::Field::Addresses->new('To' => shift);
+    defined $parsed ? ($parsed->addresses)[0] : ();
+}
+
+#------------------------------------------
+
+
+sub string()
+{   my $self  = shift;
+    my @opts  = (charset => $self->charset); # language => $self->language
+
+    my @parts;
+    my $name    = $self->phrase;
+    push @parts, $format->createPhrase($name, @opts) if defined $name;
+
+    my $address = $self->address;
+    push @parts, @parts ? '<'.$address.'>' : $address;
+
+    my $comment = $self->comment;
+    push @parts, $format->createComment($comment, @opts) if defined $comment;
+
+    join ' ', @parts;
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Address.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Address.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Address.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,338 @@
+
+=head1 NAME
+
+Mail::Message::Field::Address - One e-mail address
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Field::Address
+   is a Mail::Identity
+   is a User::Identity::Item
+
+
+=head1 SYNOPSIS
+
+ my $addr = Mail::Message::Field::Address->new(...);
+
+ my $ui   = User::Idenity->new(...);
+ my $addr = Mail::Message::Field::Address->coerce($ui);
+
+ my $mi   = Mail::Idenity->new(...);
+ my $addr = Mail::Message::Field::Address->coerce($mi);
+
+ print $addr->address;
+ print $addr->fullName;   # possibly unicode!
+ print $addr->domain;
+
+
+=head1 DESCRIPTION
+
+Many header fields can contain e-mail addresses.  Each e-mail address
+can be represented by an object of this class.  These objects will
+handle interpretation and character set encoding and decoding for you.
+
+
+=head1 OVERLOADED
+
+
+overload: B<boolean>
+
+=over 4
+
+The object used as boolean will always return C<true>
+
+=back
+
+overload: B<stringification>
+
+=over 4
+
+When the object is used in string context, it will return the encoded
+representation of the e-mail address, just like L<string()|Mail::Message::Field::Address/"Access to the content"> does.
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Initiation
+
+
+Mail::Message::Field::Address-E<gt>B<new>([NAME], OPTIONS)
+
+=over 4
+
+See L<Mail::Identity/"METHODS">
+
+=back
+
+=head2 Constructors
+
+
+$obj-E<gt>B<coerce>(STRING|OBJECT, OPTIONS)
+
+=over 4
+
+Try to coerce the OBJECT into a C<Mail::Message::Field::Address>.
+In case of a STRING, it is interpreted as an email address.
+
+The OPTIONS are passed to the object creation, and overrule the values
+found in the OBJECT.  The result may be C<undef> or a newly created
+object.  If the OBJECT is already of the correct type, it is returned
+unmodified.
+
+The OBJECT may currently be a Mail::Address, a L<Mail::Identity|Mail::Identity>, or
+a L<User::Identity|User::Identity>.  In case of the latter, one of the user's addresses
+is chosen at random.
+
+=back
+
+$obj-E<gt>B<from>(OBJECT)
+
+=over 4
+
+See L<Mail::Identity/"Constructors">
+
+=back
+
+$obj-E<gt>B<parse>(STRING)
+
+=over 4
+
+Parse the string for an address.  You never know whether one or more
+addresses are specified on a line (often applications are wrong), therefore,
+the STRING is first parsed for as many addresses as possible and then the
+one is taken at random.
+
+=back
+
+=head2 Attributes
+
+
+$obj-E<gt>B<address>
+
+=over 4
+
+See L<Mail::Identity/"Attributes">
+
+=back
+
+$obj-E<gt>B<charset>
+
+=over 4
+
+See L<Mail::Identity/"Attributes">
+
+=back
+
+$obj-E<gt>B<comment>([STRING])
+
+=over 4
+
+See L<Mail::Identity/"Attributes">
+
+=back
+
+$obj-E<gt>B<description>
+
+=over 4
+
+See L<User::Identity::Item/"Attributes">
+
+=back
+
+$obj-E<gt>B<domain>
+
+=over 4
+
+See L<Mail::Identity/"Attributes">
+
+=back
+
+$obj-E<gt>B<language>
+
+=over 4
+
+See L<Mail::Identity/"Attributes">
+
+=back
+
+$obj-E<gt>B<location>
+
+=over 4
+
+See L<Mail::Identity/"Attributes">
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<User::Identity::Item/"Attributes">
+
+=back
+
+$obj-E<gt>B<organization>
+
+=over 4
+
+See L<Mail::Identity/"Attributes">
+
+=back
+
+$obj-E<gt>B<phrase>
+
+=over 4
+
+See L<Mail::Identity/"Attributes">
+
+=back
+
+$obj-E<gt>B<username>
+
+=over 4
+
+See L<Mail::Identity/"Attributes">
+
+=back
+
+=head2 Collections
+
+
+$obj-E<gt>B<add>(COLLECTION, ROLE)
+
+=over 4
+
+See L<User::Identity::Item/"Collections">
+
+=back
+
+$obj-E<gt>B<addCollection>(OBJECT | ([TYPE], OPTIONS))
+
+=over 4
+
+See L<User::Identity::Item/"Collections">
+
+=back
+
+$obj-E<gt>B<collection>(NAME)
+
+=over 4
+
+See L<User::Identity::Item/"Collections">
+
+=back
+
+$obj-E<gt>B<find>(COLLECTION, ROLE)
+
+=over 4
+
+See L<User::Identity::Item/"Collections">
+
+=back
+
+$obj-E<gt>B<parent>([PARENT])
+
+=over 4
+
+See L<User::Identity::Item/"Collections">
+
+=back
+
+$obj-E<gt>B<type>
+
+Mail::Message::Field::Address-E<gt>B<type>
+
+=over 4
+
+See L<User::Identity::Item/"Collections">
+
+=back
+
+$obj-E<gt>B<user>
+
+=over 4
+
+See L<User::Identity::Item/"Collections">
+
+=back
+
+=head2 Access to the content
+
+
+$obj-E<gt>B<string>
+
+=over 4
+
+Returns an RFC compliant e-mail address, which will have character
+set encoding if needed.  The objects are also overloaded to call
+this method in string context.
+
+I<Example:> 
+
+ print $address->string;
+ print $address;          # via overloading
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> $object is not a collection.
+
+The first argument is an object, but not of a class which extends
+L<User::Identity::Collection|User::Identity::Collection>.
+
+I<Error:> Cannot coerce a $type into a Mail::Message::Field::Address
+
+When addresses are specified to be included in header fields, they may
+be coerced into L<Mail::Message::Field::Address|Mail::Message::Field::Address> objects first.  What
+you specify is not accepted as address specification.  This may be an
+internal error.
+
+I<Error:> Cannot load collection module for $type ($class).
+
+Either the specified $type does not exist, or that module named $class returns
+compilation errors.  If the type as specified in the warning is not
+the name of a package, you specified a nickname which was not defined.
+Maybe you forgot the 'require' the package which defines the nickname.
+
+I<Error:> Creation of a collection via $class failed.
+
+The $class did compile, but it was not possible to create an object
+of that class using the options you specified.
+
+I<Error:> Don't know what type of collection you want to add.
+
+If you add a collection, it must either by a collection object or a
+list of options which can be used to create a collection object.  In
+the latter case, the type of collection must be specified.
+
+I<Warning:> No collection $name
+
+The collection with $name does not exist and can not be created.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Addresses.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Addresses.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Addresses.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,244 @@
+use strict;
+use warnings;
+
+package Mail::Message::Field::Addresses;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Field::Structured';
+
+use Mail::Message::Field::AddrGroup;
+use Mail::Message::Field::Address;
+use List::Util 'first';
+
+
+#------------------------------------------
+# what is permitted for each field.
+
+my $address_list = {groups => 1, multi => 1};
+my $mailbox_list = {multi => 1};
+my $mailbox      = {};
+
+my %accepted     =    # defaults to $address_list
+ ( from       => $mailbox_list
+ , sender     => $mailbox
+ );
+
+
+#------------------------------------------
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    $self->{MMFF_groups}   = [];
+
+    ( my $def = lc $args->{name} ) =~ s/^resent\-//;
+    $self->{MMFF_defaults} = $accepted{$def} || $address_list;
+
+    my ($body, @body);
+    if($body = $args->{body})
+    {   @body = ref $body eq 'ARRAY' ? @$body : ($body);
+        return () unless @body;
+    }
+
+    if(@body > 1 || ref $body[0])
+    {   $self->addAddress($_) foreach @body;
+        delete $args->{body};
+    }
+
+    $self->SUPER::init($args) or return;
+    $self;
+}
+
+#------------------------------------------
+
+
+sub addAddress(@)
+{   my $self  = shift;
+    my $email = @_ && ref $_[0] ? shift : undef;
+    my %args  = @_;
+    my $group = delete $args{group} || '';
+
+    $email = Mail::Message::Field::Address->new(%args)
+        unless defined $email;
+
+    my $set = $self->group($group) || $self->addGroup(name => $group);
+    $set->addAddress($email);
+}
+
+#------------------------------------------
+
+
+sub addGroup(@)
+{   my $self  = shift;
+    my $group = @_ == 1 ? shift
+              : Mail::Message::Field::AddrGroup->new(@_);
+
+    push @{$self->{MMFF_groups}}, $group;
+    $group;
+}
+
+#------------------------------------------
+
+
+sub group($)
+{   my ($self, $name) = @_;
+    $name = '' unless defined $name;
+    first { lc($_->name) eq lc($name) } $self->groups;
+}
+
+#------------------------------------------
+
+
+sub groups() { @{shift->{MMFF_groups}} }
+
+#------------------------------------------
+
+
+sub groupNames() { map {$_->name} shift->groups }
+
+#------------------------------------------
+
+
+sub addresses() { map {$_->addresses} shift->groups }
+
+#------------------------------------------
+
+
+sub addAttribute($;@)
+{   my $self = shift;
+    $self->log(ERROR => 'No attributes for address fields.');
+    $self;
+}
+
+#------------------------------------------
+
+
+sub addExtra($@)
+{   my $self = shift;
+    $self->log(ERROR => 'No extras in address fields.');
+    $self;
+}
+
+#------------------------------------------
+
+
+sub parse($)
+{   my ($self, $string) = @_;
+    my ($group, $email) = ('', undef);
+
+    while(1)
+    {   (my $comment, $string) = $self->consumeComment($string);
+
+        if($string =~ s/^\s*\;//s ) { $group = ''; next }  # end group
+        if($string =~ s/^\s*\,//s ) { next }               # end address
+
+        (my $email, $string) = $self->consumeAddress($string);
+        if(defined $email)
+        {   # Pattern starts with e-mail address
+            ($comment, $string) = $self->consumeComment($string);
+            $email->comment($comment) if defined $comment;
+        }
+        else
+        {   # Pattern not plain address
+            my $real_phrase = $string =~ m/^\s*\"/;
+            (my $phrase, $string) = $self->consumePhrase($string);
+
+            if(defined $phrase)
+            {   ($comment, $string) = $self->consumeComment($string);
+
+                if($string =~ s/^\s*\://s )
+                {   $group = $phrase;
+                    # even empty groups must appear
+                    $self->addGroup(name=>$group) unless $self->group($group);
+                    next;
+                }
+            }
+
+            my $angle;
+            if($string =~ s/^\s*\<([^>]*)\>//s) { $angle = $1 }
+            elsif($real_phrase)
+            {   $self->log(ERROR => "Ignore unrelated phrase $string");
+                next;
+            }
+            elsif(defined $phrase)
+            {   ($angle = $phrase) =~ s/\s+/./g;
+                undef $phrase;
+            }
+
+            ($comment, $string) = $self->consumeComment($string);
+
+            # remove obsoleted route info.
+            return 1 unless defined $angle;
+            $angle =~ s/^\@.*?\://;
+
+            ($email, $angle) = $self->consumeAddress($angle
+                , phrase => $phrase, comment => $comment);
+        }
+
+        $self->addAddress($email, group => $group) if defined $email;
+        return 1 if $string =~ m/^\s*$/s;
+   }
+
+   $self->log(WARNING => 'Illegal part in address field '.$self->Name.
+        ": $string\n");
+
+   0;
+}
+
+#------------------------------------------
+
+
+sub produceBody()
+{  my @groups = sort {$a->name cmp $b->name} shift->groups;
+
+   return undef unless @groups;
+   return $groups[0]->string if @groups==1;
+
+   my $plain
+    = $groups[0]->name eq '' && $groups[0]->addresses
+    ? (shift @groups)->string.','
+    : '';
+
+   join ' ', $plain, map({$_->string} @groups);
+}
+
+#------------------------------------------
+
+
+sub consumeAddress($@)
+{   my ($self, $string, @options) = @_;
+
+    my ($local, $shorter, $loccomment) = $self->consumeDotAtom($string);
+    $local =~ s/\s//g if defined $local;
+
+    return (undef, $string)
+        unless defined $local && $shorter =~ s/^\s*\@//;
+  
+    (my $domain, $shorter, my $domcomment) = $self->consumeDomain($shorter);
+    return (undef, $string) unless defined $domain;
+
+    # loccomment and domcomment ignored
+    my $email   = Mail::Message::Field::Address->new
+     ( username => $local, domain => $domain, @options);
+
+    ($email, $shorter);
+}
+
+#------------------------------------------
+
+
+sub consumeDomain($)
+{   my ($self, $string) = @_;
+
+    return ($self->stripCFWS($1), $string)
+        if $string =~ s/\s*(\[(?:[^[]\\]*|\\.)*\])//;
+
+    my ($atom, $rest, $comment) = $self->consumeDotAtom($string);
+    $atom =~ s/\s//g if defined $atom;
+    ($atom, $rest, $comment);
+}
+
+#------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Addresses.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Addresses.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Addresses.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,814 @@
+
+=head1 NAME
+
+Mail::Message::Field::Addresses - Fields with e-mail addresses
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Field::Addresses
+   is a Mail::Message::Field::Structured
+   is a Mail::Message::Field::Full
+   is a Mail::Message::Field
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my $f = Mail::Message::Field->new(Cc =>
+                'Mail::Box <mailbox at overmeer.net>');
+
+ my $cc = Mail::Message::Field->new('Cc');
+ $cc->addAddress('Mail::Box <mailbox at overmeer.net>');
+ $cc->addAddress
+   ( phrase  => 'Mail::Box'
+   , email   => 'mailbox at overmeer.net'
+   , comment => 'Our mailing list'     # deprecated by RFC
+   );
+
+ mu $ma = Mail::Message::Field::Address->new(...);
+ $cc->addAddress($ma);
+
+ my $mi = Mail::Identity->new(...);
+ $cc->addAddress($mi);
+
+ my $g  = Mail::Message::Field::AddrGroup->new(...);
+ $cc->addGroup($g);
+
+
+=head1 DESCRIPTION
+
+All header fields which contain e-mail addresses only.  Not all address
+fields have the same possibilities, but they are all parsed the same:
+you never know how broken the applications are which produce those
+messages.
+
+When you try to create constructs which are not allowed for a certain
+kind of field, you will be warned.
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<+0>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<<=>>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<bool>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<cmp>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<stringification>
+
+=over 4
+
+See L<Mail::Message::Field::Full/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message::Field/"Constructors">
+
+=back
+
+Mail::Message::Field::Addresses-E<gt>B<from>(FIELD, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Constructors">
+
+=back
+
+Mail::Message::Field::Addresses-E<gt>B<new>
+
+=over 4
+
+ Option      Defined in       Default      
+ attributes  L<Mail::Message::Field::Structured>  <ignored>    
+ charset     L<Mail::Message::Field::Full>  undef        
+ encoding    L<Mail::Message::Field::Full>  C<'q'>       
+ extra       L<Mail::Message::Field::Structured>  <ignored>    
+ force       L<Mail::Message::Field::Full>  false        
+ language    L<Mail::Message::Field::Full>  undef        
+ log         L<Mail::Reporter>  C<'WARNINGS'>
+ trace       L<Mail::Reporter>  C<'WARNINGS'>
+
+. attributes ATTRS
+
+. charset STRING
+
+. encoding 'q'|'Q'|'b'|'B'
+
+. extra STRING
+
+. force BOOLEAN
+
+. language STRING
+
+. log LEVEL
+
+. trace LEVEL
+
+=back
+
+=head2 The field
+
+
+$obj-E<gt>B<isStructured>
+
+Mail::Message::Field::Addresses-E<gt>B<isStructured>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<length>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<string>([WRAP])
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<toDisclose>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+=head2 Access to the name
+
+
+$obj-E<gt>B<Name>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the name">
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the name">
+
+=back
+
+$obj-E<gt>B<wellformedName>([STRING])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the name">
+
+=back
+
+=head2 Access to the body
+
+
+$obj-E<gt>B<body>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<decodedBody>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Access to the body">
+
+=back
+
+$obj-E<gt>B<folded>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<foldedBody>([BODY])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<stripCFWS>([STRING])
+
+Mail::Message::Field::Addresses-E<gt>B<stripCFWS>([STRING])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<unfoldedBody>([BODY, [WRAP]])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+=head2 Access to the content
+
+
+$obj-E<gt>B<addAddress>([ADDRESS], OPTIONS)
+
+=over 4
+
+Add an ADDRESS to the field.  The addresses are organized in groups.  If no
+group is specified, the default group is taken to store the address in.  If
+no ADDRESS is specified, the option must be sufficient to create a
+L<Mail::Message::Field::Address|Mail::Message::Field::Address> from.  See the OPTIONS of
+L<Mail::Message::Field::Address::new()|Mail::Identity/"METHODS">.
+
+ Option  Defined in  Default
+ group               C<''>  
+
+. group STRING
+
+=back
+
+$obj-E<gt>B<addAttribute>(...)
+
+=over 4
+
+Attributes are not supported for address fields.
+
+=back
+
+$obj-E<gt>B<addExtra>(...)
+
+=over 4
+
+Extras are not permitted in address fields.
+
+=back
+
+$obj-E<gt>B<addGroup>(GROUP|OPTIONS)
+
+=over 4
+
+Add a group of addresses to this field.  A GROUP can be specified, which
+is a L<Mail::Message::Field::AddrGroup|Mail::Message::Field::AddrGroup> object, or one is created for you
+using the OPTIONS.  The group is returned.
+
+ Option  Defined in  Default
+ name                C<''>  
+
+. name STRING
+
+=back
+
+$obj-E<gt>B<addresses>
+
+=over 4
+
+Returns a list with all addresses defined in any group of addresses:
+all addresses which are specified on the line.  The addresses are
+L<Mail::Message::Field::Address|Mail::Message::Field::Address> objects.
+
+I<Example:> 
+
+ my @addr = $field->addresses;
+
+=back
+
+$obj-E<gt>B<attribute>(OBJECT|(STRING, OPTIONS)|(NAME,VALUE,OPTIONS))
+
+=over 4
+
+See L<Mail::Message::Field::Structured/"Access to the content">
+
+=back
+
+$obj-E<gt>B<attributes>
+
+=over 4
+
+See L<Mail::Message::Field::Structured/"Access to the content">
+
+=back
+
+$obj-E<gt>B<beautify>
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Access to the content">
+
+=back
+
+$obj-E<gt>B<comment>([STRING])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<createComment>(STRING, OPTIONS)
+
+Mail::Message::Field::Addresses-E<gt>B<createComment>(STRING, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Access to the content">
+
+=back
+
+$obj-E<gt>B<createPhrase>(STRING, OPTIONS)
+
+Mail::Message::Field::Addresses-E<gt>B<createPhrase>(STRING, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Access to the content">
+
+=back
+
+$obj-E<gt>B<group>(NAME)
+
+=over 4
+
+Returns the group of addresses with the specified NAME, or C<undef>
+if it does not exist.  If NAME is C<undef>, then the default groep
+is returned.
+
+=back
+
+$obj-E<gt>B<groupNames>
+
+=over 4
+
+Returns a list with all group names which are defined.
+
+=back
+
+$obj-E<gt>B<groups>
+
+=over 4
+
+Returns all address groups which are defined in this field.  Each
+element is a L<Mail::Message::Field::AddrGroup|Mail::Message::Field::AddrGroup> object.
+
+=back
+
+$obj-E<gt>B<study>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<toDate>([TIME])
+
+Mail::Message::Field::Addresses-E<gt>B<toDate>([TIME])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<toInt>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+=head2 Other methods
+
+
+$obj-E<gt>B<dateToTimestamp>(STRING)
+
+Mail::Message::Field::Addresses-E<gt>B<dateToTimestamp>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field/"Other methods">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<consume>(LINE | (NAME,BODY|OBJECTS))
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<consumeAddress>(STRING, OPTIONS)
+
+=over 4
+
+Try to destilate address information from the STRING.   Returned are
+an address B<object> and the left-over string.  If no address was found,
+the first returned value is C<undef>.
+
+=back
+
+$obj-E<gt>B<consumeDomain>(STRING)
+
+=over 4
+
+Try to get a valid domain representation from STRING.  Returned are the
+domain string as found (or C<undef>) and the rest of the string.
+
+=back
+
+$obj-E<gt>B<decode>(STRING, OPTIONS)
+
+Mail::Message::Field::Addresses-E<gt>B<decode>(STRING, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Internals">
+
+=back
+
+$obj-E<gt>B<defaultWrapLength>([LENGTH])
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<encode>(STRING, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Internals">
+
+=back
+
+$obj-E<gt>B<fold>(NAME, BODY, [MAXCHARS])
+
+Mail::Message::Field::Addresses-E<gt>B<fold>(NAME, BODY, [MAXCHARS])
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<produceBody>
+
+=over 4
+
+Produce the text for the field.  This will start with the single addresses,
+and end in the groups.
+
+=back
+
+$obj-E<gt>B<setWrapLength>([LENGTH])
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<stringifyData>(STRING|ARRAY|OBJECTS)
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<unfold>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+=head2 Parsing
+
+
+$obj-E<gt>B<consumeComment>(STRING)
+
+Mail::Message::Field::Addresses-E<gt>B<consumeComment>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Parsing">
+
+=back
+
+$obj-E<gt>B<consumeDotAtom>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Parsing">
+
+=back
+
+$obj-E<gt>B<consumePhrase>(STRING)
+
+Mail::Message::Field::Addresses-E<gt>B<consumePhrase>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Parsing">
+
+=back
+
+$obj-E<gt>B<parse>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Parsing">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Field::Addresses-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Field::Addresses-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Field::Addresses-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> Field content is not numerical: $content
+
+The numeric value of a field is requested (for instance the C<Lines> or
+C<Content-Length> fields should be numerical), however the data contains
+weird characters.
+
+I<Warning:> Illegal character in charset '$charset'
+
+The field is created with an utf8 string which only contains data from the
+specified character set.  However, that character set can never be a valid
+name because it contains characters which are not permitted.
+
+I<Warning:> Illegal character in field name $name
+
+A new field is being created which does contain characters not permitted
+by the RFCs.  Using this field in messages may break other e-mail clients
+or transfer agents, and therefore mutulate or extinguish your message.
+
+I<Warning:> Illegal character in language '$lang'
+
+The field is created with data which is specified to be in a certain language,
+however, the name of the language cannot be valid: it contains characters
+which are not permitted by the RFCs.
+
+I<Warning:> Illegal encoding '$encoding', used 'q'
+
+The RFCs only permit base64 (C<b > or C<B >) or quoted-printable
+(C<q> or C<Q>) encoding.  Other than these four options are illegal.
+
+I<Error:> No attributes for address fields.
+
+Is is not possible to add attributes to address fields: it is not permitted
+by the RFCs.
+
+I<Error:> No extras in address fields.
+
+It is not permitted to have free-format text parts in address fields.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Attribute.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Attribute.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Attribute.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,212 @@
+use strict;
+use warnings;
+
+package Mail::Message::Field::Attribute;
+use vars '$VERSION';
+$VERSION = '2.055';
+
+use Mail::Reporter;
+use 5.007003;
+use Encode ();
+
+use Carp;
+
+
+sub new($$@)
+{   my ($class, $attr) = (shift, shift);
+    my $value = @_ % 1 == 1 ? shift : undef;
+    my %args  = @_;
+
+    my $name  = $attr =~ m/^(.*?)(?:\*\d+)?\*?\=/ ? $1 : $attr;
+    $class->log(WARNING => "Illegal character in parameter name '$name'.\n")
+        if $name !~ m/^[!#-'*+\-.0-9A-Z^-~]+$/;
+
+    my $self  = bless
+     { MMFF_name    => $name
+     , MMFF_usecont =>
+          (defined $args{use_continuations} ? $args{use_continuations} : 1)
+     }, $class;
+
+    $self->{MMFF_charset}  = $args{charset}  if defined $args{charset};
+    $self->{MMFF_language} = $args{language} if defined $args{language};
+
+    $self->value($value)       if defined $value;
+    $self->addComponent($attr) unless $attr eq $name;
+
+    $self;
+}
+
+#------------------------------------------
+
+
+sub name() { shift->{MMFF_name} }
+
+#------------------------------------------
+
+
+sub value(;$)
+{   my $self = shift;
+    if(@_)
+    {   delete $self->{MMFF_cont};
+        return $self->{MMFF_value} = shift;
+    }
+      
+    exists $self->{MMFF_value} ? $self->{MMFF_value} : $self->decode;
+}
+
+#------------------------------------------
+
+
+sub addComponent($)
+{   my ($self, $component) = @_;
+    delete $self->{MMFF_value};
+
+    my ($name, $value) = split /\=/, $component, 2;
+    if( substr($name, -1) eq '*' && $value =~ m/^([^']*)\'([^']*)\'/ )
+    {   $self->{MMFF_charset}  = length $1 ? $1 : undef;
+        $self->{MMFF_language} = length $2 ? $2 : undef;
+    }
+
+    if( $name =~ m/\*([0-9]+)\*?$/ )
+         { $self->{MMFF_cont}[$1] = $component }
+    else { $self->{MMFF_cont}     = [ $component ] }
+
+    $component;
+}
+
+#------------------------------------------
+
+
+sub charset() { shift->{MMFF_charset} }
+
+#------------------------------------------
+
+
+sub language() { shift->{MMFF_language} }
+
+#------------------------------------------
+
+
+sub string()
+{   my $self = shift;
+    my $cont = $self->{MMFF_cont} || $self->encode;
+    return @$cont if wantarray;
+    return [] unless @$cont;
+
+    local $" = "; ";
+    "; @$cont";
+}
+
+#------------------------------------------
+
+
+sub encode()
+{   my $self  = shift;
+    my $value = $self->{MMFF_value};
+
+    my @lines;
+    my ($pre, $encoded);
+
+    my $charset  = $self->{MMFF_charset}  || '';
+    my $lang     = $self->{MMFF_language} || '';
+    my $name     = $self->{MMFF_name};
+    my $cont     = $self->{MMFF_usecont};
+
+    if($charset || $lang)
+    {   $pre     = "$name*0*=$charset'$lang'";
+        $value   = Encode::encode($charset, $value, 0);
+        $encoded = 1;
+    }
+    elsif(grep m/[^\x20-\x7E]/, $value)
+    {   $pre     = "$name*0*=''";
+        $encoded = 1;
+    }
+    else
+    {   $pre     = "$name*0=";
+        $value   =~ s/"/\\"/g;
+        $encoded = 0;
+    }
+
+    if($encoded)
+    {   # Use encoding
+        my @c    = split //, $value;
+        while(@c)
+        {   my $c = shift @c;
+            $c = '%'. sprintf "%02X", ord $c
+               unless $c =~ m/[a-zA-Z0-9]/;
+
+            if($cont && length($pre) + length($c)> 76)
+            {   push @lines, $pre;
+                $pre = $name . '*' . @lines . '*=' . $c;
+            }
+            else { $pre .= $c }
+        }
+        push @lines, $pre;
+    }
+    elsif($cont)
+    {   # Simple string, but with continuations
+        while(1)
+        {   push @lines, $pre . '"' . substr($value, 0, 75-length($pre), '') . '"';
+            last unless length $value;
+            $pre = $name . '*' . @lines . '=';
+        }
+            
+    }
+    else
+    {   # Single string only
+        push @lines, $pre . $value;
+    }
+
+    $lines[0] =~ s/\*0// if @lines==1;
+    $self->{MMFF_cont} = \@lines;
+}
+
+#------------------------------------------
+
+
+sub decode()
+{   my $self  = shift;
+    my $value = '';
+
+    foreach my $cont (  @{$self->{MMFF_cont}} )
+    {   unless(defined $cont)
+        {   $value .= "[continuation missing]";
+            next;
+        }
+
+        (my $name, local $_) = split /\=/, $cont, 2;
+
+        if(substr($name, -1) eq '*')
+        {   s/^[^']*\'[^']*\'//;
+            s/\%([a-fA-F0-9]{2})/chr hex $1/ge;
+        }
+        elsif( s/^\"(.*)\"$/$1/ ) { s/\\\"/"/g }
+        elsif( s/^\'(.*)\'$/$1/ ) { s/\\\'/'/g }
+
+        $value .= $_;
+    }
+
+    my $charset = $self->{MMFF_charset};
+    $value = Encode::decode($charset, $value, 0) if $charset;
+
+    $self->{MMFF_value} = $value;
+}
+
+#------------------------------------------
+
+
+sub mergeComponent($)
+{   my ($self, $comp) = @_;
+    my $cont  = $self->{MMFF_cont}
+       or croak "ERROR: Too late to merge: value already changed.";
+
+    defined $_ && $self->addComponent($_)
+        foreach @{$comp->{MMFF_cont}};
+
+    $self;
+}
+
+#------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Attribute.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Attribute.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Attribute.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,246 @@
+
+=head1 NAME
+
+Mail::Message::Field::Attribute - one attribute of a full field
+
+
+
+=head1 SYNOPSIS
+
+ my $field    = $msg->head->get('Content-Disposition') or return;
+ my $full     = $field->study;   # full understanding in unicode
+ my $filename = $full->attribute(filename)             or return;
+
+ print ref $filename;     # this class name
+ print $filename;         # the attributes content in utf-8
+ print $filename->value;  # same
+ print $filename->string; # print string as was found in the file
+ $filename->print(\*OUT); # print as was found in the file
+
+
+=head1 DESCRIPTION
+
+Attributes within MIME fields can be quite complex, and therefore be slow
+and consumes a lot of memory.  The L<Mail::Message::Field::Fast|Mail::Message::Field::Fast> and
+L<Mail::Message::Field::Flex|Mail::Message::Field::Flex> simplify them the attributes a lot, which
+may result in erroneous behavior in rare cases.  With the increase of
+non-western languages on Internet, the need for the complex headers
+becomes more and more in demand.
+
+A C<Mail::Message::Field::Attribute> can be found in any structured
+L<Mail::Message::Field::Full|Mail::Message::Field::Full> header field.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Message::Field::Attribute-E<gt>B<new>((NAME, [VALUE] | STRING), OPTIONS)
+
+=over 4
+
+Create a new attribute NAME with the optional VALUE.  If no VALUE is specified,
+the first argument of this method is inspected for an equals sign C<'='>.
+If that character is present, the argument is taken as STRING, containing
+a preformatted attribute which is processed.  Otherwise, the argument is
+taken as name without VALUE: set the value later with value().
+
+Whether encoding takes place depends on the OPTIONS and the existence
+of non-ascii characters in the VALUE.  The NAME can only contain ascii
+characters, hence is never encoded.
+
+To speed things up, attributes are not derived from the L<Mail::Reporter|Mail::Reporter>
+base-class.
+
+ Option             Defined in       Default      
+ charset                             C<'us-ascii'>
+ language                            undef        
+ use_continuations                   <true>       
+
+. charset STRING
+
+=over 4
+
+The VALUE is translated from utf-8 (Perl internal) to this character set,
+and the resulting string is encoded if required.  C<us-ascii> is the normal
+encoding for e-mail.  Valid character sets can be found with 
+Encode::encodings(':all').
+
+=back
+
+. language STRING
+
+=over 4
+
+RFC2231 adds the possiblity to specify a language with the field.  When no
+language is specified, none is included in the encoding.  Valid language
+names are defined by RFC2130.  This module has only limited support for
+this feature.
+
+=back
+
+. use_continuations BOOLEAN
+
+=over 4
+
+Continuations are used to break-up long parameters into pieces which
+are no longer than 76 characters. Encodings are specified in RFC2231,
+but not supported by some Mail User Agents.
+
+=back
+
+I<Example:> 
+
+ my $fn    = Mail::Message::Field::Attribute
+                ->new(filename => 'xyz');
+
+ my $fattr = 'Mail::Message::Field::Attribute';  # abbrev
+ my $fn    = $fattr->new
+     ( filename => "Re\xC7u"
+     , charset  => 'iso-8859-15'
+     , language => 'nl-BE'
+     );
+ print $fn;
+   # -->  filename*=iso-8859-15'nl-BE'Re%C7u
+
+=back
+
+=head2 The attribute
+
+
+$obj-E<gt>B<addComponent>(STRING)
+
+=over 4
+
+A component is a parameter as defined by RFC2045, optionally using
+encoding or continuations as defined by RFC2231.  Components of an
+attribute are found when a field is being parsed.  The RFCs are
+very strict on valid characters, but we cannot be: you have to accept
+what is coming in if you can.
+
+I<Example:> 
+
+ my $param = Mail::Message::Field::Attribute
+               ->new('Content-Type');
+
+ $param->addComponent("filename*=iso10646'nl-BE'%Re\47u");
+
+=back
+
+$obj-E<gt>B<charset>
+
+=over 4
+
+Returns the character set which is used for this parameter.  If any component
+is added which contains character set information, this is directly
+available.  Be warned that a character-set is case insensitive.
+
+=back
+
+$obj-E<gt>B<language>
+
+=over 4
+
+Returns the language which is defined in the argument.  If no language is
+defined C<undef> is returned, which should be interpreted as "ANY"
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+Returns the name of this attribute.
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+Returns the parameter as reference to an array of lines.  When only one line
+is returned, it may be short enough to fit on the same line with other components
+of the header field.
+
+=back
+
+$obj-E<gt>B<value>([STRING])
+
+=over 4
+
+Returns the value of this parameter, optionally after setting it first.
+
+=back
+
+=head2 Attribute encoding
+
+
+$obj-E<gt>B<decode>
+
+=over 4
+
+Translate all known continuations into a value.  The produced value is
+returned and may be utf-8 encoded or a plain string.
+
+=back
+
+$obj-E<gt>B<encode>
+
+=over 4
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<mergeComponent>(ATTRIBUTE)
+
+=over 4
+
+Merge the components from the specified attribute in this attribute.  This is
+needed when components of the same attribute are created separately.  Merging
+is required by the field parsing.
+
+=back
+
+=head2 Error handling
+
+This class does not extend L<Mail::Reporter|Mail::Reporter> for obvious performance
+reasons: there is no logging or tracing available.
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> Illegal character in parameter name '$name'
+
+The specified parameter name contains characters which are not permitted by
+the RFCs.  You can better change the name into something which is accepted,
+or risk applications to corrupt or ignore the message.
+
+I<Error:> Too late to merge: value already changed.
+
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Fast.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Fast.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Fast.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,103 @@
+use strict;
+use warnings;
+
+package Mail::Message::Field::Fast;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Field';
+
+use Carp;
+
+
+#------------------------------------------
+#
+# The DATA is stored as:   [ NAME, FOLDED-BODY ]
+# The body is kept in a folded fashion, where each line starts with
+# a single blank.
+
+
+sub new($;$@)
+{   my $class = shift;
+
+    my ($name, $body) = $class->consume(@_==1 ? (shift) : (shift, shift));
+    return () unless defined $body;
+
+    my $self = bless [$name, $body], $class;
+
+    # Attributes
+    $self->comment(shift)             if @_==1;   # one attribute line
+    $self->attribute(shift, shift) while @_ > 1;  # attribute pairs
+
+    $self;
+}
+
+#------------------------------------------
+
+sub clone()
+{   my $self = shift;
+    bless [ @$self ], ref $self;
+}
+
+#------------------------------------------
+
+sub length()
+{   my $self = shift;
+    length($self->[0]) + 1 + length($self->[1]);
+}
+
+#------------------------------------------
+
+sub name() { lc shift->[0] }
+
+#------------------------------------------
+
+sub Name() { shift->[0] }
+
+#------------------------------------------
+
+sub folded()
+{   my $self = shift;
+    return $self->[0].':'.$self->[1]
+        unless wantarray;
+
+    my @lines = $self->foldedBody;
+    my $first = $self->[0]. ':'. shift @lines;
+    ($first, @lines);
+}
+
+#------------------------------------------
+
+sub unfoldedBody($;@)
+{   my $self = shift;
+
+    $self->[1] = $self->fold($self->[0], @_)
+       if @_;
+
+    $self->unfold($self->[1]);
+}
+
+#------------------------------------------
+
+sub foldedBody($)
+{   my ($self, $body) = @_;
+    if(@_==2) { $self->[1] = $body }
+    else      { $body = $self->[1] }
+     
+    wantarray ? (split m/^/, $body) : $body;
+}
+
+#------------------------------------------
+
+# For performance reasons only
+
+sub print(;$)
+{   my $self = shift;
+    my $fh   = shift || select;
+    if(ref $fh eq 'GLOB') { print $fh $self->[0].':'.$self->[1]   }
+    else                  { $fh->print($self->[0].':'.$self->[1]) }
+    $self;
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Fast.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Fast.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Fast.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,590 @@
+
+=head1 NAME
+
+Mail::Message::Field::Fast - one line of a message header
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Field::Fast
+   is a Mail::Message::Field
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ See Mail::Message::Field
+
+
+=head1 DESCRIPTION
+
+This is the faster, but less flexible implementation of a header field.
+The data is stored in an array, and some hacks are made to speeds
+things up.  Be gentle with me, and consider that each message contains
+many of these lines, so speed is very important here.
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<+0>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<<=>>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<bool>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<cmp>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message::Field/"Constructors">
+
+=back
+
+Mail::Message::Field::Fast-E<gt>B<new>(DATA)
+
+=over 4
+
+The constructor of this object does not follow the usual practise within
+the Mail::Box suite: it does not use the constructor
+L<Mail::Reporter::new()|Mail::Reporter/"Constructors">.
+Therefor it has no logging or tracing facilities.
+
+The method can be used in one of the following ways:
+
+=over 4
+
+=item * B<new> LINE
+
+Pass a LINE as it could be found in a file: a (possibly folded) line
+which is terminated by a new-line.
+
+=item * B<new> NAME, (BODY|OBJECTS), [ATTRIBUTES]
+
+A set of values which shape the line.
+
+=back
+
+Create a new header field object.  Specify the whole LINE at once, and
+it will be split-up for you.  I case you already have the parts of the
+header line, you may specify them separately as NAME and BODY.
+
+In case you specify a single OBJECT, or a reference to an array of
+OBJECTS, these objects are processed to become suitable to fill a
+field, usually by simple strification.  When you specify one or more
+Mail::Address objects, these are transformed into a string using
+their C<format> method.  You may also add one L<Mail::Message::Field|Mail::Message::Field>,
+whose body is taken.  In case of an array, the elements are joined into
+one string with a comma.
+
+ATTRIBUTES can be exactly one string which may contain multiple attributes
+at once, quoted and formatted as required in RFC2822.  As alternative,
+list of key-value pairs can be used.  In this case, the values will get
+quoted if needed and everything formatted as the protocol demands.
+
+ Option  Defined in       Default   
+ log     L<Mail::Reporter>  <disabled>
+ trace   L<Mail::Reporter>  <disabled>
+
+. log LEVEL
+
+. trace LEVEL
+
+I<Example:> 
+
+ my $mime = Mail::Message::Field->new(
+  'Content-Type: text/plain; charset=US-ASCII');
+
+ my $mime = Mail::Message::Field->new(
+  'Content-Type' => 'text/plain; charset=US-ASCII');
+
+ my $mime = Mail::Message::Field->new(
+  'Content-Type' => 'text/plain', 'charset=US-ASCII');
+
+ my $mime = Mail::Message::Field->new(
+  'Content-Type' => 'text/plain', charset => 'Latin1');
+
+ my $mime = Mail::Message::Field->new(
+  To => Mail::Address->new('My', 'me at example.com');
+
+ my $mime = Mail::Message::Field->new(
+  Cc => [ Mail::Address->new('You', 'you at example.com')
+        , Mail::Address->new('His', 'he at example.com')
+        ]);
+
+But in practice, you can simply call
+
+ my $head = Mail::Message::Head->new;
+ $head->add( 'Content-Type' => 'text/plain'
+           , charset => 'utf8');
+
+which implicitly calls this constructor (when needed).  You can specify
+the same things for L<Mail::Message::Head::Complete::add()|Mail::Message::Head::Complete/"Access to the header"> as this
+C<new> accepts.
+
+=back
+
+=head2 The field
+
+
+$obj-E<gt>B<isStructured>
+
+Mail::Message::Field::Fast-E<gt>B<isStructured>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<length>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<string>([WRAP])
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<toDisclose>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+=head2 Access to the name
+
+
+$obj-E<gt>B<Name>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the name">
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the name">
+
+=back
+
+$obj-E<gt>B<wellformedName>([STRING])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the name">
+
+=back
+
+=head2 Access to the body
+
+
+$obj-E<gt>B<body>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<folded>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<foldedBody>([BODY])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<stripCFWS>([STRING])
+
+Mail::Message::Field::Fast-E<gt>B<stripCFWS>([STRING])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<unfoldedBody>([BODY, [WRAP]])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+=head2 Access to the content
+
+
+$obj-E<gt>B<addresses>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<attribute>(NAME [, VALUE])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<comment>([STRING])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<study>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<toDate>([TIME])
+
+Mail::Message::Field::Fast-E<gt>B<toDate>([TIME])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<toInt>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+=head2 Other methods
+
+
+$obj-E<gt>B<dateToTimestamp>(STRING)
+
+Mail::Message::Field::Fast-E<gt>B<dateToTimestamp>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field/"Other methods">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<consume>(LINE | (NAME,BODY|OBJECTS))
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<defaultWrapLength>([LENGTH])
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<fold>(NAME, BODY, [MAXCHARS])
+
+Mail::Message::Field::Fast-E<gt>B<fold>(NAME, BODY, [MAXCHARS])
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<setWrapLength>([LENGTH])
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<stringifyData>(STRING|ARRAY|OBJECTS)
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<unfold>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Field::Fast-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Field::Fast-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Field::Fast-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> Field content is not numerical: $content
+
+The numeric value of a field is requested (for instance the C<Lines> or
+C<Content-Length> fields should be numerical), however the data contains
+weird characters.
+
+I<Warning:> Illegal character in field name $name
+
+A new field is being created which does contain characters not permitted
+by the RFCs.  Using this field in messages may break other e-mail clients
+or transfer agents, and therefore mutulate or extinguish your message.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Flex.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Flex.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Flex.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,101 @@
+use strict;
+use warnings;
+
+package Mail::Message::Field::Flex;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Field';
+
+use Carp;
+
+
+sub new($;$$@)
+{   my $class  = shift;
+    my $args   = @_ <= 2 || ! ref $_[-1] ? {}
+                : ref $_[-1] eq 'ARRAY'  ? { @{pop @_} }
+                :                          pop @_;
+
+    my ($name, $body) = $class->consume(@_==1 ? (shift) : (shift, shift));
+    return () unless defined $body;
+
+    # Attributes preferably stored in array to protect order.
+    my $attr   = $args->{attributes};
+    $attr      = [ %$attr ] if defined $attr && ref $attr eq 'HASH';
+    push @$attr, @_;
+
+    $class->SUPER::new(%$args, name => $name, body => $body,
+         attributes => $attr);
+}
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    @$self{ qw/MMFF_name MMFF_body/ } = @$args{ qw/name body/ };
+
+    $self->comment($args->{comment})
+        if exists $args->{comment};
+
+    my $attr = $args->{attributes};
+    $self->attribute(shift @$attr, shift @$attr)
+        while @$attr;
+
+    $self;
+}
+
+#------------------------------------------
+
+sub clone()
+{   my $self = shift;
+    (ref $self)->new($self->Name, $self->body);
+}
+
+#------------------------------------------
+
+sub length()
+{   my $self = shift;
+    length($self->{MMFF_name}) + 1 + length($self->{MMFF_body});
+}
+
+#------------------------------------------
+
+sub name() { lc shift->{MMFF_name}}
+
+#------------------------------------------
+
+sub Name() { shift->{MMFF_name}}
+
+#------------------------------------------
+
+sub folded(;$)
+{   my $self = shift;
+    return $self->{MMFF_name}.':'.$self->{MMFF_body}
+        unless wantarray;
+
+    my @lines = $self->foldedBody;
+    my $first = $self->{MMFF_name}. ':'. shift @lines;
+    ($first, @lines);
+}
+
+#------------------------------------------
+
+sub unfoldedBody($;@)
+{   my $self = shift;
+    $self->{MMFF_body} = $self->fold($self->{MMFF_name}, @_)
+       if @_;
+
+    $self->unfold($self->{MMFF_body});
+}
+
+#------------------------------------------
+
+sub foldedBody($)
+{   my ($self, $body) = @_;
+    if(@_==2) { $self->{MMFF_body} = $body }
+    else      { $body = $self->{MMFF_body} }
+
+    wantarray ? (split /^/, $body) : $body;
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Flex.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Flex.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Flex.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,564 @@
+
+=head1 NAME
+
+Mail::Message::Field::Flex - one line of a message header
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Field::Flex
+   is a Mail::Message::Field
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+
+
+=head1 DESCRIPTION
+
+This is the flexible implementation of a field: it can easily be
+extended because it stores its data in a hash and the constructor
+(C<new>) and initializer (C<init>) are split.  However, you pay the
+price in performance.  L<Mail::Message::Field::Fast|Mail::Message::Field::Fast> is faster (as the
+name predicts).
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<+0>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<<=>>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<bool>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<cmp>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message::Field/"Constructors">
+
+=back
+
+Mail::Message::Field::Flex-E<gt>B<new>(DATA)
+
+=over 4
+
+If you stick to this flexible class of header fields, you have a bit
+more facilities than with L<Mail::Message::Field::Fast|Mail::Message::Field::Fast>.  Amongst it, you
+can specify options with the creation.  Possible arguments:
+
+=over 4
+
+=item * B<new> LINE
+
+ass a LINE as it could be found in a file: a (possibly folded) line
+which is terminated by a new-line.
+
+=item * B<new> NAME, (BODY|OBJECTS), [ATTRIBUTES], OPTIONS
+
+A set of values which shape the line.
+
+=back
+
+To be able to distinguish the different parameters, you will have
+to specify the OPTIONS as ARRAY of option pairs, or HASH of options.
+The ATTRIBUTES are a flat list of key-value pairs.  The body is
+specified as one BODY string, one OBJECT, or a reference to an array
+of OBJECTS.  See L<Mail::Message::Field|Mail::Message::Field>:
+
+ Option      Defined in       Default      
+ attributes                   C<[]>        
+ comment                      undef        
+ log         L<Mail::Reporter>  C<'WARNINGS'>
+ trace       L<Mail::Reporter>  C<'WARNINGS'>
+
+. attributes ATTRS
+
+=over 4
+
+Reference to array with list of key-value pairs representing attributes,
+or reference to a hash containing these pairs.  This is an alternative
+notation for specifying ATTRIBUTES directly as method arguments.
+
+=back
+
+. comment STRING
+
+=over 4
+
+A pre-formatted list of attributes.
+
+=back
+
+. log LEVEL
+
+. trace LEVEL
+
+=back
+
+=head2 The field
+
+
+$obj-E<gt>B<isStructured>
+
+Mail::Message::Field::Flex-E<gt>B<isStructured>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<length>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<string>([WRAP])
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<toDisclose>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+=head2 Access to the name
+
+
+$obj-E<gt>B<Name>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the name">
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the name">
+
+=back
+
+$obj-E<gt>B<wellformedName>([STRING])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the name">
+
+=back
+
+=head2 Access to the body
+
+
+$obj-E<gt>B<body>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<folded>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<foldedBody>([BODY])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<stripCFWS>([STRING])
+
+Mail::Message::Field::Flex-E<gt>B<stripCFWS>([STRING])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<unfoldedBody>([BODY, [WRAP]])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+=head2 Access to the content
+
+
+$obj-E<gt>B<addresses>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<attribute>(NAME [, VALUE])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<comment>([STRING])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<study>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<toDate>([TIME])
+
+Mail::Message::Field::Flex-E<gt>B<toDate>([TIME])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<toInt>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+=head2 Other methods
+
+
+$obj-E<gt>B<dateToTimestamp>(STRING)
+
+Mail::Message::Field::Flex-E<gt>B<dateToTimestamp>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field/"Other methods">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<consume>(LINE | (NAME,BODY|OBJECTS))
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<defaultWrapLength>([LENGTH])
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<fold>(NAME, BODY, [MAXCHARS])
+
+Mail::Message::Field::Flex-E<gt>B<fold>(NAME, BODY, [MAXCHARS])
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<setWrapLength>([LENGTH])
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<stringifyData>(STRING|ARRAY|OBJECTS)
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<unfold>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Field::Flex-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Field::Flex-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Field::Flex-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> Field content is not numerical: $content
+
+The numeric value of a field is requested (for instance the C<Lines> or
+C<Content-Length> fields should be numerical), however the data contains
+weird characters.
+
+I<Warning:> Illegal character in field name $name
+
+A new field is being created which does contain characters not permitted
+by the RFCs.  Using this field in messages may break other e-mail clients
+or transfer agents, and therefore mutulate or extinguish your message.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Full.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Full.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Full.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,389 @@
+use strict;
+use warnings;
+
+package Mail::Message::Field::Full;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Field';
+
+use Mail::Message::Field::Attribute;
+
+use utf8;
+use Encode ();
+use MIME::QuotedPrint ();
+use Storable 'dclone';
+
+use Carp;
+my $atext = q[a-zA-Z0-9!#\$%&'*+\-\/=?^_`{|}~];  # from RFC
+
+
+use overload '""' => sub { shift->decodedBody };
+
+#------------------------------------------
+
+
+my %implementation;
+
+BEGIN {
+   $implementation{$_} = 'Addresses' foreach
+      qw/from to sender cc bcc reply-to envelope-to
+         resent-from resent-to resent-cc resent-bcc resent-reply-to
+         resent-sender
+         x-beenthere errors-to mail-follow-up x-loop delivered-to
+         original-sender x-original-sender/;
+   $implementation{$_} = 'URIs' foreach
+      qw/list-help list-post list-subscribe list-unsubscribe list-archive
+         list-owner/;
+#  $implementation{$_} = 'Date' foreach
+#     qw/date resent-date/;
+}
+
+sub new($;$$@)
+{   my $class  = shift;
+    my $name   = shift;
+    my $body   = @_ % 2 ? shift : undef;
+    my %args   = @_;
+
+    $body    ||= delete $args{body};
+    unless(defined $body)
+    {   (my $n, $body) = split /\s*\:\s*/s, $name, 2;
+        $name = $n if defined $body;
+    }
+   
+    return $class->SUPER::new(%args, name => $name, body => $body)
+       if $class ne __PACKAGE__;
+
+    # Look for best class to suit this field
+    my $myclass = 'Mail::Message::Field::'
+                . ($implementation{lc $name} || 'Unstructured');
+
+    eval "require $myclass";
+    return if $@;
+
+    $myclass->SUPER::new(%args, name => $name, body => $body);
+}
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    $self->SUPER::init($args);
+    $self->{MMFF_name}       = $args->{name};
+
+    my $body = $args->{body};
+
+       if(!defined $body || !length $body || ref $body) { ; } # no body yet
+    elsif(index($body, "\n") >= 0)
+         { $self->foldedBody($body) }        # body is already folded
+    else { $self->unfoldedBody($body) }      # body must be folded
+
+    $self;
+}
+
+#------------------------------------------
+
+sub clone() { dclone(shift) }
+
+#------------------------------------------
+
+sub length()
+{   my $self = shift;
+    croak;
+}
+
+#------------------------------------------
+
+sub name() { lc shift->{MMFF_name}}
+
+#------------------------------------------
+
+sub Name() { shift->{MMFF_name}}
+
+#------------------------------------------
+
+sub folded()
+{   my $self = shift;
+    return $self->{MMFF_name}.':'.$self->foldedBody
+        unless wantarray;
+
+    my @lines = $self->foldedBody;
+    my $first = $self->{MMFF_name}. ':'. shift @lines;
+    ($first, @lines);
+}
+
+#------------------------------------------
+
+sub unfoldedBody($;$)
+{   my ($self, $body) = (shift, shift);
+
+    if(defined $body)
+    {    $self->foldedBody($self->fold($self->{MMFF_name}, $body));
+         return $body;
+    }
+
+    $body = $self->foldedBody;
+    $body =~ s/^ //;
+    $body =~ s/\n//g;
+    $body;
+}
+
+#------------------------------------------
+
+sub foldedBody($)
+{   my ($self, $body) = @_;
+
+    if(@_==2)
+    {    $self->parse($body);
+         $body =~ s/^\s*/ /;
+         $self->{MMFF_body} = $body;
+    }
+    elsif(defined($body = $self->{MMFF_body})) { ; }
+    else
+    {   # Create a new folded body from the parts.
+        $self->{MMFF_body} = $body
+           = $self->fold($self->{MMFF_name}, $self->produceBody);
+    }
+
+    wantarray ? (split /^/, $body) : $body;
+}
+
+#------------------------------------------
+
+
+sub from($@)
+{   my ($class, $field) = (shift, shift);
+    defined $field ?  $class->new($field->Name, $field->foldedBody, @_) : ();
+}
+
+#------------------------------------------
+
+
+sub decodedBody()
+{   my $self = shift;
+    $self->decode($self->unfoldedBody, @_);
+}
+
+#------------------------------------------
+
+
+sub createComment($@)
+{   my ($thing, $comment) = (shift, shift);
+
+    $comment = $thing->encode($comment, @_)
+        if @_; # encoding required...
+
+    # Correct dangling parenthesis
+    local $_ = $comment;               # work with a copy
+    s#\\[()]#xx#g;                     # remove escaped parens
+    s#[^()]#x#g;                       # remove other chars
+    while( s#\(([^()]*)\)#x$1x# ) {;}  # remove pairs of parens
+
+    substr($comment, CORE::length($_), 0, '\\')
+        while s#[()][^()]*$##;         # add escape before remaining parens
+
+    $comment =~ s#\\+$##;              # backslash at end confuses
+    "($comment)";
+}
+
+#------------------------------------------
+
+
+sub createPhrase($)
+{   my $self = shift;
+    local $_ = shift;
+    $_ =  $self->encode($_, @_)
+        if @_;  # encoding required...
+
+    if( m/[^$atext]/ )
+    {   s#\\#\\\\#g;
+        s#"#\\"#g;
+        $_ = qq["$_"];
+    }
+
+    $_;
+}
+
+#------------------------------------------
+
+
+sub beautify() { shift }
+
+#------------------------------------------
+
+
+sub encode($@)
+{   my ($self, $utf8, %args) = @_;
+
+    my ($charset, $lang, $encoding);
+
+    if($charset = $args{charset})
+    {   $self->log(WARNING => "Illegal character in charset '$charset'")
+            if $charset =~ m/[\x00-\ ()<>@,;:"\/[\]?.=\\]/;
+    }
+    else { $charset = 'us-ascii' }
+
+    if($lang = $args{language})
+    {   $self->log(WARNING => "Illegal character in language '$lang'")
+            if $lang =~ m/[\x00-\ ()<>@,;:"\/[\]?.=\\]/;
+    }
+
+    if($encoding = $args{encoding})
+    {   unless($encoding =~ m/^[bBqQ]$/ )
+        {   $self->log(WARNING => "Illegal encoding '$encoding', used 'q'");
+            $encoding = 'q';
+        }
+    }
+    else { $encoding = 'q' }
+
+    my $encoded  = Encode::encode($charset, $utf8, 0);
+
+    no utf8;
+
+    my $pre      = '=?'. $charset. ($lang ? '*'.$lang : '') .'?'.$encoding.'?';
+    my $ready    = '';
+
+    if(lc $encoding eq 'q')
+    {   # Quoted printable encoding
+        my $qp   = $encoded;
+        $qp      =~ s#([\x00-\x1F=\x7F-\xFF])#sprintf "=%02X", ord $1#ge;
+
+        return $qp           # string only contains us-ascii?
+           if !$args{force} && $qp eq $utf8;
+
+        $qp      =~ s#([_\?])#sprintf "=%02X", ord $1#ge;
+        $qp      =~ s/ /_/g;
+
+        my $take = 72 - CORE::length($pre);
+        while(CORE::length($qp) > $take)
+        {   $qp =~ s#^(.{$take}.?.?[^=][^=])## or warn $qp;
+            $ready .= "$pre$1?= ";
+        }
+        $ready .= "$pre$qp?=" if CORE::length $qp;
+    }
+
+    else
+    {   # base64 encoding
+        require MIME::Base64;
+        my $maxchars = int((74-CORE::length($pre))/4) *4;
+        my $bq       = MIME::Base64::encode_base64($encoded);
+        $bq =~ s/\s*//gs;
+        while(CORE::length($bq) > $maxchars)
+        {   $ready .= $pre . substr($bq, 0, $maxchars, '') . '?= ';
+        }
+        $ready .= "$pre$bq?=";
+    }
+
+    $ready;
+}
+
+#------------------------------------------
+
+
+sub _decoder($$$)
+{   my ($charset, $encoding, $encoded) = @_;
+    $charset   =~ s/\*[^*]+$//;   # string language, not used
+    $charset ||= 'us-ascii';
+
+    my $decoded;
+    if(lc($encoding) eq 'q')
+    {   # Quoted-printable encoded
+        $encoded =~ s/_/ /g;
+        $decoded = MIME::QuotedPrint::decode_qp($encoded);
+    }
+    elsif(lc($encoding) eq 'b')
+    {   # Base64 encoded
+        require MIME::Base64;
+        $decoded = MIME::Base64::decode_base64($encoded);
+    }
+    else
+    {   # unknown encodings ignored
+        return $encoded;
+    }
+
+    Encode::decode($charset, $decoded, 0);
+}
+
+sub decode($@)
+{   my ($self, $encoded, %args) = @_;
+    if(defined $args{is_text} ? $args{is_text} : 1)
+    {  # in text, blanks between encoding must be removed, but otherwise kept :(
+       # dirty trick to get this done: add an explicit blank.
+       $encoded =~ s/\?\=\s(?!\s*\=\?|$)/_?= /gs;
+    }
+    $encoded =~ s/\=\?([^?\s]*)\?([^?\s]*)\?([^?\s]*)\?\=\s*/_decoder($1,$2,$3)/gse;
+
+    $encoded;
+}
+
+#------------------------------------------
+
+
+sub parse($) { shift }
+
+#------------------------------------------
+
+
+sub consumePhrase($)
+{   my ($thing, $string) = @_;
+
+    if($string =~ s/^\s*\"((?:[^"\\]*|\\.)*)\"// )
+    {   (my $phrase = $1) =~ s/\\\"/"/g;
+        return ($phrase, $string);
+    }
+
+    if($string =~ s/^\s*([$atext\ \t.]+)//o )
+    {   (my $phrase = $1) =~ s/\s+$//;
+        return CORE::length($phrase) ? ($phrase, $string) : (undef, $_[1]);
+    }
+
+    (undef, $string);
+}
+
+#------------------------------------------
+
+
+sub consumeComment($)
+{   my ($thing, $string) = @_;
+
+    return (undef, $string)
+        unless $string =~ s/^\s*\(((?:[^)\\]+|\\.)*)\)//;
+
+    my $comment = $1;
+    while(1)
+    {   (my $count = $comment) =~ s/\\./xx/g;
+
+        last if $count =~ tr/(//  ==  $count =~ tr/)//;
+
+        return (undef, $_[1])
+            unless $string =~ s/^((?:[^)\\]+|\\.)*)\)//;
+
+        $comment .= ')'.$1;
+    }
+
+    $comment =~ s/\\([()])/$1/g;
+    ($comment, $string);
+}
+
+#------------------------------------------
+
+
+sub consumeDotAtom($)
+{   my ($self, $string) = @_;
+    my ($atom, $comment);
+
+    while(1)
+    {   (my $c, $string) = $self->consumeComment($string);
+        if(defined $c) { $comment .= $c; next }
+
+        last unless $string =~ s/^\s*([$atext]+(?:\.[$atext]+)*)//o;
+
+        $atom .= $1;
+    }
+
+    ($atom, $string, $comment);
+}
+
+#------------------------------------------
+
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Full.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Full.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Full.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,888 @@
+
+=head1 NAME
+
+Mail::Message::Field::Full - construct one smart line in a message header
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Field::Full
+   is a Mail::Message::Field
+   is a Mail::Reporter
+
+ Mail::Message::Field::Full is extended by
+   Mail::Message::Field::Structured
+   Mail::Message::Field::Unstructured
+
+
+=head1 SYNOPSIS
+
+ !!
+ !! UNDER CONSTRUCTION
+ !! The details of this module are NOT FINISHED yet
+ !! Some parts are already usable, however.  With care!
+ !!
+
+ # Getting to understand the complexity of a header field ...
+
+ my $fast = $msg->head->get('subject');
+ my $full = Mail::Message::Field::Full->from($fast);
+
+ my $full = $msg->head->get('subject')->study;  # same
+ my $full = $msg->head->study('subject');       # same
+ my $full = $msg->get('subject');               # same
+
+ # ... or build a complex header field yourself
+
+ my $f = Mail::Message::Field::Full->new('To');
+ my $f = Mail::Message::Field::Full->new('Subject: hi!');
+ my $f = Mail::Message::Field::Full->new(Subject => 'hi!');
+
+
+=head1 DESCRIPTION
+
+This is the I<full> implementation of a header field: it has I<full>
+understanding of all predefined header fields.  These objects will be
+quite slow, because header fields can be very complex.  Of course, this
+class delivers the optimal result, but for a quite large penalty in
+performance and memory consumption.  Are you willing to accept?
+
+This class supports the common header description from RFC2822 (formerly
+RFC822), the extensions with respect to character set encodings as specified
+in RFC2047, and the extensions on language specification and long parameter
+wrapping from RFC2231.  If you do not need the latter two, then the
+L<Mail::Message::Field::Fast|Mail::Message::Field::Fast> and L<Mail::Message::Field::Flex|Mail::Message::Field::Flex>
+are enough for your application.
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<+0>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<<=>>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<bool>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<cmp>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<stringification>
+
+=over 4
+
+In string context, the decoded body is returned, as if L<decodedBody()|Mail::Message::Field::Full/"Access to the body">
+would have been called.
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message::Field/"Constructors">
+
+=back
+
+Mail::Message::Field::Full-E<gt>B<from>(FIELD, OPTIONS)
+
+=over 4
+
+Convert any FIELD (a L<Mail::Message::Field|Mail::Message::Field> object) into a new
+L<Mail::Message::Field::Full|Mail::Message::Field::Full> object.  This conversion is done the hard
+way: the string which is produced by the original object is parsed
+again.  Usually, the string which is parsed is exactly the line (or lines)
+as found in the original input source, which is a good thing because Full
+fields are much more carefull with the actual content.
+
+OPTIONS are passed to the constructor (see L<new()|Mail::Message::Field::Full/"METHODS">).  In any case, some
+extensions of this Full field class is returned.  It depends on which
+field is created what kind of class we get.
+
+I<Example:> 
+
+ my $fast = $msg->head->get('subject');
+ my $full = Mail::Message::Field::Full->from($fast);
+
+ my $full = $msg->head->get('subject')->study;  # same
+ my $full = $msg->head->study('subject');       # same
+ my $full = $msg->get('subject');               # same
+
+=back
+
+Mail::Message::Field::Full-E<gt>B<new>(DATA)
+
+=over 4
+
+Creating a new field object the correct way is a lot of work, because
+there is so much freedom in the RFCs, but at the same time so many
+restrictions.  Most fields are implemented, but if you have your own
+field (and do no want to contribute it to MailBox), then simply call
+new on your own package.
+
+You have the choice to instantiate the object as string or in prepared
+parts:
+
+=over 4
+
+=item * B<new> LINE, OPTIONS
+
+Pass a LINE as it could be found in a file: a (possibly folded) line
+which is terminated by a new-line.
+
+=item * B<new> NAME, [BODY], OPTIONS
+
+A set of values which shape the line.
+
+=back
+
+The NAME is a wellformed header name (you may use wellformedName()) to
+be sure about the casing.  The BODY is a string, one object, or an
+ref-array of objects.  In case of objects, they must fit to the
+constructor of the field: the types which are accepted may differ.
+The optional ATTRIBUTE list contains L<Mail::Message::Field::Attribute|Mail::Message::Field::Attribute>
+objects.  Finally, there are some OPTIONS.
+
+ Option    Defined in       Default      
+ charset                    undef        
+ encoding                   C<'q'>       
+ force                      false        
+ language                   undef        
+ log       L<Mail::Reporter>  C<'WARNINGS'>
+ trace     L<Mail::Reporter>  C<'WARNINGS'>
+
+. charset STRING
+
+=over 4
+
+The body is specified in utf8, and must become 7-bits ascii to be
+transmited.  Specify a charset to which the multi-byte utf8 is converted
+before it gets encoded.  See L<encode()|Mail::Message::Field::Full/"Internals">, which does the job.
+
+=back
+
+. encoding 'q'|'Q'|'b'|'B'
+
+=over 4
+
+Non-ascii characters are encoded using Quoted-Printable ('q' or 'Q') or
+Base64 ('b' or 'B') encoding.
+
+=back
+
+. force BOOLEAN
+
+=over 4
+
+Enforce encoding in the specified charset, even when it is not needed
+because the body does not contain any non-ascii characters.
+
+=back
+
+. language STRING
+
+=over 4
+
+The language used can be specified, however is rarely used my mail clients.
+
+=back
+
+. log LEVEL
+
+. trace LEVEL
+
+I<Example:> 
+
+ my $s = Mail::Message::Field::Full->new('Subject: Hello World');
+ my $s = Mail::Message::Field::Full->new('Subject', 'Hello World');
+
+ my @attrs   = (Mail::Message::Field::Attribute->new(...), ...);
+ my @options = (extra => 'the color blue');
+ my $t = Mail::Message::Field::Full->new(To => \@addrs, @attrs, @options);
+
+=back
+
+=head2 The field
+
+
+$obj-E<gt>B<isStructured>
+
+Mail::Message::Field::Full-E<gt>B<isStructured>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<length>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<string>([WRAP])
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<toDisclose>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+=head2 Access to the name
+
+
+$obj-E<gt>B<Name>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the name">
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the name">
+
+=back
+
+$obj-E<gt>B<wellformedName>([STRING])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the name">
+
+=back
+
+=head2 Access to the body
+
+
+$obj-E<gt>B<body>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<decodedBody>(OPTIONS)
+
+=over 4
+
+Returns the unfolded body of the field, where encodings are resolved.  The
+returned line will still contain comments and such.  The OPTIONS are passed
+to the decoder, see L<decode()|Mail::Message::Field::Full/"Internals">.
+
+BE WARNED: if the field is a structured field, the content may change syntax,
+because of encapsulated special characters.  By default, the body is decoded
+as text, which results in a small difference within comments as well
+(read the RFC).
+
+=back
+
+$obj-E<gt>B<folded>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<foldedBody>([BODY])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<stripCFWS>([STRING])
+
+Mail::Message::Field::Full-E<gt>B<stripCFWS>([STRING])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<unfoldedBody>([BODY, [WRAP]])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+=head2 Access to the content
+
+
+$obj-E<gt>B<addresses>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<attribute>(NAME [, VALUE])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<beautify>
+
+=over 4
+
+For structured header fields, this removes the original encoding of the
+field's body (the format as it was offered to L<parse()|Mail::Message::Field::Full/"Parsing">), therefore the
+next request for the field will have to re-produce the read data clean
+and nice.  For unstructured bodies, this method doesn't do a thing.
+
+=back
+
+$obj-E<gt>B<comment>([STRING])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<createComment>(STRING, OPTIONS)
+
+Mail::Message::Field::Full-E<gt>B<createComment>(STRING, OPTIONS)
+
+=over 4
+
+Create a comment to become part in a field.  Comments are automatically
+included within parenthesis.  Matching pairs of parenthesis are
+permitted within the STRING.  When a non-matching parenthesis are used,
+it is only permitted with an escape (a backslash) in front of them.
+These backslashes will be added automatically if needed (don't worry!).
+Backslashes will stay, except at the end, where it will be doubled.
+
+The OPTIONS are C<charset>, C<language>, and C<encoding> as always.
+The created comment is returned.
+
+=back
+
+$obj-E<gt>B<createPhrase>(STRING, OPTIONS)
+
+Mail::Message::Field::Full-E<gt>B<createPhrase>(STRING, OPTIONS)
+
+=over 4
+
+A phrase is a text which plays a well defined role.  This is the main
+difference with comments, which have do specified meaning.  Some special
+characters in the phrase will cause it to be surrounded with double
+quotes: do not specify them yourself.
+
+The OPTIONS are C<charset>, C<language>, and C<encoding> as always.
+
+=back
+
+$obj-E<gt>B<study>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<toDate>([TIME])
+
+Mail::Message::Field::Full-E<gt>B<toDate>([TIME])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<toInt>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+=head2 Other methods
+
+
+$obj-E<gt>B<dateToTimestamp>(STRING)
+
+Mail::Message::Field::Full-E<gt>B<dateToTimestamp>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field/"Other methods">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<consume>(LINE | (NAME,BODY|OBJECTS))
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<decode>(STRING, OPTIONS)
+
+Mail::Message::Field::Full-E<gt>B<decode>(STRING, OPTIONS)
+
+=over 4
+
+Decode field encoded STRING to an utf8 string.  The input STRING is part of
+a header field, and as such, may contain encoded words in C<=?...?.?...?=>
+format defined by RFC2047.  The STRING may contain multiple encoded parts,
+maybe using different character sets.
+
+Be warned:  you MUST first interpret the field into parts, like phrases and
+comments, and then decode each part separately, otherwise the decoded text
+may interfere with your markup characters.
+
+Be warned: language information, which is defined in RFC2231, is ignored.
+
+ Option   Defined in  Default
+ is_text              C<1>   
+
+. is_text BOOLEAN
+
+=over 4
+
+Encoding on text is slightly more complicated than encoding structured data,
+because it contains blanks.  Visible blanks have to be ignored between two
+encoded words in the text, but not when an encoded word follows or preceeds
+an unencoded word.  Phrases and comments are texts.
+
+=back
+
+I<Example:> 
+
+ print Mail::Message::Field::Full->decode('=?iso-8859-1?Q?J=F8rgen?=');
+    # prints   JE<0slash>rgen
+
+=back
+
+$obj-E<gt>B<defaultWrapLength>([LENGTH])
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<encode>(STRING, OPTIONS)
+
+=over 4
+
+Encode the (possibly utf8 encoded) STRING to a string which is acceptable
+to the RFC2047 definition of a header: only containing us-ascii characters.
+
+ Option    Defined in       Default      
+ charset                    C<'us-ascii'>
+ encoding                   C<'q'>       
+ force                      <flase>      
+ language                   undef        
+
+. charset STRING
+
+=over 4
+
+STRING is an utf8 string which has to be translated into any byte-wise
+character set for transport, because MIME-headers can only contain ascii
+characters.
+
+=back
+
+. encoding 'q'|'Q'|'b'|'B'
+
+=over 4
+
+The character encoding to be used.  With C<q> or C<Q>, quoted-printable
+encoding will be used.  With C<b > or C<B >, base64 encoding will be taken.
+
+=back
+
+. force BOOLEAN
+
+=over 4
+
+Encode the string, even when it only contains us-ascii characters.  By
+default, this is off because it decreases readibility of the produced
+header fields.
+
+=back
+
+. language STRING
+
+=over 4
+
+RFC2231 defines how to specify language encodings in encoded words.  The
+STRING is a strandard iso language name.
+
+=back
+
+=back
+
+$obj-E<gt>B<fold>(NAME, BODY, [MAXCHARS])
+
+Mail::Message::Field::Full-E<gt>B<fold>(NAME, BODY, [MAXCHARS])
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<setWrapLength>([LENGTH])
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<stringifyData>(STRING|ARRAY|OBJECTS)
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<unfold>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+=head2 Parsing
+
+
+$obj-E<gt>B<consumeComment>(STRING)
+
+Mail::Message::Field::Full-E<gt>B<consumeComment>(STRING)
+
+=over 4
+
+Try to read a comment from the STRING.  When successful, the comment
+without encapsulation parenthesis is returned, together with the rest
+of the string.
+
+=back
+
+$obj-E<gt>B<consumeDotAtom>(STRING)
+
+=over 4
+
+Returns three elemens: the atom-text, the rest string, and the
+concatenated comments.  Both atom and comments can be undef.
+
+=back
+
+$obj-E<gt>B<consumePhrase>(STRING)
+
+Mail::Message::Field::Full-E<gt>B<consumePhrase>(STRING)
+
+=over 4
+
+Take the STRING, and try to strip-off a valid phrase.  In the obsolete
+phrase syntax, any sequence of words is accepted as phrase (as long as
+certain special characters are not used).  RFC2882 is stricter: only
+one word or a quoted string is allowed.  As always, the obsolete
+syntax is accepted, and the new syntax is produced.
+
+This method returns two elements: the phrase (or undef) followed
+by the resulting string.  The phrase will be removed from the optional
+quotes.  Be warned that C<""> will return an empty, valid phrase.
+
+I<Example:> 
+
+ my ($phrase, $rest) = $field->consumePhrase( q["hi!" <sales at example.com>] );
+
+=back
+
+$obj-E<gt>B<parse>(STRING)
+
+=over 4
+
+Get the detailed information from the STRING, and store the data found
+in the field object.  The accepted input is very field type dependent.
+Unstructured fields even do no parsing whatsoever.
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Field::Full-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Field::Full-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Field::Full-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> Field content is not numerical: $content
+
+The numeric value of a field is requested (for instance the C<Lines> or
+C<Content-Length> fields should be numerical), however the data contains
+weird characters.
+
+I<Warning:> Illegal character in charset '$charset'
+
+The field is created with an utf8 string which only contains data from the
+specified character set.  However, that character set can never be a valid
+name because it contains characters which are not permitted.
+
+I<Warning:> Illegal character in field name $name
+
+A new field is being created which does contain characters not permitted
+by the RFCs.  Using this field in messages may break other e-mail clients
+or transfer agents, and therefore mutulate or extinguish your message.
+
+I<Warning:> Illegal character in language '$lang'
+
+The field is created with data which is specified to be in a certain language,
+however, the name of the language cannot be valid: it contains characters
+which are not permitted by the RFCs.
+
+I<Warning:> Illegal encoding '$encoding', used 'q'
+
+The RFCs only permit base64 (C<b > or C<B >) or quoted-printable
+(C<q> or C<Q>) encoding.  Other than these four options are illegal.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Structured.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Structured.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Structured.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,73 @@
+use strict;
+use warnings;
+
+package Mail::Message::Field::Structured;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Field::Full';
+
+use Mail::Message::Field::Attribute;
+
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    $self->SUPER::init($args);
+
+    $self->addExtra($args->{extra})
+        if exists $args->{extra};
+
+    my $attr = $args->{attributes} || [];
+    $attr    = [ %$attr ] if ref $attr eq 'HASH';
+
+    while(@$attr)
+    {   my $name = shift @$attr;
+        if(ref $name) { $self->attribute($name) }
+        else          { $self->attribute($name, shift @$attr) }
+    }
+
+    $self->{MMFS_attrs} = {};
+    $self->{MMFS_extra} = ();
+    $self;
+}
+
+#------------------------------------------
+
+sub clone() { dclone(shift) }
+
+#------------------------------------------
+
+
+sub attribute($;$)
+{   my ($self, $attr) = (shift, shift);
+    my $name;
+    if(ref $attr) { $name = $attr->name }
+    elsif( !@_ )  { return $self->{MMFS_attrs}{lc $attr} }
+    else
+    {   $name = $attr;
+        $attr = Mail::Message::Field::Attribute->new($name, @_);
+    }
+
+    delete $self->{MMFF_body};
+    if(my $old =  $self->{MMFS_attrs}{$name})
+    {   $old->mergeComponent($attr);
+        return $old;
+    }
+    else
+    {   $self->{MMFS_attrs}{$name} = $attr;
+        return $attr;
+    }
+}
+
+#------------------------------------------
+
+
+sub attributes() { values %{shift->{MMFS_attrs}} }
+
+#------------------------------------------
+
+sub beautify() { delete shift->{MMFF_body} }
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Structured.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Structured.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Structured.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,754 @@
+
+=head1 NAME
+
+Mail::Message::Field::Structured - one line of a structured message header
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Field::Structured
+   is a Mail::Message::Field::Full
+   is a Mail::Message::Field
+   is a Mail::Reporter
+
+ Mail::Message::Field::Structured is extended by
+   Mail::Message::Field::Addresses
+   Mail::Message::Field::URIs
+
+
+=head1 SYNOPSIS
+
+ my $f = Mail::Message::Field::Full
+            ->new('Content-Type' => 'text/html');
+ # $f is now a Mail::Message::Field::Structured
+ # NOT READY YET!!!
+
+ my @encode = (charset => 'jp', use_continuations => 1);
+ $f->attribute('filename=passwd');
+ $f->attribute(filename => 'passwd', @encode);
+
+ my $attr = Mail::Message::Field::Attribute->new(...);
+ $f->attribute($attr);
+
+
+=head1 DESCRIPTION
+
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<+0>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<<=>>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<bool>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<cmp>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<stringification>
+
+=over 4
+
+See L<Mail::Message::Field::Full/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message::Field/"Constructors">
+
+=back
+
+Mail::Message::Field::Structured-E<gt>B<from>(FIELD, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Constructors">
+
+=back
+
+Mail::Message::Field::Structured-E<gt>B<new>(DATA)
+
+=over 4
+
+=over 4
+
+=item * B<new> LINE
+
+Pass a LINE as it could be found in a file: a (possibly folded) line
+which is terminated by a new-line.
+
+=item * B<new> NAME, BODY, OPTIONS
+
+A set of values which shape the line.
+
+=back
+
+The NAME is a wellformed header name (you may use wellformedName()) to
+be sure about the casing.  The BODY is a string, one object, or an
+ref-array of objects.  In case of objects, they must fit to the
+constructor of the field: the types which are accepted may differ.
+The optional ATTRIBUTE list contains L<Mail::Message::Field::Attribute|Mail::Message::Field::Attribute>
+objects.  Finally, there are some OPTIONS.
+
+ Option      Defined in       Default      
+ attributes                   C<[]>        
+ charset     L<Mail::Message::Field::Full>  undef        
+ encoding    L<Mail::Message::Field::Full>  C<'q'>       
+ extra                        undef        
+ force       L<Mail::Message::Field::Full>  false        
+ language    L<Mail::Message::Field::Full>  undef        
+ log         L<Mail::Reporter>  C<'WARNINGS'>
+ trace       L<Mail::Reporter>  C<'WARNINGS'>
+
+. attributes ATTRS
+
+=over 4
+
+There are various ways to specify these attributes: pass a reference
+to an array which list of key-value pairs representing attributes,
+or reference to a hash containing these pairs, or an array with
+L<Mail::Message::Field::Attribute|Mail::Message::Field::Attribute> objects.
+
+=back
+
+. charset STRING
+
+. encoding 'q'|'Q'|'b'|'B'
+
+. extra STRING
+
+=over 4
+
+Text which is appended after the line (preceded by a semicolon).
+
+=back
+
+. force BOOLEAN
+
+. language STRING
+
+. log LEVEL
+
+. trace LEVEL
+
+I<Example:> of a structured field
+
+
+ my @attrs   = (Mail::Message::Field::Attribute->new(...), ...);
+ my @options = (extra => 'the color blue');
+ my $t = Mail::Message::Field::Full->new(To => \@addrs, @attrs, @options);
+
+=back
+
+=head2 The field
+
+
+$obj-E<gt>B<isStructured>
+
+Mail::Message::Field::Structured-E<gt>B<isStructured>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<length>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<string>([WRAP])
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<toDisclose>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+=head2 Access to the name
+
+
+$obj-E<gt>B<Name>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the name">
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the name">
+
+=back
+
+$obj-E<gt>B<wellformedName>([STRING])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the name">
+
+=back
+
+=head2 Access to the body
+
+
+$obj-E<gt>B<body>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<decodedBody>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Access to the body">
+
+=back
+
+$obj-E<gt>B<folded>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<foldedBody>([BODY])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<stripCFWS>([STRING])
+
+Mail::Message::Field::Structured-E<gt>B<stripCFWS>([STRING])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<unfoldedBody>([BODY, [WRAP]])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+=head2 Access to the content
+
+
+$obj-E<gt>B<addresses>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<attribute>(OBJECT|(STRING, OPTIONS)|(NAME,VALUE,OPTIONS))
+
+=over 4
+
+Add an attribute to the field.  The attributes are added left-to-right into
+the string representation of the field, although the order of the attributes
+is un-important, according to the RFCs.
+
+You may pass a fully prepared L<Mail::Message::Field::Attribute|Mail::Message::Field::Attribute> OBJECT,
+if you like to do all preparations for correct representation of the
+data yourself.  You may also pass one STRING, which is a fully prepared
+attribute.  This STRING will not be changed, so be careful about quoting
+and encodings.
+
+As third possibility, you can specify an attribute NAME and its VALUE.
+An attribute object will be created for you implicitly in both
+cases where such object is not supplied, passing the OPTIONS.  See
+L<Mail::Message::Field::Attribute::new()|Mail::Message::Field::Attribute/"Constructors"> about the available OPTIONS.
+
+The attribute object is returned, however, when continuations are used this
+may be an object you already know about.  C<undef> is returned when
+construction fails (when the attribute is incorrect).
+
+I<Example:> 
+
+ $f->attribute(filename => 'passwd');
+ $f->attribute(filename => 'passwd', use_continuations => 0);
+
+ my $attr = Mail::Message::Field::Attribute->new(...);
+ $f->attribute($attr);
+
+=back
+
+$obj-E<gt>B<attributes>
+
+=over 4
+
+Returns a list with all attributes, which are all
+L<Mail::Message::Field::Attribute|Mail::Message::Field::Attribute> objects.  The attributes are not
+ordered in any way.  The list may be empty.  Double attributes or
+continuations are folded into one.
+
+=back
+
+$obj-E<gt>B<beautify>
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Access to the content">
+
+=back
+
+$obj-E<gt>B<comment>([STRING])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<createComment>(STRING, OPTIONS)
+
+Mail::Message::Field::Structured-E<gt>B<createComment>(STRING, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Access to the content">
+
+=back
+
+$obj-E<gt>B<createPhrase>(STRING, OPTIONS)
+
+Mail::Message::Field::Structured-E<gt>B<createPhrase>(STRING, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Access to the content">
+
+=back
+
+$obj-E<gt>B<study>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<toDate>([TIME])
+
+Mail::Message::Field::Structured-E<gt>B<toDate>([TIME])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<toInt>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+=head2 Other methods
+
+
+$obj-E<gt>B<dateToTimestamp>(STRING)
+
+Mail::Message::Field::Structured-E<gt>B<dateToTimestamp>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field/"Other methods">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<consume>(LINE | (NAME,BODY|OBJECTS))
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<decode>(STRING, OPTIONS)
+
+Mail::Message::Field::Structured-E<gt>B<decode>(STRING, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Internals">
+
+=back
+
+$obj-E<gt>B<defaultWrapLength>([LENGTH])
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<encode>(STRING, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Internals">
+
+=back
+
+$obj-E<gt>B<fold>(NAME, BODY, [MAXCHARS])
+
+Mail::Message::Field::Structured-E<gt>B<fold>(NAME, BODY, [MAXCHARS])
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<setWrapLength>([LENGTH])
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<stringifyData>(STRING|ARRAY|OBJECTS)
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<unfold>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+=head2 Parsing
+
+
+$obj-E<gt>B<consumeComment>(STRING)
+
+Mail::Message::Field::Structured-E<gt>B<consumeComment>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Parsing">
+
+=back
+
+$obj-E<gt>B<consumeDotAtom>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Parsing">
+
+=back
+
+$obj-E<gt>B<consumePhrase>(STRING)
+
+Mail::Message::Field::Structured-E<gt>B<consumePhrase>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Parsing">
+
+=back
+
+$obj-E<gt>B<parse>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Parsing">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Field::Structured-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Field::Structured-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Field::Structured-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> Field content is not numerical: $content
+
+The numeric value of a field is requested (for instance the C<Lines> or
+C<Content-Length> fields should be numerical), however the data contains
+weird characters.
+
+I<Warning:> Illegal character in charset '$charset'
+
+The field is created with an utf8 string which only contains data from the
+specified character set.  However, that character set can never be a valid
+name because it contains characters which are not permitted.
+
+I<Warning:> Illegal character in field name $name
+
+A new field is being created which does contain characters not permitted
+by the RFCs.  Using this field in messages may break other e-mail clients
+or transfer agents, and therefore mutulate or extinguish your message.
+
+I<Warning:> Illegal character in language '$lang'
+
+The field is created with data which is specified to be in a certain language,
+however, the name of the language cannot be valid: it contains characters
+which are not permitted by the RFCs.
+
+I<Warning:> Illegal encoding '$encoding', used 'q'
+
+The RFCs only permit base64 (C<b > or C<B >) or quoted-printable
+(C<q> or C<Q>) encoding.  Other than these four options are illegal.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/URIs.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/URIs.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/URIs.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,89 @@
+use strict;
+use warnings;
+
+package Mail::Message::Field::URIs;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Field::Structured';
+use Carp 'confess';
+
+use URI;
+
+
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    my ($body, @body);
+    if($body = delete $args->{body})
+    {   @body = ref $body eq 'ARRAY' ? @$body : ($body);
+        return () unless @body;
+    }
+
+    $self->{MMFU_uris} = [];
+
+    if(@body > 1 || ref $body[0])
+    {   $self->addURI($_) foreach @body;
+    }
+    elsif(defined $body)
+    {   $body = "<$body>\n" unless index($body, '<') >= 0;
+        $args->{body} = $body;
+    }
+
+    $self->SUPER::init($args);
+}
+
+#------------------------------------------
+
+sub parse($)
+{   my ($self, $string) = @_;
+    my @raw = $string =~ m/\<([^>]+)\>/g;  # simply ignore all but <>
+    $self->addURI($_) foreach @raw;
+    $self;
+}
+
+#------------------------------------------
+
+sub produceBody()
+{  my @uris = sort map { $_->as_string } shift->URIs;
+   local $" = '>, <';
+   @uris ? "<@uris>" : undef;
+}
+
+#------------------------------------------
+
+
+sub addURI(@)
+{   my $self  = shift;
+    my $uri   = ref $_[0] ? shift : URI->new(@_);
+    push @{$self->{MMFU_uris}}, $uri->canonical if defined $uri;
+    $uri;
+}
+
+#------------------------------------------
+
+
+sub URIs() { @{shift->{MMFU_uris}} }
+
+#------------------------------------------
+
+
+sub addAttribute($;@)
+{   my $self = shift;
+    $self->log(ERROR => 'No attributes for URI fields.');
+    $self;
+}
+
+#------------------------------------------
+
+
+sub addExtra($@)
+{   my $self = shift;
+    $self->log(ERROR => 'No extras in URI fields.');
+    $self;
+}
+
+#------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/URIs.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/URIs.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/URIs.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,749 @@
+
+=head1 NAME
+
+Mail::Message::Field::URIs - message header field with uris
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Field::URIs
+   is a Mail::Message::Field::Structured
+   is a Mail::Message::Field::Full
+   is a Mail::Message::Field
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my $f = Mail::Message::Field->new('List-Post' => 'http://x.org/');
+
+ my $g = Mail::Message::Field->new('List-Post');
+ $g->addURI('http://x.org');
+
+ my $uri = URI->new(...);
+ $g->addURI($uri);
+
+ my @uris = $g->URIs;
+
+
+=head1 DESCRIPTION
+
+More recent RFCs prefer uri field notation over the various differentiated
+syntaxes.  Especially the mailing-list RFCs use these fields all the
+time.  This class can maintain these fields.
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<+0>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<<=>>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<bool>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<cmp>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<stringification>
+
+=over 4
+
+See L<Mail::Message::Field::Full/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message::Field/"Constructors">
+
+=back
+
+Mail::Message::Field::URIs-E<gt>B<from>(FIELD, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Constructors">
+
+=back
+
+Mail::Message::Field::URIs-E<gt>B<new>(DATA)
+
+=over 4
+
+ Option      Defined in       Default      
+ attributes  L<Mail::Message::Field::Structured>  <ignored>    
+ charset     L<Mail::Message::Field::Full>  undef        
+ encoding    L<Mail::Message::Field::Full>  C<'q'>       
+ extra       L<Mail::Message::Field::Structured>  <ignored>    
+ force       L<Mail::Message::Field::Full>  false        
+ language    L<Mail::Message::Field::Full>  undef        
+ log         L<Mail::Reporter>  C<'WARNINGS'>
+ trace       L<Mail::Reporter>  C<'WARNINGS'>
+
+. attributes ATTRS
+
+. charset STRING
+
+. encoding 'q'|'Q'|'b'|'B'
+
+. extra STRING
+
+. force BOOLEAN
+
+. language STRING
+
+. log LEVEL
+
+. trace LEVEL
+
+I<Example:> 
+
+ my $mmfu = 'Mail::Message::Field::URIs;
+ my $f = $mmfu->new('List-Post' => 'mailto:x at y.com');
+ my $f = $mmfu->new('List-Post' => '<mailto:x at y.com>');
+ my $f = $mmfu->new('List-Post: <mailto:x at y.com>');
+ my $f = $mmfu->new('List-Post' => [ $uri, 'http://x.org' ]);
+
+=back
+
+=head2 The field
+
+
+$obj-E<gt>B<isStructured>
+
+Mail::Message::Field::URIs-E<gt>B<isStructured>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<length>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<string>([WRAP])
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<toDisclose>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+=head2 Access to the name
+
+
+$obj-E<gt>B<Name>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the name">
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the name">
+
+=back
+
+$obj-E<gt>B<wellformedName>([STRING])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the name">
+
+=back
+
+=head2 Access to the body
+
+
+$obj-E<gt>B<body>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<decodedBody>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Access to the body">
+
+=back
+
+$obj-E<gt>B<folded>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<foldedBody>([BODY])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<stripCFWS>([STRING])
+
+Mail::Message::Field::URIs-E<gt>B<stripCFWS>([STRING])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<unfoldedBody>([BODY, [WRAP]])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+=head2 Access to the content
+
+
+$obj-E<gt>B<URIs>
+
+=over 4
+
+Returns a list with all URIs defined by the field.  Mind the lower-case
+'s' at the enc of the name.
+
+I<Example:> 
+
+ my @uris = $field->URIs;
+
+=back
+
+$obj-E<gt>B<addAttribute>(...)
+
+=over 4
+
+Attributes are not supported for URI fields.
+
+=back
+
+$obj-E<gt>B<addExtra>(...)
+
+=over 4
+
+Extras are not permitted in URI fields.
+
+=back
+
+$obj-E<gt>B<addURI>(URI)
+
+=over 4
+
+Add an URI to the field.  The URI can be specified as URI object
+or as string which will be turned into an URI object.  The added
+URI is returned.
+
+I<Example:> adding an URI to an URI field
+
+
+ my $f   = Mail::Message::Field::URI->new('List-Post');
+
+ my $uri = URI->new("http://x.org");
+ $f->addURI($uri);
+
+ $f->addURI("http://y.org");  # simpler
+ $f->addURI("//y.org", "http");
+
+=back
+
+$obj-E<gt>B<addresses>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<attribute>(OBJECT|(STRING, OPTIONS)|(NAME,VALUE,OPTIONS))
+
+=over 4
+
+See L<Mail::Message::Field::Structured/"Access to the content">
+
+=back
+
+$obj-E<gt>B<attributes>
+
+=over 4
+
+See L<Mail::Message::Field::Structured/"Access to the content">
+
+=back
+
+$obj-E<gt>B<beautify>
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Access to the content">
+
+=back
+
+$obj-E<gt>B<comment>([STRING])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<createComment>(STRING, OPTIONS)
+
+Mail::Message::Field::URIs-E<gt>B<createComment>(STRING, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Access to the content">
+
+=back
+
+$obj-E<gt>B<createPhrase>(STRING, OPTIONS)
+
+Mail::Message::Field::URIs-E<gt>B<createPhrase>(STRING, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Access to the content">
+
+=back
+
+$obj-E<gt>B<study>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<toDate>([TIME])
+
+Mail::Message::Field::URIs-E<gt>B<toDate>([TIME])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<toInt>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+=head2 Other methods
+
+
+$obj-E<gt>B<dateToTimestamp>(STRING)
+
+Mail::Message::Field::URIs-E<gt>B<dateToTimestamp>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field/"Other methods">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<consume>(LINE | (NAME,BODY|OBJECTS))
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<decode>(STRING, OPTIONS)
+
+Mail::Message::Field::URIs-E<gt>B<decode>(STRING, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Internals">
+
+=back
+
+$obj-E<gt>B<defaultWrapLength>([LENGTH])
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<encode>(STRING, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Internals">
+
+=back
+
+$obj-E<gt>B<fold>(NAME, BODY, [MAXCHARS])
+
+Mail::Message::Field::URIs-E<gt>B<fold>(NAME, BODY, [MAXCHARS])
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<setWrapLength>([LENGTH])
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<stringifyData>(STRING|ARRAY|OBJECTS)
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<unfold>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+=head2 Parsing
+
+
+$obj-E<gt>B<consumeComment>(STRING)
+
+Mail::Message::Field::URIs-E<gt>B<consumeComment>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Parsing">
+
+=back
+
+$obj-E<gt>B<consumeDotAtom>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Parsing">
+
+=back
+
+$obj-E<gt>B<consumePhrase>(STRING)
+
+Mail::Message::Field::URIs-E<gt>B<consumePhrase>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Parsing">
+
+=back
+
+$obj-E<gt>B<parse>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Parsing">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Field::URIs-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Field::URIs-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Field::URIs-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> Field content is not numerical: $content
+
+The numeric value of a field is requested (for instance the C<Lines> or
+C<Content-Length> fields should be numerical), however the data contains
+weird characters.
+
+I<Warning:> Illegal character in charset '$charset'
+
+The field is created with an utf8 string which only contains data from the
+specified character set.  However, that character set can never be a valid
+name because it contains characters which are not permitted.
+
+I<Warning:> Illegal character in field name $name
+
+A new field is being created which does contain characters not permitted
+by the RFCs.  Using this field in messages may break other e-mail clients
+or transfer agents, and therefore mutulate or extinguish your message.
+
+I<Warning:> Illegal character in language '$lang'
+
+The field is created with data which is specified to be in a certain language,
+however, the name of the language cannot be valid: it contains characters
+which are not permitted by the RFCs.
+
+I<Warning:> Illegal encoding '$encoding', used 'q'
+
+The RFCs only permit base64 (C<b > or C<B >) or quoted-printable
+(C<q> or C<Q>) encoding.  Other than these four options are illegal.
+
+I<Error:> No attributes for URI fields.
+
+Is is not possible to add attributes to URI fields: it is not permitted
+by the RFCs.
+
+I<Error:> No extras in URI fields.
+
+It is not permitted to have free-format text parts in URI fields.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Unstructured.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Unstructured.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Unstructured.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,27 @@
+use strict;
+use warnings;
+
+package Mail::Message::Field::Unstructured;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Field::Full';
+
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    $self->SUPER::init($args) or return;
+
+    $self->log(WARNING=>"Attributes are not supported for unstructured fields")
+        if defined $args->{attributes};
+
+    $self->log(WARNING => "No extras for unstructured fields")
+        if defined $args->{extra};
+
+    $self;
+}
+
+#------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Unstructured.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Unstructured.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field/Unstructured.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,681 @@
+
+=head1 NAME
+
+Mail::Message::Field::Unstructured - smart unstructured field
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Field::Unstructured
+   is a Mail::Message::Field::Full
+   is a Mail::Message::Field
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my $f = Mail::Message::Field::Unstructured->new(Comments => 'hi!');
+
+
+=head1 DESCRIPTION
+
+Unstructured fields do contain information which is not restricted in
+any way.  RFC2822 defines some unstructured fields, but by default all
+unknown fields are unstructured as well.  Things like attributes and
+comments have no meaning for unstructured fields, but encoding does.
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<+0>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<<=>>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<bool>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<cmp>
+
+=over 4
+
+See L<Mail::Message::Field/"OVERLOADED">
+
+=back
+
+overload: B<stringification>
+
+=over 4
+
+See L<Mail::Message::Field::Full/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message::Field/"Constructors">
+
+=back
+
+Mail::Message::Field::Unstructured-E<gt>B<from>(FIELD, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Constructors">
+
+=back
+
+Mail::Message::Field::Unstructured-E<gt>B<new>(DATA)
+
+=over 4
+
+When the DATA is specified as single line, the content part is considered to
+be correcly (character) encoded and escaped.  Typically, it is a line as
+read from file.  The folding of the line is kept as is.
+
+In case more than one argument is provided, the second is considered the BODY.
+Attributes and other special things are not defined for unstructured fields,
+and therefore not valid options.  The BODY can be a single string, a single
+OBJECT, or an array of OBJECTS.  The objects are stringified (into a comma
+separated list).  Each BODY element is interpreted with the specified encoding.
+
+When the BODY is empty, the construction of the object fails: C<undef> is
+returned.
+
+ Option    Defined in       Default      
+ charset   L<Mail::Message::Field::Full>  undef        
+ encoding  L<Mail::Message::Field::Full>  C<'q'>       
+ force     L<Mail::Message::Field::Full>  false        
+ language  L<Mail::Message::Field::Full>  undef        
+ log       L<Mail::Reporter>  C<'WARNINGS'>
+ trace     L<Mail::Reporter>  C<'WARNINGS'>
+
+. charset STRING
+
+. encoding 'q'|'Q'|'b'|'B'
+
+. force BOOLEAN
+
+. language STRING
+
+. log LEVEL
+
+. trace LEVEL
+
+I<Example:> 
+
+ my $s = Mail::Message::Field::Unstructured->new('Comment', 'Hi!');
+
+ # Use autodetect
+ my $s = Mail::Message::Field::Full->new('Comment', 'Hi!');
+ my $s = Mail::Message::Field::Full->new('Comment: Hi!');
+
+=back
+
+=head2 The field
+
+
+$obj-E<gt>B<isStructured>
+
+Mail::Message::Field::Unstructured-E<gt>B<isStructured>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<length>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<string>([WRAP])
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+$obj-E<gt>B<toDisclose>
+
+=over 4
+
+See L<Mail::Message::Field/"The field">
+
+=back
+
+=head2 Access to the name
+
+
+$obj-E<gt>B<Name>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the name">
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the name">
+
+=back
+
+$obj-E<gt>B<wellformedName>([STRING])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the name">
+
+=back
+
+=head2 Access to the body
+
+
+$obj-E<gt>B<body>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<decodedBody>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Access to the body">
+
+=back
+
+$obj-E<gt>B<folded>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<foldedBody>([BODY])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<stripCFWS>([STRING])
+
+Mail::Message::Field::Unstructured-E<gt>B<stripCFWS>([STRING])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+$obj-E<gt>B<unfoldedBody>([BODY, [WRAP]])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the body">
+
+=back
+
+=head2 Access to the content
+
+
+$obj-E<gt>B<addresses>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<attribute>(NAME [, VALUE])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<beautify>
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Access to the content">
+
+=back
+
+$obj-E<gt>B<comment>([STRING])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<createComment>(STRING, OPTIONS)
+
+Mail::Message::Field::Unstructured-E<gt>B<createComment>(STRING, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Access to the content">
+
+=back
+
+$obj-E<gt>B<createPhrase>(STRING, OPTIONS)
+
+Mail::Message::Field::Unstructured-E<gt>B<createPhrase>(STRING, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Access to the content">
+
+=back
+
+$obj-E<gt>B<study>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<toDate>([TIME])
+
+Mail::Message::Field::Unstructured-E<gt>B<toDate>([TIME])
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+$obj-E<gt>B<toInt>
+
+=over 4
+
+See L<Mail::Message::Field/"Access to the content">
+
+=back
+
+=head2 Other methods
+
+
+$obj-E<gt>B<dateToTimestamp>(STRING)
+
+Mail::Message::Field::Unstructured-E<gt>B<dateToTimestamp>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field/"Other methods">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<consume>(LINE | (NAME,BODY|OBJECTS))
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<decode>(STRING, OPTIONS)
+
+Mail::Message::Field::Unstructured-E<gt>B<decode>(STRING, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Internals">
+
+=back
+
+$obj-E<gt>B<defaultWrapLength>([LENGTH])
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<encode>(STRING, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Internals">
+
+=back
+
+$obj-E<gt>B<fold>(NAME, BODY, [MAXCHARS])
+
+Mail::Message::Field::Unstructured-E<gt>B<fold>(NAME, BODY, [MAXCHARS])
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<setWrapLength>([LENGTH])
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<stringifyData>(STRING|ARRAY|OBJECTS)
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+$obj-E<gt>B<unfold>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field/"Internals">
+
+=back
+
+=head2 Parsing
+
+
+$obj-E<gt>B<consumeComment>(STRING)
+
+Mail::Message::Field::Unstructured-E<gt>B<consumeComment>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Parsing">
+
+=back
+
+$obj-E<gt>B<consumeDotAtom>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Parsing">
+
+=back
+
+$obj-E<gt>B<consumePhrase>(STRING)
+
+Mail::Message::Field::Unstructured-E<gt>B<consumePhrase>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Parsing">
+
+=back
+
+$obj-E<gt>B<parse>(STRING)
+
+=over 4
+
+See L<Mail::Message::Field::Full/"Parsing">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Field::Unstructured-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Field::Unstructured-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Field::Unstructured-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> Field content is not numerical: $content
+
+The numeric value of a field is requested (for instance the C<Lines> or
+C<Content-Length> fields should be numerical), however the data contains
+weird characters.
+
+I<Warning:> Illegal character in charset '$charset'
+
+The field is created with an utf8 string which only contains data from the
+specified character set.  However, that character set can never be a valid
+name because it contains characters which are not permitted.
+
+I<Warning:> Illegal character in field name $name
+
+A new field is being created which does contain characters not permitted
+by the RFCs.  Using this field in messages may break other e-mail clients
+or transfer agents, and therefore mutulate or extinguish your message.
+
+I<Warning:> Illegal character in language '$lang'
+
+The field is created with data which is specified to be in a certain language,
+however, the name of the language cannot be valid: it contains characters
+which are not permitted by the RFCs.
+
+I<Warning:> Illegal encoding '$encoding', used 'q'
+
+The RFCs only permit base64 (C<b > or C<B >) or quoted-printable
+(C<q> or C<Q>) encoding.  Other than these four options are illegal.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,467 @@
+use strict;
+use warnings;
+
+package Mail::Message::Field;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Reporter';
+
+use Carp;
+use Mail::Address;
+use POSIX      'strftime';
+use IO::Handle;
+
+our %_structured;  # not to be used directly: call isStructured!
+my $default_wrap_length = 78;
+
+
+use overload qq("") => sub { $_[0]->unfoldedBody }
+           , '+0'   => sub { $_[0]->toInt || 0 }
+           , bool   => sub {1}
+           , cmp    => sub { $_[0]->unfoldedBody cmp "$_[1]" }
+           , '<=>'  => sub { $_[2]
+                           ? $_[1]        <=> $_[0]->toInt
+                           : $_[0]->toInt <=> $_[1]
+                           }
+           , fallback => 1;
+
+#------------------------------------------
+
+
+sub new(@)
+{   my $class = shift;
+    if($class eq __PACKAGE__)  # bootstrap
+    {   require Mail::Message::Field::Fast;
+        return Mail::Message::Field::Fast->new(@_);
+    }
+    $class->SUPER::new(@_);
+}
+
+#------------------------------------------
+
+
+#------------------------------------------
+
+
+BEGIN {
+%_structured = map { (lc($_) => 1) }
+  qw/To Cc Bcc From Date Reply-To Sender
+     Resent-Date Resent-From Resent-Sender Resent-To Return-Path
+     List-Help List-Post List-Unsubscribe Mailing-List
+     Received References Message-ID In-Reply-To
+     Content-Length Content-Type
+     Delivered-To
+     Lines
+     MIME-Version
+     Precedence
+     Status/;
+} 
+
+sub isStructured(;$)
+{   my $name  = ref $_[0] ? shift->name : $_[1];
+    exists $_structured{lc $name};
+}
+
+#------------------------------------------
+
+
+sub print(;$)
+{   my $self = shift;
+    my $fh   = shift || select;
+    $fh->print(scalar $self->folded);
+}
+
+#------------------------------------------
+
+
+sub toString(;$) {my $self = shift;$self->string(@_)}
+sub string(;$)
+{   my $self  = shift;
+    return $self->folded unless @_;
+
+    my $wrap  = shift || $default_wrap_length;
+    my $name  = $self->Name;
+    my @lines = $self->fold($name, $self->unfoldedBody, $wrap);
+    $lines[0] = $name . ':' . $lines[0];
+    wantarray ? @lines : join('', @lines);
+}
+
+#------------------------------------------
+
+
+sub toDisclose()
+{   shift->name !~ m!^(?: (?:x-)?status
+                      |   (?:resent-)?bcc
+                      |   Content-Length
+                      |   x-spam-
+                      ) $!x;
+}
+
+#------------------------------------------
+
+
+sub nrLines() { my @l = shift->foldedBody; scalar @l }
+
+#------------------------------------------
+
+
+sub size() {length shift->toString}
+
+#------------------------------------------
+
+
+# attempt to change the case of a tag to that required by RFC822. That
+# being all characters are lowercase except the first of each
+# word. Also if the word is an `acronym' then all characters are
+# uppercase. We, rather arbitrarily, decide that a word is an acronym
+# if it does not contain a vowel and isn't the well-known 'Cc' or
+# 'Bcc' headers.
+
+my %wf_lookup
+  = qw/mime MIME  ldap LDAP  soap SOAP  swe SWE
+       bcc Bcc  cc Cc/;
+
+sub wellformedName(;$)
+{   my $thing = shift;
+    my $name = @_ ? shift : $thing->name;
+
+    join '-',
+       map { $wf_lookup{lc $_} || ( /[aeiouyAEIOUY]/ ? ucfirst lc : uc ) }
+          split /\-/, $name;
+}
+
+#------------------------------------------
+
+
+#------------------------------------------
+
+
+sub body()
+{   my $self = shift;
+    my $body = $self->unfoldedBody;
+    return $body unless $self->isStructured;
+
+    $body =~ s/\s*\;.*//s;
+    $body;
+}
+
+#------------------------------------------
+
+
+#------------------------------------------
+
+
+sub unfoldedBody { shift->notImplemented }
+
+#------------------------------------------
+
+
+sub stripCFWS($)
+{   my $thing  = shift;
+
+    # get (folded) data
+    my $string = @_ ? shift : $thing->foldedBody;
+
+    # remove comments
+    my $r          = '';
+    my $in_dquotes = 0;
+    my $open_paren = 0;
+
+    my @s = split m/([()"])/, $string;
+    while(@s)
+    {   my $s = shift @s;
+
+           if(length $r && substr($r, -1) eq "\\") { $r .= $s } # esc'd special
+        elsif($s eq '"')   { $in_dquotes = not $in_dquotes; $r .= $s }
+        elsif($s eq '(' && !$in_dquotes) { $open_paren++ }
+        elsif($s eq ')' && !$in_dquotes) { $open_paren-- }
+        elsif($open_paren) {}  # in comment
+        else               { $r .= $s }
+    }
+
+    # beautify and unfold at the same time
+    for($r)
+    {  s/\s+/ /gs;
+       s/\s+$//;
+       s/^\s+//;
+    }
+
+    $r;
+}
+
+#------------------------------------------
+
+
+sub comment(;$)
+{   my $self = shift;
+    return undef unless $self->isStructured;
+
+    my $body = $self->unfoldedBody;
+
+    if(@_)
+    {   my $comment = shift;
+        $body    =~ s/\s*\;.*//;
+        $body   .= "; $comment" if defined $comment && length $comment;
+        $self->unfoldedBody($body);
+        return $comment;
+    }
+ 
+    $body =~ s/.*?\;\s*// ? $body : '';
+}
+
+#------------------------------------------
+
+sub content() { shift->unfoldedBody }  # Compatibility
+
+#------------------------------------------
+
+
+sub attribute($;$)
+{   my ($self, $attr) = (shift, shift);
+    my $body  = $self->unfoldedBody;
+
+    unless(@_)
+    {   return
+           $body =~ m/\b$attr\s*\=\s*
+                       ( "( (?: [^"]|\\" )* )"
+                       | '( (?: [^']|\\' )* )'
+                       | (\S*)
+                       )
+                  /xi ? $+ : undef;
+    }
+
+    my $value = shift;
+    unless(defined $value)  # remove attribute
+    {   for($body)
+        {      s/\b$attr\s*=\s*'([^']|\\')*'//i
+            or s/\b$attr\s*=\s*"([^"]|\\")*"//i
+            or s/\b$attr\s*=\s*\S*//i;
+        }
+        $self->unfoldedBody($body);
+        return undef;
+    }
+
+    (my $quoted = $value) =~ s/"/\\"/g;
+    for($body)
+    {       s/\b$attr\s*=\s*'([^']|\\')*'/$attr="$quoted"/i
+         or s/\b$attr\s*=\s*"([^"]|\\")*"/$attr="$quoted"/i
+         or s/\b$attr\s*=\s*\S+/$attr="$quoted"/i
+         or do { $_ .= qq(; $attr="$quoted") }
+    }
+
+    $self->unfoldedBody($body);
+    $value;
+}
+
+#------------------------------------------
+
+
+sub toInt()
+{   my $self = shift;
+    return $1 if $self->body =~ m/^\s*(\d+)\s*$/;
+
+    $self->log(WARNING => "Field content is not numerical: ". $self->toString);
+
+    return undef;
+}
+
+#------------------------------------------
+
+
+my @weekday = qw/Sun Mon Tue Wed Thu Fri Sat Sun/;
+my @month   = qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/;
+
+sub toDate(@)
+{   my $class  = shift;
+    my @time   = @_== 0 ? localtime() : @_==1 ? localtime(shift) : @_;
+    my $format = "$weekday[$time[6]], %d $month[$time[4]] %Y %H:%M:%S %z";
+    my $time   = strftime($format, @time);
+
+    # for C libs which do not (GNU compliantly) support %z
+    $time =~ s/ (\%z|[A-Z]+)$/_tz_offset($1)/e;
+
+    $time; 
+}
+
+sub _tz_offset($)
+{  my $zone = shift;
+   require Time::Zone;
+
+   my $diff = $zone eq '%z' ? Time::Zone::tz_local_offset()
+           :                  Time::Zone::tz_offset($zone);
+   my $minutes = int((abs($diff)+0.01) / 60);     # float rounding errors :(
+   my $hours   = int(($minutes+0.01) / 60);
+   $minutes   -= $hours * 60;
+   sprintf( ($diff < 0 ? " -%02d%02d" : " +%02d%02d"), $hours, $minutes);
+}
+
+#------------------------------------------
+
+
+sub addresses() { Mail::Address->parse(shift->unfoldedBody) }
+
+#------------------------------------------
+
+
+sub study()
+{   my $self = shift;
+    require Mail::Message::Field::Full;
+    Mail::Message::Field::Full->new(scalar $self->folded);
+}
+
+#------------------------------------------
+
+
+sub dateToTimestamp($)
+{   my $string = $_[0]->stripCFWS($_[1]);
+
+    # in RFC822, FWSes can appear within the time.
+    $string =~ s/(\d\d)\s*\:\s*(\d\d)\s*\:\s*(\d\d)/$1:$2:$3/;
+
+    require Date::Parse;
+    Date::Parse::str2time($string, 'GMT');
+}
+
+
+#------------------------------------------
+
+
+#=notice Empty field: $name
+#Empty fields are not allowed, however sometimes found in messages constructed
+#by broken applications.  You probably want to ignore this message unless you
+#wrote this broken application yourself.
+
+sub consume($;$)
+{   my $self = shift;
+    my ($name, $body) = defined $_[1] ? @_ : split(/\s*\:\s*/, (shift), 2);
+
+    Mail::Reporter->log(WARNING => "Illegal character in field name $name")
+       if $name =~ m/[^\041-\071\073-\176]/;
+
+    #
+    # Compose the body.
+    #
+
+    if(ref $body)                 # Objects or array
+    {   my $flat = $self->stringifyData($body) or return ();
+        $body = $self->fold($name, $flat);
+    }
+    elsif($body !~ s/\n+$/\n/g)   # Added by user...
+    {   $body = $self->fold($name, $body);
+    }
+    else                          # Created by parser
+    {   # correct erroneous wrap-seperators (dos files under UNIX)
+        $body =~ s/[\012\015]+/\n/g;
+        $body =~ s/^[ \t]*/ /;  # start with one blank, folding kept unchanged
+
+        $self->log(NOTICE => "Empty field: $name\n")
+           if $body eq " \n";
+    }
+
+    ($name, $body);
+}
+
+#------------------------------------------
+
+
+sub stringifyData($)
+{  my ($self, $arg) = (shift, shift);
+   my @addr;
+   foreach my $obj (ref $arg eq 'ARRAY' ? @$arg : ($arg))
+   {  next unless defined $obj;
+
+      if(!ref $obj)                  { push @addr, $obj; next }
+      if($obj->isa('Mail::Address')) { push @addr, $obj->format; next }
+
+      if($obj->isa('Mail::Identity') || $obj->isa('User::Identity'))
+      {   require Mail::Message::Field::Address;
+          push @addr, Mail::Message::Field::Address->coerce($obj)->string;
+      }
+      elsif($obj->isa('User::Identity::Collection::Emails'))
+      {   my @roles = $obj->roles or next;
+          require Mail::Message::Field::AddrGroup;
+          my $group = Mail::Message::Field::AddrGroup->coerce($obj);
+          push @addr, $group->string if $group;
+      }
+      else
+      {    # any other object is stringified
+           push @addr, "$obj";
+      }
+   }
+
+   @addr ? join(', ', at addr) : undef;
+}
+
+#------------------------------------------
+
+
+sub setWrapLength(;$)
+{   my $self = shift;
+
+    $self->[1] = $self->fold($self->[0],$self->unfoldedBody, @_)
+        if @_ || $self->[1] !~ m/\n$/;
+
+    $self;
+}
+
+#------------------------------------------
+
+
+sub defaultWrapLength(;$)
+{   my $self = shift;
+    @_ ? ($default_wrap_length = shift) : $default_wrap_length;
+}
+
+#------------------------------------------
+
+
+sub fold($$;$)
+{   my $thing = shift;
+    my $name  = shift;
+    my $line  = shift;
+    my $wrap  = shift || $default_wrap_length;
+
+    $line    =~ s/\n\s/ /gms;            # Remove accidental folding
+    return " \n" unless length $line;    # empty field
+
+    my @folded;
+    while(1)
+    {  my $max = $wrap - (@folded ? 1 : length($name) + 2);
+       my $min = $max >> 2;
+       last if length $line < $max;
+
+          $line =~ s/^ ( .{$min,$max}   # $max to 30 chars
+                        [;,]            # followed at a ; or ,
+                       )[ \t]           # and then a WSP
+                    //x
+       || $line =~ s/^ ( .{$min,$max} ) # $max to 30 chars
+                       [ \t]            # followed by a WSP
+                    //x
+       || $line =~ s/^ ( .{$max,}? )    # longer, but minimal chars
+                       [ \t]            # followed by a WSP
+                    //x
+       || $line =~ s/^ (.*) //x;        # everything
+
+       push @folded, " $1\n";
+    }
+
+    push @folded, " $line\n" if length $line;
+    wantarray ? @folded : join('', @folded);
+}
+
+#------------------------------------------
+
+
+sub unfold($)
+{   my $string = $_[1];
+    for($string)
+    {   s/\n//g;
+        s/^ +//;
+    }
+    $string;
+}
+
+#------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Field.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,1108 @@
+
+=head1 NAME
+
+Mail::Message::Field - one line of a message header
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Field
+   is a Mail::Reporter
+
+ Mail::Message::Field is extended by
+   Mail::Message::Field::Fast
+   Mail::Message::Field::Flex
+   Mail::Message::Field::Full
+
+
+=head1 SYNOPSIS
+
+ my $field = Mail::Message::Field->new(From => 'fish at tux.aq');
+ print $field->name;
+ print $field->body;
+ print $field->comment;
+ print $field->content;  # body & comment
+ $field->print(\*OUT);
+ print $field->string;
+ print "$field\n";
+ print $field->attribute('charset') || 'us-ascii';
+
+
+=head1 DESCRIPTION
+
+This implementation follows the guidelines of rfc2822 as close as possible,
+and may there produce a different output than implementations based on
+the obsolete rfc822.  However, the old output will still be accepted.
+
+These objects each store one header line, and facilitates access routines to
+the information hidden in it.  Also, you may want to have a look at the
+added methods of a message:
+
+ my @from    = $message->from;
+ my $sender  = $message->sender;
+ my $subject = $message->subject;
+ my $msgid   = $message->messageId;
+
+ my @to      = $message->to;
+ my @cc      = $message->cc;
+ my @bcc     = $message->bcc;
+ my @dest    = $message->destinations;
+
+ my $other   = $message->get('Reply-To');
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+(stringification) produces the unfolded body of the field, which may
+be what you expect.  This is what makes what the field object seems
+to be a simple string. The string is produced by L<unfoldedBody()|Mail::Message::Field/"Access to the body">.
+
+I<Example:> 
+
+ print $msg->get('subject');  # via overloading
+ print $msg->get('subject')->unfoldedBody; # same
+
+ my $subject = $msg->get('subject') || 'your mail';
+ print "Re: $subject\n";
+
+=back
+
+overload: B<+0>
+
+=over 4
+
+(numification) When the field is numeric, the value will be returned.
+The result is produced by L<toInt()|Mail::Message::Field/"Access to the content">.  If the value is not correct,
+a C<0> is produced, to simplify calculations.
+
+=back
+
+overload: B<<=>>
+
+=over 4
+
+(numeric comparison) Compare the integer field contents with something
+else.
+
+I<Example:> 
+
+ if($msg->get('Content-Length') > 10000) ...
+ if($msg->size > 10000) ... ; # same, but better
+
+=back
+
+overload: B<bool>
+
+=over 4
+
+Always true, to make it possible to say C<if($field)>.
+
+=back
+
+overload: B<cmp>
+
+=over 4
+
+(string comparison) Compare the unfolded body of a field with an other
+field or a string, using the buildin C<cmp>.
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+Create a copy of this field object.
+
+=back
+
+Mail::Message::Field-E<gt>B<new>(DATA)
+
+=over 4
+
+See L<Mail::Message::Field::Fast::new()|Mail::Message::Field::Fast/"METHODS">,
+L<Mail::Message::Field::Flex::new()|Mail::Message::Field::Flex/"METHODS">,
+and L<Mail::Message::Field::Full::new()|Mail::Message::Field::Full/"METHODS">.
+By default, a C<Fast> field is produced.
+
+ Option  Defined in       Default      
+ log     L<Mail::Reporter>  C<'WARNINGS'>
+ trace   L<Mail::Reporter>  C<'WARNINGS'>
+
+. log LEVEL
+
+. trace LEVEL
+
+=back
+
+=head2 The field
+
+
+$obj-E<gt>B<isStructured>
+
+Mail::Message::Field-E<gt>B<isStructured>
+
+=over 4
+
+Some fields are described in the RFCs as being I<structured>: having a
+well described syntax.  These fields have common ideas about comments
+and the like, what they do not share with unstructured fields, like
+the C<Subject> field.
+
+I<Example:> 
+
+ my $field = Mail::Message::Field->new(From => 'me');
+ if($field->isStructured)
+
+ Mail::Message::Field->isStructured('From');
+
+=back
+
+$obj-E<gt>B<length>
+
+=over 4
+
+Returns the total length of the field in characters, which includes the
+field's name, body and folding characters.
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+Returns the number of lines needed to display this header-line.
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+Print the whole header-line to the specified file-handle. One line may
+result in more than one printed line, because of the folding of long
+lines.  The FILEHANDLE defaults to the selected handle.
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+Returns the number of bytes needed to display this header-line.
+
+=back
+
+$obj-E<gt>B<string>([WRAP])
+
+=over 4
+
+Returns the field as string.  By default, this returns the same as
+L<folded()|Mail::Message::Field/"Access to the body">. However, the optional WRAP will cause to re-fold to take
+place (without changing the folding stored inside the field).
+
+=back
+
+$obj-E<gt>B<toDisclose>
+
+=over 4
+
+Returns whether this field can be disclosed to other people, for instance
+when sending the message to an other party.  Returns a C<true> or C<false>
+condition.
+See also L<Mail::Message::Head::Complete::printUndisclosed()|Mail::Message::Head::Complete/"Access to the header">.
+
+=back
+
+=head2 Access to the name
+
+
+$obj-E<gt>B<Name>
+
+=over 4
+
+Returns the name of this field in original casing.  See L<name()|Mail::Message::Field/"Access to the name"> as well.
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+Returns the name of this field, with all characters lower-cased for
+ease of comparison.  See L<Name()|Mail::Message::Field/"Access to the name"> as well.
+
+=back
+
+$obj-E<gt>B<wellformedName>([STRING])
+
+=over 4
+
+(Instance method class method)
+As instance method, the current field's name is correctly formatted
+and returned.  When a STRING is used, that one is formatted.
+
+I<Example:> 
+
+ print Mail::Message::Field->Name('content-type')
+   # -->  Content-Type
+
+ my $field = $head->get('date');
+ print $field->Name;
+   # -->  Date
+
+=back
+
+=head2 Access to the body
+
+
+$obj-E<gt>B<body>
+
+=over 4
+
+This method may be what you want, but usually, the L<foldedBody()|Mail::Message::Field/"Access to the body"> and
+L<unfoldedBody()|Mail::Message::Field/"Access to the body"> are what you are looking for.  This method is
+cultural heritage, and should be avoided.
+
+Returns the body of the field.  When this field is structured, it will
+be B<stripped> from everything what is behind the first semi-color (C<;>).
+In aby case, the string is unfolded.  
+Whether the field is structured is defined by L<isStructured()|Mail::Message::Field/"The field">.
+
+=back
+
+$obj-E<gt>B<folded>
+
+=over 4
+
+Returns the folded version of the whole header.  When the header is
+shorter than the wrap length, a list of one line is returned.  Otherwise
+more lines will be returned, all but the first starting with at least
+one blank.  See also L<foldedBody()|Mail::Message::Field/"Access to the body"> to get the same information without
+the field's name.
+
+In scalar context, the lines are delived into one string, which is
+a little faster because that's the way they are stored internally...
+
+I<Example:> 
+
+ my @lines = $field->folded;
+ print $field->folded;
+ print scalar $field->folded; # faster
+
+=back
+
+$obj-E<gt>B<foldedBody>([BODY])
+
+=over 4
+
+Returns the body as a set of lines. In scalar context, this will be one line
+containing newlines.  Be warned about the newlines when you do
+pattern-matching on the result of thie method.
+
+The optional BODY argument changes the field's body.  The folding of the
+argument must be correct.
+
+=back
+
+$obj-E<gt>B<stripCFWS>([STRING])
+
+Mail::Message::Field-E<gt>B<stripCFWS>([STRING])
+
+=over 4
+
+Remove the I<comments> and I<folding white spaces> from the STRING.  Without
+string and only as instance method, the L<unfoldedBody()|Mail::Message::Field/"Access to the body"> is being stripped
+and returned.
+
+WARNING: This operation is only allowed for structured header fields (which
+are defined by the various RFCs as being so.  You don't want parts within
+braces which are in the Subject header line to be removed, to give an
+example.
+
+=back
+
+$obj-E<gt>B<unfoldedBody>([BODY, [WRAP]])
+
+=over 4
+
+Returns the body as one single line, where all folding information (if
+available) is removed.  This line will also NOT end on a new-line.
+
+The optional BODY argument changes the field's body.  The right folding is
+performed before assignment.  The WRAP may be specified to enforce a
+folding size.
+
+I<Example:> 
+
+ my $body = $field->unfoldedBody;
+ print "$field";   # via overloading
+
+=back
+
+=head2 Access to the content
+
+
+$obj-E<gt>B<addresses>
+
+=over 4
+
+Returns a list of Mail::Address objects, which represent the
+e-mail addresses found in this header line.
+
+I<Example:> 
+
+ my @addr = $message->head->get('to')->addresses;
+ my @addr = $message->to;
+
+=back
+
+$obj-E<gt>B<attribute>(NAME [, VALUE])
+
+=over 4
+
+Get the value of an attribute, optionally after setting it to a new value.
+Attributes are part of some header lines, and hide themselves in the
+comment field.  If the attribute does not exist, then C<undef> is
+returned.
+
+I<Example:> 
+
+ my $field = Mail::Message::Field->new(
+  'Content-Type: text/plain; charset="us-ascii"');
+
+ print $field->attribute('charset');
+   # --> us-ascii
+
+ print $field->attribute('bitmap') || 'no'
+   # --> no
+
+ $field->atrribute(filename => '/tmp/xyz');
+ $field->print;
+   # --> Content-Type: text/plain; charset="us-ascii";
+   #       filename="/tmp/xyz"
+   # Automatically folded, and no doubles created.
+
+=back
+
+$obj-E<gt>B<comment>([STRING])
+
+=over 4
+
+Returns the unfolded comment (part after a semi-colon) in a structureed
+header-line. optionally after setting it to a new STRING first.
+When C<undef> is specified as STRING, the comment is removed.
+Whether the field is structured is defined by L<isStructured()|Mail::Message::Field/"The field">.
+
+The I<comment> part of a header field often contains C<attributes>.  Often
+it is preferred to use L<attribute()|Mail::Message::Field/"Access to the content"> on them.
+
+=back
+
+$obj-E<gt>B<study>
+
+=over 4
+
+Study the header field in detail: turn on the full parsing and detailed
+understanding of the content of the fields.  L<Mail::Message::Field::Fast|Mail::Message::Field::Fast>
+and L<Mail::Message::Field::Fast|Mail::Message::Field::Fast> objects will be transformed into any
+L<Mail::Message::Field::Full|Mail::Message::Field::Full> object.
+
+I<Example:> 
+
+ my $subject = $msg->head->get('subject')->study;
+ my $subject = $msg->head->study('subject');  # same
+ my $subject = $msg->study('subject');        # same
+
+=back
+
+$obj-E<gt>B<toDate>([TIME])
+
+Mail::Message::Field-E<gt>B<toDate>([TIME])
+
+=over 4
+
+Convert a timestamp into an rfc2822 compliant date format.  This differs
+from the default output of C<localtime> in scalar context.  Without
+argument, the C<localtime> is used to get the current time. TIME can
+be specified as one numeric (like the result of C<time()>) and as list
+(like produced by c<localtime()> in list context).
+
+Be sure to have your timezone set right, especially when this script
+runs automatically.
+
+I<Example:> 
+
+ my $now = time;
+ Mail::Message::Field->toDate($now);
+ Mail::Message::Field->toDate(time);
+
+ Mail::Message::Field->toDate(localtime);
+ Mail::Message::Field->toDate;      # same
+ # returns someting like:
+ #     Wed, 28 Aug 2002 10:40:25 +0200
+
+=back
+
+$obj-E<gt>B<toInt>
+
+=over 4
+
+Returns the value which is related to this field as integer.  A check is
+performed whether this is right.
+
+=back
+
+=head2 Other methods
+
+
+$obj-E<gt>B<dateToTimestamp>(STRING)
+
+Mail::Message::Field-E<gt>B<dateToTimestamp>(STRING)
+
+=over 4
+
+Convert a STRING which represents and RFC compliant time string into
+a timestamp like is produced by the C<time> function.
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<consume>(LINE | (NAME,BODY|OBJECTS))
+
+=over 4
+
+Accepts a whole field LINE, or a pair with the field's NAME and BODY. In
+the latter case, the BODY data may be specified as array of OBJECTS which
+are stringified.  Returned is a nicely formatted pair of two strings: the
+field's name and a folded body.
+
+This method is called by L<new()|Mail::Message::Field/"Constructors">, and usually not by an application
+program. The details about converting the OBJECTS to a field content
+are explained in L</Specifying field data>.
+
+=back
+
+$obj-E<gt>B<defaultWrapLength>([LENGTH])
+
+=over 4
+
+Any field from any header for any message will have this default wrapping.
+This is maintained in one global variable.  Without a specified LENGTH,
+the current value is returned.  The default is 78.
+
+=back
+
+$obj-E<gt>B<fold>(NAME, BODY, [MAXCHARS])
+
+Mail::Message::Field-E<gt>B<fold>(NAME, BODY, [MAXCHARS])
+
+=over 4
+
+Make the header field with NAME fold into multiple lines.
+Wrapping is performed by inserting newlines before a blanks in the
+BODY, such that no line exceeds the MAXCHARS and each line is as long
+as possible.
+
+The RFC requests for folding on nice spots, but this request is
+mainly ignored because it would make folding too slow.
+
+=back
+
+$obj-E<gt>B<setWrapLength>([LENGTH])
+
+=over 4
+
+Force the wrapping of this field to the specified LENGTH characters. The
+wrapping is performed with L<fold()|Mail::Message::Field/"Internals"> and the results stored within
+the field object.
+
+Without LENGTH, the message will be folded, unless it is already folded.
+Pre-folded lines are detected on a trailing new-line character.
+
+I<Example:> 
+
+ $field->setWrapLength(99);
+ $field->setWrapLength;
+
+=back
+
+$obj-E<gt>B<stringifyData>(STRING|ARRAY|OBJECTS)
+
+=over 4
+
+This method implements the translation of user supplied objects into
+ascii fields.  The process is explained in L</Specifying field data>.
+
+=back
+
+$obj-E<gt>B<unfold>(STRING)
+
+=over 4
+
+The reverse action of L<fold()|Mail::Message::Field/"Internals">: all lines which form the body of a field
+are joined into one by removing all line terminators (even the last).
+Possible leading blanks on the first line are removed as well.
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Field-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Field-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Field-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> Field content is not numerical: $content
+
+The numeric value of a field is requested (for instance the C<Lines> or
+C<Content-Length> fields should be numerical), however the data contains
+weird characters.
+
+I<Warning:> Illegal character in field name $name
+
+A new field is being created which does contain characters not permitted
+by the RFCs.  Using this field in messages may break other e-mail clients
+or transfer agents, and therefore mutulate or extinguish your message.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+=head1 DETAILS
+
+
+=head2 Field syntax
+
+Fields are stored in the header of a message, which are represented by
+L<Mail::Message::Head|Mail::Message::Head> objects. A field is a combination of a I<name>,
+I<body>, and I<attributes>.  Especially the term "body" is cause for
+confusion: sometimes the attributes are considered to be part of the body.
+
+The name of the field is followed by a colon ("C<:>", not preceeded by
+blanks, but followed by one blank).  Each attribute is preceeded by
+a separate semi-colon ("C<;>").  Names of fields are case-insensitive and
+cannot contain blanks.
+
+I<Example:> of fields
+
+
+Correct fields:
+
+ Field: hi!
+ Content-Type: text/html; charset=latin1
+ 
+Incorrect fields, but accepted:
+
+ Field : wrong, blank before colon
+ Field:                 # wrong, empty
+ Field:not nice, blank preferred after colon
+ One Two: wrong, blank in name
+
+=head3 Folding fields
+
+Fields which are long can be folded to span more than one line.  The real
+limit for lines in messages is only at 998 characters, however such long
+lines are not easy to read without support of an application.  Therefore
+rfc2822 (which defines the message syntax) specifies explicitly that
+field lines can be re-formatted into multiple sorter lines without change
+of meaning, by adding new-line characters to any field before any blank or
+tab.
+
+Usually, the lines are reformatted to create lines which are 78 characters
+maximum. Some applications try harder to fold on nice spots, like before
+attributes.  Especially the C<Received> field is often manually folded into
+some nice layout.  In most cases however, it is preferred to produce lines
+which are as long as possible but max 78.
+
+BE WARNED that all fields can be subjected to folding, and that you usually
+want the unfolded value.
+
+I<Example:> of field folding
+
+
+ Subject: this is a short line, and not folded
+
+ Subject: this subject field is much longer, and therefore
+  folded into multiple
+  lines, although one more than needed.
+
+=head3 Structured fields
+
+The rfc2822 describes a large number of header fields explicitly.  These
+fields have a defined meaning.  For some of the fields, like the C<Subject>
+field, the meaning is straight forward the contents itself.  These fields
+are the I<Unstructured Fields>.
+
+Other fields have a well defined internal syntax because their content is
+needed by e-mail applications. For instance, the C<To> field contains
+addresses which must be understood by all applications in the same way.
+These are the I<Structured Fields>, see L<isStructured()|Mail::Message::Field/"The field">.
+
+=head3 Comments in fields
+
+Stuctured fields can contain comments, which are pieces of text enclosed in
+parenthesis.  These comments can be placed close to anywhere in the line
+and must be ignored be the application.  Not all applications are capable
+of handling comments correctly in all circumstances.
+
+I<Example:> of field comments
+
+
+ To: mailbox (Mail::Box mailinglist) <mailbox at overmeer.net>
+ Date: Thu, 13 Sep 2001 09:40:48 +0200 (CEST)
+ Subject: goodbye (was: hi!)
+
+On the first line, the text "Mail::Box mailinglist" is used as comment.
+Be warned that rfc2822 explicitly states that comments in e-mail address
+specifications should not be considered to contain any usable information.
+
+On the second line, the timezone is specified as comment. The C<Date>
+field format has no way to indicate the timezone of the sender, but only
+contains the timezone difference to UTC, however one could decide to add
+this as comment.  Application must ignore this data because the C<Date>
+field is structured.
+
+The last field is unstructured.  The text between parantheses is an
+integral part of the subject line.
+
+=head2 Getting a field
+
+As many programs as there are handling e-mail, as many variations on
+accessing the header information are requested.  Be careful which way
+you access the data: read the variations described here and decide
+which solution suites your needs best.
+
+=head3 Using get() field
+
+The C<get()> interface is copied from other Perl modules which can
+handle e-mail messages.  Many applications which simply replace
+Mail::Internet objects by L<Mail::Message|Mail::Message> objects will work
+without modification.
+
+There is more than one get method.  The exact results depend on which
+get you use.  When L<Mail::Message::get()|Mail::Message/"The header"> is called, you will get the
+unfolded, stripped from comments, stripped from attributes contents of
+the field as B<string>.  Character-set encodings will still be in the
+string.  If the same fieldname appears more than once in the header,
+only the last value is returned.
+
+When L<Mail::Message::Head::get()|Mail::Message::Head/"Access to the header"> is called in scalar context, the
+last field with the specified name is returned as field B<object>.
+This object strinigfies into the unfolded contents of the field, including
+attributes and comments.  In list context, all appearances of the field
+in the header are returned as objects.
+
+BE WARNED that some lines seem unique, but are not according to the
+official rfc.  For instance, C<To> fields can appear more than once.
+If your program calls C<get('to')> in scalar context, some information
+is lost.
+
+I<Example:> of using get()
+
+
+ print $msg->get('subject') || 'no subject';
+ print $msg->head->get('subject') || 'no subject';
+
+ my @to = $msg->head->get('to');
+
+=head3 Using study() field
+
+As the name C<study> already implies, this way of accessing the fields is
+much more thorough but also slower.  The C<study> of a field is like a
+C<get>, but provides easy access to the content of the field and handles
+character-set decoding correctly.
+
+The L<Mail::Message::study()|Mail::Message/"The header"> method will only return the last field
+with that name as object.  L<Mail::Message::Head::study()|Mail::Message::Head/"Access to the header"> and
+L<Mail::Message::Field::study()|Mail::Message::Field/"Access to the content"> return all fields when used in list
+context.
+
+I<Example:> of using study()
+
+
+ print $msg->study('subject') || 'no subject';
+ my @rec  = $msg->head->study('Received');
+
+ my $from = $msg->head->get('From')->study;
+ my $from = $msg->head->study('From');  # same
+ my @addr = $from->addresses;
+
+=head3 Using resent groups
+
+Some fields belong together in a group of fields.  For instance, a set
+of lines is used to define one step in the mail transport process.  Each
+step adds a C<Received> line, and optionally some C<Resent-*> lines and
+C<Return-Path>.  These groups of lines shall stay together and in order
+when the message header is processed.
+
+The C<Mail::Message::Head::ResentGroup> object simplifies the access to
+these related fields.  These resent groups can be deleted as a whole,
+or correctly constructed.
+
+I<Example:> of using resent groups
+
+
+ my $rgs = $msg->head->resentGroups;
+ $rgs[0]->delete if @rgs;
+
+ $msg->head->removeResentGroups;
+
+=head2 The field's data
+
+There are many ways to get the fields info as object, and there are also
+many ways to process this data within the field.
+
+=head3 Access to the field
+
+=over 4
+
+=item * L<string()|Mail::Message::Field/"The field">
+
+Returns the text of the body exactly as will be printed to file when
+L<print()|Mail::Message::Field/"The field"> is called, so name, main body, and attributes.
+
+=item * L<foldedBody()|Mail::Message::Field/"Access to the body">
+
+Returns the text of the body, like L<string()|Mail::Message::Field/"The field">, but without the name of
+the field.
+
+=item * L<unfoldedBody()|Mail::Message::Field/"Access to the body">
+
+Returns the text of the body, like L<foldedBody()|Mail::Message::Field/"Access to the body">, but then with all
+new-lines removed.  This is the normal way to get the content of
+unstructured fields.  Character-set encodings will still be in place.
+Fields are stringified into their unfolded representation.
+
+=item * L<stripCFWS()|Mail::Message::Field/"Access to the body">
+
+Returns the text of structured fields, where new-lines and comments are
+removed from the string.  This is a good start for parsing the field,
+for instance to find e-mail addresses in them.
+
+=item * L<Mail::Message::Field::Full::decodedBody()|Mail::Message::Field::Full/"Access to the body">
+
+Studied fields can produce the unfolded text decoded into utf8 strings.
+This is an expensive process, but the only correct way to get the field's
+data.  More useful for people who are not living in ASCII space.
+
+=item * Studied fields
+
+Studied fields have powerful methods to provide ways to access and produce
+the contents of (structured) fields exactly as the involved rfcs prescribe.
+
+=back
+
+=head3 Using simplified field access
+
+Some fields are accessed that often that there are support methods to
+provide simplified access.  All these methods are called upon a message
+directly.
+
+I<Example:> of simplified field access
+
+
+ print $message->subject;
+ print $message->get('subject') || '';  # same
+
+ my @from = $message->from; # returns addresses
+ $message->reply->send if $message->sender;
+
+The C<sender> method will return the address specified in the C<Sender>
+field, or the first named in the C<From> field.  It will return C<undef>
+in case no address is known.
+
+=head3 Specifying field data
+
+Field data can be anything, strongly dependent on the type
+of field at hand. If you decide to contruct the fields very
+carefully via some L<Mail::Message::Field::Full|Mail::Message::Field::Full> extension (like via
+L<Mail::Message::Field::Addresses|Mail::Message::Field::Addresses> objects), then you will have protection
+build-in.  However, you can bluntly create any L<Mail::Message::Field|Mail::Message::Field>
+object based on some data.
+
+When you create a field, you may specify a string, object, or an array
+of strings and objects.  On the moment, objects are only used to help
+the construction on e-mail addresses, however you may add some of your
+own.
+
+The following rules (implemented in L<stringifyData()|Mail::Message::Field/"Internals">) are obeyed given
+the argument is:
+
+=over 4
+
+=item * a string
+
+The string must be following the (complicated) rules of the rfc2822, and
+is made field content as specified.  When the string is not terminated
+by a new-line (C<"\n">) it will be folded according to the standard rules.
+
+=item * a Mail::Address object
+
+The most used Perl object to parse and produce address lines.  This object
+does not understand character set encodings in phrases.
+
+=item * a L<Mail::Identity|Mail::Identity> object
+
+As part of the L<User::Identity|User::Identity> distribution, this object has full
+understanding of the meaning of one e-mail address, related to a person.
+All features defined by rfc2822 are implemented.
+
+=item * a L<User::Identity|User::Identity> object
+
+A person is specified, which may have more than one L<Mail::Identity|Mail::Identity>'s
+defined.  Some methods, like L<Mail::Message::reply()|Mail::Message::Construct::Reply/"Constructing a message"> and
+L<Mail::Message::forward()|Mail::Message::Construct::Forward/"Constructing a message"> try to select the right e-mail address
+smart (see their method descriptions), but in other cases the first
+e-mail address found is used.
+
+=item * a L<User::Identity::Collection::Emails|User::Identity::Collection::Emails> object
+
+All L<Mail::Identity|Mail::Identity> objects in the collection will be included in
+the field as a group carying the name of the collection.
+
+=item * any other object
+
+For all other objects, the stringification overload is used to produce
+the field content.
+
+=item * an ARRAY
+
+You may also specify an array with a mixture of any of the above.  The
+elements will be joined as comma-separated list.  If you do not want
+comma's inbetween, you will have to process the array yourself.
+
+=back
+
+I<Example:> specifying simple field data
+
+
+ my $f = Mail::Message::Field->new(Subject => 'hi!');
+ my $b = Mail::Message->build(Subject => 'monkey');
+
+I<Example:> s specifying e-mail addresses for a field
+
+
+ use Mail::Address;
+ my $fish = Mail::Address->new('Mail::Box', 'fish at tux.aq');
+ print $fish->format;   # ==> Mail::Box <fish at tux.aq>
+ my $exa  = Mail::Address->new(undef, 'me at example.com');
+ print $exa->format;    # ==> me at example.com
+
+ my $b = $msg->build(To => "you at example.com");
+ my $b = $msg->build(To => $fish);
+ my $b = $msg->build(To => [ $fish, $exa ]);
+
+ my @all = ($fish, "you at example.com", $exa);
+ my $b = $msg->build(To => \@all);
+ my $b = $msg->build(To => [ "xyz", @all ]);
+
+I<Example:> specifying identities for a field
+
+
+ use User::Identity;
+ my $patrik = User::Identity->new
+  ( name      => 'patrik'
+  , full_name => "Patrik Fältström"  # from rfc
+  , charset   => "ISO-8859-1"
+  );
+ $patrik->add
+  ( email    => "him at home.net"
+  );
+
+ my $b = $msg->build(To => $patrik);
+
+ $b->get('To')->print;
+   # ==> =?ISO-8859-1?Q?Patrik_F=E4ltstr=F6m?=
+   #     <him at home.net>
+
+=head2 Field class implementation
+
+For performance reasons only, there are three types of fields: the
+fast, the flexible, and the full understander:
+
+=over 4
+
+=item * L<Mail::Message::Field::Fast|Mail::Message::Field::Fast>
+
+C<Fast> objects are not derived from a C<Mail::Reporter>.  The consideration
+is that fields are so often created, and such a small objects at the same
+time, that setting-up a logging for each of the objects is relatively
+expensive and not really useful.
+The fast field implementation uses an array to store the data: that
+will be faster than using a hash.  Fast fields are not easily inheritable,
+because the object creation and initiation is merged into one method.
+
+=item * L<Mail::Message::Field::Flex|Mail::Message::Field::Flex>
+
+The flexible implementation uses a hash to store the data.  The L<new()|Mail::Message::Field/"Constructors">
+and C<init> methods are split, so this object is extensible.
+
+=item * L<Mail::Message::Field::Full|Mail::Message::Field::Full>
+
+With a full implementation of all applicable RFCs (about 5), the best
+understanding of the fields is reached.  However, this comes with
+a serious memory and performance penalty.  These objects are created
+from fast or flex header fields when L<study()|Mail::Message::Field/"Access to the content"> is called.
+
+=back
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Complete.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Complete.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Complete.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,498 @@
+use strict;
+use warnings;
+
+package Mail::Message::Head::Complete;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Head';
+
+use Mail::Box::Parser;
+use Mail::Message::Head::Partial;
+
+use Scalar::Util 'weaken';
+use List::Util   'sum';
+
+
+sub clone(;@)
+{   my $self   = shift;
+    my $copy   = ref($self)->new($self->logSettings);
+
+    $copy->addNoRealize($_->clone) foreach $self->orderedFields;
+    $copy->modified(1);
+    $copy;
+}
+
+#------------------------------------------
+
+sub build(@)
+{   my $self = shift;
+    my $head = $self->new;
+    $head->add(shift, shift) while @_;
+    $head;
+}
+
+#------------------------------------------
+
+
+sub isDelayed() {0}
+
+#------------------------------------------
+
+
+sub nrLines() { sum 1, map { $_->nrLines } shift->orderedFields }
+
+#------------------------------------------
+
+
+sub size() { sum 1, map {$_->size} shift->orderedFields }
+
+#------------------------------------------
+
+
+sub add(@)
+{   my $self = shift;
+
+    # Create object for this field.
+
+    my $field
+      = @_==1 && ref $_[0] ? shift     # A fully qualified field is added.
+      : ($self->{MMH_field_type} || 'Mail::Message::Field::Fast')->new(@_);
+
+    $field->setWrapLength;
+
+    # Put it in place.
+
+    my $known = $self->{MMH_fields};
+    my $name  = $field->name;  # is already lower-cased
+
+    $self->addOrderedFields($field);
+
+    if(defined $known->{$name})
+    {   if(ref $known->{$name} eq 'ARRAY') { push @{$known->{$name}}, $field }
+        else { $known->{$name} = [ $known->{$name}, $field ] }
+    }
+    else
+    {   $known->{$name} = $field;
+    }
+
+    $self->{MMH_modified}++;
+    $field;
+}
+
+#------------------------------------------
+
+
+sub count($)
+{   my $known = shift->{MMH_fields};
+    my $value = $known->{lc shift};
+
+      ! defined $value ? 0
+    : ref $value       ? @$value
+    :                    1;
+}
+
+#------------------------------------------
+
+
+sub names() {shift->knownNames}
+ 
+#------------------------------------------
+
+
+sub grepNames(@)
+{   my $self = shift;
+    my @take;
+    push @take, (ref $_ eq 'ARRAY' ? @$_ : $_) foreach @_;
+
+    return $self->names unless @take;
+
+    my $take;
+    if(@take==1 && ref $take[0] eq 'Regexp')
+    {   $take    = $take[0];   # one regexp prepared already
+    }
+    else
+    {   # I love this trick:
+        local $" = ')|(?:';
+        $take    = qr/^(?:(?:@take))/i;
+    }
+
+    grep {$_->Name =~ $take} $self->orderedFields;
+}
+
+#------------------------------------------
+
+
+my @skip_none = qw/content-transfer-encoding content-disposition/;
+my %skip_none = map { ($_ => 1) } @skip_none;
+
+sub set(@)
+{   my $self = shift;
+    my $type = $self->{MMH_field_type} || 'Mail::Message::Field::Fast';
+    $self->{MMH_modified}++;
+
+    # Create object for this field.
+    my $field = @_==1 && ref $_[0] ? shift->clone : $type->new(@_);
+
+    my $name  = $field->name;         # is already lower-cased
+    my $known = $self->{MMH_fields};
+
+    # Internally, non-existing content-info are in the body stored as 'none'
+    # The header will not contain these lines.
+
+    if($skip_none{$name} && $field->body eq 'none')
+    {   delete $known->{$name};
+        return $field;
+    }
+
+    $field->setWrapLength;
+    $known->{$name} = $field;
+
+    $self->addOrderedFields($field);
+    $field;
+}
+
+#------------------------------------------
+
+
+sub reset($@)
+{   my ($self, $name) = (shift, lc shift);
+
+    my $known = $self->{MMH_fields};
+
+    if(@_==0)
+    {   $self->{MMH_modified}++ if delete $known->{$name};
+        return ();
+    }
+
+    $self->{MMH_modified}++;
+
+    # Cloning required, otherwise double registrations will not be
+    # removed from the ordered list: that's controled by 'weaken'
+
+    my @fields = map {$_->clone} @_;
+
+    if(@_==1) { $known->{$name} = $fields[0] }
+    else      { $known->{$name} = [@fields]  }
+
+    $self->addOrderedFields(@fields);
+    $self;
+}
+ 
+#------------------------------------------
+
+
+sub delete($) { $_[0]->reset($_[1]) }
+
+#------------------------------------------
+
+
+sub removeField($)
+{   my ($self, $field) = @_;
+    my $name  = $field->name;
+    my $known = $self->{MMH_fields};
+
+    if(!defined $known->{$name})
+    { ; }  # complain
+    elsif(ref $known->{$name} eq 'ARRAY')
+    {    for(my $i=0; $i < @{$known->{$name}}; $i++)
+         {
+             return splice @{$known->{$name}}, $i, 1
+                 if $known->{$name}[$i] eq $field;
+         }
+    }
+    elsif($known->{$name} eq $field)
+    {    return delete $known->{$name};
+    }
+
+    $self->log(WARNING => "Cannot remove field $name from header: not found.");
+
+    return;
+}
+
+#------------------------------------------
+
+
+sub removeFields(@)
+{   my $self = shift;
+    (bless $self, 'Mail::Message::Head::Partial')->removeFields(@_);
+}
+   
+#------------------------------------------
+
+
+sub removeFieldsExcept(@)
+{   my $self = shift;
+    (bless $self, 'Mail::Message::Head::Partial')->removeFieldsExcept(@_);
+}
+
+#------------------------------------------
+
+
+sub removeContentInfo() { shift->removeFields(qr/^Content-/, 'Lines') }
+
+#------------------------------------------
+
+
+sub removeResentGroups(@)
+{   my $self = shift;
+    (bless $self, 'Mail::Message::Head::Partial')->removeResentGroups(@_);
+}
+
+#------------------------------------------
+
+
+sub removeListGroup(@)
+{   my $self = shift;
+    (bless $self, 'Mail::Message::Head::Partial')->removeListGroup(@_);
+}
+
+#------------------------------------------
+
+
+sub removeSpamGroups(@)
+{   my $self = shift;
+    (bless $self, 'Mail::Message::Head::Partial')->removeSpamGroups(@_);
+}
+
+#------------------------------------------
+
+
+sub spamDetected()
+{   my $self = shift;
+    my @sgs = $self->spamGroups or return undef;
+    grep { $_->spamDetected } @sgs;
+}
+
+#------------------------------------------
+
+
+sub print(;$)
+{   my $self  = shift;
+    my $fh    = shift || select;
+
+    $_->print($fh)
+        foreach $self->orderedFields;
+
+    if(ref $fh eq 'GLOB') { print $fh "\n" }
+    else                  { $fh->print("\n") }
+
+    $self;
+}
+
+#------------------------------------------
+
+
+sub printUndisclosed($)
+{   my ($self, $fh) = @_;
+
+    $_->print($fh)
+       foreach grep {$_->toDisclose} $self->orderedFields;
+
+    if(ref $fh eq 'GLOB') { print $fh "\n" }
+    else                  { $fh->print("\n") }
+
+    $self;
+}
+
+#------------------------------------------
+
+
+sub toString() {shift->string}
+sub string()
+{   my $self  = shift;
+
+    my @lines = map {$_->string} $self->orderedFields;
+    push @lines, "\n";
+
+    wantarray ? @lines : join('', @lines);
+}
+
+#------------------------------------------
+
+
+sub resentGroups()
+{   my $self = shift;
+    require Mail::Message::Head::ResentGroup;
+    Mail::Message::Head::ResentGroup->from($self);
+}
+
+#------------------------------------------
+
+
+sub addResentGroup(@)
+{   my $self  = shift;
+
+    require Mail::Message::Head::ResentGroup;
+    my $rg = @_==1 ? (shift) : Mail::Message::Head::ResentGroup->new(@_);
+
+    my @fields = $rg->orderedFields;
+    my $order  = $self->{MMH_order};
+
+    # Look for the first line which relates to resent groups
+    my $i;
+    for($i=0; $i < @$order; $i++)
+    {   next unless defined $order->[$i];
+        last if $rg->isResentGroupFieldName($order->[$i]->name);
+    }
+
+    my $known = $self->{MMH_fields};
+    while(@fields)
+    {   my $f    = pop @fields;
+
+        # Add to the order of fields
+        splice @$order, $i, 0, $f;
+        weaken( $order->[$i] );
+        my $name = $f->name;
+
+        # Adds *before* in the list for get().
+           if(!defined $known->{$name})      {$known->{$name} = $f}
+        elsif(ref $known->{$name} eq 'ARRAY'){unshift @{$known->{$name}},$f}
+        else                       {$known->{$name} = [$f, $known->{$name}]}
+    }
+
+    $rg->messageHead($self);
+
+    # Oh, the header has changed!
+    $self->modified(1);
+
+    $rg;
+}
+
+#------------------------------------------
+
+
+sub listGroup()
+{   my $self = shift;
+    eval "require 'Mail::Message::Head::ListGroup'";
+    Mail::Message::Head::ListGroup->from($self);
+}
+
+#------------------------------------------
+
+
+sub addListGroup($)
+{   my ($self, $lg) = @_;
+    $lg->attach($self);
+}
+
+#------------------------------------------
+
+
+sub spamGroups(@)
+{   my $self = shift;
+    require Mail::Message::Head::SpamGroup;
+    my @types = @_ ? (types => \@_) : ();
+    my @sgs   = Mail::Message::Head::SpamGroup->from($self, @types);
+    wantarray || @_ != 1 ? @sgs : $sgs[0];
+}
+
+#------------------------------------------
+
+
+sub addSpamGroup($)
+{   my ($self, $sg) = @_;
+    $sg->attach($self);
+}
+
+#------------------------------------------
+
+
+
+sub timestamp() {shift->guessTimestamp || time}
+
+#------------------------------------------
+
+
+sub recvstamp()
+{   my $self = shift;
+
+    return $self->{MMH_recvstamp} if exists $self->{MMH_recvstamp};
+
+    my $recvd = $self->get('received', 0) or
+        return $self->{MMH_recvstamp} = undef;
+
+    my $stamp = Mail::Message::Field->dateToTimestamp($recvd->comment);
+
+    $self->{MMH_recvstamp} = $stamp > 0 ? $stamp : undef;
+}
+
+#------------------------------------------
+
+
+sub guessTimestamp()
+{   my $self = shift;
+    return $self->{MMH_timestamp} if exists $self->{MMH_timestamp};
+
+    my $stamp;
+    if(my $date = $self->get('date'))
+    {   $stamp = Mail::Message::Field->dateToTimestamp($date);
+    }
+
+    unless($stamp)
+    {   foreach (reverse $self->get('received'))
+        {   $stamp = Mail::Message::Field->dateToTimestamp($_->comment);
+            last if $stamp;
+        }
+    }
+
+    $self->{MMH_timestamp} = $stamp > 0 ? $stamp : undef;
+}
+
+#------------------------------------------
+
+sub guessBodySize()
+{   my $self = shift;
+
+    my $cl = $self->get('Content-Length');
+    return $1 if defined $cl && $cl =~ m/(\d+)/;
+
+    my $lines = $self->get('Lines');   # 40 chars per lines
+    return $1 * 40   if defined $lines && $lines =~ m/(\d+)/;
+
+    undef;
+}
+
+#------------------------------------------
+
+
+sub createFromLine()
+{   my $self   = shift;
+
+    my $from   = $self->get('from') || '';
+    my $stamp  = $self->timestamp;
+    my $sender = $from =~ m/\<.*?\>/ ? $& : 'unknown';
+    "From $sender ".(gmtime $stamp)."\n";
+}
+
+#------------------------------------------
+
+
+my $unique_id     = time;
+my $hostname;
+
+sub createMessageId()
+{   my $mid = shift->messageIdPrefix . '-' . $unique_id++;
+
+    unless(defined $hostname)
+    {   require Sys::Hostname;
+        $hostname = Sys::Hostname::hostname() || 'localhost';
+    }
+
+    $mid . '@' . $hostname;
+}
+
+#------------------------------------------
+
+
+our $unique_prefix;
+
+sub messageIdPrefix(;$)
+{   my $self = shift;
+    return $unique_prefix if !@_ && defined $unique_prefix;
+
+    $unique_prefix = shift || "mailbox-$$";
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Complete.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Complete.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Complete.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,909 @@
+
+=head1 NAME
+
+Mail::Message::Head::Complete - the header of one message
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Head::Complete
+   is a Mail::Message::Head
+   is a Mail::Reporter
+
+ Mail::Message::Head::Complete is extended by
+   Mail::Message::Head::Partial
+   Mail::Message::Replace::MailHeader
+
+ Mail::Message::Head::Complete is realized by
+   Mail::Message::Head::Delayed
+   Mail::Message::Head::Subset
+
+
+=head1 SYNOPSIS
+
+ my $head = Mail::Message::Head::Complete->new;
+ See Mail::Message::Head
+
+
+=head1 DESCRIPTION
+
+E-mail's message can be in various states: unread, partially read, and
+fully read.  The class stores a message of which all header lines are
+known for sure.
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Message::Head/"OVERLOADED">
+
+=back
+
+overload: B<bool>
+
+=over 4
+
+See L<Mail::Message::Head/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<build>(FIELDS)
+
+=over 4
+
+See L<Mail::Message::Head/"Constructors">
+
+=back
+
+$obj-E<gt>B<clone>([FIELDS])
+
+=over 4
+
+Make a copy of the header, optionally limited only to the header lines
+specified by FIELDS.  The lines which are taken must start with one of the
+list.  If no list is specified, all will be taken.
+
+I<Example:> 
+
+ my $newhead = $head->clone('Subject', 'Received');
+
+=back
+
+Mail::Message::Head::Complete-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Head/"Constructors">
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<isEmpty>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<knownNames>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<message>([MESSAGE])
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+Return the number of lines needed to display this header (including
+the trailing newline)
+
+=back
+
+$obj-E<gt>B<orderedFields>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+Return the number of bytes needed to display this header (including
+the trailing newline).  On systems which use CRLF as line separator,
+the number of lines in the header (see L<nrLines()|Mail::Message::Head::Complete/"The header">) must be added to
+find the actual size in the file.
+
+=back
+
+=head2 Access to the header
+
+
+$obj-E<gt>B<add>(FIELD | LINE | (NAME,BODY[,ATTRS]))
+
+=over 4
+
+Add a field to the header.  If a field is added more than once, all values
+are stored in the header, in the order they are added.
+
+When a FIELD object is specified (some L<Mail::Message::Field|Mail::Message::Field> instance), that
+will be added.  Another possibility is to specify a raw header LINE, or a
+header line nicely split-up in NAME and BODY, in which case the
+field constructor is called for you.
+
+LINE or BODY specifications which are terminated by a new-line are considered 
+to be correctly folded.  Lines which are not terminated by a new-line will
+be folded when needed: new-lines will be added where required.  It is strongly
+adviced to let MailBox do the folding for you.
+
+The return value of this method is the L<Mail::Message::Field|Mail::Message::Field> object
+which is created (or was specified).
+
+I<Example:> 
+
+ my $head  = Mail::Message::Head->new;
+ $head->add('Subject: hi!');
+ $head->add(From => 'me at home');
+ my $field = Mail::Message::Field->new('To: you at there');
+ $head->add($field);
+ my Mail::Message::Field $s = $head->add(Sender => 'I');
+
+=back
+
+$obj-E<gt>B<addListGroup>(OBJECT)
+
+=over 4
+
+A I<list group> is a set of header fields which contain data about a
+mailing list which was used to transmit the message.  See
+L<Mail::Message::Head::ListGroup|Mail::Message::Head::ListGroup> for details about the implementation
+of the OBJECT.
+
+When you have a list group prepared, you can add it later using this
+method.  You will get your private copy of the list group data in
+return, because the same group can be used for multiple messages.
+
+I<Example:> of adding a list group to a header
+
+
+ my $lg = Mail::Message::Head::ListGroup->new(...);
+ my $own_lg = $msg->head->addListGroup($lg);
+
+=back
+
+$obj-E<gt>B<addResentGroup>(RESENT-GROUP|DATA)
+
+=over 4
+
+Add a RESENT-GROUP (a L<Mail::Message::Head::ResentGroup|Mail::Message::Head::ResentGroup> object) to
+the header.  If you specify DATA, that is used to create such group
+first.  If no C<Received> line is specified, it will be created
+for you.
+
+These header lines have nothing to do with the user's sense
+of C<reply> or C<forward> actions: these lines trace the e-mail
+transport mechanism.
+
+I<Example:> 
+
+ my $rg = Mail::Message::Head::ResentGroup->new(head => $head, ...);
+ $head->addResentGroup($rg);
+
+ my $rg = $head->addResentGroup(From => 'me');
+
+=back
+
+$obj-E<gt>B<addSpamGroup>(OBJECT)
+
+=over 4
+
+A I<spam fighting group> is a set of header fields which contains data
+which is used to fight spam.  See L<Mail::Message::Head::SpamGroup|Mail::Message::Head::SpamGroup>
+for details about the implementation of the OBJECT.
+
+When you have a spam group prepared, you can add it later using this
+method.  You will get your private copy of the spam group data in
+return, because the same group can be used for multiple messages.
+
+I<Example:> of adding a spam group to a header
+
+
+ my $sg = Mail::Message::Head::SpamGroup->new(...);
+ my $own_sg = $msg->head->addSpamGroup($sg);
+
+=back
+
+$obj-E<gt>B<count>(NAME)
+
+=over 4
+
+Count the number of fields with this NAME.  Most fields will return 1:
+only one occurance in the header.  As example, the C<Received> fields
+are usually present more than once.
+
+=back
+
+$obj-E<gt>B<delete>(NAME)
+
+=over 4
+
+Remove the field with the specified name.  If the header contained
+multiple lines with the same name, they will be replaced all together.
+This method simply calls L<reset()|Mail::Message::Head::Complete/"Access to the header"> without replacement fields.
+
+=back
+
+$obj-E<gt>B<get>(NAME [,INDEX])
+
+=over 4
+
+See L<Mail::Message::Head/"Access to the header">
+
+=back
+
+$obj-E<gt>B<grepNames>([NAMES|ARRAY-OF-NAMES|REGEXS])
+
+=over 4
+
+Filter from all header fields the names which start will any of the
+specified list.  When no names are specified, all names will be returned.
+The list is ordered as they where read from file, or added later.
+
+The NAMES are regular expressions, and will all be matched case insensitive
+and attached to the front of the string only.  You may also specify
+one or more prepared regexes.
+
+I<Example:> 
+
+ print $head->grepNames();         # same as $head->names
+ print $head->grepNames('X-', 'Subject', ');
+ print $head->grepNames('To\b');   # will only select To
+
+=back
+
+$obj-E<gt>B<listGroup>
+
+=over 4
+
+Returns a I<list group> description: the set of headers which form
+the information about mailing list software used to transport the
+message.  See also L<addListGroup()|Mail::Message::Head::Complete/"Access to the header"> and L<removeListGroup()|Mail::Message::Head::Complete/"Access to the header">.
+
+I<Example:> use of listGroup()
+
+
+ if(my $lg = $msg->head->listGroup)
+ {  $lg->print(\*STDERR);
+    $lg->delete;
+ }
+
+ $msg->head->removeListGroup;
+
+=back
+
+$obj-E<gt>B<names>
+
+=over 4
+
+Returns a full ordered list of known field names, as defined in the
+header.  Fields which were reset() to be empty will still be
+listed here.
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+Print all headers to the specified FILEHANDLE, by default the selected
+filehandle.  See L<printUndisclosed()|Mail::Message::Head::Complete/"Access to the header"> to limit the headers to include
+only the public headers.
+
+I<Example:> 
+
+ $head->print(\*OUT);
+ $head->print;
+
+ my $fh = IO::File->new(...);
+ $head->print($fh);
+
+=back
+
+$obj-E<gt>B<printUndisclosed>([FILEHANDLE])
+
+=over 4
+
+Like the usual L<print()|Mail::Message::Head::Complete/"Access to the header">, the header lines are printed to the specified
+FILEHANDLE, by default the selected filehandle.  In this case, however,
+C<Bcc> and C<Resent-Bcc> lines are included.
+
+=back
+
+$obj-E<gt>B<removeContentInfo>
+
+=over 4
+
+Remove all body related fields from the header.  The header will become
+partial.
+
+=back
+
+$obj-E<gt>B<removeField>(FIELD)
+
+=over 4
+
+Remove the specified FIELD object from the header.  This is useful when
+there are possible more than one fields with the same name, and you
+need to remove exactly one of them.  Also have a look at L<delete()|Mail::Message::Head::Complete/"Access to the header">,
+L<reset()|Mail::Message::Head::Complete/"Access to the header">, and L<set()|Mail::Message::Head::Complete/"Access to the header">.
+
+See also L<Mail::Message::Head::Partial::removeFields()|Mail::Message::Head::Partial/"Access to the header"> (mind the 's'
+at the end of the name), which accepts a string or regular expression
+as argument to select the fields to be removed.
+
+=back
+
+$obj-E<gt>B<removeFields>(STRING|REGEXP, [STRING|REGEXP, ...])
+
+=over 4
+
+The header object is turned into a L<Mail::Message::Head::Partial|Mail::Message::Head::Partial> object
+which has a set of fields removed.  Read about the implications and the
+possibilities in L<Mail::Message::Head::Partial::removeFields()|Mail::Message::Head::Partial/"Access to the header">.
+
+=back
+
+$obj-E<gt>B<removeFieldsExcept>(STRING|REGEXP, [STRING|REGEXP, ...])
+
+=over 4
+
+The header object is turned into a L<Mail::Message::Head::Partial|Mail::Message::Head::Partial> object
+which has a set of fields removed.  Read about the implications and the
+possibilities in L<Mail::Message::Head::Partial::removeFieldsExcept()|Mail::Message::Head::Partial/"Access to the header">.
+
+=back
+
+$obj-E<gt>B<removeListGroup>
+
+=over 4
+
+Removes all fields related to mailing list administration at once.
+The header object is turned into a L<Mail::Message::Head::Partial|Mail::Message::Head::Partial>
+object.  Read about the implications and the possibilities in
+L<Mail::Message::Head::Partial::removeListGroup()|Mail::Message::Head::Partial/"Access to the header">.
+
+=back
+
+$obj-E<gt>B<removeResentGroups>
+
+=over 4
+
+Removes all resent groups at once.  The header object is turned into
+a L<Mail::Message::Head::Partial|Mail::Message::Head::Partial> object.  Read about the implications and the
+possibilities in L<Mail::Message::Head::Partial::removeResentGroups()|Mail::Message::Head::Partial/"Access to the header">.
+
+=back
+
+$obj-E<gt>B<removeSpamGroups>
+
+=over 4
+
+Removes all fields which were added by various spam detection software
+at once.  The header object is turned into a L<Mail::Message::Head::Partial|Mail::Message::Head::Partial>
+object.  Read about the implications and the possibilities in
+L<Mail::Message::Head::Partial::removeSpamGroups()|Mail::Message::Head::Partial/"Access to the header">.
+
+=back
+
+$obj-E<gt>B<resentGroups>
+
+=over 4
+
+Returns a list of L<Mail::Message::Head::ResentGroup|Mail::Message::Head::ResentGroup> objects which
+each represent one intermediate point in the message's transmission in
+the order as they appear in the header: the most recent one first.
+See also L<addResentGroup()|Mail::Message::Head::Complete/"Access to the header"> and L<removeResentGroups()|Mail::Message::Head::Complete/"Access to the header">.
+
+A resent group contains a set of header fields whose names start
+with C<Resent->.  Before the first C<Resent> line is I<trace> information,
+which is composed of an optional C<Return-Path> field and an required
+C<Received> field.
+
+=back
+
+$obj-E<gt>B<reset>(NAME, FIELDS)
+
+=over 4
+
+Replace the values in the header fields named by NAME with the values
+specified in the list of FIELDS. A single name can correspond to multiple
+repeated fields.
+
+Removing fields which are part of one of the predefined field groups is
+not a smart idea.  You can better remove these fields as group, all
+together.  For instance, the C<'Received'> lines are part of resent
+groups, C<'X-Spam'> is past of a spam group, and C<List-Post> belongs
+to a list group.  You can delete a whole group with
+L<Mail::Message::Head::FieldGroup::delete()|Mail::Message::Head::FieldGroup/"The header">, or with methods which
+are provided by L<Mail::Message::Head::Partial|Mail::Message::Head::Partial>.
+
+If FIELDS is empty, the corresponding NAME fields will
+be removed. The location of removed fields in the header order will be
+remembered. Fields with the same name which are added later will appear at
+the remembered position.  This is equivalent to the L<delete()|Mail::Message::Head::Complete/"Access to the header"> method.
+
+I<Example:> 
+
+ # reduce number of 'Keywords' lines to last 5)
+ my @keywords = $head->get('Keywords');
+ $head->reset('Keywords', @keywords[-5..-1]) if @keywords > 5;
+
+ # Reduce the number of Received lines to only the last added one.
+ my @rgs = $head->resentGroups;
+ shift @rgs;     # keep this one (later is added in front)
+ $_->delete foreach @rgs;
+
+=back
+
+$obj-E<gt>B<set>(FIELD | LINE | (NAME, BODY [,ATTRS]))
+
+=over 4
+
+The C<set> method is similar to the L<add()|Mail::Message::Head::Complete/"Access to the header"> method, and takes the same
+options. However, existing values for fields will be removed before a new
+value is added.
+
+=back
+
+$obj-E<gt>B<spamDetected>
+
+=over 4
+
+Returns whether one of the spam groups defines a report about spam.  If there
+are not header fields in the message which relate to spam-detection
+software, C<undef> is returned.  The spamgroups which report spam are returned.
+
+I<Example:> 
+
+ $message->delete if $message->spamDetected;
+
+ call_spamassassin($message)
+    unless defined $message->spamDetected;
+
+=back
+
+$obj-E<gt>B<spamGroups>([NAMES])
+
+=over 4
+
+Returns a list of L<Mail::Message::Head::SpamGroup|Mail::Message::Head::SpamGroup> objects, each collecting
+some lines which contain spam fighting information.  When any NAMES are
+given, then only these groups are returned.
+See also L<addSpamGroup()|Mail::Message::Head::Complete/"Access to the header"> and L<removeSpamGroups()|Mail::Message::Head::Complete/"Access to the header">.
+
+In scalar context, with exactly one NAME specified, that group will be
+returned.  With more NAMES or without NAMES, a list will be returned
+(which defaults to the length of the list in scalar context).
+
+I<Example:> use of listGroup()
+
+
+ my @sg = $msg->head->spamGroups;
+ $sg[0]->print(\*STDERR);
+ $sg[-1]->delete;
+
+ my $sg = $msg->head->spamGroups('SpamAssassin');
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+Returns the whole header as one scalar (in scalar context) or list
+of lines (list context).  Triggers completion.
+
+=back
+
+$obj-E<gt>B<study>(NAME [,INDEX])
+
+=over 4
+
+See L<Mail::Message::Head/"Access to the header">
+
+=back
+
+=head2 About the body
+
+
+$obj-E<gt>B<guessBodySize>
+
+=over 4
+
+See L<Mail::Message::Head/"About the body">
+
+=back
+
+$obj-E<gt>B<guessTimeStamp>
+
+=over 4
+
+Make a guess about when the message was origanally posted, based on the
+information found in the header's C<Date> field.
+
+For some kinds of folders, L<Mail::Message::guessTimestamp()|Mail::Message/"The header"> may produce
+a better result, for instance by looking at the modification time of the
+file in which the message is stored.  Also some protocols, like POP can
+supply that information.
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+See L<Mail::Message::Head/"About the body">
+
+=back
+
+$obj-E<gt>B<recvstamp>
+
+=over 4
+
+Returns an indication about when the message was sent, but only using the
+C<Date> field in the header as last resort: we do not trust the sender of
+the message to specify the correct date.  See L<timestamp()|Mail::Message::Head::Complete/"About the body"> when you do
+trust the sender.
+
+Many spam producers fake a date, which mess up the order of receiving
+things.  The timestamp which is produced is derived from the Received
+headers, if they are present, and C<undef> otherwise.
+
+The timestamp is encoded as C<time> is on your system (see perldoc -f
+time), and as such usable for the C<gmtime> and C<localtime> methods.
+
+I<Example:> of time-sorting folders with received messages
+
+
+ my $folder = $mgr->open('InBox');
+ my @messages = sort {$a->recvstamp <=> $b->recvstamp}
+                   $folder->messages;
+
+I<Example:> of time-sorting messages of mixed origin
+
+
+ my $folder = $mgr->open('MyFolder');
+
+ # Pre-calculate timestamps to be sorted (for speed)
+ my @stamps = map { [ ($_->timestamp || 0), $_ ] }
+                     $folder->messages;
+
+ my @sorted
+   = map { $_->[1] }      # get the message for the stamp
+       sort {$a->[0] <=> $b->[0]}   # stamps are numerics
+          @stamps;
+
+=back
+
+$obj-E<gt>B<timestamp>
+
+=over 4
+
+Returns an indication about when the message was sent, with as
+little guessing as possible.  In this case, the date as specified by the
+sender is trusted.  See L<recvstamp()|Mail::Message::Head::Complete/"About the body"> when you do not want to trust the
+sender.
+
+The timestamp is encoded as C<time> is
+on your system (see perldoc -f time), and as such usable for the C<gmtime>
+and C<localtime> methods.
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<addNoRealize>(FIELD)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<addOrderedFields>(FIELDS)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<createFromLine>
+
+=over 4
+
+For some mail-folder types separate messages by a line starting with
+'C<From >'.  If a message is moved to such folder from a folder-type
+which does not support these separators, this method is called to produce
+one.
+
+=back
+
+$obj-E<gt>B<createMessageId>
+
+=over 4
+
+Creates a message-id for this message.  This method will be run when
+a new message is created, or a message is discovered without the
+message-id header field.  Message-ids are required for detection of
+message-threads.  See L<messageIdPrefix()|Mail::Message::Head::Complete/"Internals">.
+
+=back
+
+$obj-E<gt>B<fileLocation>
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<load>
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<messageIdPrefix>([STRING])
+
+=over 4
+
+Sets/returns the message-id start.  The rest of the message-id is an
+integer which is derived from the current time and the local host.
+See L<createMessageId()|Mail::Message::Head::Complete/"Internals">.
+
+=back
+
+$obj-E<gt>B<moveLocation>(DISTANCE)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<read>(PARSER)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<setNoRealize>(FIELD)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Head::Complete-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Head::Complete-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Head::Complete-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> Cannot remove field $name from header: not found.
+
+You ask to remove a field which is not known in the header.  Using
+L<delete()|Mail::Message::Head::Complete/"Access to the header">, L<reset()|Mail::Message::Head::Complete/"Access to the header">, or L<set()|Mail::Message::Head::Complete/"Access to the header"> to do the job will not result
+in warnings: those methods check the existence of the field first.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Delayed.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Delayed.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Delayed.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,91 @@
+
+use strict;
+
+package Mail::Message::Head::Delayed;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Head';
+
+use Object::Realize::Later
+    becomes          => 'Mail::Message::Head::Complete',
+    realize          => 'load',
+    believe_caller   => 1;
+
+use Scalar::Util 'weaken';
+
+
+sub build(@) {shift->log(ERROR => "Cannot build() a delayed header.") }
+
+#------------------------------------------
+
+sub init($$)
+{   my ($self, $args) = @_;
+    $self->SUPER::init($args);
+
+    if(defined $args->{message})
+    {   $self->{MMHD_message} = $args->{message};
+        weaken($self->{MMHD_message});
+    }
+
+    $self;
+}
+
+#------------------------------------------
+
+sub isDelayed() {1}
+
+#------------------------------------------
+
+sub modified(;$)
+{   return 0 if @_==1 || !$_[1];
+    shift->forceRealize->modified(1);
+}
+
+#------------------------------------------
+
+sub isModified() { 0 }
+
+#------------------------------------------
+
+sub isEmpty() { 0 }
+
+#------------------------------------------
+
+
+sub get($;$)
+{   my $self = shift;
+    $self->load->get(@_);
+}
+
+#------------------------------------------
+
+
+sub guessBodySize() {undef}
+
+#-------------------------------------------
+
+
+sub guessTimestamp() {undef}
+
+#------------------------------------------
+
+
+sub read($)
+{   my ($self, $parser, $headtype, $bodytype)  = @_;
+
+#   $parser->skipHeader not implemented... returns where
+    $self->{MMH_where}   = 0;
+    $self;
+}
+
+#------------------------------------------
+
+sub load() {$_[0] = $_[0]->message->loadHead}
+
+#------------------------------------------
+
+sub setNoRealize($) { shift->log(INTERNAL => "Setting field on a delayed?") }
+
+#-------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Delayed.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Delayed.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Delayed.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,409 @@
+
+=head1 NAME
+
+Mail::Message::Head::Delayed - a not-read header of a Mail::Message
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Head::Delayed realizes a Mail::Message::Head::Complete
+
+ Mail::Message::Head::Delayed
+   is a Mail::Message::Head
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my Mail::Message::Head::Delayed $delayed = ...;
+ $delayed->isa('Mail::Message::Head')  # true
+ $delayed->guessBodySize               # undef
+ $delayed->isDelayed                   # true
+
+
+=head1 DESCRIPTION
+
+This object is used as place-holder, to be replaced
+by a L<Mail::Message::Head|Mail::Message::Head> when someone accesses the header of a message.
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Message::Head/"OVERLOADED">
+
+=back
+
+overload: B<bool>
+
+=over 4
+
+See L<Mail::Message::Head/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<build>(FIELDS)
+
+=over 4
+
+You cannot create a delayed header with fields.
+
+=back
+
+Mail::Message::Head::Delayed-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Head/"Constructors">
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<isEmpty>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<knownNames>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<message>([MESSAGE])
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<orderedFields>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+=head2 Access to the header
+
+
+$obj-E<gt>B<get>(NAME [,INDEX])
+
+=over 4
+
+Get the information about the header line NAME.  Realization will
+take place.
+
+=back
+
+$obj-E<gt>B<study>(NAME [,INDEX])
+
+=over 4
+
+See L<Mail::Message::Head/"Access to the header">
+
+=back
+
+=head2 About the body
+
+
+$obj-E<gt>B<guessBodySize>
+
+=over 4
+
+On a delayed head, this retuns C<undef>, because when there is no header
+there is also no body.
+
+For messages in directory or network organized folders,
+L<Mail::Message::size()|Mail::Message/"The Message"> usually will give a figure for the whole message
+without much cost.  Subtract a few hundred bytes for the header, and
+you will get a good estimate.
+
+=back
+
+$obj-E<gt>B<guessTimeStamp>
+
+=over 4
+
+Make a guess about when the message was originally posted.
+On a delayed head, this returns C<undef>.
+For messages in directory or network organized folders,
+L<Mail::Message::timestamp()|Mail::Message/"The header"> usually will give a figure without much cost.
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+See L<Mail::Message::Head/"About the body">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<addNoRealize>(FIELD)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<addOrderedFields>(FIELDS)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<fileLocation>
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<load>
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<moveLocation>(DISTANCE)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<read>(PARSER)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<setNoRealize>(FIELD)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Head::Delayed-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Head::Delayed-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Head::Delayed-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot build() a delayed header.
+
+A delayed message header cannot contain any information, so cannot be
+build.  You can construct complete or subset headers.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/FieldGroup.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/FieldGroup.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/FieldGroup.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,178 @@
+
+package Mail::Message::Head::FieldGroup;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Reporter';
+
+use strict;
+use warnings;
+
+
+sub new(@)
+{   my $class = shift;
+
+    my @fields;
+    push @fields, shift while ref $_[0];
+
+    $class->SUPER::new(@_, fields => \@fields);
+}
+
+sub init($$)
+{   my ($self, $args) = @_;
+    $self->SUPER::init($args);
+
+    my $head = $self->{MMHF_head}
+      = $args->{head} || Mail::Message::Head::Partial->new;
+
+    $self->add($_)                            # add specified object fields
+        foreach @{$args->{fields}};
+
+    $self->add($_, delete $args->{$_})        # add key-value paired fields
+        foreach grep m/^[A-Z]/, keys %$args;
+
+    $self->{MMHF_version}  = $args->{version}  if defined $args->{version};
+    $self->{MMHF_software} = $args->{software} if defined $args->{software};
+    $self->{MMHF_type}     = $args->{type}     if defined $args->{type};
+
+    $self->{MMHF_fns}      = [];
+    $self;
+}
+
+#------------------------------------------
+
+
+sub implementedTypes() { shift->notImplemented }
+
+#------------------------------------------
+
+
+sub from($) { shift->notImplemented }
+
+#------------------------------------------
+
+
+sub clone()
+{   my $self = shift;
+    my $clone = bless %$self, ref $self;
+    $clone->{MMHF_fns} = [ $self->fieldNames ];
+    $clone;
+}
+
+#------------------------------------------
+
+
+sub head() { shift->{MMHF_head} }
+
+#------------------------------------------
+
+
+sub attach($)
+{   my ($self, $head) = @_;
+    $head->add($_->clone) for $self->fields;
+    $self;
+}
+
+#------------------------------------------
+
+
+sub delete()
+{   my $self   = shift;
+    my $head   = $self->head;
+    $head->removeField($_) foreach $self->fields;
+    $self;
+}
+
+#------------------------------------------
+
+
+sub add(@)
+{   my $self = shift;
+    my $field = $self->head->add(@_) or return ();
+    push @{$self->{MMHF_fns}}, $field->name;
+    $self;
+}
+
+#------------------------------------------
+
+
+sub fields()
+{   my $self = shift;
+    my $head = $self->head;
+    map { $head->get($_) } $self->fieldNames;
+}
+
+#------------------------------------------
+
+
+sub fieldNames() { @{shift->{MMHF_fns}} }
+
+#------------------------------------------
+
+
+sub addFields(@)
+{   my $self = shift;
+    my $head = $self->head;
+
+    push @{$self->{MMHF_fns}}, @_;
+    @_;
+}
+
+#------------------------------------------
+
+
+sub version() { shift->{MMHF_version} }
+
+#------------------------------------------
+
+
+sub software() { shift->{MMHF_software} }
+
+#------------------------------------------
+
+
+sub type() { shift->{MMHF_type} }
+
+#------------------------------------------
+
+
+sub detected($$$)
+{   my $self = shift;
+    @$self{ qw/MMHF_type MMHF_software MMHF_version/ } = @_;
+}
+
+#------------------------------------------
+
+
+sub collectFields(;$) { shift->notImplemented }
+
+#------------------------------------------
+
+
+sub print(;$)
+{   my $self = shift;
+    my $out  = shift || select;
+    $_->print($out) foreach $self->fields;
+}
+
+#------------------------------------------
+
+
+sub details()
+{   my $self     = shift;
+    my $type     = $self->type || 'Unknown';
+
+    my $software = $self->software;
+    undef $software if defined($software) && $type eq $software;
+    my $version  = $self->version;
+    my $release
+      = defined $software
+      ? (defined $version ? " ($software $version)" : " ($software)")
+      : (defined $version ? " ($version)"           : '');
+
+    my $fields   = scalar $self->fields;
+    "$type $release, $fields fields";
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/FieldGroup.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/FieldGroup.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/FieldGroup.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,462 @@
+
+=head1 NAME
+
+Mail::Message::Head::FieldGroup - a sub set of fields in a header
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Head::FieldGroup
+   is a Mail::Reporter
+
+ Mail::Message::Head::FieldGroup is extended by
+   Mail::Message::Head::ListGroup
+   Mail::Message::Head::ResentGroup
+   Mail::Message::Head::SpamGroup
+
+
+=head1 SYNOPSIS
+
+Never instantiated directly.
+
+
+=head1 DESCRIPTION
+
+Some fields have a combined meaning: a set of fields which represent
+one intermediate step during the transport of the message (a
+I<resent group>, implemented in L<Mail::Message::Head::ResentGroup|Mail::Message::Head::ResentGroup>), 
+fields added by mailing list software (implemented in
+L<Mail::Message::Head::ListGroup|Mail::Message::Head::ListGroup>), or fields added by Spam detection
+related software (implemented by L<Mail::Message::Head::SpamGroup|Mail::Message::Head::SpamGroup>).
+Each set of fields can be extracted or added as group with objects
+which are based on the implementation in this class.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+Make a copy of this object.  The collected fieldnames are copied and the
+list type information.  No deep copy is made for the header: this is
+only copied as reference.
+
+=back
+
+$obj-E<gt>B<from>(HEAD|MESSAGE)
+
+=over 4
+
+Create a group of fields based on the specified MESSAGE or message HEAD.
+This may return one or more of the objects, which depends on the
+type of group.  Mailing list fields are all stored in one object,
+where resent and spam groups can appear more than once.
+
+=back
+
+$obj-E<gt>B<implementedTypes>
+
+Mail::Message::Head::FieldGroup-E<gt>B<implementedTypes>
+
+=over 4
+
+Returns a list of strings containing all possible return values for
+L<type()|Mail::Message::Head::FieldGroup/"Access to the header">.
+
+=back
+
+Mail::Message::Head::FieldGroup-E<gt>B<new>(FIELDS, OPTIONS)
+
+=over 4
+
+Construct an object which maintains one set of header FIELDS.  The
+FIELDS may be specified as C<Mail::Message::Field> objects or as key-value
+pairs.  The OPTIONS and FIELDS (as key-value pair) can be mixed: they are
+distinguished by their name, where the fields always start with a capital.
+The field objects must aways lead the OPTIONS.
+
+ Option    Defined in       Default      
+ head                       C<undef>     
+ log       L<Mail::Reporter>  C<'WARNINGS'>
+ software                   C<undef>     
+ trace     L<Mail::Reporter>  C<'WARNINGS'>
+ type                       C<undef>     
+ version                    C<undef>     
+
+. head HEAD
+
+=over 4
+
+The header HEAD object is used to store the grouped fields in.
+If no header is specified, a L<Mail::Message::Head::Partial|Mail::Message::Head::Partial> is created
+for you.  If you wish to scan the existing fields in a header, then use
+the L<from()|Mail::Message::Head::FieldGroup/"Constructors"> method.
+
+=back
+
+. log LEVEL
+
+. software STRING
+
+=over 4
+
+Name of the software which produced the fields.
+
+=back
+
+. trace LEVEL
+
+. type STRING
+
+=over 4
+
+Group name for the fields.  Often the same, or close
+to the same STRING, as the C<software> option contains.
+
+=back
+
+. version STRING
+
+=over 4
+
+Version number for the software which produced the fields.
+
+=back
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<add>((FIELD, VALUE) | OBJECT)
+
+=over 4
+
+Add a field to the header, using the field group.  When the field group
+is already attached to a real message header, it will appear in that
+one as well as being registed in this set.  If no header is defined,
+the field only appears internally.
+
+I<Example:> adding a field to a detached list group
+
+
+ my $this = Mail::Message::Head::ListGroup->new(...);
+ $this->add('List-Id' => 'mailbox');
+ $msg->addListGroup($this);
+ $msg->send;
+
+I<Example:> adding a field to an attached list group
+
+
+ my $lg = Mail::Message::Head::ListGroup->from($msg);
+ $lg->add('List-Id' => 'mailbox');
+
+=back
+
+$obj-E<gt>B<addFields>([FIELDNAMES])
+
+=over 4
+
+Add some FIELDNAMES to the set.
+
+=back
+
+$obj-E<gt>B<attach>(HEAD)
+
+=over 4
+
+Add a group of fields to a message HEAD.  The fields will be cloned(!)
+into the header, so that the field group object can be used again.
+
+I<Example:> attaching a list group to a message
+
+
+ my $lg = Mail::Message::Head::ListGroup->new(...);
+ $lg->attach($msg->head);
+ $msg->head->addListGroup($lg);   # same
+
+ $msg->head->addSpamGroup($sg);   # also implemented with attach
+
+=back
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+Remove all the header lines which are combined in this fields group,
+from the header.
+
+=back
+
+$obj-E<gt>B<fieldNames>
+
+=over 4
+
+Return the names of the fields which are used in this group.
+
+=back
+
+$obj-E<gt>B<fields>
+
+=over 4
+
+Return the fields which are defined for this group.
+
+=back
+
+$obj-E<gt>B<head>
+
+=over 4
+
+Returns the header object, which includes these fields.
+
+=back
+
+=head2 Access to the header
+
+
+$obj-E<gt>B<software>
+
+=over 4
+
+Returns the name of the software as is defined in the headers.  The may
+be slightly different from the return value of L<type()|Mail::Message::Head::FieldGroup/"Access to the header">, but usually
+not too different.
+
+=back
+
+$obj-E<gt>B<type>
+
+=over 4
+
+Returns an abstract name for the field group; which software is
+controling it.  C<undef> is returned in case the type is not known.
+Valid names are group type dependent: see the applicable manual
+pages.  A list of all types can be retreived with L<implementedTypes()|Mail::Message::Head::FieldGroup/"Constructors">.
+
+=back
+
+$obj-E<gt>B<version>
+
+=over 4
+
+Returns the version number of the software used to produce the fields.
+Some kinds of software do leave such a trace, other cases will return
+C<undef>
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<collectFields>([NAME])
+
+=over 4
+
+Scan the header for fields which are usually contained in field group
+with the specified NAME.  For mailinglist groups, you can not specify
+a NAME: only one set of headers will be found (all headers are considered
+to be produced by exactly one package of mailinglist software).
+
+This method is automatically called when a field group is
+constructed via L<from()|Mail::Message::Head::FieldGroup/"Constructors"> on an existing header or message.
+
+Returned are the names of the list header fields found, in scalar
+context the amount of fields.  An empty list/zero indicates that there
+was no group to be found.
+
+Please warn the author of MailBox if you see that to few
+or too many fields are included.
+
+=back
+
+$obj-E<gt>B<detected>(TYPE, SOFTWARE, VERSION)
+
+=over 4
+
+Sets the values for the field group type, software, and version,
+prossibly to C<undef>.
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Head::FieldGroup-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<details>
+
+=over 4
+
+Produce information about the detected/created field group, which may be
+helpful during debugging.  A nicely formatted string is returned.
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Head::FieldGroup-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Head::FieldGroup-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+Print the group to the specified FILEHANDLE or GLOB.  This is probably only
+useful for debugging purposed.  The output defaults to the selected file
+handle.
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/ListGroup.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/ListGroup.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/ListGroup.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,238 @@
+
+package Mail::Message::Head::ListGroup;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Head::FieldGroup';
+
+use strict;
+use warnings;
+
+use List::Util 'first';
+
+
+sub init($$)
+{   my ($self, $args) = @_;
+    $self->SUPER::init($args);
+
+    my $address = $args->{address};
+       if(!defined $address) { ; }
+    elsif(!ref $address || !$address->isa('Mail::Message::Field::Address'))
+    {   require Mail::Message::Field::Address;
+        my $mi   = Mail::Message::Field::Address->coerce($address);
+
+        $self->log(ERROR =>
+                "Cannot convert \"$address\" into an address object"), return
+            unless defined $mi;
+
+        $address = $mi;
+    }
+    $self->{MMHL_address}  = $address          if defined $args->{address};
+
+    $self->{MMHL_listname} = $args->{listname} if defined $args->{listname};
+    $self->{MMHL_rfc}      = $args->{rfc}      if defined $args->{rfc};
+    $self->{MMHL_fns}      = [];
+    $self;
+}
+
+#------------------------------------------
+
+
+sub from($)
+{   my ($class, $from) = @_;
+    my $head = $from->isa('Mail::Message::Head') ? $from : $from->head;
+    my $self = $class->new(head => $head);
+
+    return () unless $self->collectFields;
+
+    my ($type, $software, $version, $field);
+    if(my $communigate = $head->get('X-ListServer'))
+    {   ($software, $version) = $communigate =~ m/^(.*)\s+LIST\s*([\d.]+)\s*$/i;
+        $type    = ($software =~ m/Pro/ ? 'CommuniGatePro' : 'CommuniGate');
+    }
+    elsif(my $mailman = $head->get('X-Mailman-Version'))
+    {   $version = "$mailman";
+        $type    = 'Mailman';
+    }
+    elsif(my $majordomo = $head->get('X-Majordomo-Version'))
+    {   $version = "$majordomo";
+        $type    = 'Majordomo';
+    }
+    elsif(my $ecartis = $head->get('X-Ecartis-Version'))
+    {   ($software, $version) = $ecartis =~ m/^(.*)\s+(v[\d.]+)/;
+        $type    = 'Ecartis';
+    }
+    elsif(my $listar = $head->get('X-Listar-Version'))
+    {   ($software, $version) = $listar =~ m/^(.*?)\s+(v[\w.]+)/;
+        $type    = 'Listar';
+    }
+    elsif(defined($field = $head->get('List-Software'))
+          && $field =~ m/listbox/i)
+    {   ($software, $version) = $field =~ m/^(\S*)\s*(v[\d.]+)\s*$/;
+        $type    = 'Listbox';
+    }
+    elsif($field = first { m!LISTSERV-TCP/IP!s } $head->get('Received'))
+    {   # Listserv is hard to recognise
+        ($software, $version) = $field =~
+            m!\( (LISTSERV-TCP/IP) \s+ release \s+ (\S+) \)!xs;
+        $type = 'Listserv';
+    }
+    elsif(defined($field = $head->get('X-Mailing-List'))
+          && $field =~ m[archive/latest])
+    {   $type    = 'Smartlist' }
+    elsif(defined($field = $head->get('Mailing-List')) && $field =~ m/yahoo/i )
+    {   $type    = 'YahooGroups' }
+    elsif(defined($field) && $field =~ m/(ezmlm)/i )
+    {   $type    = 'Ezmlm' }
+    elsif(my $fml = $head->get('X-MLServer'))
+    {   ($software, $version) = $fml =~ m/^\s*(\S+)\s*\[\S*\s*([^\]]*?)\s*\]/;
+        $type    = 'FML';
+    }
+    elsif(defined($field = $head->get('List-Subscribe')
+                        || $head->get('List-Unsubscribe'))
+          && $field =~ m/sympa/i)
+    {   $type    = 'Sympa' }
+    elsif(first { m/majordom/i } $head->get('Received'))
+    {   # Majordomo is hard to recognize
+        $type    = "Majordomo";
+    }
+    elsif($field = $head->get('List-ID') && $field =~ m/listbox\.com/i)
+    {   $type    = "Listbox" }
+
+    $self->detected($type, $software, $version);
+    $self;
+}
+
+#------------------------------------------
+
+
+sub rfc()
+{  my $self = shift;
+   return $self->{MMHL_rfc} if defined $self->{MMHL_rfc};
+
+   my $head = $self->head;
+     defined $head->get('List-Post') ? 'rfc2369'
+   : defined $head->get('List-Id')   ? 'rfc2919'
+   :                                    undef;
+}
+
+#------------------------------------------
+
+
+sub address()
+{   my $self = shift;
+    return $self->{MMHL_address} if exists $self->{MMHL_address};
+
+    my $type = $self->type || 'Unknown';
+    my $head = $self->head;
+
+    my ($field, $address);
+    if($type eq 'Smartlist' && defined($field = $head->get('X-Mailing-List')))
+    {   $address = $1 if $field =~ m/\<([^>]+)\>/ }
+    elsif($type eq 'YahooGroups')
+    {   $address = $head->get('X-Apparently-To')->unfoldedBody }
+    elsif($type eq 'Listserv')
+    {   $address = $head->get('Sender') }
+
+    $address ||= $head->get('List-Post') || $head->get('Reply-To')
+             || $head->get('Sender');
+    $address = $address->study if ref $address;
+
+       if(!defined $address) { ; }
+    elsif(!ref $address)
+    {   $address =~ s/\bowner-|-(?:owner|bounce|admin)\@//i;
+        $address = Mail::Message::Field::Address->new(address => $address);
+    }
+    elsif($address->isa('Mail::Message::Field::Addresses'))
+    {   # beautify
+        $address     = ($address->addresses)[0];
+        my $username = defined $address ? $address->username : '';
+        if($username =~ s/^owner-|-(owner|bounce|admin)$//i)
+        {   $address = Mail::Message::Field::Address->new
+               (username => $username, domain => $address->domain);
+        }
+    }
+    elsif($address->isa('Mail::Message::Field::URIs'))
+    {   my $uri  = first { $_->scheme eq 'mailto' } $address->URIs;
+        $address = defined $uri
+                 ? Mail::Message::Field::Address->new(address => $uri->to)
+                 : undef;
+    }
+    else  # Don't understand life anymore :-(
+    {   undef $address;
+    }
+
+    $self->{MMHL_address} = $address;
+}
+
+#------------------------------------------
+
+
+sub listname()
+{   my $self = shift;
+    return $self->{MMHL_listname} if exists $self->{MMHL_listname};
+
+    my $head = $self->head;
+
+    # Some lists have a field with the name only
+    my $list = $head->get('List-ID') || $head->get('X-List')
+            || $head->get('X-ML-Name');
+
+    my $listname;
+    if(defined $list)
+    {   $listname = $list->study->decodedBody;
+    }
+    elsif(my $address = $self->address)
+    {   $listname = $address->phrase || $address->address;
+    }
+
+    $self->{MMHL_listname} = $listname;
+}
+
+#------------------------------------------
+
+
+my $list_field_names
+  = qr/ ^ (?: List|X-Envelope|X-Original ) - 
+      | ^ (?: Precedence|Mailing-List|Approved-By ) $
+      | ^ X-(?: Loop|BeenThere|Sequence|List|Sender|MLServer ) $
+      | ^ X-(?: Mailman|Listar|Egroups|Encartis|ML ) -
+      | ^ X-(?: Archive|Mailing|Original|Mail|ListServer ) -
+      | ^ (?: Mail-Followup|Delivered|Errors|X-Apperently ) -To $
+      /xi;
+
+sub isListGroupFieldName($) { $_[1] =~ $list_field_names }
+
+#------------------------------------------
+
+
+sub collectFields()
+{   my $self = shift;
+    my @names = map { $_->name } $self->head->grepNames($list_field_names);
+    $self->addFields(@names);
+    @names;
+}
+
+#------------------------------------------
+
+
+sub details()
+{   my $self     = shift;
+    my $type     = $self->type || 'Unknown';
+
+    my $software = $self->software;
+    undef $software if defined($software) && $type eq $software;
+    my $version  = $self->version;
+    my $release
+      = defined $software
+      ? (defined $version ? " ($software $version)" : " ($software)")
+      : (defined $version ? " ($version)"           : '');
+
+    my $address  = $self->address || 'unknown address';
+    my $fields   = scalar $self->fields;
+    "$type at $address$release, $fields fields";
+}
+
+#------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/ListGroup.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/ListGroup.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/ListGroup.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,533 @@
+
+=head1 NAME
+
+Mail::Message::Head::ListGroup - mailinglist related header fields
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Head::ListGroup
+   is a Mail::Message::Head::FieldGroup
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my $lg = Mail::Message::Head::ListGroup->new(head => $head, ...);
+ $head->addListGroup($lg);
+
+ my $lg = $head->addListGroup(...);
+
+ $lg->delete;
+
+
+=head1 DESCRIPTION
+
+A I<list group> is a set of header fields which are added by mailing-list
+managing software.  This class knowns various details about that software.
+
+The knowledge and test messages which are used to initially implement
+this module is taken from Mail::ListDetector, written by
+Michael Stevens <mailto:michael at etla.org>.  The logic is redesigned to
+add flexibility and use the powerful MailBox features.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<address>
+
+=over 4
+
+Returns a L<Mail::Message::Field::Address|Mail::Message::Field::Address> object (or C<undef>) which
+defines the posting address of the mailing list.
+
+=back
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"Constructors">
+
+=back
+
+$obj-E<gt>B<from>(HEAD|MESSAGE)
+
+=over 4
+
+Create a C<Mail::Message::Head::ListGroup> based in the specified MESSAGE
+or message HEAD.
+
+=back
+
+$obj-E<gt>B<implementedTypes>
+
+Mail::Message::Head::ListGroup-E<gt>B<implementedTypes>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"Constructors">
+
+=back
+
+$obj-E<gt>B<listname>
+
+=over 4
+
+Returns the name of the mailing list, which is usually a part of the
+e-mail address which is used to post the messages to.
+
+=back
+
+Mail::Message::Head::ListGroup-E<gt>B<new>(FIELDS, OPTIONS)
+
+=over 4
+
+Construct an object which maintains one set of mailing list headers
+
+ Option    Defined in       Default               
+ address                    C<undef>              
+ head      L<Mail::Message::Head::FieldGroup>  C<undef>              
+ listname                   <derived from address>
+ log       L<Mail::Reporter>  C<'WARNINGS'>         
+ rfc                        C<undef>              
+ software  L<Mail::Message::Head::FieldGroup>  C<undef>              
+ trace     L<Mail::Reporter>  C<'WARNINGS'>         
+ type      L<Mail::Message::Head::FieldGroup>  C<undef>              
+ version   L<Mail::Message::Head::FieldGroup>  C<undef>              
+
+. address STRING|OBJECT
+
+=over 4
+
+Address of the mailing list, which may be specified as STRING
+or e-mail containing object (a Mail::Address or L<Mail::Identity|Mail::Identity>.
+In any case, the data is converted into a L<Mail::Identity|Mail::Identity>.
+
+=back
+
+. head HEAD
+
+. listname STRING
+
+=over 4
+
+A short textual representation of the mailing-list.
+
+=back
+
+. log LEVEL
+
+. rfc 'rfc2919'|'rfc2369'
+
+=over 4
+
+Defines the mailing list software follows an rfc.
+
+=back
+
+. software STRING
+
+. trace LEVEL
+
+. type STRING
+
+. version STRING
+
+=back
+
+$obj-E<gt>B<rfc>
+
+=over 4
+
+When the mailing list software follows the guidelines of one of the dedicated
+RFCs, then this will be returned otherwise C<undef>.  The return values can
+be C<rfc2919>, C<rfc2369>, or C<undef>.
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<add>((FIELD, VALUE) | OBJECT)
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"The header">
+
+=back
+
+$obj-E<gt>B<addFields>([FIELDNAMES])
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"The header">
+
+=back
+
+$obj-E<gt>B<attach>(HEAD)
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"The header">
+
+=back
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"The header">
+
+=back
+
+$obj-E<gt>B<fieldNames>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"The header">
+
+=back
+
+$obj-E<gt>B<fields>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"The header">
+
+=back
+
+$obj-E<gt>B<head>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"The header">
+
+=back
+
+=head2 Access to the header
+
+
+$obj-E<gt>B<isListGroupFieldName>(NAME)
+
+Mail::Message::Head::ListGroup-E<gt>B<isListGroupFieldName>(NAME)
+
+=over 4
+
+=back
+
+$obj-E<gt>B<software>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"Access to the header">
+
+=back
+
+$obj-E<gt>B<type>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"Access to the header">
+
+=back
+
+$obj-E<gt>B<version>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"Access to the header">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<collectFields>
+
+=over 4
+
+Scan the header for fields which are usually contained in mailing list
+software.  This method is automatically called when a list group is
+constructed L<from()|Mail::Message::Head::ListGroup/"Constructors"> an existing header or message.
+
+Returned are the names of the list header fields found, in scalar
+context the amount.  An empty list/zero indicates that this is not
+a mailing list message.
+
+Please warn the author of MailBox if you see that to few
+or too many fields are included.
+
+=back
+
+$obj-E<gt>B<detected>(TYPE, SOFTWARE, VERSION)
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Head::ListGroup-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<details>
+
+=over 4
+
+Produce information about the detected/create list group, which may be
+helpful during debugging, by default to the selected file handle.
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Head::ListGroup-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Head::ListGroup-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot convert "$string" into an address object
+
+The L<new(address)|Mail::Message::Head::ListGroup/"Constructors"> is coerced into a L<Mail::Message::Field::Address|Mail::Message::Field::Address>,
+which fails.  Have a look at L<Mail::Message::Field::Address::coerce()|Mail::Message::Field::Address/"Constructors">
+to see what valid arguments are.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+=head1 DETAILS
+
+
+=head2 Mailing list fields
+
+
+=head3 Detected lists
+
+The L<Mail::Message::Head::ListGroup|Mail::Message::Head::ListGroup> class can detect many different
+mailing lists, some of which are very popular and some of which are
+rare.
+
+Numerous fields in a header are addded when the message is passed
+through a mailing list server.  Each list software has defined its own
+fields, sometimes woth conflicting definitions.  There are also two
+RFCs about mailing list: C<rfc2919> and C<rfc2369>.
+
+The following lists are currently detected.  Between parenthesis is
+the string returned by L<type()|Mail::Message::Head::FieldGroup/"Access to the header"> when that differs from the software
+name.
+
+=over 4
+
+=item * CommuniGate
+
+Legacy commercial MacOS implementation by Stalker Software Inc.
+L<http://www.stalker.com/mac/default.html>
+
+=item * CommuniGate Pro (CommuniGatePro)
+
+Commercial rfc2919 compliant implementation by Stalker Software Inc.
+L<http://www.stalker.com>
+
+=item * Ecartis
+
+Commercial mailing list manager, formerly known as Listar. Produced
+by NodeRunner Computing.  See L<http://www.ecartis.com>.
+
+=item * Ezmlm
+
+Open Source mailing list manager, available from L<http://www.ezmlm.org>.
+
+=item * FML
+
+Open Source mailing list manager, see L<http://www.fml.org>.
+
+=item * Listar
+
+Old name for Ecartis.
+
+=item * Listbox
+
+Mailing lists defined at L<http://listbox.com>.
+
+=item * Mailman
+
+GNU's mailing list manager, available from L<http://www.list.org>.
+
+=item * Majordomo
+
+Free (licenced) mailing list manager by Great Circle Associates,
+available from L<http://www.greatcircle.com/majordomo/>
+
+=item * Smartlist
+
+Related to procmail, as expressed by their shared main page at
+L<http://www.procmail.org/>.
+
+=item * Yahoo! Groups (YahooGroups)
+
+Mailing lists defined at L<http://groups.yahoo.com>.
+
+=item * Listserv
+
+Commercial mailing list manager, produced by L-Soft. See
+L<http://www.lsoft.com/>.
+
+=back
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Partial.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Partial.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Partial.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,124 @@
+
+use strict;
+
+package Mail::Message::Head::Partial;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Head::Complete';
+
+use Scalar::Util 'weaken';
+
+
+sub removeFields(@)
+{   my $self  = shift;
+    my $known = $self->{MMH_fields};
+
+    foreach my $match (@_)
+    {
+        if(ref $match)
+        {   $_ =~ $match && delete $known->{$_} foreach keys %$known;
+        }
+        else { delete $known->{lc $match} }
+    }
+
+    $self->cleanupOrderedFields;
+}
+
+#------------------------------------------
+
+
+sub removeFieldsExcept(@)
+{   my $self   = shift;
+    my $known  = $self->{MMH_fields};
+    my %remove = map { ($_ => 1) } keys %$known;
+
+    foreach my $match (@_)
+    {   if(ref $match)
+        {   $_ =~ $match && delete $remove{$_} foreach keys %remove;
+        }
+        else { delete $remove{lc $match} }
+    }
+
+    delete @$known{ keys %remove };
+
+    $self->cleanupOrderedFields;
+}
+
+#------------------------------------------
+
+
+sub removeResentGroups()
+{   my $self = shift;
+    require Mail::Message::Head::ResentGroup;
+
+    my $known = $self->{MMH_fields};
+    my $found = 0;
+    foreach my $name (keys %$known)
+    {   next unless Mail::Message::Head::ResentGroup
+                         ->isResentGroupFieldName($name);
+        delete $known->{$name};
+        $found++;
+    }
+
+    $self->cleanupOrderedFields;
+    $self->modified(1) if $found;
+    $found;
+}
+
+#------------------------------------------
+
+
+sub removeListGroup()
+{   my $self = shift;
+    require Mail::Message::Head::ListGroup;
+
+    my $known = $self->{MMH_fields};
+    my $found = 0;
+    foreach my $name (keys %$known)
+    {   next unless Mail::Message::Head::ListGroup->isListGroupFieldName($name);
+        delete $known->{$name};
+	$found++;
+    }
+
+    $self->cleanupOrderedFields if $found;
+    $self->modified(1) if $found;
+    $found;
+}
+
+#------------------------------------------
+
+
+sub removeSpamGroups()
+{   my $self = shift;
+    require Mail::Message::Head::SpamGroup;
+
+    my $known = $self->{MMH_fields};
+    my $found = 0;
+    foreach my $name (keys %$known)
+    {   next unless Mail::Message::Head::SpamGroup->isSpamGroupFieldName($name);
+        delete $known->{$name};
+	$found++;
+    }
+
+    $self->cleanupOrderedFields if $found;
+    $self->modified(1) if $found;
+    $found;
+}
+
+#------------------------------------------
+
+
+sub cleanupOrderedFields()
+{   my $self = shift;
+    my @take = grep { defined $_ } @{$self->{MMH_order}};
+    weaken($_) foreach @take;
+    $self->{MMH_order} = \@take;
+    $self;
+}
+
+#------------------------------------------
+
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Partial.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Partial.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Partial.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,742 @@
+
+=head1 NAME
+
+Mail::Message::Head::Partial - subset of header information of a message
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Head::Partial
+   is a Mail::Message::Head::Complete
+   is a Mail::Message::Head
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my $partial = $head->strip;
+ $partial->isa('Mail::Message::Head')  # true
+ $partial->isDelayed                      # false
+ $partial->isPartial                      # true
+
+ $partial->removeFields( qr/^X-/ );
+ $partial->removeFieldsExcept( qw/To From/ );
+ $partial->removeResentGroups;
+ $partial->removeListGroup;
+ $partial->removeSpamGroups;
+
+
+=head1 DESCRIPTION
+
+Header information consumes a considerable amount of memory.  Most of this
+information is only useful during a short period of time in your program,
+or sometimes it is not used at all.  You then can decide to remove most
+of the header information.  However, be warned that it will be lost
+permanently: the header (and therefore the messsage) gets mutulated!
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Message::Head/"OVERLOADED">
+
+=back
+
+overload: B<bool>
+
+=over 4
+
+See L<Mail::Message::Head/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<build>(FIELDS)
+
+=over 4
+
+See L<Mail::Message::Head/"Constructors">
+
+=back
+
+$obj-E<gt>B<clone>([FIELDS])
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Constructors">
+
+=back
+
+Mail::Message::Head::Partial-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Head/"Constructors">
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<isEmpty>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<knownNames>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<message>([MESSAGE])
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"The header">
+
+=back
+
+$obj-E<gt>B<orderedFields>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"The header">
+
+=back
+
+=head2 Access to the header
+
+
+$obj-E<gt>B<add>(FIELD | LINE | (NAME,BODY[,ATTRS]))
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<addListGroup>(OBJECT)
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<addResentGroup>(RESENT-GROUP|DATA)
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<addSpamGroup>(OBJECT)
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<cleanupOrderedFields>
+
+=over 4
+
+The header maintains a list of fields which are ordered in sequence of
+definition.  It is required to maintain the header order to keep the
+related fields of resent groups together.  The fields are also included
+in a hash, sorted on their name for fast access.
+
+The references to field objects in the hash are real, those in the ordered 
+list are weak.  So when field objects are removed from the hash, their
+references in the ordered list are automagically undef'd.
+
+When many fields are removed, for instance with L<removeFields()|Mail::Message::Head::Partial/"Access to the header"> or
+L<removeFieldsExcept()|Mail::Message::Head::Partial/"Access to the header">, then it is useful to remove the list of undefs
+from the ordered list as well.  In those cases, this method is called
+automatically, however you may have your own reasons to call this method.
+
+=back
+
+$obj-E<gt>B<count>(NAME)
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<delete>(NAME)
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<get>(NAME [,INDEX])
+
+=over 4
+
+See L<Mail::Message::Head/"Access to the header">
+
+=back
+
+$obj-E<gt>B<grepNames>([NAMES|ARRAY-OF-NAMES|REGEXS])
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<listGroup>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<names>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<printUndisclosed>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<removeContentInfo>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<removeField>(FIELD)
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<removeFields>(STRING|REGEXP, [STRING|REGEXP, ...])
+
+=over 4
+
+Remove the fields from the header which are exactly named 'STRING' (case
+insensitive) or match the REGular EXPresssion.  Do not forget to add the
+'i' modifier to the REGEXP, because fields are case insensitive.
+
+See also L<removeField()|Mail::Message::Head::Complete/"Access to the header"> which is used to remove one field object from
+the header.  The reverse specification can be made with
+C<removeFieldsExcept()>.
+
+I<Example:> 
+
+ $head->removeFields('bcc', 'received');
+ $head->removeFields( qr/^content-/i );
+
+=back
+
+$obj-E<gt>B<removeFieldsExcept>(STRING|REGEXP, [STRING|REGEXP, ...])
+
+=over 4
+
+Remove all fields from the header which are not equivalent to one of the
+specified STRINGs (case-insensitive) and which are not matching one of
+the REGular EXPressions.  Do not forget to add the 'i' modifier to the
+REGEXP, because fields are case insensitive.
+
+See also L<removeField()|Mail::Message::Head::Complete/"Access to the header"> which is used to remove one field object from
+the header.  The reverse specification can be made with C<removeFields()>.
+
+I<Example:> 
+
+ $head->removeFieldsExcept('subject', qr/^content-/i ); 
+ $head->removeFieldsExcept( qw/subject to from sender cc/ );
+
+=back
+
+$obj-E<gt>B<removeListGroup>
+
+=over 4
+
+Removes all header lines which are used to administer mailing lists.
+Which fields that are is explained in L<Mail::Message::Head::ListGroup|Mail::Message::Head::ListGroup>.
+Returned is the number of removed lines.
+
+=back
+
+$obj-E<gt>B<removeResentGroups>
+
+=over 4
+
+Removes all header lines which are member of a I<resent group>, which
+are explained in L<Mail::Message::Head::ResentGroup|Mail::Message::Head::ResentGroup>.  Returned is the
+number of removed lines.
+
+For removing single groups (for instance because you want to keep the
+last), use L<Mail::Message::Head::FieldGroup::delete()|Mail::Message::Head::FieldGroup/"The header">.
+
+=back
+
+$obj-E<gt>B<removeSpamGroups>
+
+=over 4
+
+Removes all header lines which were produced by spam detection and
+spam-fighting software.  Which fields that are is explained in
+L<Mail::Message::Head::SpamGroup|Mail::Message::Head::SpamGroup>.  Returned is the number of removed lines.
+
+=back
+
+$obj-E<gt>B<resentGroups>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<reset>(NAME, FIELDS)
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<set>(FIELD | LINE | (NAME, BODY [,ATTRS]))
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<spamDetected>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<spamGroups>([NAMES])
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<study>(NAME [,INDEX])
+
+=over 4
+
+See L<Mail::Message::Head/"Access to the header">
+
+=back
+
+=head2 About the body
+
+
+$obj-E<gt>B<guessBodySize>
+
+=over 4
+
+See L<Mail::Message::Head/"About the body">
+
+=back
+
+$obj-E<gt>B<guessTimeStamp>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"About the body">
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+See L<Mail::Message::Head/"About the body">
+
+=back
+
+$obj-E<gt>B<recvstamp>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"About the body">
+
+=back
+
+$obj-E<gt>B<timestamp>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"About the body">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<addNoRealize>(FIELD)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<addOrderedFields>(FIELDS)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<createFromLine>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Internals">
+
+=back
+
+$obj-E<gt>B<createMessageId>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Internals">
+
+=back
+
+$obj-E<gt>B<fileLocation>
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<load>
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<messageIdPrefix>([STRING])
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Internals">
+
+=back
+
+$obj-E<gt>B<moveLocation>(DISTANCE)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<read>(PARSER)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<setNoRealize>(FIELD)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Head::Partial-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Head::Partial-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Head::Partial-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> Cannot remove field $name from header: not found.
+
+You ask to remove a field which is not known in the header.  Using
+L<delete()|Mail::Message::Head::Complete/"Access to the header">, L<reset()|Mail::Message::Head::Complete/"Access to the header">, or L<set()|Mail::Message::Head::Complete/"Access to the header"> to do the job will not result
+in warnings: those methods check the existence of the field first.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+=head1 DETAILS
+
+
+=head2 Reducing the header size
+
+A message header is very large in memory and quite large on disk, and
+therefore a good candidate for size reduction.  One way to reduce the
+size is by simply eliminating superfluous header fields.  Each field
+requires at least 100 bytes of run-time memory, so this may help!
+
+Before you start playing around with L<removeFields()|Mail::Message::Head::Partial/"Access to the header"> and
+L<removeFieldsExcept()|Mail::Message::Head::Partial/"Access to the header">, you may take a look at two large groups
+of fields which can be removes as sets: the resent headers and the
+mailinglist headers.
+
+Resent headers describe the intermediate steps in the transmission
+process for the messages.  After successful delivery, they are rarely
+useful.
+
+When you are archiving a mailinglist, it is hardly ever useful to
+store a the list administration lines for each message as well.
+
+I<Example:> see examples/reduce.pl in distribution
+
+
+ foreach my $msg ($folder->messages)
+ {  $msg->head->removeResentGroups;
+    $msg->head->removeResentList;
+ }
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/ResentGroup.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/ResentGroup.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/ResentGroup.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,257 @@
+
+use strict;
+
+package Mail::Message::Head::ResentGroup;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Head::FieldGroup';
+
+use Scalar::Util 'weaken';
+use Mail::Message::Field::Fast;
+
+use Sys::Hostname 'hostname';
+use Mail::Address;
+
+
+# all lower cased!
+my @ordered_field_names =
+  ( 'return-path', 'delivered-to' , 'received', 'resent-date'
+  , 'resent-from', 'resent-sender', , 'resent-to', 'resent-cc'
+  , 'resent-bcc', 'resent-message-id'
+  );
+
+my %resent_field_names = map { ($_ => 1) } @ordered_field_names;
+
+sub init($$)
+{   my ($self, $args) = @_;
+
+    $self->SUPER::init($args);
+
+    $self->{MMHR_real}  = $args->{message_head};
+
+    $self->set(Received => $self->createReceived)
+        if $self->orderedFields && ! $self->received;
+
+    $self;
+}
+
+#------------------------------------------
+
+
+sub from($@)
+{   return $_[0]->resentFrom if @_ == 1;   # backwards compat
+
+    my ($class, $from, %args) = @_;
+    my $head = $from->isa('Mail::Message::Head') ? $from : $from->head;
+
+    my (@groups, $group, $return_path, $delivered_to);
+
+    foreach my $field ($head->orderedFields)
+    {   my $name = $field->name;
+        next unless $resent_field_names{$name};
+
+        if($name eq 'return-path')              { $return_path  = $field }
+        elsif($name eq 'delivered-to')          { $delivered_to = $field }
+        elsif(substr($name, 0, 7) eq 'resent-')
+        {   $group->add($field) if defined $group }
+        elsif($name eq 'received')
+        {
+            $group = Mail::Message::Head::ResentGroup
+                          ->new($field, message_head => $head);
+            push @groups, $group;
+
+            $group->add($delivered_to) if defined $delivered_to;
+            undef $delivered_to;
+
+            $group->add($return_path) if defined $return_path;
+            undef $return_path;
+        }
+    }
+
+    @groups;
+}
+
+#------------------------------------------
+
+
+sub messageHead(;$)
+{   my $self = shift;
+    @_ ? $self->{MMHR_real} = shift : $self->{MMHR_real};
+}
+
+#------------------------------------------
+
+
+sub orderedFields()
+{   my $head = shift->head;
+    map { $head->get($_) || () } @ordered_field_names;
+}
+
+#------------------------------------------
+
+
+sub set($;$)
+{   my $self  = shift;
+    my $field;
+
+    if(@_==1) { $field = shift }
+    else
+    {   my ($fn, $value) = @_;
+        my $name  = $resent_field_names{lc $fn} ? $fn : "Resent-$fn";
+        $field = Mail::Message::Field::Fast->new($name, $value);
+    }
+
+    $self->head->set($field);
+    $field;
+}
+
+#-------------------------------------------
+
+sub fields() { shift->orderedFields }
+
+#-------------------------------------------
+
+sub fieldNames() { map { $_->Name } shift->orderedFields }
+
+#-------------------------------------------
+
+sub delete()
+{   my $self   = shift;
+    my $head   = $self->messageHead;
+    $head->removeField($_) foreach $self->fields;
+    $self;
+}
+
+#------------------------------------------
+
+
+sub add(@) { shift->set(@_) }
+
+#-------------------------------------------
+
+
+sub addFields(@) { shift->notImplemented }
+
+#-------------------------------------------
+
+
+sub returnPath() { shift->{MMHR_return_path} }
+
+#------------------------------------------
+
+
+sub deliveredTo() { shift->head->get('Delivered-To') }
+
+#------------------------------------------
+
+
+sub received() { shift->head->get('Received') }
+
+#------------------------------------------
+
+
+sub receivedTimestamp()
+{   my $received = shift->received or return;
+    my $comment  = $received->comment or return;
+    Mail::Message::Field->dateToTimestamp($comment);
+}
+
+#------------------------------------------
+
+
+sub date($) { shift->head->get('resent-date') }
+
+#------------------------------------------
+
+
+sub dateTimestamp()
+{   my $date = shift->date or return;
+    Mail::Message::Field->dateToTimestamp($date->unfoldedBody);
+}
+
+#------------------------------------------
+
+
+sub resentFrom()
+{   my $from = shift->head->get('resent-from') or return ();
+    wantarray ? $from->addresses : $from;
+}
+
+#------------------------------------------
+
+
+sub sender()
+{   my $sender = shift->head->get('resent-sender') or return ();
+    wantarray ? $sender->addresses : $sender;
+}
+
+#------------------------------------------
+
+
+sub to()
+{   my $to = shift->head->get('resent-to') or return ();
+    wantarray ? $to->addresses : $to;
+}
+
+#------------------------------------------
+
+
+sub cc()
+{   my $cc = shift->head->get('resent-cc') or return ();
+    wantarray ? $cc->addresses : $cc;
+}
+
+#------------------------------------------
+
+
+sub bcc()
+{   my $bcc = shift->head->get('resent-bcc') or return ();
+    wantarray ? $bcc->addresses : $bcc;
+}
+
+#------------------------------------------
+
+
+sub destinations()
+{   my $self = shift;
+    ($self->to, $self->cc, $self->bcc);
+}
+
+#------------------------------------------
+
+
+sub messageId() { shift->head->get('resent-message-id') }
+
+#------------------------------------------
+
+
+sub isResentGroupFieldName($) { $resent_field_names{lc $_[1]} }
+
+#------------------------------------------
+
+
+my $unique_received_id = 'rc'.time;
+
+sub createReceived(;$)
+{   my ($self, $domain) = @_;
+
+    unless(defined $domain)
+    {   my $sender = ($self->sender)[0] || ($self->resentFrom)[0];
+        $domain    = $sender->host if defined $sender;
+    }
+
+    my $received
+      = 'from ' . $domain
+      . ' by '  . hostname
+      . ' with SMTP'
+      . ' id '  . $unique_received_id++
+      . ' for ' . $self->head->get('Resent-To')  # may be wrong
+      . '; '. Mail::Message::Field->toDate;
+
+    $received;
+}
+
+#-------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/ResentGroup.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/ResentGroup.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/ResentGroup.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,652 @@
+
+=head1 NAME
+
+Mail::Message::Head::ResentGroup - header fields tracking message delivery
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Head::ResentGroup
+   is a Mail::Message::Head::FieldGroup
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my $rg = Mail::Message::Head::ResentGroup->new(head => $head,
+              From => 'me at home.nl', To => 'You at tux.aq');
+ $head->addResentGroup($rg);
+
+ my $rg = $head->addResentGroup(From => 'me');
+
+ my @from = $rg->From;
+
+ my @rgs = $head->resentGroups;
+ $rg[2]->delete if @rgs > 2;
+
+
+=head1 DESCRIPTION
+
+A I<resent group> is a set of header fields which describe one intermediate
+step in the message transport.  Resent groups B<have NOTHING to do> with
+user activety; there is no relation to the C<user's> sense of creating
+reply, forward, or bounce messages at all!
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"Constructors">
+
+=back
+
+$obj-E<gt>B<from>([HEAD|MESSAGE, OPTIONS])
+
+=over 4
+
+WARNING: this method has two very different purposes.  For backward
+compatibility reasons, without arguments L<resentFrom()|Mail::Message::Head::ResentGroup/"Access to the header"> is called to
+return the C<From> field of this resent group.
+
+With any arguments, a list of C<Mail::Message::Head::ResentGroup> objects
+is returned, taken from the specified MESSAGE or message HEAD.
+
+=back
+
+$obj-E<gt>B<implementedTypes>
+
+Mail::Message::Head::ResentGroup-E<gt>B<implementedTypes>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"Constructors">
+
+=back
+
+Mail::Message::Head::ResentGroup-E<gt>B<new>([FIELDS], OPTIONS)
+
+=over 4
+
+Create an object which maintains one set of resent headers.  The
+FIELDS are L<Mail::Message::Field|Mail::Message::Field> objects from the same header.
+
+OPTIONS which start with capitals will be used to construct additional
+fields.  These option names are prepended with C<Resent->, keeping the
+capitization of what is specified.
+
+ Option        Defined in       Default                
+ Bcc                            undef                  
+ Cc                             undef                  
+ Date                           <now>                  
+ Delivered-To                   undef                  
+ From                           <required>             
+ Message-ID                     <uniquely created>     
+ Received                       <created>              
+ Return-Path                    undef                  
+ Sender                         undef                  
+ To                             undef                  
+ head                           <created automatically>
+ log           L<Mail::Reporter>  C<'WARNINGS'>          
+ message_head                   C<undef>               
+ software      L<Mail::Message::Head::FieldGroup>  C<undef>               
+ trace         L<Mail::Reporter>  C<'WARNINGS'>          
+ type          L<Mail::Message::Head::FieldGroup>  C<undef>               
+ version       L<Mail::Message::Head::FieldGroup>  C<undef>               
+
+. Bcc STRING|OBJECT|OBJECTS
+
+. Cc STRING|OBJECT|OBJECTS
+
+. Date STRING
+
+=over 4
+
+When this resent-group is dispatched by the resender of the message. Like
+the C<Date> field, it is not the date and time that the message was
+actually transported.
+
+=back
+
+. Delivered-To STRING|FIELD
+
+. From STRING|OBJECT|OBJECTS
+
+. Message-ID STRING|FIELD
+
+=over 4
+
+The C<Resent-Message-ID> which identifies this resent group.  The FIELD
+must contain a message id.
+
+=back
+
+. Received STRING
+
+=over 4
+
+The C<Received> field is the starting line for a resent group of header
+lines. If it is not defined, one is created using L<createReceived()|Mail::Message::Head::ResentGroup/"Internals">.
+
+=back
+
+. Return-Path STRING|FIELD
+
+. Sender STRING|OBJECT
+
+=over 4
+
+Only permitted when more than one from address is specified.  In this case,
+it selects one of these addresses as the main originator of the message.
+
+=back
+
+. To STRING|OBJECT|OBJECTS
+
+. head OBJECT
+
+=over 4
+
+The header where the data is stored in.  Be dafault a
+L<Mail::Message::Head::Partial|Mail::Message::Head::Partial> is created for you.
+
+=back
+
+. log LEVEL
+
+. message_head HEAD
+
+=over 4
+
+The real header of the message where this resent group is part of.  The
+C<head> used in this class is only a container for a subset of fields.
+
+=back
+
+. software STRING
+
+. trace LEVEL
+
+. type STRING
+
+. version STRING
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<add>((FIELD =E<gt> VALUE) | OBJECT)
+
+=over 4
+
+All fields appear only once, so C<add()> behaves as L<set()|Mail::Message::Head::ResentGroup/"The header">.
+
+=back
+
+$obj-E<gt>B<addFields>([FIELDNAMES])
+
+=over 4
+
+Not applicable to resent-groups: the same name can appear in more than
+one group.  Therefore, a FIELDNAME is sufficiently distinctive.
+
+=back
+
+$obj-E<gt>B<attach>(HEAD)
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"The header">
+
+=back
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"The header">
+
+=back
+
+$obj-E<gt>B<fieldNames>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"The header">
+
+=back
+
+$obj-E<gt>B<fields>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"The header">
+
+=back
+
+$obj-E<gt>B<head>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"The header">
+
+=back
+
+$obj-E<gt>B<messageHead>([HEAD])
+
+=over 4
+
+Returns (optionally after setting) the real header where this resent group
+belongs to.  This may be undef at creation, and then later filled in
+when L<Mail::Message::Head::Complete::addResentGroup()|Mail::Message::Head::Complete/"Access to the header"> is called.
+
+=back
+
+$obj-E<gt>B<orderedFields>
+
+=over 4
+
+Returns the fields in the order as should appear in header according
+to rfc2822.  For the C<Resent-> fields of the group, the order is
+not that important, but the C<Return-Path>, C<Delivered-To>, and C<Received>
+must come first.  Only fields mentioned in the RFC are returned.
+
+=back
+
+$obj-E<gt>B<set>((FIELD =E<gt> VALUE) | OBJECT)
+
+=over 4
+
+Set a FIELD to a (new) VALUE.  The FIELD names which do not start with
+'Resent-*' but need it will have that added.  It is also an option to
+specify a fully prepared message field OBJECT.  In any case, a field
+OBJECT is returned.
+
+I<Example:> 
+
+ my $this = Mail::Message::Head::ResentGroup->new;
+ $this->set(To => 'fish at tux.aq');
+ $msg->addResentGroup($this);
+ $msg->send;
+
+ $msg->bounce(To => 'fish at tux.aq')->send;   # the same
+
+ my $this = Mail::Message::Head::ResentGroup
+     ->new(To => 'fish at tux.aq');
+
+=back
+
+=head2 Access to the header
+
+
+$obj-E<gt>B<bcc>
+
+=over 4
+
+In scalar context, the C<Resent-Bcc> field is returned.  In list context,
+the addresses as specified within the bcc field are returned as
+Mail::Address objects.  Bcc fields are not transmitted (hidden for
+external parties).
+
+=back
+
+$obj-E<gt>B<cc>
+
+=over 4
+
+In scalar context, the C<Resent-Cc> field is returned.  In list context,
+the addresses as specified within the cc field are returned as
+Mail::Address objects.
+
+=back
+
+$obj-E<gt>B<date>
+
+=over 4
+
+Returns the C<Resent-Date> field, or C<undef> if it was not defined.
+
+=back
+
+$obj-E<gt>B<dateTimestamp>
+
+=over 4
+
+The timestamp as stored within the C<Resent-Date> field converted to
+local system time.
+
+=back
+
+$obj-E<gt>B<deliveredTo>
+
+=over 4
+
+The field which describes the C<Delivered-To> of this resent group.
+
+=back
+
+$obj-E<gt>B<destinations>
+
+=over 4
+
+Returns a list of all addresses specified in the C<Resent-To>, C<-Cc>, and
+C<-Bcc> fields of this resent group.
+
+=back
+
+$obj-E<gt>B<isResentGroupFieldName>(NAME)
+
+Mail::Message::Head::ResentGroup-E<gt>B<isResentGroupFieldName>(NAME)
+
+=over 4
+
+=back
+
+$obj-E<gt>B<messageId>
+
+=over 4
+
+Returns the message-ID used for this group of resent lines.
+
+=back
+
+$obj-E<gt>B<received>
+
+=over 4
+
+The field which describes the C<Received> data of this resent group.
+
+=back
+
+$obj-E<gt>B<receivedTimestamp>
+
+=over 4
+
+The timestamp as stored within the C<Received> field converted to
+local system time.
+
+=back
+
+$obj-E<gt>B<resentFrom>
+
+=over 4
+
+In scalar context, the C<Resent-From> field is returned.  In list
+context, the addresses as specified within the from field are
+returned as Mail::Address objects.
+
+For reasons of backward compatibility and consistency, the L<from()|Mail::Message::Head::ResentGroup/"METHODS">
+method will return the same as this method.
+
+=back
+
+$obj-E<gt>B<returnPath>
+
+=over 4
+
+The field which describes the C<Return-Path> of this resent group.
+
+=back
+
+$obj-E<gt>B<sender>
+
+=over 4
+
+In scalar context, the C<Resent-Sender> field is returned.  In list
+context, the addresses as specified within the from field are
+returned as Mail::Address objects.
+
+=back
+
+$obj-E<gt>B<software>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"Access to the header">
+
+=back
+
+$obj-E<gt>B<to>
+
+=over 4
+
+In scalar context, the C<Resent-To> field is returned.  In list context,
+the addresses as specified within the to field are returned as
+Mail::Address objects.
+
+=back
+
+$obj-E<gt>B<type>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"Access to the header">
+
+=back
+
+$obj-E<gt>B<version>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"Access to the header">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<collectFields>([NAME])
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"Internals">
+
+=back
+
+$obj-E<gt>B<createReceived>([DOMAIN])
+
+=over 4
+
+Create a recieved field for this resent group.  This is automatically
+called if none was specified during creation of this resent group object.
+
+The content of this field is described in RFC2821 section 4.4.  It could use
+some improvement.
+
+=back
+
+$obj-E<gt>B<detected>(TYPE, SOFTWARE, VERSION)
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Head::ResentGroup-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<details>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Head::ResentGroup-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Head::ResentGroup-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Message header required for creation of ResentGroup.
+
+It is required to know to which header the resent-group
+is created.  Use the C<head> option.  Maybe you should use
+L<Mail::Message::Head::Complete::addResentGroup()|Mail::Message::Head::Complete/"Access to the header"> with DATA, which will
+organize the correct initiations for you.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/SpamGroup.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/SpamGroup.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/SpamGroup.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,175 @@
+
+package Mail::Message::Head::SpamGroup;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Head::FieldGroup';
+
+use strict;
+use warnings;
+
+use Carp 'confess';
+
+
+#------------------------------------------
+
+
+my %fighters;
+my $fighterfields;    # one regexp for all fields
+
+sub knownFighters() { keys %fighters }
+
+#------------------------------------------
+
+
+sub fighter($;@)
+{   my ($thing, $name) = (shift, shift);
+
+    if(@_)
+    {   my %args   = @_;
+        defined $args{fields} or confess "Spamfighters require fields\n";
+        defined $args{isspam} or confess "Spamfighters require isspam\n";
+        $fighters{$name} = \%args;
+
+        my @fields = map { $_->{fields} } values %fighters;
+        local $" = '|';
+        $fighterfields = qr/@fields/;
+    }
+
+    %{$fighters{$name}};
+}
+
+
+BEGIN
+{  __PACKAGE__->fighter( SpamAssassin =>
+       fields  => qr/^X-Spam-/i
+     , isspam  =>
+          sub { my ($sg, $head) = @_;
+                my $f = $head->get('X-Spam-Flag') || $head->get('X-Spam-Status')
+                   or return 0;
+
+                $f =~ m/^yes\b/i;
+              }
+    , version =>
+          sub { my ($sg, $head) = @_;
+                my $assin = $head->get('X-Spam-Checker-Version') or return ();
+                my ($software, $version) = $assin =~ m/^(.*)\s+(.*?)\s*$/;
+                ($software, $version);
+              }
+    );
+
+  __PACKAGE__->fighter( 'Habeas-SWE' =>
+      fields  => qr/^X-Habeas-SWE/i
+    , isspam  =>
+          sub { my ($sg, $head) = @_;
+                not $sg->habeasSweFieldsCorrect;
+              }
+    );
+
+  __PACKAGE__->fighter( MailScanner  =>
+      fields  => qr/^X-MailScanner/i
+    , isspam  =>
+          sub { my ($sg, $head) = @_;
+                my $subject = $head->get('subject');
+                $subject =~ m/^\{ (?:spam|virus)/xi;
+              }
+    );
+
+}
+
+#------------------------------------------
+
+
+sub from($@)
+{  my ($class, $from, %args) = @_;
+   my $head  = $from->isa('Mail::Message::Head') ? $from : $from->head;
+   my ($self, @detected);
+
+   my @types = defined $args{types} ? @{$args{types}} : $class->knownFighters;
+
+   foreach my $type (@types)
+   {   $self = $class->new(head => $head) unless defined $self;
+       next unless $self->collectFields($type);
+
+       my %fighter = $self->fighter($type);
+       my ($software, $version)
+           = defined $fighter{version} ? $fighter{version}->($self, $head) : ();
+ 
+       $self->detected($type, $software, $version);
+       $self->spamDetected( $fighter{isspam}->($self, $head) );
+
+       push @detected, $self;
+       undef $self;             # create a new one
+   }
+
+   @detected;
+}
+
+#------------------------------------------
+
+sub collectFields($)
+{   my ($self, $set) = @_;
+    my %fighter = $self->fighter($set)
+       or confess "ERROR: No spam set $set.";
+
+    my @names = map { $_->name } $self->head->grepNames( $fighter{fields} );
+    return () unless @names;
+
+    $self->addFields(@names);
+    @names;
+}
+
+#------------------------------------------
+
+
+sub isSpamGroupFieldName($) { $_[1] =~ $fighterfields }
+
+#------------------------------------------
+
+
+my @habeas_lines =
+( 'winter into spring', 'brightly anticipated', 'like Habeas SWE (tm)'
+, 'Copyright 2002 Habeas (tm)'
+, 'Sender Warranted Email (SWE) (tm). The sender of this'
+, 'email in exchange for a license for this Habeas'
+, 'warrant mark warrants that this is a Habeas Compliant'
+, 'Message (HCM) and not spam. Please report use of this'
+, 'mark in spam to <http://www.habeas.com/report/>.'
+);
+
+sub habeasSweFieldsCorrect(;$)
+{   my $self;
+
+    if(@_ > 1)
+    {   my ($class, $thing) = @_;
+        my $head = $thing->isa('Mail::Message::Head') ? $thing : $thing->head;
+        $self    = $head->spamGroups('Habeas-SWE') or return;
+    }
+    else
+    {   $self = shift;
+        my $type = $self->type;
+        return unless defined $type && $type eq 'Habeas-SWE';
+    }
+
+    my $head     = $self->head;
+    return if $self->fields != @habeas_lines;
+
+    for(my $nr=1; $nr <= $#habeas_lines; $nr++)
+    {   my $f = $head->get("X-Habeas-SWE-$nr") or return;
+        return if $f->unfoldedBody ne $habeas_lines[$nr-1];
+    }
+
+    1;
+}
+
+#------------------------------------------
+
+
+sub spamDetected(;$)
+{   my $self = shift;
+    @_? ($self->{MMFS_spam} = shift) : $self->{MMFS_spam};
+}
+
+#------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/SpamGroup.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/SpamGroup.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/SpamGroup.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,540 @@
+
+=head1 NAME
+
+Mail::Message::Head::SpamGroup - spam fighting related header fields
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Head::SpamGroup
+   is a Mail::Message::Head::FieldGroup
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my $sg = Mail::Message::Head::SpamGroup->new(head => $head, ...);
+ $head->addSpamGroup($sg);
+
+ my $sg = $head->addSpamGroup( <options> );
+ $sg->delete;
+ 
+ my @sgs = $head->spamGroups;
+
+
+=head1 DESCRIPTION
+
+A I<spam group> is a set of header fields which are added by spam detection
+and spam fighting software.  This class knows various details about
+that software.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"Constructors">
+
+=back
+
+$obj-E<gt>B<fighter>(NAME, [SETTINGS])
+
+Mail::Message::Head::SpamGroup-E<gt>B<fighter>(NAME, [SETTINGS])
+
+=over 4
+
+Get the SETTINGS of a certain spam-fighter, optionally after setting them.
+The L<knownFighters()> method returns the defined names.  The names
+are case-sensitive.
+
+ Option   Defined in       Default   
+ fields                    <required>
+ isspam                    <required>
+ version                   C<undef>  
+
+. fields REGEXP
+
+=over 4
+
+The regular expression which indicates which of the header fields are
+added by the spam fighter software.
+
+=back
+
+. isspam CODE
+
+=over 4
+
+The CODE must return true or false, to indicate whether the spam fighter
+thinks that the message contains spam.  The CODE ref is called with
+the spamgroup object (under construction) and the header which is inspected.
+
+=back
+
+. version CODE
+
+=over 4
+
+Can be called to collect the official name and the version of the
+software which is used to detect spam.  The CODE ref is called with
+the spamgroup object (under construction) and the header which is inspected.
+
+=back
+
+I<Example:> adding your own spam-fighter definitions
+
+
+ Mail::Message::Head::SpamGroup->fighter( 'MY-OWN',
+    fields => qw/^x-MY-SPAM-DETECTOR-/,
+    isspam => sub { my ($sg, $head) = @_; $head->fields > 100 }
+   );
+
+=back
+
+$obj-E<gt>B<from>(HEAD|MESSAGE, OPTIONS)
+
+=over 4
+
+Returns a list of C<Mail::Message::Head::SpamGroup> objects, based on the
+specified MESSAGE or message HEAD.
+
+ Option  Defined in  Default 
+ types               C<undef>
+
+. types ARRAY-OF-NAMES
+
+=over 4
+
+Only the specified types will be tried.  If the ARRAY is empty, an empty
+list is returned.  Without this option, all sets are returned.
+
+=back
+
+=back
+
+$obj-E<gt>B<habeasSweFieldsCorrect>([MESSAGE|HEAD])
+
+Mail::Message::Head::SpamGroup-E<gt>B<habeasSweFieldsCorrect>([MESSAGE|HEAD])
+
+=over 4
+
+Returns a true value if the MESSAGE or HEAD contains C<Habeas-SWE> fields
+which are correct.  Without argument, this is used as instance method on
+an existing Spam-Group.
+
+I<Example:> checking Habeas-SWE fields
+
+
+ if(Mail::Message::Head::SpamGroup->habeasSweFieldsCorrect($message))
+ {   $message->label(spam => 0);
+ }
+
+ my $sg = $message->head->spamGroups('Habeas-SWE');
+ if($sg->habeasSweFieldsCorrect) { ... };
+
+ use List::Util 'first';
+ if(first {$_->habeasSweFieldsCorrect} $head->spamGroups)
+ {   ...
+ }
+
+=back
+
+$obj-E<gt>B<implementedTypes>
+
+Mail::Message::Head::SpamGroup-E<gt>B<implementedTypes>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"Constructors">
+
+=back
+
+$obj-E<gt>B<isSpamGroupFieldName>(NAME)
+
+Mail::Message::Head::SpamGroup-E<gt>B<isSpamGroupFieldName>(NAME)
+
+=over 4
+
+=back
+
+$obj-E<gt>B<knownFighters>
+
+Mail::Message::Head::SpamGroup-E<gt>B<knownFighters>
+
+=over 4
+
+Returns an unsorted list of all names representing pre-defined spam-fighter
+software.  You can ask details about them, and register more fighters with
+the L<fighter()|Mail::Message::Head::SpamGroup/"Constructors"> method.
+
+=back
+
+Mail::Message::Head::SpamGroup-E<gt>B<new>(FIELDS, OPTIONS)
+
+=over 4
+
+Construct an object which maintains one set of fields which were added
+by spam fighting software.
+
+ Option    Defined in       Default      
+ head      L<Mail::Message::Head::FieldGroup>  C<undef>     
+ log       L<Mail::Reporter>  C<'WARNINGS'>
+ software  L<Mail::Message::Head::FieldGroup>  C<undef>     
+ trace     L<Mail::Reporter>  C<'WARNINGS'>
+ type      L<Mail::Message::Head::FieldGroup>  C<undef>     
+ version   L<Mail::Message::Head::FieldGroup>  C<undef>     
+
+. head HEAD
+
+. log LEVEL
+
+. software STRING
+
+. trace LEVEL
+
+. type STRING
+
+. version STRING
+
+=back
+
+$obj-E<gt>B<spamDetected>([BOOLEAN])
+
+=over 4
+
+Returns (after setting) whether this group of spam headers thinks that
+this is spam.  See L<Mail::Message::Head::Complete::spamDetected()|Mail::Message::Head::Complete/"Access to the header">.
+
+I<Example:> 
+
+  die if $head->spamDetected;
+
+  foreach my $sg ($head->spamGroups)
+  {   print $sg->type." found spam\n" if $sg->spamDetected;
+  }
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<add>((FIELD, VALUE) | OBJECT)
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"The header">
+
+=back
+
+$obj-E<gt>B<addFields>([FIELDNAMES])
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"The header">
+
+=back
+
+$obj-E<gt>B<attach>(HEAD)
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"The header">
+
+=back
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"The header">
+
+=back
+
+$obj-E<gt>B<fieldNames>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"The header">
+
+=back
+
+$obj-E<gt>B<fields>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"The header">
+
+=back
+
+$obj-E<gt>B<head>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"The header">
+
+=back
+
+=head2 Access to the header
+
+
+$obj-E<gt>B<software>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"Access to the header">
+
+=back
+
+$obj-E<gt>B<type>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"Access to the header">
+
+=back
+
+$obj-E<gt>B<version>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"Access to the header">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<collectFields>([NAME])
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"Internals">
+
+=back
+
+$obj-E<gt>B<detected>(TYPE, SOFTWARE, VERSION)
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Head::SpamGroup-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<details>
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Head::SpamGroup-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Head::SpamGroup-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message::Head::FieldGroup/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+=head1 DETAILS
+
+
+=head2 Spam fighting fields
+
+
+=head3 Detected spam fighting software
+
+The L<Mail::Message::Head::SpamGroup|Mail::Message::Head::SpamGroup> class can be used to detect
+fields which were produced by different spam fighting software.
+
+=over 4
+
+=item * SpamAssassin
+
+These fields are added by L<Mail::SpamAssassin>, which is the central
+implementation of the spam-assassin package.  The homepage of this
+GPL'ed project can be found at L<http://spamassassin.org>.
+
+=item * Habeas-SWE
+
+Habeas tries to fight spam via the standard copyright protection
+mechanism: Sender Warranted E-mail (SWE). Only when you have a contract
+with Habeas, you are permitted to add a few copyrighted lines to your
+e-mail. Spam senders will be refused a contract.  Mail clients which
+see these nine lines are (quite) sure that the message is sincere.
+
+See L<http://www.habeas.com> for all the details on this commercial
+product.
+
+=item * MailScanner
+
+The MailScanner filter is developed and maintained by
+transtec Computers.  The software is available for free download from
+L<http://www.sng.ecs.soton.ac.uk/mailscanner/>.  Commercial support
+is provided via L<http://www.mailscanner.biz>.
+
+=back
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Subset.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Subset.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Subset.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,92 @@
+
+use strict;
+
+package Mail::Message::Head::Subset;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Head';
+
+use Object::Realize::Later
+    becomes        => 'Mail::Message::Head::Complete',
+    realize        => 'load',
+    believe_caller => 1;
+
+use Date::Parse;
+
+
+sub count($)
+{   my ($self, $name) = @_;
+
+    my @values = $self->get($name);
+
+    return $self->load->count($name)
+       unless @values;
+
+    scalar @values;
+}
+
+#-------------------------------------------
+
+
+sub get($;$)
+{   my $self = shift;
+ 
+    if(wantarray)
+    {   my @values = $self->SUPER::get(@_);
+        return @values if @values;
+    }
+    else
+    {   my $value  = $self->SUPER::get(@_);
+        return $value  if defined $value;
+    }
+
+    $self->load->get(@_);
+}
+
+
+#-------------------------------------------
+
+
+sub guessBodySize()
+{   my $self = shift;
+
+    my $cl = $self->SUPER::get('Content-Length');
+    return $1 if defined $cl && $cl =~ m/(\d+)/;
+
+    my $lines = $self->SUPER::get('Lines');   # 40 chars per lines
+    return $1*40 if defined $lines && $lines =~ m/(\d+)/;
+
+    undef;
+}
+
+#-------------------------------------------
+# Be careful not to trigger loading: this is not the thoroughness
+# we want from this method.
+
+sub guessTimestamp()
+{   my $self = shift;
+    return $self->{MMHS_timestamp} if $self->{MMHS_timestamp};
+
+    my $stamp;
+    if(my $date = $self->SUPER::get('date'))
+    {   $stamp = str2time($date, 'GMT');
+    }
+
+    unless($stamp)
+    {   foreach ($self->SUPER::get('received'))
+        {   $stamp = str2time($_, 'GMT');
+            last if $stamp;
+        }
+    }
+
+    $self->{MMHS_timestamp} = $stamp;
+}
+
+#-------------------------------------------
+
+
+sub load() {$_[0] = $_[0]->message->loadHead}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Subset.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Subset.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head/Subset.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,408 @@
+
+=head1 NAME
+
+Mail::Message::Head::Subset - subset of header information of a message
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Head::Subset realizes a Mail::Message::Head::Complete
+
+ Mail::Message::Head::Subset
+   is a Mail::Message::Head
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my Mail::Message::Head::Subset $subset = ...;
+ $subset->isa('Mail::Message::Head')  # true
+ $subset->guessBodySize               # integer or undef
+ $subset->isDelayed                   # true
+
+
+=head1 DESCRIPTION
+
+Some types of folders contain an index file which lists a few lines of
+information per messages.  Especially when it is costly to read header lines,
+the index speeds-up access considerably.  For instance, the subjects of
+all messages are often wanted, but waiting for a thousand messages of the
+folder to be read may imply a thousand network reads (IMAP) or file
+openings (MH)
+
+When you access header fields which are not in the header subset, the whole
+header has to be parsed (which may consume considerable time, depending on
+the type of folder).
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Message::Head/"OVERLOADED">
+
+=back
+
+overload: B<bool>
+
+=over 4
+
+See L<Mail::Message::Head/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<build>(FIELDS)
+
+=over 4
+
+See L<Mail::Message::Head/"Constructors">
+
+=back
+
+Mail::Message::Head::Subset-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Head/"Constructors">
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<isEmpty>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<knownNames>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<message>([MESSAGE])
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<orderedFields>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+=head2 Access to the header
+
+
+$obj-E<gt>B<count>(NAME)
+
+=over 4
+
+Count the number of fields with this NAME.  If the NAME cannot be found,
+the full header get loaded.  In case we find any NAME field, it is
+decided we know all of them, and loading is not needed.
+
+=back
+
+$obj-E<gt>B<get>(NAME [,INDEX])
+
+=over 4
+
+Get the data which is related to the field with the NAME.  The case of the
+characters in NAME does not matter.  When a NAME is used which is not known
+yet, realization will take place.
+
+=back
+
+$obj-E<gt>B<study>(NAME [,INDEX])
+
+=over 4
+
+See L<Mail::Message::Head/"Access to the header">
+
+=back
+
+=head2 About the body
+
+
+$obj-E<gt>B<guessBodySize>
+
+=over 4
+
+The body size is defined in the C<Content-Length> field.  However, this
+field may not be known.  In that case, a guess is made based on the known
+C<Lines> field.  When also that field is not known yet, C<undef> is returned.
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+See L<Mail::Message::Head/"About the body">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<addNoRealize>(FIELD)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<addOrderedFields>(FIELDS)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<fileLocation>
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<load>
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<moveLocation>(DISTANCE)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<read>(PARSER)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<setNoRealize>(FIELD)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Head::Subset-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Head::Subset-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Head::Subset-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,259 @@
+use strict;
+use warnings;
+
+package Mail::Message::Head;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Reporter';
+
+use Mail::Message::Head::Complete;
+use Mail::Message::Field::Fast;
+
+use Carp;
+use Scalar::Util 'weaken';
+
+
+use overload qq("") => 'string_unless_carp'
+           , bool   => 'isEmpty';
+
+# To satisfy overload in static resolving.
+sub toString() { shift->load->toString }
+sub string()   { shift->load->string }
+
+sub string_unless_carp()
+{   my $self = shift;
+    return $self->toString unless (caller)[0] eq 'Carp';
+
+    (my $class = ref $self) =~ s/^Mail::Message/MM/;
+    "$class object";
+}
+
+#------------------------------------------
+
+
+sub new(@)
+{   my $class = shift;
+
+    return Mail::Message::Head::Complete->new(@_)
+       if $class eq __PACKAGE__;
+
+    $class->SUPER::new(@_);
+}
+ 
+sub init($)
+{   my ($self, $args) = @_;
+
+    $self->SUPER::init($args);
+
+    $self->{MMH_field_type} = $args->{field_type}
+        if $args->{field_type};
+
+    $self->message($args->{message})
+        if defined $args->{message};
+
+    $self->{MMH_fields}     = {};
+    $self->{MMH_order}      = [];
+    $self->{MMH_modified}   = $args->{modified} || 0;
+    $self;
+}
+
+#------------------------------------------
+
+
+sub build(@)
+{   shift;
+    Mail::Message::Head::Complete->build(@_);
+}
+
+#------------------------------------------
+
+
+sub isDelayed { 1 }
+
+#------------------------------------------
+
+
+sub modified(;$)
+{   my $self = shift;
+    return $self->isModified unless @_;
+    $self->{MMH_modified} = shift;
+}
+
+#------------------------------------------
+
+
+sub isModified() { shift->{MMH_modified} }
+
+#------------------------------------------
+
+
+sub isEmpty { scalar keys %{shift->{MMH_fields}} }
+
+#------------------------------------------
+
+
+sub message(;$)
+{   my $self = shift;
+    if(@_)
+    {    $self->{MMH_message} = shift;
+         weaken($self->{MMH_message});
+    }
+
+    $self->{MMH_message};
+}
+
+#------------------------------------------
+
+
+sub orderedFields() { grep {defined $_} @{shift->{MMH_order}} }
+
+#------------------------------------------
+
+
+sub knownNames() { keys %{shift->{MMH_fields}} }
+
+#------------------------------------------
+
+
+sub get($;$)
+{   my $known = shift->{MMH_fields};
+    my $value = $known->{lc(shift)};
+    my $index = shift;
+
+    if(defined $index)
+    {   return ! defined $value      ? undef
+             : ref $value eq 'ARRAY' ? $value->[$index]
+             : $index == 0           ? $value
+             :                         undef;
+    }
+    elsif(wantarray)
+    {   return ! defined $value      ? ()
+             : ref $value eq 'ARRAY' ? @$value
+             :                         ($value);
+    }
+    else
+    {   return ! defined $value      ? undef
+             : ref $value eq 'ARRAY' ? $value->[-1]
+             :                         $value;
+    }
+}
+
+sub get_all(@) { my @all = shift->get(@_) }   # compatibility, force list
+sub setField($$) {shift->add(@_)} # compatibility
+
+#------------------------------------------
+
+
+sub study($;$)
+{   my $self = shift;
+    return map {$_->study} $self->get(@_)
+       if wantarray;
+
+    my $got  = $self->get(@_);
+    defined $got ? $got->study : undef;
+}
+
+#------------------------------------------
+
+
+#------------------------------------------
+
+
+sub isMultipart()
+{   my $type = shift->get('Content-Type');
+    $type && $type->body =~ m[^multipart/]i;
+}
+
+#------------------------------------------
+
+
+sub read($)
+{   my ($self, $parser) = @_;
+
+    my @fields = $parser->readHeader;
+    @$self{ qw/MMH_begin MMH_end/ } = (shift @fields, shift @fields);
+
+    my $type   = $self->{MMH_field_type} || 'Mail::Message::Field::Fast';
+
+    $self->addNoRealize($type->new( @$_ ))
+        foreach @fields;
+
+    $self;
+}
+
+#------------------------------------------
+
+
+#  Warning: fields are added in addResentGroup() as well!
+sub addOrderedFields(@)
+{   my $order = shift->{MMH_order};
+    foreach (@_)
+    {   push @$order, $_;
+        weaken( $order->[-1] );
+    }
+    @_;
+}
+
+#------------------------------------------
+
+
+sub load($) {shift}
+
+#------------------------------------------
+
+
+sub fileLocation()
+{   my $self = shift;
+    @$self{ qw/MMH_begin MMH_end/ };
+}
+
+#------------------------------------------
+
+
+sub moveLocation($)
+{   my ($self, $dist) = @_;
+    $self->{MMH_begin} -= $dist;
+    $self->{MMH_end}   -= $dist;
+    $self;
+}
+
+#------------------------------------------
+
+
+sub setNoRealize($)
+{   my ($self, $field) = @_;
+
+    my $known = $self->{MMH_fields};
+    my $name  = $field->name;
+
+    $self->addOrderedFields($field);
+    $known->{$name} = $field;
+    $field;
+}
+
+#------------------------------------------
+
+
+sub addNoRealize($)
+{   my ($self, $field) = @_;
+
+    my $known = $self->{MMH_fields};
+    my $name  = $field->name;
+
+    $self->addOrderedFields($field);
+
+    if(defined $known->{$name})
+    {   if(ref $known->{$name} eq 'ARRAY') { push @{$known->{$name}}, $field }
+        else { $known->{$name} = [ $known->{$name}, $field ] }
+    }
+    else
+    {   $known->{$name} = $field;
+    }
+
+    $field;
+}
+
+#------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Head.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,612 @@
+
+=head1 NAME
+
+Mail::Message::Head - the header of one message
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Head
+   is a Mail::Reporter
+
+ Mail::Message::Head is extended by
+   Mail::Box::IMAP4::Head
+   Mail::Message::Head::Complete
+   Mail::Message::Head::Delayed
+   Mail::Message::Head::Subset
+
+
+=head1 SYNOPSIS
+
+ my $head = Mail::Message::Head->new;
+ $head->add('From: me at localhost');
+ $head->add(From => 'me at localhost');
+ $head->add(Mail::Message::Field->new(From => 'me'));
+ my Mail::Message::Field $subject = $head->get('subject');
+ my Mail::Message::Field @rec = $head->get('received');
+ $head->delete('From');
+
+
+=head1 DESCRIPTION
+
+C<Mail::Message::Head> MIME headers are part of L<Mail::Message|Mail::Message> messages,
+which are grouped in L<Mail::Box|Mail::Box> folders.
+
+B<ATTENTION!!!> most functionality about e-mail headers is described
+in L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>, which is a matured header object.
+Other kinds of headers will be translated to that type when time comes.
+
+On this page, the general methods which are available on any header are
+described.  Read about differences in the sub-class specific pages.
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+(stringifaction) The header, when used as string, will format as if
+L<Mail::Message::Head::Complete::string()|Mail::Message::Head::Complete/"Access to the header"> was called, so return a
+nicely folder full header.  An exception is made for Carp, which will
+get a simplified string to avoid unreadible messages from C<croak>
+and C<confess>.
+
+I<Example:> using a header object as string
+
+
+ print $head;     # implicit stringification by print
+ $head->print;    # the same
+
+ print "$head";   # explicit stringication
+
+=back
+
+overload: B<bool>
+
+=over 4
+
+When the header does not contain any lines (which is illegal, according
+to the RFCs), false is returned.  In all other cases, a true value is
+produced.
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<build>(FIELDS)
+
+=over 4
+
+A fast way to construct a header with many lines.
+The FIELDS are (name, content) pairs of the header.   A
+L<Mail::Message::Head::Complete|Mail::Message::Head::Complete> header is created by simply calling
+L<Mail::Message::Head::Complete::build()|Mail::Message::Head/"Constructors">, and then each field
+is added.  Double field names are permitted.
+
+I<Example:> 
+
+ my $head = Mail::Message::Head->build
+  ( From     => 'me at example.com'
+  , To       => 'you at anywhere.aq'
+  , Received => 'one'
+  , Received => 'two'
+  );
+
+ print ref $head;
+  # -->  Mail::Message::Head::Complete
+
+=back
+
+Mail::Message::Head-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+Create a new message header object.  The object will store all the
+fields of a header.  When you get information from the header, it
+will be returned to you as L<Mail::Message::Field|Mail::Message::Field> objects, although
+the fields may be stored differently internally.
+
+If you try to instantiate a L<Mail::Message::Head|Mail::Message::Head>, you will automatically
+be upgraded to a L<Mail::Message::Head::Complete|Mail::Message::Head::Complete> --a full head.
+
+ Option      Defined in       Default                                                 
+ field_type                   L<Mail::Message::Field::Fast|Mail::Message::Field::Fast>
+ log         L<Mail::Reporter>  C<'WARNINGS'>                                           
+ message                      undef                                                   
+ modified                     <false>                                                 
+ trace       L<Mail::Reporter>  C<'WARNINGS'>                                           
+
+. field_type CLASS
+
+=over 4
+
+The type of objects that all the fields will have.  This must be
+an extension of L<Mail::Message::Field|Mail::Message::Field>.
+
+=back
+
+. log LEVEL
+
+. message MESSAGE
+
+=over 4
+
+The MESSAGE where this header belongs to.  Usually, this is not known
+at creation of the header, but sometimes it is.  If not, call the
+message() method later to set it.
+
+=back
+
+. modified BOOLEAN
+
+. trace LEVEL
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+Headers may only be partially read, in which case they are called delayed.
+This method returns true if some header information still needs to be
+read. Returns false if all header data has been read.
+Will never trigger completion.
+
+=back
+
+$obj-E<gt>B<isEmpty>
+
+=over 4
+
+Are there any fields defined in the current header?  Be warned that
+the header will not be loaded for this: delayed headers will return
+true in any case.
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+Returns whether the header has been modified after being read.
+
+I<Example:> 
+
+ if($head->isModified) { ... }
+
+=back
+
+$obj-E<gt>B<knownNames>
+
+=over 4
+
+Like L<Mail::Message::Head::Complete::names()|Mail::Message::Head::Complete/"Access to the header">, but only returns the known
+header fields, which may be less than C<names> for header types which are
+partial.  C<names()> will trigger completion, where C<knownNames()> does not.
+
+=back
+
+$obj-E<gt>B<message>([MESSAGE])
+
+=over 4
+
+Get (after setting) the message where this header belongs to.
+This does not trigger completion.
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+Sets the modified flag to BOOLEAN.  Without value, the current setting is
+returned, but in that case you can better use L<isModified()|Mail::Message::Head/"The header">.
+Changing this flag will not trigger header completion.
+
+I<Example:> 
+
+ $head->modified(1);
+ if($head->modified) { ... }
+ if($head->isModified) { ... }
+
+=back
+
+$obj-E<gt>B<orderedFields>
+
+=over 4
+
+Retuns the fields ordered the way they were read or added.
+
+=back
+
+=head2 Access to the header
+
+
+$obj-E<gt>B<get>(NAME [,INDEX])
+
+=over 4
+
+Get the data which is related to the field with the NAME.  The case of the
+characters in NAME does not matter.
+
+If there is only one data element defined for the NAME, or if there is an
+INDEX specified as the second argument, only the specified element will be
+returned. If the field NAME matches more than one header the return value
+depends on the context. In LIST context, all values will be returned in
+the order they are read. In SCALAR context, only the last value will be
+returned.
+
+I<Example:> 
+
+ my $head = Mail::Message::Head->new;
+ $head->add('Received: abc');
+ $head->add('Received: xyz');
+ $head->add('Subject: greetings');
+
+ my @rec_list   = $head->get('Received');
+ my $rec_scalar = $head->get('Received');
+ print ", at rec_list,$rec_scalar,"     # ,abc xyz, xyz,
+ print $head->get('Received', 0);    # abc
+ my @sub_list   = $head->get('Subject');
+ my $sub_scalar = $head->get('Subject');
+ print ", at sub_list,$sub_scalar,"     # ,greetings, greetings,
+
+=back
+
+$obj-E<gt>B<study>(NAME [,INDEX])
+
+=over 4
+
+Like L<get()|Mail::Message::Head/"Access to the header">, but puts more effort in understanding the contents of the
+field.  L<Mail::Message::Field::study()|Mail::Message::Field/"Access to the content"> will be called for the field
+with the specified FIELDNAME, which returns L<Mail::Message::Field::Full|Mail::Message::Field::Full>
+objects. In scalar context only the last field with that name is returned.
+When an INDEX is specified, that element is returned.
+
+=back
+
+=head2 About the body
+
+
+$obj-E<gt>B<guessBodySize>
+
+=over 4
+
+Try to estimate the size of the body of this message, but without parsing
+the header or body.  The result might be C<undef> or a few percent of
+the real size.  It may even be very far of the real value, that's why
+this is a guess.
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+Returns whether the body of the related message is a multipart body.
+May trigger completion, when the C<Content-Type> field is not defined.
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<addNoRealize>(FIELD)
+
+=over 4
+
+Add a field, like L<Mail::Message::Head::Complete::add()|Mail::Message::Head::Complete/"Access to the header"> does, but
+avoid the loading of a possibly partial header.  This method does not
+test the validity of the argument, nor flag the header as changed.
+This does not trigger completion.
+
+=back
+
+$obj-E<gt>B<addOrderedFields>(FIELDS)
+
+=over 4
+
+=back
+
+$obj-E<gt>B<fileLocation>
+
+=over 4
+
+Returns the location of the header in the file, as a pair begin and end.  The
+begin is the first byte of the header.  The end is the first byte after
+the header.
+
+=back
+
+$obj-E<gt>B<load>
+
+=over 4
+
+Be sure that the header is loaded.  This returns the loaded header
+object.
+
+=back
+
+$obj-E<gt>B<moveLocation>(DISTANCE)
+
+=over 4
+
+Move the registration of the header in the file.
+
+=back
+
+$obj-E<gt>B<read>(PARSER)
+
+=over 4
+
+Read the header information of one message into this header structure.  This
+method is called by the folder object (some L<Mail::Box|Mail::Box> sub-class), which
+passes the PARSER as an argument.
+
+=back
+
+$obj-E<gt>B<setNoRealize>(FIELD)
+
+=over 4
+
+Set a field, but avoid the loading of a possibly partial header as set()
+does.  This method does not test the validity of the argument, nor flag the
+header as changed.  This does not trigger completion.
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Head-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Head-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Head-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+=head1 DETAILS
+
+
+=head2 Ordered header fields
+
+Many Perl implementations make a big mistake by disturbing the order
+of header fields.  For some fields (especially the I<resent groups>,
+see L<Mail::Message::Head::ResentGroup|Mail::Message::Head::ResentGroup>) the order shall be
+maintained.
+
+MailBox will keep the order of the fields as they were found in the
+source.  When your add a new field, it will be added at the end.  If
+your replace a field with a new value, it will stay in the original
+order.
+
+=head2 Head class implementation
+
+The header of a MIME message object contains a set of lines, which are
+called I<fields> (by default represented by L<Mail::Message::Field|Mail::Message::Field>
+objects).  Dependent on the situation, the knowledge about the fields can
+be in one of three situations, each represented by a sub-class of this
+module:
+
+=over 4
+
+=item * L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>
+
+In this case, it is sure that all knowledge about the header is available.
+When you L<get()|Mail::Message::Head/"Access to the header"> information from the header and it is not there, it will
+never be there.
+
+=item * L<Mail::Message::Head::Subset|Mail::Message::Head::Subset>
+
+There is no certainty whether all header lines are known (probably not).  This
+may be caused as result of reading a fast index file, as described in
+L<Mail::Box::MH::Index|Mail::Box::MH::Index>.  The object is automatically transformed
+into a L<Mail::Message::Head::Complete|Mail::Message::Head::Complete> when all header lines must be known.
+
+=item * L<Mail::Message::Head::Partial|Mail::Message::Head::Partial>
+
+A partial header is like a subset header: probably the header is incomplete.
+The means that you are not sure whether a L<get()|Mail::Message::Head/"Access to the header"> for a field fails because
+the field is not a part of the message or that it fails because it is not
+yet known to the program.  Where the subset header knows where to get the
+other fields, the partial header does not know it.  It cannot hide its
+imperfection.
+
+=item * L<Mail::Message::Head::Delayed|Mail::Message::Head::Delayed>
+
+In this case, there is no single field known.  Access to this header will
+always trigger the loading of the full header.
+
+=back
+
+=head2 Subsets of header fields
+
+Message headers can be quite large, and therefore MailBox provides
+simplified access to some subsets of information.  You can grab these
+sets of fields together, create and delete them as group.
+
+On the moment, the following sets are defined:
+
+=over 4
+
+=item * L<Mail::Message::Head::ResentGroup|Mail::Message::Head::ResentGroup>
+
+A I<resent group> is a set of fields which is used to log one step
+in the transmission of the message from the original sender to the
+destination.
+
+Each step adds a set of headers to indicate when the message was received
+and how it was forwarded (without modification).  These fields are
+best created using L<Mail::Message::bounce()|Mail::Message::Construct::Bounce/"Constructing a message">.
+
+=item * L<Mail::Message::Head::ListGroup|Mail::Message::Head::ListGroup>
+
+Fields which are used to administer and log mailing list activity.  Mailing
+list software has to play trics with the original message to be able to
+get the reply on that message back to the mailing list.  Usually a large
+number of lines are added.
+
+=item * L<Mail::Message::Head::SpamGroup|Mail::Message::Head::SpamGroup>
+
+A set of fields which contains header fields which are produced by
+spam detection software.  You may want to remove these fields when
+
+you store a message for a longer period of time.
+=back
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Part.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Part.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Part.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,129 @@
+use strict;
+use warnings;
+
+package Mail::Message::Part;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message';
+use Scalar::Util 'weaken';
+
+use Carp;
+
+
+sub init($)
+{   my ($self, $args) = @_;
+    $args->{head} ||= Mail::Message::Head::Complete->new;
+
+    $self->SUPER::init($args);
+
+    confess "No container specified for part.\n"
+        unless exists $args->{container};
+
+    weaken($self->{MMP_container})
+       if $self->{MMP_container} = $args->{container};
+
+    $self;
+}
+
+#------------------------------------------
+
+
+sub coerce($@)
+{   my ($class, $thing, $container) = (shift, shift, shift);
+
+    return $class->buildFromBody($thing, $container, @_)
+        if $thing->isa('Mail::Message::Body');
+
+    # Although cloning is a Bad Thing(tm), we must avoid modifying
+    # header fields of messages which reside in a folder.
+    my $message = $thing->isa('Mail::Box::Message') ? $thing->clone : $thing;
+
+    my $part    = $class->SUPER::coerce($message);
+    $part->container($container);
+    $part;
+}
+
+#------------------------------------------
+
+
+sub buildFromBody($$;@)
+{   my ($class, $body, $container) = (shift, shift, shift);
+    my @log     = $body->logSettings;
+
+    my $head    = Mail::Message::Head::Complete->new(@log);
+    while(@_)
+    {   if(ref $_[0]) {$head->add(shift)}
+        else          {$head->add(shift, shift)}
+    }
+
+    my $part = $class->new
+     ( head      => $head
+     , container => $container
+     , @log
+     );
+
+    $part->body($body);
+    $part;
+}
+
+#------------------------------------------
+
+sub container(;$)
+{   my $self = shift;
+    return $self->{MMP_container} unless @_;
+
+    $self->{MMP_container} = shift;
+    weaken($self->{MMP_container});
+}
+
+#------------------------------------------
+
+sub toplevel()
+{   my $body = shift->container or return;
+    my $msg  = $body->message   or return;
+    $msg->toplevel;
+}
+
+#------------------------------------------
+
+sub isPart() { 1 }
+
+#------------------------------------------
+
+
+sub printEscapedFrom($)
+{   my ($self, $out) = @_;
+    $self->head->print($out);
+    $self->body->printEscapedFrom($out);
+}
+
+#------------------------------------------
+
+sub readFromParser($;$)
+{   my ($self, $parser, $bodytype) = @_;
+
+    my $head = $self->readHead($parser)
+            || Mail::Message::Head::Complete->new
+                 ( message     => $self
+                 , field_type  => $self->{MM_field_type}
+                 , $self->logSettings
+                 );
+
+    my $body = $self->readBody($parser, $head, $bodytype)
+            || Mail::Message::Body::Lines->new(data => []);
+
+    $self->head($head);
+    $self->storeBody($body->contentInfoFrom($head));
+    $self;
+}
+
+#------------------------------------------
+
+
+sub destruct()
+{  my $self = shift;
+   $self->log(ERROR =>'You cannot destruct message parts, only whole messages');
+   undef;
+}
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Part.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Part.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Part.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,906 @@
+
+=head1 NAME
+
+Mail::Message::Part - a part of a message, but a message by itself
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Part
+   is a Mail::Message
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my Mail::Message $message = ...;
+ if($message->isMultipart) {
+    my Mail::Message::Part $part;
+
+    foreach $part ($message->body->parts) {
+       $part->print(\*OUT);
+       my $attached_head = $part->head;
+       my $attached_body = $part->body;      # encoded as read
+       my $attached_body = $part->decoded;   # transfer-encoding removed
+    }
+ }
+
+
+=head1 DESCRIPTION
+
+A C<Mail::Message::Part> object contains a message which is included in
+the body of an other message.  For instance I<attachments> are I<parts>.
+
+READ L<Mail::Message|Mail::Message> FIRST.  A part is a special message: it has a
+reference to its parent message, and will usually not be sub-classed
+into mail folder specific variants.
+
+
+
+=head1 METHODS
+
+
+$obj-E<gt>B<printEscapedFrom>(FILEHANDLE)
+
+=over 4
+
+Prints the message part, but all lines which start with 'From ' will get
+a leading C<gt>.  See L<Mail::Message::Body::printEscapedFrom()|Mail::Message::Body/"Access to the payload">.
+
+=back
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message/"Constructors">
+
+=back
+
+Mail::Message::Part-E<gt>B<coerce>(BODY|MESSAGE, MULTIPART, HEADERS)
+
+=over 4
+
+Transforms a BODY or MESSAGE to a real message part.  The MULTIPART
+refers to the parental body.
+
+When ta BODY is specified, extra HEADERS can be supplied as well.
+Bodies are coerced into message parts by calling L<buildFromBody()|Mail::Message::Part/"METHODS">.
+If you specify a MESSAGE residing in a folder, this message will
+automatically be cloned.
+
+=back
+
+Mail::Message::Part-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+Create a message part.
+
+ Option      Defined in       Default                                                       
+ body        L<Mail::Message>  undef                                                         
+ body_type   L<Mail::Message>  L<Mail::Message::Body::Lines|Mail::Message::Body::Lines>      
+ container                    <required>                                                    
+ deleted     L<Mail::Message>  <false>                                                       
+ field_type  L<Mail::Message>  undef                                                         
+ head        L<Mail::Message>  <empty header>                                                
+ head_type   L<Mail::Message>  L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>
+ labels      L<Mail::Message>  {}                                                            
+ log         L<Mail::Reporter>  C<'WARNINGS'>                                                 
+ messageId   L<Mail::Message>  undef                                                         
+ modified    L<Mail::Message>  <false>                                                       
+ trace       L<Mail::Reporter>  C<'WARNINGS'>                                                 
+ trusted     L<Mail::Message>  <false>                                                       
+
+. body OBJECT
+
+. body_type CLASS
+
+. container BODY
+
+=over 4
+
+Reference to the parental L<Mail::Message::Body|Mail::Message::Body> object where this part
+is a member of.  That object may be a L<Mail::Message::Body::Multipart|Mail::Message::Body::Multipart>
+or a L<Mail::Message::Body::Nested|Mail::Message::Body::Nested>.
+
+=back
+
+. deleted BOOLEAN
+
+. field_type CLASS
+
+. head OBJECT
+
+. head_type CLASS
+
+. labels ARRAY|HASH
+
+. log LEVEL
+
+. messageId STRING
+
+. modified BOOLEAN
+
+. trace LEVEL
+
+. trusted BOOLEAN
+
+=back
+
+=head2 Constructing a message
+
+
+$obj-E<gt>B<bounce>([RG-OBJECT|OPTIONS])
+
+=over 4
+
+See L<Mail::Message::Construct::Bounce/"Constructing a message">
+
+=back
+
+Mail::Message::Part-E<gt>B<build>([MESSAGE|BODY], CONTENT)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+Mail::Message::Part-E<gt>B<buildFromBody>(BODY, CONTAINER, HEADERS)
+
+=over 4
+
+Shape a message part around a BODY.  Bodies have information about their
+content in them, which is used to construct a header for the message.
+Next to that, more HEADERS can be specified.  No headers are obligatory.
+No extra headers are fabricated automatically.
+
+I<Example:> 
+
+ my $multi = Mail::Message::Body::Multipart->new;
+ my $part  = Mail::Message::Part->buildFromBody($body, $multi);
+
+=back
+
+$obj-E<gt>B<forward>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardAttach>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardEncapsulate>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardInline>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardNo>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPostlude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPrelude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardSubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+Mail::Message::Part-E<gt>B<read>(FILEHANDLE|SCALAR|REF-SCALAR|ARRAY-OF-LINES, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Read/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<rebuild>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<reply>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replyPrelude>([STRING|FIELD|ADDRESS|ARRAY-OF-THINGS])
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replySubject>(STRING)
+
+Mail::Message::Part-E<gt>B<replySubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+=head2 The Message
+
+
+$obj-E<gt>B<container>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isDummy>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isPart>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<messageId>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<send>([MAILER], OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<toplevel>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<write>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<bcc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<cc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<date>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<destinations>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<from>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<get>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<guessTimestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<head>([HEAD])
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<sender>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<study>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<subject>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<timestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<to>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+=head2 The body
+
+
+$obj-E<gt>B<body>([BODY])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<decoded>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<encode>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isNested>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<parts>(['ALL'|'ACTIVE'|'DELETED'|'RECURSE'|FILTER])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+=head2 Flags
+
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<deleted>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isDeleted>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<label>(LABEL|PAIRS)
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<labels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<labelsToStatus>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<statusToLabels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+=head2 The whole message as text
+
+
+$obj-E<gt>B<file>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<lines>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<printStructure>([FILEHANDLE][, INDENT])
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readBody>(PARSER, HEAD [, BODYTYPE])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readFromParser>(PARSER, [BODYTYPE])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readHead>(PARSER [,CLASS])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<recursiveRebuildPart>(PART, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Internals">
+
+=back
+
+$obj-E<gt>B<storeBody>(BODY)
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<takeMessageId>([STRING])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Message::Construct/"METHODS">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Part-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Part-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Part-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortSize>([VALUE])
+
+Mail::Message::Part-E<gt>B<shortSize>([VALUE])
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortString>
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<destruct>
+
+=over 4
+
+Message parts can not be destructed per part: only whole messages can
+be forcefully freed from memory.  Of course, you can L<delete()|Mail::Message/"Flags"> separate
+parts, which only sets a flag not to write a part again.  Furthermore,
+you may cosider L<rebuild()|Mail::Message::Construct::Rebuild/"Constructing a message"> to get rit of deleted parts.
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot include forward source as $include.
+
+Unknown alternative for the L<forward(include)|Mail::Message::Construct::Forward/"Constructing a message">.  Valid choices are
+C<NO>, C<INLINE>, C<ATTACH>, and C<ENCAPSULATE>.
+
+I<Error:> Cannot include reply source as $include.
+
+Unknown alternative for the C<include> option of L<reply()|Mail::Message::Construct::Reply/"Constructing a message">.  Valid
+choices are C<NO>, C<INLINE>, and C<ATTACH>.
+
+I<Error:> No address to create forwarded to.
+
+If a forward message is created, a destination address must be specified.
+
+I<Error:> No default mailer found to send message.
+
+The message L<send()|Mail::Message/"The Message"> mechanism had not enough information to automatically
+find a mail transfer agent to sent this message.  Specify a mailer
+explicitly using the C<via> options.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> You cannot destruct message parts, only whole messages
+
+Message parts can not be destructed per part: only whole messages can
+be forcefully freed from memory. Consider L<delete()|Mail::Message/"Flags"> or L<rebuild()|Mail::Message::Construct::Rebuild/"Constructing a message">.
+
+I<Error:> forwardAttach requires a preamble object
+
+
+I<Error:> forwardEncapsulate requires a preamble object
+
+
+I<Error:> no rebuild rule $name defined.
+
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Replace/MailHeader.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Replace/MailHeader.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Replace/MailHeader.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,196 @@
+
+use strict;
+use warnings;
+
+package Mail::Message::Replace::MailHeader;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::Head::Complete';
+
+
+sub new(@)
+{   my $class = shift;
+    unshift @_, 'raw_data' if @_ % 2;
+    $class->SUPER::new(@_);
+}
+
+sub init($)
+{   my ($self, $args) = @_;
+    defined $self->SUPER::init($args) or return;
+
+    $self->modify     ($args->{Modify}     || $args->{Reformat} || 0);
+    $self->fold_length($args->{FoldLength} || 79);
+    $self->mail_from  ($args->{MailFrom}   || 'KEEP');
+    $self;
+}
+
+
+sub delete($;$)
+{   my ($self, $tag) = (shift, shift);
+    return $self->delete($tag) unless @_;
+
+    my $index   = shift;
+    my @fields  = $self->get($tag);
+    my ($field) = splice @fields, $index, 1;
+    $self->reset($tag, @fields);
+    $field;
+}
+
+
+sub add($$)
+{   my $self  = shift;
+    my $field = $self->add(shift);
+    $field->unfoldedBody;
+}
+
+
+sub replace($$;$)
+{   my ($self, $tag, $line, $index) = @_;
+    $line =~ s/^([^:]+)\:\s*// && ($tag = $1) unless defined $tag;
+
+    my $field  = Mail::Message::Field::Fast->new($tag, $line);
+    my @fields = $self->get($tag);
+    $fields[ $index||0 ] = $field;
+    $self->reset($tag, @fields);
+
+    $field;
+}
+
+
+sub get($;$)
+{   my $head = shift->head;
+    my @ret  = map { $head->get(@_) } @_;
+
+    if(wantarray) { return @ret ? map({$_->unfoldedBody} @ret) : () }
+    else          { return @ret ? $ret[0]->unfoldedBody : undef }
+}
+
+
+sub modify(;$)
+{   my $self = shift;
+    @_ ? ($self->{MH_refold} = shift) : $self->{MH_refold};
+}
+
+
+sub mail_from(;$)
+{   my $self = shift;
+    return $self->{MH_mail_from} unless @_;
+
+    my $choice = uc(shift);
+    die "bad Mail-From choice: '$choice'"
+        unless $choice =~ /^(IGNORE|ERROR|COERCE|KEEP)$/;
+
+    $self->{MH_mail_from} = $choice;
+}
+
+
+sub fold(;$)
+{   my $self = shift;
+    my $wrap = @_ ? shift : $self->fold_length;
+    $_->setWrapLength($wrap) foreach $self->orderedFields;
+    $self;
+}
+
+
+sub unfold(;$)
+{   my $self = shift;
+    my @fields = @_ ? $self->get(shift) : $self->orderedFields;
+    $_->setWrapLength(100_000) foreach @fields;  # blunt approach
+    $self;
+}
+
+
+sub extract($)
+{   my ($self, $lines) = @_;
+
+    my $parser = Mail::Box::Parser::Perl->new
+       ( filename  => 'extract from array'
+       , data      => $lines
+       , trusted   => 1
+       );
+
+    $self->read($parser);
+    $parser->close;
+
+    # Remove header from array
+    shift @$lines while @$lines && $lines->[0] != m/^[\r\n]+/;
+    shift @$lines if @$lines;
+    $self;
+}
+
+
+sub read($)
+{   my ($self, $file) = @_;
+    my $parser = Mail::Box::Parser::Perl->new
+       ( filename  => ('from file-handle '.ref $file)
+       , file      => $file
+       , trusted   => 1
+       );
+    $self->read($parser);
+    $parser->close;
+    $self;
+}
+
+
+sub empty() { shift->removeFields( m/^/ ) }
+
+
+sub header(;$)
+{   my $self = shift;
+    $self->extract(shift) if @_;
+    $self->fold if $self->modify;
+    [ $self->orderedFields ];
+}
+
+
+sub header_hashref($) { die "Don't use header_hashref!!!" }
+
+
+sub combine($;$) { die "Don't use combine()!!!" }
+
+
+sub exists() { shift->count }
+
+
+sub as_string() { shift->string }
+
+
+sub fold_length(;$$)
+{   my $self = shift;
+    return $self->{MH_wrap} unless @_;
+
+    my $old  = $self->{MH_wrap};
+    my $wrap = $self->{MH_wrap} = shift;
+    $self->fold($wrap) if $self->modify;
+    $old;
+}    
+
+
+sub tags() { shift->names }
+
+
+sub dup() { shift->clone }
+
+
+sub cleanup() { shift }
+
+
+BEGIN
+{ *Mail::Header::new =
+     sub { my $class = shift;
+           Mail::Message::Replace::MailHeader->new(@_);
+         }
+}
+
+
+
+sub isa($)
+{   my ($thing, $class) = @_;
+    return 1 if $class eq 'Mail::Mailer';
+    $thing->SUPER::isa($class);
+}
+
+
+1;
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Replace/MailHeader.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Replace/MailHeader.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Replace/MailHeader.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,871 @@
+
+=head1 NAME
+
+Mail::Message::Replace::MailHeader - fake Mail::Header
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Replace::MailHeader
+   is a Mail::Message::Head::Complete
+   is a Mail::Message::Head
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ !!! VERY ALPHA CODE !!!
+
+ # change
+ use Mail::Internet;
+ use Mail::Header;
+ # into
+ use Mail::Message::Replace::MailInternet;
+ # in existing code, and the code should still work, but
+ # with the Mail::Message features.
+
+
+=head1 DESCRIPTION
+
+This module is a wrapper around a L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>,
+which simulates a L<Mail::Header> object.  The name-space of that module
+is hijacked and many methods are added.
+
+Most methods will work without any change, but you should test your
+software again.  Small changes have been made to L<fold_length()|Mail::Message::Replace::MailHeader/"Simulating Mail::Header">,
+L<header_hashref()|Mail::Message::Replace::MailHeader/"Simulating Mail::Header">.
+
+
+=head1 OVERLOADED
+
+
+overload: B<"">
+
+=over 4
+
+See L<Mail::Message::Head/"OVERLOADED">
+
+=back
+
+overload: B<bool>
+
+=over 4
+
+See L<Mail::Message::Head/"OVERLOADED">
+
+=back
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<build>(FIELDS)
+
+=over 4
+
+See L<Mail::Message::Head/"Constructors">
+
+=back
+
+$obj-E<gt>B<clone>([FIELDS])
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Constructors">
+
+=back
+
+Mail::Message::Replace::MailHeader-E<gt>B<new>([ARG], OPTIONS)
+
+=over 4
+
+The ARG is an array with header lines.
+
+ Option      Defined in       Default                                                 
+ FoldLength                   79                                                      
+ MailFrom                     C<'KEEP'>                                               
+ Modify                       <false>                                                 
+ field_type  L<Mail::Message::Head>  L<Mail::Message::Field::Fast|Mail::Message::Field::Fast>
+ log         L<Mail::Reporter>  C<'WARNINGS'>                                           
+ message     L<Mail::Message::Head>  undef                                                   
+ modified    L<Mail::Message::Head>  <false>                                                 
+ trace       L<Mail::Reporter>  C<'WARNINGS'>                                           
+
+. FoldLength INTEGER
+
+. MailFrom 'IGNORE'|'ERROR'|'COERCE'|'KEEP'
+
+=over 4
+
+How to handle the C<From > lines.  See L<mail_from()|Mail::Message::Replace::MailHeader/"Simulating Mail::Header">.
+
+=back
+
+. Modify BOOLEAN
+
+=over 4
+
+Reformat all header lines when they come in: change the folding.
+
+=back
+
+. field_type CLASS
+
+. log LEVEL
+
+. message MESSAGE
+
+. modified BOOLEAN
+
+. trace LEVEL
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<isEmpty>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<knownNames>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<message>([MESSAGE])
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"The header">
+
+=back
+
+$obj-E<gt>B<orderedFields>
+
+=over 4
+
+See L<Mail::Message::Head/"The header">
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"The header">
+
+=back
+
+=head2 Access to the header
+
+
+$obj-E<gt>B<add>(LINE, [INDEX])
+
+=over 4
+
+Add a header line, which simply calls C<Mail::Message::Head::add()> on
+the header for the specified LINE.  The INDEX is ignored, the unfolded
+body of the field is returned.
+
+=back
+
+$obj-E<gt>B<addListGroup>(OBJECT)
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<addResentGroup>(RESENT-GROUP|DATA)
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<addSpamGroup>(OBJECT)
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<count>(NAME)
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<delete>(TAG, [INDEX])
+
+=over 4
+
+Delete the fields with the specified TAG.  The deleted fields are
+returned.  If no index is given, then all are removed.
+
+=back
+
+$obj-E<gt>B<get>(NAME, [INDEX])
+
+=over 4
+
+Get all the header fields with the specified NAME.  In scalar context,
+only the first fitting NAME is returned.  Even when only one NAME is
+specified, multiple lines may be returned in list context: some fields
+appear more than once in a header.
+
+=back
+
+$obj-E<gt>B<grepNames>([NAMES|ARRAY-OF-NAMES|REGEXS])
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<listGroup>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<names>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<printUndisclosed>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<removeContentInfo>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<removeField>(FIELD)
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<removeFields>(STRING|REGEXP, [STRING|REGEXP, ...])
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<removeFieldsExcept>(STRING|REGEXP, [STRING|REGEXP, ...])
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<removeListGroup>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<removeResentGroups>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<removeSpamGroups>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<replace>(TAG, LINE, [INDEX])
+
+=over 4
+
+Replace the field named TAG. from place INDEX (by default the first) by
+the LINE.  When TAG is C<undef>, it will be extracted from the LINE first.
+This calls L<Mail::Message::Head::Complete::reset()|Mail::Message::Head::Complete/"Access to the header"> on the message's head.
+
+=back
+
+$obj-E<gt>B<resentGroups>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<reset>(NAME, FIELDS)
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<set>(FIELD | LINE | (NAME, BODY [,ATTRS]))
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<spamDetected>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<spamGroups>([NAMES])
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Access to the header">
+
+=back
+
+$obj-E<gt>B<study>(NAME [,INDEX])
+
+=over 4
+
+See L<Mail::Message::Head/"Access to the header">
+
+=back
+
+=head2 About the body
+
+
+$obj-E<gt>B<guessBodySize>
+
+=over 4
+
+See L<Mail::Message::Head/"About the body">
+
+=back
+
+$obj-E<gt>B<guessTimeStamp>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"About the body">
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+See L<Mail::Message::Head/"About the body">
+
+=back
+
+$obj-E<gt>B<recvstamp>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"About the body">
+
+=back
+
+$obj-E<gt>B<timestamp>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"About the body">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<addNoRealize>(FIELD)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<addOrderedFields>(FIELDS)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<createFromLine>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Internals">
+
+=back
+
+$obj-E<gt>B<createMessageId>
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Internals">
+
+=back
+
+$obj-E<gt>B<fileLocation>
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<load>
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<messageIdPrefix>([STRING])
+
+=over 4
+
+See L<Mail::Message::Head::Complete/"Internals">
+
+=back
+
+$obj-E<gt>B<moveLocation>(DISTANCE)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+$obj-E<gt>B<setNoRealize>(FIELD)
+
+=over 4
+
+See L<Mail::Message::Head/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Replace::MailHeader-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Replace::MailHeader-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Replace::MailHeader-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+=head2 Access to the header
+
+
+=head2 Simulating Mail::Header
+
+
+$obj-E<gt>B<as_string>
+
+=over 4
+
+Returns the whole header as one big scalar.
+Calls L<Mail::Message::Head::Complete::string()|Mail::Message::Head::Complete/"Access to the header">.
+
+=back
+
+$obj-E<gt>B<cleanup>
+
+=over 4
+
+Cleanup memory usage.  Not needed here.
+
+=back
+
+$obj-E<gt>B<combine>(TAG, [WITH])
+
+=over 4
+
+I do not see any valid reason for this command, so did not implement it.
+
+=back
+
+$obj-E<gt>B<dup>
+
+=over 4
+
+Duplicate the header, which is simply L<clone()|Mail::Message::Head::Complete/"Constructors">.
+
+=back
+
+$obj-E<gt>B<empty>
+
+=over 4
+
+Clean-out the whole hash. Better not use this (simply create another
+header object), although it should work.
+
+=back
+
+$obj-E<gt>B<exists>
+
+=over 4
+
+Returns whether there are any fields.
+
+=back
+
+$obj-E<gt>B<extract>(ARRAY)
+
+=over 4
+
+Extract (and remove) header fields from the array.
+
+=back
+
+$obj-E<gt>B<fold>([LENGTH])
+
+=over 4
+
+Refold all fields in the header, to LENGTH or whatever L<fold_length()|Mail::Message::Replace::MailHeader/"Simulating Mail::Header">
+returns.
+
+=back
+
+$obj-E<gt>B<fold_length>([[TAG], LENGTH])
+
+=over 4
+
+Returns the line wrap, optionally after setting it to LENGTH.  The
+old value is returned.  The TAG argument is ignored, because it is
+silly to have different lines fold in different ways.  This method
+cannot be called statically anymore.
+
+=back
+
+$obj-E<gt>B<header>([ARRAY])
+
+=over 4
+
+Extract the fields from the ARRAY, if specified, and then fold the fields.
+Returned is an array with all fields, produced via L<orderedFields()|Mail::Message::Head/"The header">.
+
+=back
+
+$obj-E<gt>B<header_hashref>(HASH)
+
+=over 4
+
+If you are using this method, you must be stupid... anyway: I do not want to
+support it for now: use L<add()|Mail::Message::Replace::MailHeader/"Access to the header"> and friends.
+
+=back
+
+$obj-E<gt>B<mail_from>(['IGNORE'|'ERROR'|'COERCE'|'KEEP'])
+
+=over 4
+
+What to do when a header line in the form `From ' is encountered. Valid
+values are C<IGNORE> - ignore and discard the header, C<ERROR> - invoke
+an error (call die), C<COERCE> - rename them as Mail-From and C<KEEP>
+- keep them.
+
+=back
+
+$obj-E<gt>B<modify>([BOOLEAN])
+
+=over 4
+
+Refold the headers when they are added.
+
+=back
+
+$obj-E<gt>B<read>(FILE)
+
+=over 4
+
+Read the header from the FILE.
+
+=back
+
+$obj-E<gt>B<tags>
+
+=over 4
+
+Returns all the names of fields, implemented by
+L<Mail::Message::Head::Complete::names()|Mail::Message::Head::Complete/"Access to the header">.
+
+=back
+
+$obj-E<gt>B<unfold>([TAG])
+
+=over 4
+
+Remove the folding for all instances of TAG, or all fields at once.
+
+=back
+
+=head2 The nasty bits
+
+
+$obj-E<gt>B<isa>(CLASS)
+
+Mail::Message::Replace::MailHeader-E<gt>B<isa>(CLASS)
+
+=over 4
+
+Of course, the C<isa()> class inheritance check should not see our
+nasty trick.
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> Cannot remove field $name from header: not found.
+
+You ask to remove a field which is not known in the header.  Using
+L<delete()|Mail::Message::Replace::MailHeader/"Access to the header">, L<reset()|Mail::Message::Head::Complete/"Access to the header">, or L<set()|Mail::Message::Head::Complete/"Access to the header"> to do the job will not result
+in warnings: those methods check the existence of the field first.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Replace/MailInternet.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Replace/MailInternet.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Replace/MailInternet.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,361 @@
+
+use strict;
+use warnings;
+
+package Mail::Message::Replace::MailInternet;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message';
+
+use Mail::Box::FastScalar;
+use Mail::Box::Parser::Perl;
+use Mail::Message::Body::Lines;
+
+use File::Spec;
+
+
+sub new(@)
+{   my $class = shift;
+    my $data  = @_ % 2 ? shift : undef;
+    $class = __PACKAGE__ if $class eq 'Mail::Internet';
+    $class->SUPER::new(@_, raw_data => $data);
+}
+
+sub init($)
+{   my ($self, $args) = @_;
+    $args->{head_type} ||= 'Mail::Message::Replace::MailHeader';
+    $args->{head}      ||= $args->{Header};
+    $args->{body}      ||= $args->{Body};
+
+    defined $self->SUPER::init($args) or return;
+
+    $self->{MI_wrap}      = $args->{FoldLength} || 79;
+    $self->{MI_mail_from} = $args->{MailFrom};
+    $self->{MI_modify}    = exists $args->{Modify} ? $args->{Modify} : 1;
+
+    $self->processRawData($self->{raw_data}, !defined $args->{Header}
+       , !defined $args->{Body}) if defined $self->{raw_data};
+
+    $self;
+}
+
+sub processRawData($$$)
+{   my ($self, $data, $get_head, $get_body) = @_;
+    return $self unless $get_head || $get_body;
+ 
+    my ($filename, $lines);
+    if(ref $data eq 'ARRAY')
+    {   $filename = 'array of lines';
+        $lines    = $data;
+    }
+    elsif(ref $data eq 'GLOB')
+    {   $filename = 'file (GLOB)';
+        $lines    = [ <$data> ];
+    }
+    elsif(ref $data && $data->isa('IO::Handle'))
+    {   $filename = 'file ('.ref($data).')';
+        $lines    = [ $data->getlines ];
+    }
+    else
+    {   $self->log(ERROR=> "Mail::Internet does not support this kind of data");
+        return undef;
+    }
+
+    return unless @$lines;
+
+    my $buffer = join '', @$lines;
+    my $file   = Mail::Box::FastScalar->new(\$buffer);
+
+    my $parser = Mail::Box::Parser::Perl->new
+     ( filename  => $filename
+     , file      => $file
+     , trusted   => 1
+     );
+
+    my $head;
+    if($get_head)
+    {   my $from = substr($lines->[0], 0, 5) eq 'From ' ? shift @$lines : undef;
+
+        my $head = $self->{MM_head_type}->new
+          ( MailFrom   => $self->{MI_mail_from}
+          , Modify => $self->{MI_modify}
+          , FoldLength => $self->{MI_wrap}
+          );
+        $head->read($parser);
+        $head->mail_from($from) if defined $from;
+        $self->head($head);
+    }
+    else
+    {   $head = $self->head;
+    }
+
+    $self->storeBody($self->readBody($parser, $head)) if $get_body;
+    $self->addReport($parser);
+    $parser->stop;
+    $self;
+}
+
+
+sub coerce() { confess }
+
+
+sub dup()
+{   my $self = shift;
+    ref($self)->coerce($self->clone);
+}
+
+
+sub empty() { shift->DESTROY }
+
+
+sub MailFrom(;$)
+{   my $self = shift;
+    @_ ? ($self->{MI_mail_from} = shift) : $self->{MU_mail_from};
+}
+
+
+sub read($@)
+{   my $thing = shift;
+
+    return $thing->SUPER::read(@_)   # Mail::Message behavior
+        unless ref $thing;
+
+    # Mail::Header emulation
+    my $data = shift;
+    $thing->processRawData($data, 1, 1);
+}
+
+
+sub read_body($)
+{   my ($self, $data) = @_;
+    $self->processRawData($data, 0, 1);
+}
+
+
+sub read_header($)
+{   my ($self, $data) = @_;
+    $self->processRawData($data, 1, 0);
+}
+
+
+sub extract($)
+{   my ($self, $data) = @_;
+    $self->processRawData($data, 1, 1);
+}
+
+
+sub reply(@)
+{   my ($self, %args) = @_;
+
+    my $reply_head = $self->{MM_head_type}->new;
+    my $home       = $ENV{HOME} || File::Spec->curdir;
+    my $headtemp   = File::Spec->catfile($home, '.mailhdr');
+
+    if(open HEAD, '<', $headtemp)
+    {    my $parser = Mail::Box::Parser::Perl->new
+           ( filename  => $headtemp
+           , file      => \*HEAD
+           , trusted   => 1
+           );
+         $reply_head->read($parser);
+         $parser->close;
+    }
+
+    $args{quote}       ||= delete $args{Inline}   || '>';
+    $args{group_reply} ||= delete $args{ReplyAll} || 0;
+    my $keep             = delete $args{Keep}     || [];
+    my $exclude          = delete $args{Exclude}  || [];
+
+    my $reply = $self->SUPER::reply(%args);
+
+    my $head  = $self->head;
+
+    $reply_head->add($_->clone)
+        foreach map { $head->get($_) } @$keep;
+
+    $reply_head->reset($_) foreach @$exclude;
+
+    ref($self)->coerce($reply);
+}
+
+
+sub add_signature(;$)
+{   my $self     = shift;
+    my $filename = shift
+       || File::Spec->catfile($ENV{HOME} || File::Spec->curdir, '.signature');
+    $self->sign(File => $filename);
+}
+
+
+sub sign(@)
+{   my ($self, $args) = @_;
+    my $sig;
+
+    if(my $filename = delete $self->{File})
+    {   $sig = Mail::Message::Body->new(file => $filename);
+    }
+    elsif(my $sig   = delete $self->{Signature})
+    {   $sig = Mail::Message::Body->new(data => $sig);
+    }
+
+    return unless defined $sig;
+ 
+    my $body = $self->decoded->stripSignature;
+    my $set  = $body->concatenate($body, "-- \n", $sig);
+    $self->body($set) if defined $set;
+    $set;
+}
+
+
+sub send($@)
+{   my ($self, $type, %args) = @_;
+    $self->send(via => $type);
+}
+
+
+sub nntppost(@)
+{   my ($self, %args) = @_;
+    $args{port}       ||= delete $args{Port};
+    $args{nntp_debug} ||= delete $args{Debug};
+
+    $self->send(via => 'nntp', %args);
+}
+
+
+
+sub head(;$)
+{  my $self = shift;
+   return $self->SUPER::head(@_) if @_;
+   $self->SUPER::head || $self->{MM_head_type}->new(message => $self);
+}
+
+
+sub header(;$) { shift->head->header(@_) }
+
+
+sub fold(;$) { shift->head->fold(@_) }
+
+
+sub fold_length(;$$) { shift->head->fold_length(@_) }
+
+
+sub combine($;$) { shift->head->combine(@_) }
+
+
+sub print_header(@) { shift->head->print(@_) }
+
+
+sub clean_header() { shift->header }
+
+
+sub tidy_headers() { }
+
+
+sub add(@) { shift->head->add(@_) }
+
+
+sub replace(@) { shift->head->replace(@_) }
+
+
+sub get(@) { shift->head->get(@_) }
+
+
+sub delete(@)
+{   my $self = shift;
+    @_ ?  $self->head->delete(@_) : $self->SUPER::delete;
+}
+
+
+sub body(@)
+{   my $self = shift;
+
+    unless(@_)
+    {   my $body = $self->body;
+        return defined $body ? scalar($body->lines) : [];
+    }
+
+    my $data = ref $_[0] eq 'ARRAY' ? shift : \@_;
+    my $body  = Mail::Message::Body::Lines->new(data => $data);
+    $self->body($body);
+
+    $body;
+}
+
+
+sub print_body(@) { shift->SUPER::body->print(@_) }
+
+
+sub bodyObject(;$) { shift->SUPER::body(@_) }
+
+
+sub remove_sig(;$)
+{   my $self  = shift;
+    my $lines = shift || 10;
+    my $stripped = $self->decoded->stripSignature(max_lines => $lines);
+    $self->body($stripped) if defined $stripped;
+    $stripped;
+}
+
+
+sub tidy_body(;$)
+{   my $self  = shift;
+
+    my $body  = $self->body or return;
+    my @body  = $body->lines;
+
+    shift @body while @body &&  $body[0] =~ m/^\s*$/;
+    pop   @body while @body && $body[-1] =~ m/^\s*$/;
+
+    return $body if $body->nrLines == @body;
+    my $new = Mail::Message::Body::Lines->new(based_on => $body, data=>\@body);
+    $self->body($new);
+}
+
+
+sub smtpsend(@)
+{   my ($self, %args) = @_;
+    my $from = $args{MailFrom} || $ENV{MAILADDRESS} || $ENV{USER} || 'unknown';
+    $args{helo}       ||= delete $args{Hello};
+    $args{port}       ||= delete $args{Port};
+    $args{smtp_debug} ||= delete $args{Debug};
+
+    my $host  = $args{Host};
+    unless(defined $host)
+    {   my $hosts = $ENV{SMTPHOSTS};
+        $host = (split /\:/, $hosts)[0] if defined $hosts;
+    }
+    $args{host} = $host;
+
+    $self->send(via => 'smtp', %args);
+}
+
+
+sub as_mbox_string()
+{   my $self   = shift;
+    my $head   = $self->head->clone;
+    $head->delete('Content-Length');
+
+    my $buffer = '';
+    my $file   = Mail::Box::FastScalar->new(\$buffer);
+    $head->print($file);
+    $self->body->printEscapedFrom($file);
+    $buffer;
+}
+
+
+BEGIN { *Mail::Internet::new =
+          sub { my $class = shift;
+                Mail::Message::Replace::MailInternet->new(@_);
+              }
+      }
+
+
+sub isa($)
+{   my ($thing, $class) = @_;
+    return 1 if $class eq 'Mail::Internet';
+    $thing->SUPER::isa($class);
+}
+
+
+1;
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Replace/MailInternet.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Replace/MailInternet.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Replace/MailInternet.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,1346 @@
+
+=head1 NAME
+
+Mail::Message::Replace::MailInternet - fake Mail::Internet
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Replace::MailInternet
+   is a Mail::Message
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ !!! VERY ALPHA CODE !!!
+
+ # change
+ use Mail::Internet;
+ # into
+ use Mail::Message::Replace::MailInternet;
+ # in existing code, and the code should still work, but
+ # with the Mail::Message features.
+
+
+=head1 DESCRIPTION
+
+This module is a wrapper around a L<Mail::Message|Mail::Message>, which simulates
+a L<Mail::Internet> object.  The name-space of that module is hijacked
+and many methods are added.
+
+Most methods will work without any change, but you may need to have
+a look at your L<smtpsend()|Mail::Message::Replace::MailInternet/"The body"> and L<send()|Mail::Message::Replace::MailInternet/"The Message"> calls.
+
+
+=head1 OVERLOADED
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+See L<Mail::Message/"Constructors">
+
+=back
+
+Mail::Message::Replace::MailInternet-E<gt>B<coerce>(MESSAGE)
+
+=over 4
+
+Coerce (adapt type) of the specified MESSAGE (anything
+L<Mail::Message::coerce()|Mail::Message/"Constructors"> accepts) into an Mail::Internet simulating
+object.
+
+=back
+
+$obj-E<gt>B<dup>
+
+=over 4
+
+Duplicate the message.  The result will again be a L<Mail::Internet>
+compatible object.
+
+=back
+
+$obj-E<gt>B<empty>
+
+=over 4
+
+Remove all data from this object.  Very dangerous!
+
+=back
+
+Mail::Message::Replace::MailInternet-E<gt>B<new>([ARG], [OPTIONS])
+
+=over 4
+
+ Option      Defined in       Default                                                                 
+ Body                         C<undef>                                                                
+ FoldLength                   79                                                                      
+ Header                       C<undef>                                                                
+ MailFrom                     C<'KEEP'>                                                               
+ Modify                       0                                                                       
+ body        L<Mail::Message>  undef                                                                   
+ body_type   L<Mail::Message>  L<Mail::Message::Body::Lines|Mail::Message::Body::Lines>                
+ deleted     L<Mail::Message>  <false>                                                                 
+ field_type  L<Mail::Message>  undef                                                                   
+ head        L<Mail::Message>  undef                                                                   
+ head_type   L<Mail::Message>  L<Mail::Message::Replace::MailHeader|Mail::Message::Replace::MailHeader>
+ labels      L<Mail::Message>  {}                                                                      
+ log         L<Mail::Reporter>  C<'WARNINGS'>                                                           
+ messageId   L<Mail::Message>  undef                                                                   
+ modified    L<Mail::Message>  <false>                                                                 
+ trace       L<Mail::Reporter>  C<'WARNINGS'>                                                           
+ trusted     L<Mail::Message>  <false>                                                                 
+
+. Body ARRAY-OF-LINES
+
+=over 4
+
+Array of C<"\n"> terminated lines.  If not specified, the lines will be
+read from ARG.
+
+=back
+
+. FoldLength INTEGER
+
+=over 4
+
+Number of characters permitted on any refolded header line.
+Passed to L<Mail::Message::Replace::MailHeader::new(FoldLength)|Mail::Message::Replace::MailHeader/"METHODS">.
+
+=back
+
+. Header OBJECT
+
+=over 4
+
+The L<Mail::Header> object, which is passed here, is a fake one as well...
+It is translated into a L<new(head)|Mail::Message/"Constructors">.  If not given, the header will be
+parsed from the ARG.
+
+=back
+
+. MailFrom 'IGNORE'|'ERROR'|'COERCE'|'KEEP'
+
+=over 4
+
+What to do with leading "C<From >" lines in e-mail data.
+Passed to L<Mail::Message::Replace::MailHeader::new(MailFrom)|Mail::Message::Replace::MailHeader/"METHODS">.
+
+=back
+
+. Modify BOOLEAN
+
+=over 4
+
+Whether to re-fold all the incoming fields.
+Passed to L<Mail::Message::Replace::MailHeader::new(Modify)|Mail::Message::Replace::MailHeader/"METHODS">.
+
+=back
+
+. body OBJECT
+
+. body_type CLASS
+
+. deleted BOOLEAN
+
+. field_type CLASS
+
+. head OBJECT
+
+. head_type CLASS
+
+. labels ARRAY|HASH
+
+. log LEVEL
+
+. messageId STRING
+
+. modified BOOLEAN
+
+. trace LEVEL
+
+. trusted BOOLEAN
+
+I<Example:> replace traditional Mail::Internet by this wrapper
+
+
+  # was
+  use Mail::Internet;
+  my $mi = Mail::Internet->new(@options);
+
+  # becomes
+  use Mail::Message::Replace::MailInternet;
+  my $mi = Mail::Internet->new(@options);
+
+=back
+
+=head2 Attributes
+
+
+$obj-E<gt>B<MailFrom>([STRING])
+
+=over 4
+
+Your email address.
+
+=back
+
+=head2 Constructing a message
+
+
+$obj-E<gt>B<add_signature>([FILENAME])
+
+=over 4
+
+Replaced by L<sign()|Mail::Message::Replace::MailInternet/"Constructing a message">, but still usable. FILENAME is the file which
+contains the signature, which defaults to C<$ENV{HOME}/.signature>.
+
+=back
+
+$obj-E<gt>B<bounce>([RG-OBJECT|OPTIONS])
+
+=over 4
+
+See L<Mail::Message::Construct::Bounce/"Constructing a message">
+
+=back
+
+Mail::Message::Replace::MailInternet-E<gt>B<build>([MESSAGE|BODY], CONTENT)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+Mail::Message::Replace::MailInternet-E<gt>B<buildFromBody>(BODY, [HEAD], HEADERS)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<extract>(ARRAY or FILEHANDLE)
+
+=over 4
+
+Read header and body from an ARRAY or FILEHANDLE
+
+=back
+
+$obj-E<gt>B<forward>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardAttach>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardEncapsulate>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardInline>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardNo>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPostlude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPrelude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardSubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<read>(ARRAY|FILEHANDLE, OPTIONS)
+
+Mail::Message::Replace::MailInternet-E<gt>B<read>(ARRAY|FILEHANDLE, OPTIONS)
+
+=over 4
+
+Read header and body from the specified ARRAY or FILEHANDLE.  When used as
+object method, L<Mail::Message::read()|Mail::Message::Construct::Read/"Constructing a message"> is called, to be MailBox compliant.
+As class method, the Mail::Internet compatible read is called.  OPTIONS are
+only available in the first case.
+
+ Option               Defined in       Default 
+ body_type            L<Mail::Message::Construct::Read>  C<undef>
+ strip_status_fields  L<Mail::Message::Construct::Read>  <true>  
+
+. body_type CLASS
+
+. strip_status_fields BOOLEAN
+
+=back
+
+$obj-E<gt>B<read_body>(ARRAY|FILEHANDLE)
+
+=over 4
+
+Read only the message's body from the ARRAY or FILEHANDLE.
+
+=back
+
+$obj-E<gt>B<read_header>(ARRAY|FILEHANDLE)
+
+=over 4
+
+Read only the message's header from the ARRAY or FILEHANDLE
+
+=back
+
+$obj-E<gt>B<rebuild>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<reply>(OPTIONS)
+
+=over 4
+
+BE WARNED: the main job for creating a reply is done by
+L<Mail::Message::reply()|Mail::Message::Construct::Reply/"Constructing a message">, which may produce a result which is compatible,
+but may be different from L<Mail::Internet>'s version.
+
+ Option           Defined in       Default                                                                   
+ Bcc              L<Mail::Message::Construct::Reply>  undef                                                                     
+ Cc               L<Mail::Message::Construct::Reply>  <'cc' in current>                                                         
+ Exclude                           []                                                                        
+ From             L<Mail::Message::Construct::Reply>  <'to' in current>                                                         
+ Inline                            E<gt>                                                                     
+ Keep                              []                                                                        
+ Message-ID       L<Mail::Message::Construct::Reply>  <uniquely generated>                                                      
+ ReplyAll                          <false>                                                                   
+ Subject          L<Mail::Message::Construct::Reply>  L<replySubject()|Mail::Message::Construct::Reply/"Constructing a message">
+ To               L<Mail::Message::Construct::Reply>  <sender in current>                                                       
+ body             L<Mail::Message::Construct::Reply>  undef                                                                     
+ group_reply      L<Mail::Message::Construct::Reply>  <true>                                                                    
+ header_template                   C<$ENV{HOME}/.mailhdr>                                                    
+ include          L<Mail::Message::Construct::Reply>  C<'INLINE'>                                                               
+ max_signature    L<Mail::Message::Construct::Reply>  C<10>                                                                     
+ message_type     L<Mail::Message::Construct::Reply>  L<Mail::Message|Mail::Message>                                            
+ postlude         L<Mail::Message::Construct::Reply>  undef                                                                     
+ prelude          L<Mail::Message::Construct::Reply>  undef                                                                     
+ quote            L<Mail::Message::Construct::Reply>  'E<gt> '                                                                  
+ signature        L<Mail::Message::Construct::Reply>  undef                                                                     
+ strip_signature  L<Mail::Message::Construct::Reply>  C<qr/^--\s/>                                                              
+
+. Bcc ADDRESSES
+
+. Cc ADDRESSES
+
+. Exclude ARRAY-OF-NAMES
+
+=over 4
+
+Remove the fields witht the specified names from the produced reply message.
+
+=back
+
+. From ADDRESSES
+
+. Inline STRING
+
+=over 4
+
+Quotation STRING, which is translated into L<reply(quote)|Mail::Message::Construct::Reply/"Constructing a message">.  The normal
+default of C<quote> is "E<gt> ", in stead of "E<gt>".
+
+=back
+
+. Keep ARRAY-OF-NAMES
+
+=over 4
+
+Copy all header fields with the specified NAMES from the source to the
+reply message.
+
+=back
+
+. Message-ID STRING
+
+. ReplyAll BOOLEAN
+
+=over 4
+
+Reply to the group?  Translated into L<reply(group_reply)|Mail::Message::Construct::Reply/"Constructing a message">, which has
+as default the exact oposite of this option, being C<true>.
+
+=back
+
+. Subject STRING|CODE
+
+. To ADDRESSES
+
+. body BODY
+
+. group_reply BOOLEAN
+
+. header_template FILENAME|C<undef>
+
+=over 4
+
+Read the return header from the template file.  When this is explicitly
+set to C<undef>, or the file does not exist, then a header will be created.
+
+=back
+
+. include 'NO'|'INLINE'|'ATTACH'
+
+. max_signature INTEGER
+
+. message_type CLASS
+
+. postlude BODY|LINES
+
+. prelude BODY|LINES
+
+. quote CODE|STRING
+
+. signature BODY|MESSAGE
+
+. strip_signature REGEXP|STRING|CODE
+
+=back
+
+$obj-E<gt>B<replyPrelude>([STRING|FIELD|ADDRESS|ARRAY-OF-THINGS])
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replySubject>(STRING)
+
+Mail::Message::Replace::MailInternet-E<gt>B<replySubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<sign>(OPTIONS)
+
+=over 4
+
+Add a signature (a few extra lines) to the message.
+
+ Option     Defined in       Default 
+ File                        C<undef>
+ Signature                   ''      
+
+. File FILENAME
+
+=over 4
+
+Specifies a filename where the signature is in.
+
+=back
+
+. Signature STRING|ARRAY-OF-LINES
+
+=over 4
+
+The signature in memory.
+
+=back
+
+=back
+
+=head2 The Message
+
+
+$obj-E<gt>B<container>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isDummy>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<isPart>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<messageId>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<nntppost>(OPTIONS)
+
+=over 4
+
+Send an NNTP message (newsgroup message), which is equivalent to
+Mail::Transport::NNTP or L<Mail::Message::send()|Mail::Message/"The Message"> with C<via 'nntp'>.
+
+ Option  Defined in       Default           
+ Debug                    <false>           
+ Host                     <from Net::Config>
+ Port                     119               
+
+. Debug BOOLEAN
+
+. Host HOSTNAME
+
+. Port INTEGER
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+Prints the whole message to the specified FILEHANDLE, which default to
+STDOUT.  This calls L<Mail::Message::print()|Mail::Message/"The Message">.
+
+=back
+
+$obj-E<gt>B<send>(TYPE, OPTIONS)
+
+=over 4
+
+Send via Mail Transfer Agents (MUA).  These will be handled by various
+L<Mail::Transport::Send|Mail::Transport::Send> extensions.  The C<test> TYPE is not supported.
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<toplevel>
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+$obj-E<gt>B<write>([FILEHANDLE])
+
+=over 4
+
+See L<Mail::Message/"The Message">
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<add>(LINES)
+
+=over 4
+
+Add header lines, which simply calls C<Mail::Message::Head::add()> on
+the header for each specified LINE. The last added LINE is returned.
+
+=back
+
+$obj-E<gt>B<bcc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<cc>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<clean_header>
+
+=over 4
+
+Not to be used, replaced by L<header()|Mail::Message::Replace::MailInternet/"The header">.
+
+=back
+
+$obj-E<gt>B<combine>(TAG, [WITH])
+
+=over 4
+
+Not implemented, because I see no use for it.
+
+=back
+
+$obj-E<gt>B<date>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<delete>(NAME, [INDEX]])
+
+=over 4
+
+Delete the fields with the specified NAME.  The deleted fields are
+returned.
+
+BE WARNED: if no NAME is specified, the C<delete> is interpreted as
+the deletion of the message in a folder, so L<Mail::Box::Message::delete()|Mail::Message/"Flags">
+will be called.  This may have no negative effect at all...
+
+Calls L<Mail::Message::Replace::MailHeader::delete()|Mail::Message::Replace::MailHeader/"Access to the header">
+
+=back
+
+$obj-E<gt>B<destinations>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<fold>([LENGTH])
+
+=over 4
+
+Fold all the fields to a certain maximum LENGTH.
+Implemented by L<Mail::Message::Replace::MailHeader::fold()|Mail::Message::Replace::MailHeader/"Simulating Mail::Header">
+
+=back
+
+$obj-E<gt>B<fold_length>([[TAG], LENGTH])
+
+=over 4
+
+Set the maximum line LENGTH.  TAG is ignored.
+Implemented by L<Mail::Message::Replace::MailHeader::fold_length()|Mail::Message::Replace::MailHeader/"Simulating Mail::Header">
+
+=back
+
+$obj-E<gt>B<from>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<get>(NAME, [INDEX])
+
+=over 4
+
+Get all the header fields with the specified NAME.  In scalar context,
+only the first fitting NAME is returned.  Even when only one NAME is
+specified, multiple lines may be returned: some fields appear more than
+once in a header.  Calls L<Mail::Message::Replace::MailHeader::get()|Mail::Message::Replace::MailHeader/"Access to the header">
+
+=back
+
+$obj-E<gt>B<guessTimestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<head>([HEAD])
+
+=over 4
+
+Returns the head of the message, or creates an empty one if none is
+defined.  The HEAD argument, which sets the header, is not available
+for L<Mail::Internet>, but is there to be compatible with the C<head>
+method of L<Mail::Message|Mail::Message>.
+
+=back
+
+$obj-E<gt>B<header>([ARRAY])
+
+=over 4
+
+Optionally reads a header from the ARRAY, and then returns those fields
+as array-ref nicely folded.
+Implemented by L<Mail::Message::Replace::MailHeader::header()|Mail::Message::Replace::MailHeader/"Simulating Mail::Header">
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<print_header>(FILEHANDLE)
+
+=over 4
+
+Calls L<Mail::Message::Head::Complete::print()|Mail::Message::Head::Complete/"Access to the header">.
+
+=back
+
+$obj-E<gt>B<replace>(TAG, LINE, [INDEX])
+
+=over 4
+
+Adds LINES to the header, but removes fields with the same name if they
+already exist.  Calls L<Mail::Message::Replace::MailHeader::replace()|Mail::Message::Replace::MailHeader/"Access to the header">
+
+=back
+
+$obj-E<gt>B<sender>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<study>(FIELDNAME)
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<subject>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<tidy_headers>
+
+=over 4
+
+No effect anymore (always performed).
+
+=back
+
+$obj-E<gt>B<timestamp>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+$obj-E<gt>B<to>
+
+=over 4
+
+See L<Mail::Message/"The header">
+
+=back
+
+=head2 The body
+
+
+$obj-E<gt>B<body>([ARRAY-OF-LINES|LIST-OF-LINES])
+
+=over 4
+
+Returns an array of lines, representing the body.  With arguments, a
+new body will be created.  In L<Mail::Internet>, the body is not an
+object but a simple array.
+
+BE WARNED: this overrules the L<Mail::Message::body()|Mail::Message/"The body"> method, which
+may cause some confusion.  Use L<bodyObject()|Mail::Message::Replace::MailInternet/"The body"> to get access to that
+body's data.
+
+=back
+
+$obj-E<gt>B<bodyObject>([BODY])
+
+=over 4
+
+Calls L<Mail::Message::body()|Mail::Message/"The body">, because that C<body> method is overruled
+by the one which has a L<Mail::Internet> compatible interface.
+
+=back
+
+$obj-E<gt>B<decoded>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<encode>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<isNested>
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<parts>(['ALL'|'ACTIVE'|'DELETED'|'RECURSE'|FILTER])
+
+=over 4
+
+See L<Mail::Message/"The body">
+
+=back
+
+$obj-E<gt>B<print_body>([FILEHANDLE])
+
+=over 4
+
+Prints the body to the specified FILEHANDLE, which defaults to STDOUT.  This
+calls L<Mail::Message::Body::print()|Mail::Message::Body/"Access to the payload">.
+
+=back
+
+$obj-E<gt>B<remove_sig>([NRLINES])
+
+=over 4
+
+Remove the signature of a message with a maximum of NRLINES lines, which
+defaults to 10.  The work is done on the decoded body content, by
+L<Mail::Message::Body::stripSignature()|Mail::Message::Body::Construct/"Constructing a body">.
+
+=back
+
+$obj-E<gt>B<smtpsend>(OPTIONS)
+
+=over 4
+
+This method is calling L<Mail::Message::send()|Mail::Message/"The Message"> via C<smtp>, which is
+implemented in L<Mail::Transport::SMTP|Mail::Transport::SMTP>.  The implementation is
+slightly different, so this method is not 100% compliant.
+
+ Option    Defined in       Default                               
+ Debug                      <false>                               
+ Hello                      <helo_domain from Net::Config>        
+ Host                       C<$ENV{SMTPHOSTS} or from Net::Config>
+ MailFrom                   C<$ENV{MAILADDRESS}> or $ENV{USER}    
+ Port                       25                                    
+
+. Debug BOOLEAN
+
+. Hello STRING
+
+. Host HOSTNAME
+
+=over 4
+
+Only the first detected HOSTNAME is taken, so differs from the original
+implementation.
+
+=back
+
+. MailFrom STRING
+
+=over 4
+
+Your e-mail address.  This simulated L<Mail::Internet> object does not
+try to create an e-mail address from the sendmail configuration file,
+because that is generally a bad idea in environments with virtual hosts,
+as we have now-adays.
+
+=back
+
+. Port INTEGER
+
+=back
+
+$obj-E<gt>B<tidy_body>
+
+=over 4
+
+Removes blank lines from begin and end of the body.
+
+=back
+
+=head2 Flags
+
+
+$obj-E<gt>B<deleted>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isDeleted>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<label>(LABEL|PAIRS)
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<labels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<labelsToStatus>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+$obj-E<gt>B<statusToLabels>
+
+=over 4
+
+See L<Mail::Message/"Flags">
+
+=back
+
+=head2 The whole message as text
+
+
+$obj-E<gt>B<as_mbox_string>
+
+=over 4
+
+Returns the whole message as one string, which can be included in an
+MBOX folder (while not using L<Mail::Box::Mbox|Mail::Box::Mbox>).  The C<Content-Length>
+header field is removed and lines in the body which start with C<From >
+are escaped with an E<gt>.
+
+=back
+
+$obj-E<gt>B<file>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<lines>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<printStructure>([FILEHANDLE][, INDENT])
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readBody>(PARSER, HEAD [, BODYTYPE])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readFromParser>(PARSER, [BODYTYPE])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<readHead>(PARSER [,CLASS])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<recursiveRebuildPart>(PART, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Internals">
+
+=back
+
+$obj-E<gt>B<storeBody>(BODY)
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+$obj-E<gt>B<takeMessageId>([STRING])
+
+=over 4
+
+See L<Mail::Message/"Internals">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Message::Construct/"METHODS">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::Replace::MailInternet-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::Replace::MailInternet-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::Replace::MailInternet-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortSize>([VALUE])
+
+Mail::Message::Replace::MailInternet-E<gt>B<shortSize>([VALUE])
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortString>
+
+=over 4
+
+See L<Mail::Message/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<destruct>
+
+=over 4
+
+See L<Mail::Message/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+=head2 The nasty bits
+
+
+$obj-E<gt>B<isa>(CLASS)
+
+Mail::Message::Replace::MailInternet-E<gt>B<isa>(CLASS)
+
+=over 4
+
+Of course, the C<isa()> class inheritance check should not see our
+nasty trick.
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot include forward source as $include.
+
+Unknown alternative for the L<forward(include)|Mail::Message::Construct::Forward/"Constructing a message">.  Valid choices are
+C<NO>, C<INLINE>, C<ATTACH>, and C<ENCAPSULATE>.
+
+I<Error:> Mail::Internet does not support this kind of data
+
+The ARGS data can only be a file handle or an ARRAY.  Other data types
+are not supported (see L<read()|Mail::Message::Replace::MailInternet/"Constructing a message"> if you want to have more).
+
+I<Error:> No address to create forwarded to.
+
+If a forward message is created, a destination address must be specified.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> forwardAttach requires a preamble object
+
+
+I<Error:> forwardEncapsulate requires a preamble object
+
+
+I<Error:> no rebuild rule $name defined.
+
+
+
+=head1 DETAILS
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/Base64.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/Base64.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/Base64.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,82 @@
+
+use strict;
+use warnings;
+
+package Mail::Message::TransferEnc::Base64;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::TransferEnc';
+
+use MIME::Base64;
+
+
+sub name() { 'base64' }
+
+#------------------------------------------
+
+sub check($@)
+{   my ($self, $body, %args) = @_;
+    $body;
+}
+
+#------------------------------------------
+
+
+sub decode($@)
+{   my ($self, $body, %args) = @_;
+
+    my $lines
+      = $body->isa('Mail::Message::Body::File')
+      ? $self->_decode_from_file($body)
+      : $self->_decode_from_lines($body);
+
+    unless($lines)
+    {   $body->transferEncoding('none');
+        return $body;
+    }
+ 
+    my $bodytype
+      = defined $args{result_type} ? $args{result_type}
+      : $body->isBinary            ? 'Mail::Message::Body::File'
+      :                              ref $body;
+
+    $bodytype->new
+     ( based_on          => $body
+     , transfer_encoding => 'none'
+     , data              => $lines
+     );
+}
+
+sub _decode_from_file($)
+{   my ($self, $body) = @_;
+    local $_;
+
+    my $in = $body->file || return;
+    my $unpacked = decode_base64(join '', $in->getlines);
+    $in->close;
+    $unpacked;
+}
+
+sub _decode_from_lines($)
+{   my ($self, $body) = @_;
+    join '', map { decode_base64($_) } $body->lines;
+}
+
+#------------------------------------------
+
+sub encode($@)
+{   my ($self, $body, %args) = @_;
+
+    my $bodytype = $args{result_type} || ref $body;
+
+    $bodytype->new
+     ( based_on          => $body
+     , checked           => 1
+     , transfer_encoding => 'base64'
+     , data              => encode_base64($body->string)
+     );
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/Base64.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/Base64.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/Base64.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,278 @@
+
+=head1 NAME
+
+Mail::Message::TransferEnc::Base64 - encode/decode base64 message bodies
+
+
+=head1 INHERITANCE
+
+ Mail::Message::TransferEnc::Base64
+   is a Mail::Message::TransferEnc
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my Mail::Message $msg = ...;
+ my $decoded = $msg->decoded;
+ my $encoded = $msg->encode(transfer => 'base64');
+
+
+=head1 DESCRIPTION
+
+Encode or decode message bodies with base64.  The e-mail protocol and
+user agents can not handle binary data.  Therefore, binary data -but
+even sometimes non-binary data- is encoded into ASCII, this is
+transportable.
+
+Base64 re-groups the bits of bytes, and maps them on characters. The
+data contains bytes of 8 bits (an I<octet>).  These are repacked into
+groups of 6 bits, pointing in an array of characters containing
+C<[A-Za-z0-9+/]>.  This way, three data bytes become 4 base64 bytes.
+The encoded data will be trailed by C<'='> characters to align on
+four bytes.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Message::TransferEnc::Base64-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+See L<Mail::Reporter/"Constructors">
+
+=back
+
+=head2 The Encoder
+
+
+Mail::Message::TransferEnc::Base64-E<gt>B<addTransferEncoder>(TYPE, CLASS)
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"The Encoder">
+
+=back
+
+$obj-E<gt>B<create>(TYPE, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"The Encoder">
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"The Encoder">
+
+=back
+
+=head2 Encoding
+
+
+$obj-E<gt>B<check>(BODY, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"Encoding">
+
+=back
+
+$obj-E<gt>B<decode>(BODY, OPTIONS)
+
+=over 4
+
+ Option       Defined in                     Default              
+ result_type  L<Mail::Message::TransferEnc>  <type of source body>
+
+. result_type CLASS
+
+=back
+
+$obj-E<gt>B<encode>(BODY, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"Encoding">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::TransferEnc::Base64-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::TransferEnc::Base64-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::TransferEnc::Base64-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> Base64 line length not padded on 4.
+
+While decoding base64 the data in a message body, a string was found which
+was not padded into a multiple of four bytes.  This is illegal, and therefore
+this data is ignored.
+
+I<Error:> Decoder for transfer encoding $type does not work: $@
+
+Compiling the required transfer encoding resulted in errors, which means
+that the decoder can not be used.
+
+I<Warning:> No decoder for transfer encoding $type.
+
+A decoder for the specified type of transfer encoding is not implemented.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/Binary.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/Binary.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/Binary.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,57 @@
+
+use strict;
+use warnings;
+
+package Mail::Message::TransferEnc::Binary;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::TransferEnc';
+
+
+sub name() { 'binary' }
+
+#------------------------------------------
+
+sub check($@)
+{   my ($self, $body, %args) = @_;
+    $body;
+}
+
+#------------------------------------------
+
+sub decode($@)
+{   my ($self, $body, %args) = @_;
+    $body->transferEncoding('none');
+    $body;
+}
+
+#------------------------------------------
+
+sub encode($@)
+{   my ($self, $body, %args) = @_;
+
+    my @lines;
+
+    my $changes = 0;
+    foreach ($self->lines)
+    {   $changes++ if s/[\000\013]//g;
+        push @lines, $_;
+    }
+
+    unless($changes)
+    {   $body->transferEncoding('none');
+        return $body;
+    }
+
+    my $bodytype = $args{result_type} || ref($self->load);
+
+    $bodytype->new
+     ( based_on          => $self
+     , transfer_encoding => 'none'
+     , data              => \@lines
+     );
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/Binary.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/Binary.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/Binary.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,260 @@
+
+=head1 NAME
+
+Mail::Message::TransferEnc::Binary - encode/decode binary message bodies
+
+
+=head1 INHERITANCE
+
+ Mail::Message::TransferEnc::Binary
+   is a Mail::Message::TransferEnc
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my Mail::Message $msg = ...;
+ my $decoded = $msg->decoded;
+ my $encoded = $msg->encode(transfer => 'binary');
+
+
+=head1 DESCRIPTION
+
+Encode or decode message bodies for binary transfer encoding.  This is
+totally no encoding.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Message::TransferEnc::Binary-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+See L<Mail::Reporter/"Constructors">
+
+=back
+
+=head2 The Encoder
+
+
+Mail::Message::TransferEnc::Binary-E<gt>B<addTransferEncoder>(TYPE, CLASS)
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"The Encoder">
+
+=back
+
+$obj-E<gt>B<create>(TYPE, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"The Encoder">
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"The Encoder">
+
+=back
+
+=head2 Encoding
+
+
+$obj-E<gt>B<check>(BODY, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"Encoding">
+
+=back
+
+$obj-E<gt>B<decode>(BODY [, OPTIONS])
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"Encoding">
+
+=back
+
+$obj-E<gt>B<encode>(BODY, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"Encoding">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::TransferEnc::Binary-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::TransferEnc::Binary-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::TransferEnc::Binary-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Decoder for transfer encoding $type does not work: $@
+
+Compiling the required transfer encoding resulted in errors, which means
+that the decoder can not be used.
+
+I<Warning:> No decoder for transfer encoding $type.
+
+A decoder for the specified type of transfer encoding is not implemented.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/EightBit.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/EightBit.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/EightBit.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,62 @@
+
+use strict;
+use warnings;
+
+package Mail::Message::TransferEnc::EightBit;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::TransferEnc';
+
+
+sub name() { '8bit' }
+
+#------------------------------------------
+
+sub check($@)
+{   my ($self, $body, %args) = @_;
+    $body;
+}
+
+#------------------------------------------
+
+sub decode($@)
+{   my ($self, $body, %args) = @_;
+    $body->transferEncoding('none');
+    $body;
+}
+
+#------------------------------------------
+
+sub encode($@)
+{   my ($self, $body, %args) = @_;
+
+    my @lines;
+    my $changes = 0;
+
+    foreach ($body->lines)
+    {   $changes++ if s/[\000\013]//g;
+
+        $changes++ if length > 997;
+        push @lines, substr($_, 0, 996, '')."\n"
+            while length > 997;
+
+        push @lines, $_;
+    }
+
+    unless($changes)
+    {   $body->transferEncoding('8bit');
+        return $body;
+    }
+
+    my $bodytype = $args{result_type} || ref $body;
+
+    $bodytype->new
+     ( based_on          => $body
+     , transfer_encoding => '8bit'
+     , data              => \@lines
+     );
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/EightBit.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/EightBit.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/EightBit.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,271 @@
+
+=head1 NAME
+
+Mail::Message::TransferEnc::EightBit - encode/decode 8bit message bodies
+
+
+=head1 INHERITANCE
+
+ Mail::Message::TransferEnc::EightBit
+   is a Mail::Message::TransferEnc
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my Mail::Message $msg = ...;
+ my $decoded = $msg->decoded;
+ my $encoded = $msg->encode(transfer => '8bit');
+
+
+=head1 DESCRIPTION
+
+Encode or decode message bodies for 8bit transfer encoding.  This is
+only very little encoding.  According to the specs:
+
+RFC-2045 Section 2.8 defines legal `8bit' data:
+
+ "8bit data" refers to data that is all represented as relatively
+ short lines with 998 octets or less between CRLF line separation
+ sequences [RFC-821]), but octets with decimal values greater than 127
+ may be used.  As with "7bit data" CR and LF octets only occur as part
+ of CRLF line separation sequences and no NULs are allowed.
+
+As you can safely conclude: decoding of these bodies is no work
+at all.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Message::TransferEnc::EightBit-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+See L<Mail::Reporter/"Constructors">
+
+=back
+
+=head2 The Encoder
+
+
+Mail::Message::TransferEnc::EightBit-E<gt>B<addTransferEncoder>(TYPE, CLASS)
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"The Encoder">
+
+=back
+
+$obj-E<gt>B<create>(TYPE, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"The Encoder">
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"The Encoder">
+
+=back
+
+=head2 Encoding
+
+
+$obj-E<gt>B<check>(BODY, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"Encoding">
+
+=back
+
+$obj-E<gt>B<decode>(BODY [, OPTIONS])
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"Encoding">
+
+=back
+
+$obj-E<gt>B<encode>(BODY, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"Encoding">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::TransferEnc::EightBit-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::TransferEnc::EightBit-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::TransferEnc::EightBit-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Decoder for transfer encoding $type does not work: $@
+
+Compiling the required transfer encoding resulted in errors, which means
+that the decoder can not be used.
+
+I<Warning:> No decoder for transfer encoding $type.
+
+A decoder for the specified type of transfer encoding is not implemented.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/QuotedPrint.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/QuotedPrint.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/QuotedPrint.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,56 @@
+
+use strict;
+use warnings;
+
+package Mail::Message::TransferEnc::QuotedPrint;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::TransferEnc';
+
+use MIME::QuotedPrint;
+
+
+sub name() { 'quoted-printable' }
+
+#------------------------------------------
+
+sub check($@)
+{   my ($self, $body, %args) = @_;
+    $body;
+}
+
+#------------------------------------------
+
+
+sub decode($@)
+{   my ($self, $body, %args) = @_;
+
+    my @lines    = map decode_qp($_), $body->lines;
+    my $bodytype = $args{result_type} || ref $body;
+
+    $bodytype->new
+     ( based_on          => $body
+     , transfer_encoding => 'none'
+     , data              => \@lines
+     );
+}
+
+#------------------------------------------
+
+
+sub encode($@)
+{   my ($self, $body, %args) = @_;
+
+    my @lines    = map encode_qp($_), $body->lines;
+    my $bodytype = $args{result_type} || ref $body;
+
+    $bodytype->new
+     ( based_on          => $body
+     , transfer_encoding => 'quoted-printable'
+     , data              => \@lines
+     );
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/QuotedPrint.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/QuotedPrint.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/QuotedPrint.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,286 @@
+
+=head1 NAME
+
+Mail::Message::TransferEnc::QuotedPrint - handle quoted-printable message bodies
+
+
+=head1 INHERITANCE
+
+ Mail::Message::TransferEnc::QuotedPrint
+   is a Mail::Message::TransferEnc
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my Mail::Message $msg = ...;
+ my $decoded = $msg->decoded;
+ my $encoded = $msg->encode(transfer => 'quoted-printable');
+
+
+=head1 DESCRIPTION
+
+Encode and decode message bodies for quoted-printable transfer encoding.
+The Quoted-Printable encoding is intended
+to represent data that largely consists of bytes that correspond to
+printable characters in the ASCII character set.  Non-printable
+characters (as defined by English Americans) are represented by a
+triplet consisting of the character "=" followed by two hexadecimal
+digits.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Message::TransferEnc::QuotedPrint-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+See L<Mail::Reporter/"Constructors">
+
+=back
+
+=head2 The Encoder
+
+
+Mail::Message::TransferEnc::QuotedPrint-E<gt>B<addTransferEncoder>(TYPE, CLASS)
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"The Encoder">
+
+=back
+
+$obj-E<gt>B<create>(TYPE, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"The Encoder">
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"The Encoder">
+
+=back
+
+=head2 Encoding
+
+
+$obj-E<gt>B<check>(BODY, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"Encoding">
+
+=back
+
+$obj-E<gt>B<decode>(BODY, OPTIONS)
+
+=over 4
+
+Decoding is tricky, and not without loss of information.  Lines will
+stay separate lines, although they might have been joined before the
+encoding split them up.  Characters which are not printable will be
+replaced by their octal value, and carriage returns (C<'=0D'>) at
+end of line are removed.
+
+ Option       Defined in                     Default              
+ result_type  L<Mail::Message::TransferEnc>  <type of source body>
+
+. result_type CLASS
+
+=back
+
+$obj-E<gt>B<encode>(BODY, OPTIONS)
+
+=over 4
+
+Encoding is to quoted-printable is a careful process: All characters
+outside the normal printing range, and including C<'='> are encoded.
+They are translated into a C<'='> followed by a two digit hex of the
+ascii value of the character.  The same treatment is for white-spaces
+at the end of a line.
+
+The lines which are constructed which must be 76 characters max, not
+broken on encoded characters.
+
+ Option       Defined in                     Default              
+ result_type  L<Mail::Message::TransferEnc>  <type of source body>
+
+. result_type CLASS
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::TransferEnc::QuotedPrint-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::TransferEnc::QuotedPrint-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::TransferEnc::QuotedPrint-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Decoder for transfer encoding $type does not work: $@
+
+Compiling the required transfer encoding resulted in errors, which means
+that the decoder can not be used.
+
+I<Warning:> No decoder for transfer encoding $type.
+
+A decoder for the specified type of transfer encoding is not implemented.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/SevenBit.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/SevenBit.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/SevenBit.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,63 @@
+
+use strict;
+use warnings;
+
+package Mail::Message::TransferEnc::SevenBit;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Message::TransferEnc';
+
+
+sub name() { '7bit' }
+
+#------------------------------------------
+
+sub check($@)
+{   my ($self, $body, %args) = @_;
+    $body;
+}
+
+#------------------------------------------
+
+sub decode($@)
+{   my ($self, $body, %args) = @_;
+    $body->transferEncoding('none');
+    $body;
+}
+
+#------------------------------------------
+
+sub encode($@)
+{   my ($self, $body, %args) = @_;
+
+    my @lines;
+    my $changes = 0;
+
+    foreach ($body->lines)
+    {   $changes++ if s/[^\000-\127]/chr(ord($&) & 0x7f)/ge;
+        $changes++ if s/[\000\013]//g;
+
+        $changes++ if length > 997;
+        push @lines, substr($_, 0, 996, '')."\n"
+            while length > 997;
+
+        push @lines, $_;
+    }
+
+    unless($changes)
+    {   $body->transferEncoding('7bit');
+        return $body;
+    }
+
+    my $bodytype = $args{result_type} || ref $body;
+
+    $bodytype->new
+     ( based_on          => $body
+     , transfer_encoding => '7bit'
+     , data              => \@lines
+     );
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/SevenBit.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/SevenBit.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc/SevenBit.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,272 @@
+
+=head1 NAME
+
+Mail::Message::TransferEnc::SevenBit - encode/decode 7bit message bodies
+
+
+=head1 INHERITANCE
+
+ Mail::Message::TransferEnc::SevenBit
+   is a Mail::Message::TransferEnc
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my Mail::Message $msg = ...;
+ my $decoded = $msg->decoded;
+ my $encoded = $msg->encode(transfer => '7bit');
+
+
+=head1 DESCRIPTION
+
+Encode or decode message bodies for 7bit transfer encoding.  This is
+only very little encoding.  According to the specs:
+
+RFC-2045 Section 2.7 defines legal `7bit' data:
+
+  "7bit data" refers to data that is all represented as relatively
+  short lines with 998 octets or less between CRLF line separation
+  sequences [RFC-821].  No octets with decimal values greater than 127
+  are allowed and neither are NULs (octets with decimal value 0).  CR
+  (decimal value 13) and LF (decimal value 10) octets only occur as
+  part of CRLF line separation sequences.
+
+As you can safely conclude: decoding of these bodies is no work
+at all.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Message::TransferEnc::SevenBit-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+See L<Mail::Reporter/"Constructors">
+
+=back
+
+=head2 The Encoder
+
+
+Mail::Message::TransferEnc::SevenBit-E<gt>B<addTransferEncoder>(TYPE, CLASS)
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"The Encoder">
+
+=back
+
+$obj-E<gt>B<create>(TYPE, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"The Encoder">
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"The Encoder">
+
+=back
+
+=head2 Encoding
+
+
+$obj-E<gt>B<check>(BODY, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"Encoding">
+
+=back
+
+$obj-E<gt>B<decode>(BODY [, OPTIONS])
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"Encoding">
+
+=back
+
+$obj-E<gt>B<encode>(BODY, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::TransferEnc/"Encoding">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::TransferEnc::SevenBit-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::TransferEnc::SevenBit-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::TransferEnc::SevenBit-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Decoder for transfer encoding $type does not work: $@
+
+Compiling the required transfer encoding resulted in errors, which means
+that the decoder can not be used.
+
+I<Warning:> No decoder for transfer encoding $type.
+
+A decoder for the specified type of transfer encoding is not implemented.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,72 @@
+
+use strict;
+use warnings;
+
+package Mail::Message::TransferEnc;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Reporter';
+
+
+my %encoder =
+ ( base64 => 'Mail::Message::TransferEnc::Base64'
+ , '7bit' => 'Mail::Message::TransferEnc::SevenBit'
+ , '8bit' => 'Mail::Message::TransferEnc::EightBit'
+ , 'quoted-printable' => 'Mail::Message::TransferEnc::QuotedPrint'
+ );
+
+#------------------------------------------
+
+ 
+sub create($@)
+{   my ($class, $type) = (shift, shift);
+
+    my $encoder = $encoder{lc $type};
+    unless($encoder)
+    {   $class->new(@_)->log(WARNING => "No decoder for transfer encoding $type.");
+        return;
+    }
+
+    eval "require $encoder";
+    if($@)
+    {   $class->new(@_)->log(ERROR =>
+            "Decoder for transfer encoding $type does not work:\n$@");
+        return;
+    }
+
+    $encoder->new(@_);
+}
+
+#------------------------------------------
+
+
+sub addTransferEncoder($$)
+{   my ($class, $type, $encoderclass) = @_;
+    $encoder{lc $type} = $encoderclass;
+    $class;
+}
+
+#------------------------------------------
+
+
+sub name {shift->notImplemented}
+
+#------------------------------------------
+
+
+sub check($@) {shift->notImplemented}
+
+#------------------------------------------
+
+
+sub decode($@) {shift->notImplemented}
+
+#------------------------------------------
+
+
+sub encode($) {shift->notImplemented}
+
+#------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/TransferEnc.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,334 @@
+
+=head1 NAME
+
+Mail::Message::TransferEnc - message transfer encoder/decoder
+
+
+=head1 INHERITANCE
+
+ Mail::Message::TransferEnc
+   is a Mail::Reporter
+
+ Mail::Message::TransferEnc is extended by
+   Mail::Message::TransferEnc::Base64
+   Mail::Message::TransferEnc::Binary
+   Mail::Message::TransferEnc::EightBit
+   Mail::Message::TransferEnc::QuotedPrint
+   Mail::Message::TransferEnc::SevenBit
+
+
+=head1 SYNOPSIS
+
+ my Mail::Message $msg = ...;
+ my $decoded = $msg->decoded;
+ my $encoded = $msg->encode(transfer => 'base64');
+
+
+=head1 DESCRIPTION
+
+This class is the base for various encoders and decoders, which are
+used during transport of the message.  This packages, and all which are
+derived, are invoked by the message's L<Mail::Message::decoded()|Mail::Message/"The body"> and
+L<Mail::Message::encode()|Mail::Message/"The body"> methods:
+
+ my $message = $folder->message(3);
+ my $decoded_body = $message->decoded;
+ my $encoded_body = $message->encode(transfer => 'base64');
+
+The following coders/decoders are currently available:
+
+=over 4
+
+=item * L<Mail::Message::TransferEnc::Base64|Mail::Message::TransferEnc::Base64>
+
+C<base64> for binary information.
+
+=item * L<Mail::Message::TransferEnc::SevenBit|Mail::Message::TransferEnc::SevenBit>
+
+C<7bit> for plain old ASCII characters only.
+
+=item * L<Mail::Message::TransferEnc::EightBit|Mail::Message::TransferEnc::EightBit>
+
+C<8bit> for extended character set data, not encoded.
+
+=item * L<Mail::Message::TransferEnc::QuotedPrint|Mail::Message::TransferEnc::QuotedPrint>
+
+C<quoted-printable> encdoded extended character set data.
+
+=back
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Message::TransferEnc-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+See L<Mail::Reporter/"Constructors">
+
+=back
+
+=head2 The Encoder
+
+
+Mail::Message::TransferEnc-E<gt>B<addTransferEncoder>(TYPE, CLASS)
+
+=over 4
+
+Adds one new encoder to the list known by the Mail::Box suite.  The
+TYPE is found in the message's header in the C<Content-Transfer-Encoding>
+field.
+
+=back
+
+$obj-E<gt>B<create>(TYPE, OPTIONS)
+
+=over 4
+
+Create a new coder/decoder based on the required type.
+
+=back
+
+$obj-E<gt>B<name>
+
+=over 4
+
+The name of the encoder.  Case is not significant.
+
+=back
+
+=head2 Encoding
+
+
+$obj-E<gt>B<check>(BODY, OPTIONS)
+
+=over 4
+
+Check whether the body is correctly encoded.  If so, the body reference is
+returned with the C<checked> flag set.  Otherwise, a new object is created
+and returned.
+
+ Option       Defined in  Default              
+ result_type              <type of source body>
+
+. result_type CLASS
+
+=over 4
+
+The type of the body to be produced, when the checker decides to return
+modified data.  
+
+=back
+
+=back
+
+$obj-E<gt>B<decode>(BODY [, OPTIONS])
+
+=over 4
+
+Use the encoder to decode the content of BODY.  A new body is returned.
+
+ Option       Defined in  Default              
+ result_type              <type of source body>
+
+. result_type CLASS
+
+=over 4
+
+The type of the body to be produced, when the decoder decides to return
+modified data.
+
+=back
+
+=back
+
+$obj-E<gt>B<encode>(BODY, OPTIONS)
+
+=over 4
+
+Use the encoder to encode the content of BODY.
+
+ Option       Defined in  Default              
+ result_type              <type of source body>
+
+. result_type CLASS
+
+=over 4
+
+The type of the body to be produced, when the decoder decides to return
+modified data.
+
+=back
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message::TransferEnc-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message::TransferEnc-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message::TransferEnc-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Decoder for transfer encoding $type does not work: $@
+
+Compiling the required transfer encoding resulted in errors, which means
+that the decoder can not be used.
+
+I<Warning:> No decoder for transfer encoding $type.
+
+A decoder for the specified type of transfer encoding is not implemented.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Wrapper/SpamAssassin.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Wrapper/SpamAssassin.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Wrapper/SpamAssassin.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,105 @@
+use strict;
+use warnings;
+
+package Mail::Message::Wrapper::SpamAssassin;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::SpamAssassin::Message';
+
+use Carp;
+use Mail::Message::Body;
+
+#------------------------------------------
+
+
+sub new(@)    # fix missing infra-structure of base element
+{   my ($class, $message, %args) = @_;
+
+    $_->delete for $message->head->spamGroups('SpamAssassin');
+
+    $class->SUPER::new($message)->init(\%args);
+}
+
+sub init($) { shift }
+
+#------------------------------------------
+
+sub create_new() {croak "Should not be used"}
+
+#------------------------------------------
+
+sub get($) { $_[0]->get_header($_[1]) }
+
+sub get_header($)
+{   my ($self, $name) = @_;
+    my $field = $self->get_mail_object->head->get($name);
+    defined $field ? $field->unfoldedBody : undef;
+}
+
+#------------------------------------------
+
+sub get_pristine_header($)
+{   my ($self, $name) = @_;
+    my $field = $self->get_mail_object->head->get($name);
+    defined $field ? $field->foldedBody : undef;
+}
+
+#------------------------------------------
+
+sub put_header($$)
+{   my ($self, $name, $value) = @_;
+    my $head = $self->get_mail_object->head;
+    $value =~ s/\s{2,}/ /g;
+    $value =~ s/\s*$//;      # will cause a refold as well
+    return () unless length $value;
+
+    $head->add($name => $value);
+}
+
+#------------------------------------------
+
+sub get_all_headers($)
+{   my $head = shift->get_mail_object->head;
+    "$head";
+}
+    
+#------------------------------------------
+
+sub replace_header($$)
+{   my $head = shift->get_mail_object->head;
+    my ($name, $value) = @_;
+    $head->set($name, $value);
+}
+
+#------------------------------------------
+
+sub delete_header($)
+{   my $head = shift->get_mail_object->head;
+    my $name = shift;
+    $head->delete($name);
+}
+
+#------------------------------------------
+
+sub get_body() {shift->get_mail_object->body->lines }
+
+#------------------------------------------
+
+sub get_pristine() { shift->get_mail_object->head->string }
+
+#------------------------------------------
+
+sub replace_body($)
+{   my ($self, $data) = @_;
+    my $body = Mail::Message::Body->new(data => $data);
+    $self->get_mail_object->storeBody($body);
+}
+
+#------------------------------------------
+
+sub replace_original_message($)
+{   my ($self, $lines) = @_;
+    die "We will not replace the message.  Use report_safe = 0\n";
+}
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Wrapper/SpamAssassin.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Wrapper/SpamAssassin.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message/Wrapper/SpamAssassin.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,70 @@
+
+=head1 NAME
+
+Mail::Message::Wrapper::SpamAssassin - Connect a Mail::Message with Mail::SpamAssassin
+
+
+=head1 INHERITANCE
+
+ Mail::Message::Wrapper::SpamAssassin
+   is a Mail::SpamAssassin::Message
+
+
+=head1 SYNOPSIS
+
+ # See Mail::Box::Search::SpamAssassin for the prefered interface
+ # However, it is possible to do:
+
+ my $msg    = ...;   # some Mail::Message object
+ my $sa     = Mail::Message::Wrapper::SpamAssassin->new($msg);
+ my $spam   = Mail::SpamAssassin->new;
+ my $status = $spam->check($sa);
+
+ $msg->label(spam => 1) if $status->is_spam;
+ $status->rewrite_mail;  # Adds spam lines to header
+
+
+=head1 DESCRIPTION
+
+The C<Mail::Message::Wrapper::SpamAssassin>
+class --sorry for the long package
+name-- is a wrapper around Mail::SpamAssassin::Message, which is an
+interface to the spam checking software of Mail::SpamAssassin.
+
+
+
+=head1 METHODS
+
+
+Mail::Message::Wrapper::SpamAssassin-E<gt>B<new>(MESSAGE, OPTIONS)
+
+=over 4
+
+Creates a wrapper around the MESSAGE.  The already present fields
+from a previous run of Spam::Assassin (or probably fake lines) are
+removed first.
+
+=back
+
+
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,744 @@
+use strict;
+use warnings;
+
+package Mail::Message;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Reporter';
+
+use Mail::Message::Part;
+use Mail::Message::Head::Complete;
+use Mail::Message::Construct;
+
+use Mail::Message::Body::Lines;
+use Mail::Message::Body::Multipart;
+use Mail::Message::Body::Nested;
+
+use Carp;
+
+
+our $crlf_platform;
+BEGIN { $crlf_platform = $^O =~ m/win32|cygwin/i }
+
+#------------------------------------------
+
+
+sub init($)
+{   my ($self, $args) = @_;
+    $self->SUPER::init($args);
+
+    # Field initializations also in coerce()
+    $self->{MM_modified} = $args->{modified}  || 0;
+    $self->{MM_trusted}  = $args->{trusted}   || 0;
+
+    # Set the header
+
+    my $head;
+    if(defined($head = $args->{head})) { $self->head($head) }
+    elsif(my $msgid = $args->{messageId} || $args->{messageID})
+    {   $self->takeMessageId($msgid);
+    }
+
+    # Set the body
+    if(my $body = $args->{body})
+    {   $self->{MM_body} = $body;
+        $body->message($self);
+    }
+
+    $self->{MM_body_type} = $args->{body_type}
+       if defined $args->{body_type};
+
+    $self->{MM_head_type} = $args->{head_type}
+       if defined $args->{head_type};
+
+    $self->{MM_field_type} = $args->{field_type}
+       if defined $args->{field_type};
+
+    my $labels = $args->{labels} || [];
+    my @labels = ref $labels eq 'ARRAY' ? @$labels : %$labels;
+    push @labels, deleted => $args->{deleted} if exists $args->{deleted};
+    $self->{MM_labels} = { @labels };
+
+    $self;
+}
+
+#------------------------------------------
+
+
+my $mail_internet_converter;
+my $mime_entity_converter;
+
+sub coerce($)
+{   my ($class, $message) = @_;
+
+    return bless $message, $class
+        if $message->isa(__PACKAGE__);
+
+    if($message->isa('MIME::Entity'))
+    {   unless($mime_entity_converter)
+        {   eval {require Mail::Message::Convert::MimeEntity};
+                confess "Install MIME::Entity" if $@;
+
+            $mime_entity_converter = Mail::Message::Convert::MimeEntity->new;
+        }
+
+        $message = $mime_entity_converter->from($message)
+            or return;
+    }
+
+    elsif($message->isa('Mail::Internet'))
+    {   unless($mail_internet_converter)
+        {   eval {require Mail::Message::Convert::MailInternet};
+            confess "Install Mail::Internet" if $@;
+
+           $mail_internet_converter = Mail::Message::Convert::MailInternet->new;
+        }
+
+        $message = $mail_internet_converter->from($message)
+            or return;
+    }
+
+    else
+    {   my $what = ref $message ? 'a'.ref($message).' object' : 'text';
+        confess "Cannot coerce $what into a ". __PACKAGE__." object.\n";
+    }
+
+    $message->{MM_modified}  ||= 0;
+    bless $message, $class;
+}
+
+#------------------------------------------
+
+
+sub clone()
+{   my $self  = shift;
+
+    # First clone body, which may trigger head load as well.  If head is
+    # triggered first, then it may be decided to be lazy on the body at
+    # moment.  And then the body would be triggered.
+
+    my $clone = Mail::Message->new
+     ( body  => $self->body->clone
+     , head  => $self->head->clone
+     , $self->logSettings
+     );
+
+    my $labels = $self->labels;
+    my %labels = %$labels;
+    delete $labels{deleted};
+
+    $clone->{MM_labels} = \%labels;
+    $clone;
+}
+
+#------------------------------------------
+
+
+sub messageId() { $_[0]->{MM_message_id} || $_[0]->takeMessageId}
+sub messageID() {shift->messageId}   # compatibility
+
+#------------------------------------------
+
+
+sub container() { undef } # overridden by Mail::Message::Part
+
+#------------------------------------------
+
+
+sub isPart() { 0 } # overridden by Mail::Message::Part
+
+#------------------------------------------
+
+
+sub toplevel() { shift } # overridden by Mail::Message::Part
+
+#------------------------------------------
+
+
+sub isDummy() { 0 }
+
+#------------------------------------------
+
+
+sub print(;$)
+{   my $self = shift;
+    my $out  = shift || select;
+
+    $self->head->print($out);
+    $self->body->print($out);
+    $self;
+}
+
+#------------------------------------------
+
+
+sub write(;$)
+{   my $self = shift;
+    my $out  = shift || select;
+
+    $self->head->print($out);
+    $self->body->print($out);
+    $self;
+}
+
+#------------------------------------------
+
+
+my $default_mailer;
+
+sub send(@)
+{   my $self = shift;
+
+    require Mail::Transport::Send;
+
+    my $mailer;
+    $default_mailer = $mailer = shift
+        if ref $_[0] && $_[0]->isa('Mail::Transport::Send');
+
+    my %args = @_;
+    if( ! $args{via} && defined $default_mailer )
+    {   $mailer = $default_mailer
+    }
+    else
+    {   my $via = delete $args{via} || 'sendmail';
+        $default_mailer = $mailer = Mail::Transport->new(via => $via);
+    }
+
+    $mailer->send($self, %args);
+}
+
+#------------------------------------------
+
+
+sub size()
+{   my $self = shift;
+    $self->head->size + $self->body->size;
+}
+
+#------------------------------------------
+
+
+sub head(;$)
+{   my $self = shift;
+    return $self->{MM_head} unless @_;
+
+    my $head = shift;
+    unless(defined $head)
+    {   delete $self->{MM_head};
+        return undef;
+    }
+
+    $self->log(INTERNAL => "wrong type of head for $self")
+        unless ref $head && $head->isa('Mail::Message::Head');
+
+    $head->message($self);
+
+    if(my $old = $self->{MM_head})
+    {   $self->{MM_modified}++ unless $old->isDelayed;
+    }
+
+    $self->{MM_head} = $head;
+
+    $self->takeMessageId unless $head->isDelayed;
+
+    $head;
+}
+
+#------------------------------------------
+
+
+sub get($)
+{   my $field = shift->head->get(shift) || return undef;
+    $field->body;
+}
+
+#------------------------------------------
+
+
+sub study($)
+{  my $head = shift->head or return;
+   scalar $head->study(@_);    # return only last
+}
+
+#-------------------------------------------
+
+
+sub from() { map {$_->addresses} shift->head->get('From') }
+
+#-------------------------------------------
+
+
+sub sender()
+{   my $self   = shift;
+    my $sender = $self->head->get('Sender') || $self->head->get('From')
+               || return ();
+
+    ($sender->addresses)[0];                 # first specified address
+}
+
+#-------------------------------------------
+
+
+sub to() { map {$_->addresses} shift->head->get('To') }
+
+#-------------------------------------------
+
+
+sub cc() { map {$_->addresses} shift->head->get('Cc') }
+
+#-------------------------------------------
+
+
+sub bcc() { map {$_->addresses} shift->head->get('Bcc') }
+
+#-------------------------------------------
+
+
+#-------------------------------------------
+
+
+sub destinations()
+{   my $self = shift;
+    my %to = map { (lc($_->address) => $_) }
+                  $self->to, $self->cc, $self->bcc;
+    values %to;
+}
+
+#-------------------------------------------
+
+
+sub subject()
+{   my $subject = shift->get('subject');
+    defined $subject ? $subject : '';
+}
+
+#-------------------------------------------
+
+
+sub guessTimestamp() {shift->head->guessTimestamp}
+
+#-------------------------------------------
+
+
+sub timestamp()
+{   my $head = shift->head or return;
+    $head->recvstamp || $head->timestamp;
+}
+
+#------------------------------------------
+
+
+sub nrLines()
+{   my $self = shift;
+    $self->head->nrLines + $self->body->nrLines;
+}
+
+#-------------------------------------------
+
+  
+sub body(;$@)
+{   my $self = shift;
+    return $self->{MM_body} unless @_;
+
+    my $head = $self->head;
+    $head->removeContentInfo if defined $head;
+
+    my ($rawbody, %args) = @_;
+    unless(defined $rawbody)
+    {   # Disconnect body from message.
+        my $body = delete $self->{MM_body};
+        $body->message(undef) if defined $body;
+        return $body;
+    }
+
+    $self->log(INTERNAL => "wrong type of body for $rawbody")
+        unless ref $rawbody && $rawbody->isa('Mail::Message::Body');
+
+    # Bodies of real messages must be encoded for safe transmission.
+    # Message parts will get encoded on the moment the whole multipart
+    # is transformed into a real message.
+    my $body = $self->isPart ? $rawbody : $rawbody->encoded;
+    $body->contentInfoTo($self->head);
+
+    my $oldbody = $self->{MM_body};
+    return $body if defined $oldbody && $body==$oldbody;
+
+    $body->message($self);
+    $body->modified(1) if defined $oldbody;
+
+    $self->{MM_body} = $body;
+}
+
+#------------------------------------------
+
+
+sub decoded(@)
+{   my ($self, %args) = @_;
+
+    return $self->{MB_decoded} if $self->{MB_decoded};
+
+    my $body    = $self->body->load or return;
+    my $decoded = $body->decoded(result_type => $args{result_type});
+
+    $self->{MB_decoded} = $decoded if $args{keep};
+    $decoded;
+}
+
+#------------------------------------------
+
+
+sub encode(@)
+{   my $body = shift->body->load;
+    $body ? $body->encode(@_) : undef;
+}
+
+#-------------------------------------------
+
+
+sub isMultipart() {shift->head->isMultipart}
+
+#-------------------------------------------
+
+
+sub isNested() {shift->body->isNested}
+
+#-------------------------------------------
+
+
+sub parts(;$)
+{   my $self    = shift;
+    my $what    = shift || 'ACTIVE';
+
+    my $body    = $self->body;
+    my $recurse = $what eq 'RECURSE' || ref $what;
+
+    my @parts
+     = $body->isNested     ? $body->nested->parts($what)
+     : $body->isMultipart  ? $body->parts($recurse ? 'RECURSE' : ())
+     :                       $self;
+
+      ref $what eq 'CODE' ? (grep {$what->($_)} @parts)
+    : $what eq 'ACTIVE'   ? (grep {not $_->isDeleted } @parts)
+    : $what eq 'DELETED'  ? (grep { $_->isDeleted } @parts)
+    : $what eq 'ALL'      ? @parts
+    : $recurse            ? @parts
+    : confess "Select parts via $what?";
+}
+
+#------------------------------------------
+
+
+sub modified(;$)
+{   my $self = shift;
+
+    return $self->isModified unless @_;  # compatibility 2.036
+
+    my $flag = shift;
+    $self->{MM_modified} = $flag;
+    my $head = $self->head;
+    $head->modified($flag) if $head;
+    my $body = $self->body;
+    $body->modified($flag) if $body;
+
+    $flag;
+}
+
+#------------------------------------------
+
+
+sub isModified()
+{   my $self = shift;
+    return 1 if $self->{MM_modified};
+
+    my $head = $self->head;
+    if($head && $head->isModified)
+    {   $self->{MM_modified}++;
+        return 1;
+    }
+
+    my $body = $self->body;
+    if($body && $body->isModified)
+    {   $self->{MM_modified}++;
+        return 1;
+    }
+
+    0;
+}
+
+#------------------------------------------
+
+
+sub label($;$)
+{   my $self   = shift;
+    return $self->{MM_labels}{$_[0]} unless @_ > 1;
+    my $return = $_[1];
+
+    my %labels = @_;
+    @{$self->{MM_labels}}{keys %labels} = values %labels;
+    $return;
+}
+
+#------------------------------------------
+
+
+sub labels()
+{   my $self = shift;
+    wantarray ? keys %{$self->{MM_labels}} : $self->{MM_labels};
+}
+
+#------------------------------------------
+
+
+sub isDeleted() { shift->label('deleted') }
+
+#-------------------------------------------
+
+
+sub delete()
+{  my $self = shift;
+   my $old = $self->label('deleted');
+   $old || $self->label(deleted => time);
+}
+
+#-------------------------------------------
+
+
+sub deleted(;$)
+{   my $self = shift;
+
+    @_ ? $self->label(deleted => shift)
+       : $self->label('deleted')   # compat 2.036
+}
+
+#-------------------------------------------
+
+
+sub labelsToStatus()
+{   my $self    = shift;
+    my $head    = $self->head;
+    my $labels  = $self->labels;
+
+    my $status  = $head->get('status') || '';
+    my $newstatus
+      = $labels->{seen}    ? 'RO'
+      : $labels->{old}     ? 'O'
+      : '';
+
+    $head->set(Status => $newstatus)
+        if $newstatus ne $status;
+
+    my $xstatus = $head->get('x-status') || '';
+    my $newxstatus
+      = ($labels->{replied} ? 'A' : '')
+      . ($labels->{flagged} ? 'F' : '');
+
+    $head->set('X-Status' => $newxstatus)
+        if $newxstatus ne $xstatus;
+
+    $self;
+}
+
+#-------------------------------------------
+
+
+sub statusToLabels()
+{   my $self    = shift;
+    my $head    = $self->head;
+
+    if(my $status  = $head->get('status'))
+    {   $status = $status->foldedBody;
+        $self->label
+         ( seen    => (index($status, 'R') >= 0)
+         , old     => (index($status, 'O') >= 0)
+	 );
+    }
+
+    if(my $xstatus = $head->get('x-status'))
+    {   $xstatus = $xstatus->foldedBody;
+        $self->label
+         ( replied => (index($xstatus, 'A') >= 0)
+         , flagged => (index($xstatus, 'F') >= 0)
+	 );
+    }
+
+    $self;
+}
+
+#------------------------------------------
+
+
+#------------------------------------------
+# All next routines try to create compatibility with release < 2.0
+sub isParsed()   { not shift->isDelayed }
+sub headIsRead() { not shift->head->isa('Mail::Message::Delayed') }
+
+#------------------------------------------
+
+
+sub readFromParser($;$)
+{   my ($self, $parser, $bodytype) = @_;
+
+    my $head = $self->readHead($parser)
+            || Mail::Message::Head::Complete->new
+                 ( message     => $self
+                 , field_type  => $self->{MM_field_type}
+                 , $self->logSettings
+                 );
+
+    my $body = $self->readBody($parser, $head, $bodytype)
+       or return;
+
+    $self->head($head);
+    $self->storeBody($body);
+    $self;
+}
+
+#------------------------------------------
+
+
+sub readHead($;$)
+{   my ($self, $parser) = (shift, shift);
+
+    my $headtype = shift
+      || $self->{MM_head_type} || 'Mail::Message::Head::Complete';
+
+    $headtype->new
+      ( message     => $self
+      , field_type  => $self->{MM_field_type}
+      , $self->logSettings
+      )->read($parser);
+}
+
+#------------------------------------------
+
+
+my $mpbody = 'Mail::Message::Body::Multipart';
+my $nbody  = 'Mail::Message::Body::Nested';
+my $lbody  = 'Mail::Message::Body::Lines';
+
+sub readBody($$;$$)
+{   my ($self, $parser, $head, $getbodytype) = @_;
+
+    my $bodytype
+      = ! $getbodytype   ? ($self->{MM_body_type} || $lbody)
+      : ref $getbodytype ? $getbodytype->($self, $head)
+      :                    $getbodytype;
+
+    my $body;
+    if($bodytype->isDelayed)
+    {   $body = $bodytype->new
+          ( message           => $self
+          , $self->logSettings
+          );
+    }
+    else
+    {   my $ct   = $head->get('Content-Type');
+        my $type = defined $ct ? lc($ct->body) : 'text/plain';
+
+        # Be sure you have acceptable bodies for multiparts and nested.
+        if(substr($type, 0, 10) eq 'multipart/' && !$bodytype->isMultipart)
+        {   $bodytype = $mpbody }
+        elsif($type eq 'message/rfc822' && !$bodytype->isNested)
+        {   $bodytype = $nbody  }
+
+        $body = $bodytype->new
+        ( message           => $self
+        , checked           => $self->{MM_trusted}
+        , $self->logSettings
+        );
+        $body->contentInfoFrom($head);
+    }
+
+    my $lines   = $head->get('Lines');
+    my $size    = $head->guessBodySize;
+
+    $body->read
+      ( $parser, $head, $getbodytype,
+      , $size, (defined $lines ? int $lines->body : undef)
+      ) or return;
+}
+
+#------------------------------------------
+
+
+sub storeBody($)
+{   my ($self, $body) = @_;
+    $self->{MM_body} = $body;
+    $body->message($self);
+    $body;
+}
+
+#-------------------------------------------
+
+
+sub isDelayed()
+{    my $body = shift->body;
+     !$body || $body->isDelayed;
+}
+
+#------------------------------------------
+
+
+sub takeMessageId(;$)
+{   my $self  = shift;
+    my $msgid = (@_ ? shift : $self->get('Message-ID')) || '';
+
+    if($msgid =~ m/\<([^>]*)\>/s)
+    {   $msgid = $1;
+        $msgid =~ s/\s//gs;
+    }
+ 
+    $msgid = $self->head->createMessageId
+        unless length $msgid;
+
+    $self->{MM_message_id} = $msgid;
+}
+
+#------------------------------------------
+
+
+sub shortSize(;$)
+{   my $self = shift;
+    my $size = shift;
+    $size = $self->head->guessBodySize unless defined $size;
+
+      !defined $size     ? '?'
+    : $size < 1_000      ? sprintf "%3d "  , $size
+    : $size < 10_000     ? sprintf "%3.1fK", $size/1024
+    : $size < 1_000_000  ? sprintf "%3.0fK", $size/1024
+    : $size < 10_000_000 ? sprintf "%3.1fM", $size/(1024*1024)
+    :                      sprintf "%3.0fM", $size/(1024*1024);
+}
+
+#------------------------------------------
+
+
+sub shortString()
+{   my $self    = shift;
+    my $subject = $self->head->get('subject') || '';
+    chomp $subject;
+
+    sprintf "%4s(%2d) %-30.30s", $self->shortSize, $subject;
+}
+
+#------------------------------------------
+
+
+sub DESTROY()
+{   my $self = shift;
+    return if $self->inGlobalDestruction;
+
+    $self->SUPER::DESTROY;
+    $self->head(undef);
+    $self->body(undef);
+}
+
+#------------------------------------------
+
+
+sub destruct() { $_[0] = undef }
+
+#------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Message.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,1600 @@
+
+=head1 NAME
+
+Mail::Message - general message object
+
+
+=head1 INHERITANCE
+
+ Mail::Message has extra code in
+   Mail::Message::Construct::Forward
+   Mail::Message::Construct::Text
+   Mail::Message::Construct::Build
+   Mail::Message::Construct::Rebuild
+   Mail::Message::Construct::Bounce
+   Mail::Message::Construct
+   Mail::Message::Construct::Reply
+   Mail::Message::Construct::Read
+
+ Mail::Message
+   is a Mail::Reporter
+
+ Mail::Message is extended by
+   Mail::Box::Message
+   Mail::Message::Dummy
+   Mail::Message::Part
+   Mail::Message::Replace::MailInternet
+
+
+=head1 SYNOPSIS
+
+ use Mail::Box::Manager;
+ my $mgr    = Mail::Box::Manager->new;
+ my $folder = $mgr->open(folder => 'InBox');
+ my $msg    = $folder->message(2);    # $msg is a Mail::Message now
+
+ my $subject = $msg->subject;         # The message's subject
+ my @cc      = $msg->cc;              # List of Mail::Address'es
+
+ my $msg       = Mail::Message->build(...);
+ my $reply_msg = Mail::Message->reply(...);
+ my $frwd_msg  = Mail::Message->forward(...);
+
+ my Mail::Message::Head $head = $msg->head;
+ my Mail::Message::Body $body = $msg->decoded;
+ $msg->decoded->print($outfile);
+
+
+=head1 DESCRIPTION
+
+A C<Mail::Message> object is a container for MIME-encoded message information,
+as defined by RFC2822.  Everything what is not specificly related to storing
+the messages in mailboxes (folders) is implemented in this class.  Methods
+which are related to folders is implemented in the L<Mail::Box::Message|Mail::Box::Message>
+extension.
+
+The main methods are L<get()|Mail::Message/"The header">, to get information from a message header
+field, and L<decoded()|Mail::Message/"The body"> to get the intended content of a message.
+But there are many more which can assist your program.
+
+Complex message handling, like construction of replies and forwards, are
+implemented in separate packages which are autoloaded into this class.
+This means you can simply use these methods as if they are part of this class.
+Those package add functionality to all kinds of message objects.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+$obj-E<gt>B<clone>
+
+=over 4
+
+Create a copy of this message.  Returned is a C<Mail::Message> object.
+The head and body, the log and trace levels are taken.  Labels are
+copied with the message, but the delete and modified flags are not.
+ 
+BE WARNED: the clone of any kind of message (or a message part)
+will B<always> be a C<Mail::Message> object.  For example, a
+L<Mail::Box::Message|Mail::Box::Message>'s clone is detached from the folder of its original.
+When you use L<Mail::Box::addMessage()|Mail::Box/"The folder"> with the cloned message at hand,
+then the clone will automatically be coerced into the right message type
+to be added.
+
+See also L<Mail::Box::Message::copyTo()|Mail::Box::Message/"The message"> and L<Mail::Box::Message::moveTo()|Mail::Box::Message/"The message">.
+
+I<Example:> 
+
+ $copy = $msg->clone;
+
+=back
+
+Mail::Message-E<gt>B<coerce>(MESSAGE)
+
+=over 4
+
+Coerce a MESSAGE into a Mail::Message.  In some
+occasions, for instance where you add a message to a folder, this
+coercion is automatically called to ensure that the correct message
+type is stored.
+
+The coerced message is returned on success, otherwise C<undef>.  The
+coerced message may be a reblessed version of the original message
+or a new object.  In case the message has to be specialized, for
+instance from a general Mail::Message into a Mail::Box::Mbox::Message,
+no copy is needed.  However, to coerce a Mail::Internet object into
+a Mail::Message, a lot of copying and converting will take place.
+
+Valid MESSAGEs which can be coerced into Mail::Message objects
+are of type
+
+=over 4
+
+=item * Any type of L<Mail::Box::Message|Mail::Box::Message>
+
+=item * MIME::Entity's, using L<Mail::Message::Convert::MimeEntity|Mail::Message::Convert::MimeEntity>
+
+=item * Mail::Internet's, using L<Mail::Message::Convert::MailInternet|Mail::Message::Convert::MailInternet>
+
+=back
+
+L<Mail::Message::Part|Mail::Message::Part>'s, which are extensions of C<Mail::Message>'s,
+can also be coerced directly from a L<Mail::Message::Body|Mail::Message::Body>.
+
+I<Example:> 
+
+ my $folder  = Mail::Box::Mbox->new;
+ my $message = Mail::Message->build(...);
+
+ my $coerced = Mail::Box::Mbox::Message->coerce($message);
+ $folder->addMessage($coerced);
+
+Simpler replacement for the previous two lines:
+
+ my $coerced = $folder->addMessage($message);
+
+=back
+
+Mail::Message-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option      Defined in       Default                                                       
+ body                         undef                                                         
+ body_type                    L<Mail::Message::Body::Lines|Mail::Message::Body::Lines>      
+ deleted                      <false>                                                       
+ field_type                   undef                                                         
+ head                         undef                                                         
+ head_type                    L<Mail::Message::Head::Complete|Mail::Message::Head::Complete>
+ labels                       {}                                                            
+ log         L<Mail::Reporter>  C<'WARNINGS'>                                                 
+ messageId                    undef                                                         
+ modified                     <false>                                                       
+ trace       L<Mail::Reporter>  C<'WARNINGS'>                                                 
+ trusted                      <false>                                                       
+
+. body OBJECT
+
+=over 4
+
+Instantiate the message with a body which has been created somewhere
+before the message is constructed.  The OBJECT must be a sub-class
+of Mail::Message::Body.  See also L<body()|Mail::Message/"The body"> and L<storeBody()|Mail::Message/"Internals">.
+
+=back
+
+. body_type CLASS
+
+=over 4
+
+Default type of body to be created for L<readBody()|Mail::Message/"Internals">.
+
+=back
+
+. deleted BOOLEAN
+
+=over 4
+
+Is the file deleted from the start?
+
+=back
+
+. field_type CLASS
+
+. head OBJECT
+
+=over 4
+
+Instantiate the message with a head which has been created somewhere
+before the message is constructed.  The OBJECT must be a (sub-)class
+of L<Mail::Message::Head|Mail::Message::Head>. See also L<head()|Mail::Message/"The header">.
+
+=back
+
+. head_type CLASS
+
+=over 4
+
+Default type of head to be created for L<readHead()|Mail::Message/"Internals">.
+
+=back
+
+. labels ARRAY|HASH
+
+=over 4
+
+Initial values of the labels.  In case of L<Mail::Box::Message|Mail::Box::Message>'s, this
+shall reflect the state the message is in.  For newly constructed
+L<Mail::Message|Mail::Message>'s, this may be anything you want, because L<coerce()|Mail::Message/"Constructors">
+will take care of the folder specifics once the message is added to one.
+
+=back
+
+. log LEVEL
+
+. messageId STRING
+
+=over 4
+
+The id on which this message can be recognized.  If none specified and
+not defined in the header --but one is needed-- there will be one assigned
+to the message to be able to pass unique message-ids between objects.
+
+=back
+
+. modified BOOLEAN
+
+=over 4
+
+Flags this message as being modified from the beginning on.  Usually,
+modification is auto-detected, but there may be reasons to be extra
+explicit.
+
+=back
+
+. trace LEVEL
+
+. trusted BOOLEAN
+
+=over 4
+
+Is this message from a trusted source?  If not, the content must be
+checked before use.  This checking will be performed when the
+body data is decoded or used for transmission.
+
+=back
+
+=back
+
+=head2 Constructing a message
+
+
+$obj-E<gt>B<bounce>([RG-OBJECT|OPTIONS])
+
+=over 4
+
+See L<Mail::Message::Construct::Bounce/"Constructing a message">
+
+=back
+
+Mail::Message-E<gt>B<build>([MESSAGE|BODY], CONTENT)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+Mail::Message-E<gt>B<buildFromBody>(BODY, [HEAD], HEADERS)
+
+=over 4
+
+See L<Mail::Message::Construct::Build/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forward>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardAttach>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardEncapsulate>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardInline>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardNo>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPostlude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardPrelude>
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<forwardSubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Forward/"Constructing a message">
+
+=back
+
+Mail::Message-E<gt>B<read>(FILEHANDLE|SCALAR|REF-SCALAR|ARRAY-OF-LINES, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Read/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<rebuild>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<reply>(OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replyPrelude>([STRING|FIELD|ADDRESS|ARRAY-OF-THINGS])
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+$obj-E<gt>B<replySubject>(STRING)
+
+Mail::Message-E<gt>B<replySubject>(STRING)
+
+=over 4
+
+See L<Mail::Message::Construct::Reply/"Constructing a message">
+
+=back
+
+=head2 The Message
+
+
+$obj-E<gt>B<container>
+
+=over 4
+
+If the message is a part of another message, C<container> returns the
+reference to the containing body.
+
+I<Example:> 
+
+ my Mail::Message $msg = ...
+ return unless $msg->body->isMultipart;
+ my $part   = $msg->body->part(2);
+
+ return unless $part->body->isMultipart;
+ my $nested = $part->body->part(3);
+
+ $nested->container;  # returns $msg->body
+ $nested->toplevel;   # returns $msg
+ $msg->container;     # returns undef
+ $msg->toplevel;      # returns $msg
+ $msg->isPart;        # returns false
+ $part->isPart;       # returns true
+
+=back
+
+$obj-E<gt>B<isDummy>
+
+=over 4
+
+Dummy messages are used to fill holes in linked-list and such, where only
+a message-id is known, but not the place of the header of body data.
+
+This method is also available for L<Mail::Message::Dummy|Mail::Message::Dummy> objects,
+where this will return C<true>.  On any extension of C<Mail::Message>,
+this will return C<false>.
+
+=back
+
+$obj-E<gt>B<isPart>
+
+=over 4
+
+Returns true if the message is a part of another message.  This is
+the case for L<Mail::Message::Part|Mail::Message::Part> extensions of C<Mail::Message>.
+
+=back
+
+$obj-E<gt>B<messageId>
+
+=over 4
+
+Retrieve the message's id.  Every message has a unique message-id.  This id
+is used mainly for recognizing discussion threads.
+
+=back
+
+$obj-E<gt>B<print>([FILEHANDLE])
+
+=over 4
+
+Print the message to the FILE-HANDLE, which defaults to the selected
+filehandle, without the encapsulation sometimes required by a folder
+type, like L<write()|Mail::Message/"The Message"> does.
+
+I<Example:> 
+
+ $message->print(\*STDERR);  # to the error output
+ $message->print;            # to the selected file
+
+ my $out = IO::File->new('out', 'w');
+ $message->print($out);      # no encapsulation: no folder
+ $message->write($out);      # with encapsulation: is folder.
+
+=back
+
+$obj-E<gt>B<send>([MAILER], OPTIONS)
+
+=over 4
+
+Transmit the message to anything outside this Perl program.  MAILER
+is a L<Mail::Transport::Send|Mail::Transport::Send> object.  When the MAILER is not specified, one
+will be created, and kept as default for the next messages as well.
+
+The OPTIONS are mailer specific, and a mixture of what is usable for
+the creation of the mailer object and the sending itself.  Therefore, see
+for possible options L<Mail::Transport::Send::new()|Mail::Transport::Send/"METHODS"> and
+L<Mail::Transport::Send::send()|Mail::Transport::Send/"Sending mail">.
+
+I<Example:> 
+
+ $message->send;
+
+is short (but little less flexibile) for
+
+ my $mailer = Mail::Transport::SMTP->new(@smtpopts);
+ $mailer->send($message, @sendopts);
+
+See examples/send.pl in the distribution of L<Mail::Box|Mail::Box>.
+
+I<Example:> 
+
+ $message->send(via => 'sendmail')
+
+=back
+
+$obj-E<gt>B<size>
+
+=over 4
+
+Returns an estimated size of the whole message in bytes.  In many occasions,
+the functions which process the message further, for instance L<send()|Mail::Message/"The Message">
+or L<print()|Mail::Message/"The Message"> will need to add/change header lines or add CR characters,
+so the size is only an estimate with a few percent margin of the real
+result.
+
+The computation assumes that each line ending is represented by one
+character (like UNIX, MacOS, and sometimes Cygwin), and not two characters
+(like Windows and sometimes Cygwin).  If you write the message to file on
+a system which uses CR and LF to end a single line (all Windows versions),
+the result in that file will be at least L<nrLines()|Mail::Message/"The header"> larger than this
+method returns.
+
+=back
+
+$obj-E<gt>B<toplevel>
+
+=over 4
+
+Returns a reference to the main message, which will be the current
+message if the message is not part of another message.
+
+=back
+
+$obj-E<gt>B<write>([FILEHANDLE])
+
+=over 4
+
+Write the message to the FILE-HANDLE, which defaults to the selected
+FILEHANDLE, with all surrounding information which is needed to put
+it correctly in a folder file.
+
+In most cases, the result of C<write> will be the same as with L<print()|Mail::Message/"The Message">.
+The main exception is for Mbox folder messages, which will get printed
+with their leading 'From ' line and a trailing blank.  Each line of
+their body which starts with 'From ' will have an 'E<gt>' added in front.
+
+=back
+
+=head2 The header
+
+
+$obj-E<gt>B<bcc>
+
+=over 4
+
+Returns the addresses which are specified on the C<Bcc> header line (or lines)
+A list of Mail::Address objects is returned.
+C<Bcc> stands for I<Blind Carbon Copy>: destinations of the message which are
+not listed in the messages actually sent.  So, this field will be empty
+for received messages, but may be present in messages you construct yourself.
+
+=back
+
+$obj-E<gt>B<cc>
+
+=over 4
+
+Returns the addresses which are specified on the C<Cc> header line (or lines)
+A list of Mail::Address objects is returned.  C<Cc> stands for
+I<Carbon Copy>; the people addressed on this line receive the message
+informational, and are usually not expected to reply on its content.
+
+=back
+
+$obj-E<gt>B<date>
+
+=over 4
+
+Method has been removed for reasons of consistency.  Use L<timestamp()|Mail::Message/"The header">
+or C<$msg->head->get('Date')>.
+
+=back
+
+$obj-E<gt>B<destinations>
+
+=over 4
+
+Returns a list of Mail::Address objects which contains the combined
+info of active C<To>, C<Cc>, and C<Bcc> addresses.  Double addresses are
+removed if detectable.
+
+=back
+
+$obj-E<gt>B<from>
+
+=over 4
+
+Returns the address of the sender.  It is possible to have more than
+one address specified in the C<From> field of the message. Therefore a
+list of Mail::Address objects is returned, which usually has
+length 1.
+
+If you need one address of a sender, for instance to create a reply to,
+then use L<sender()|Mail::Message/"The header">.
+
+I<Example:> using from() to get all sender addresses
+
+
+ my @from = $message->from;
+
+=back
+
+$obj-E<gt>B<get>(FIELDNAME)
+
+=over 4
+
+Returns the value which is stored in the header field with the specified
+name.  The FIELDNAME is case insensitive.  The I<unfolded body> of the
+field is returned, stripped from any attributes.
+See L<Mail::Message::Field::body()|Mail::Message::Field/"Access to the body">.
+
+If the field has multiple appearances in the header, only the last
+instance is returned.  If you need more complex handing of fields, then
+call L<Mail::Message::Head::get()|Mail::Message::Head/"Access to the header"> yourself.  See L<study()|Mail::Message/"The header"> when you
+want to be smart, doing the better (but slower) job.
+
+I<Example:> the get() short-cut for header fields
+
+
+ print $msg->get('Content-Type'), "\n";
+
+Is equivalent to:
+
+ print $msg->head->get('Content-Type')->body, "\n";
+
+=back
+
+$obj-E<gt>B<guessTimestamp>
+
+=over 4
+
+Return an estimate on the time this message was sent.  The data is
+derived from the header, where it can be derived from the C<date> and
+C<received> lines.  For MBox-like folders you may get the date from
+the from-line as well.
+
+This method may return C<undef> if the header is not parsed or only
+partially known.  If you require a time, then use the L<timestamp()|Mail::Message/"The header">
+method, described below.
+
+I<Example:> using guessTimestamp() to get a transmission date
+
+
+ print "Receipt ", ($message->timestamp || 'unknown'), "\n";
+
+=back
+
+$obj-E<gt>B<head>([HEAD])
+
+=over 4
+
+Return (optionally after setting) the HEAD of this message.
+The head must be an (sub-)class of L<Mail::Message::Head|Mail::Message::Head>.
+When the head is added, status information is taken from it
+and transformed into labels.  More labels can be added by the
+LABELS hash.  They are added later.
+
+I<Example:> 
+
+ $msg->head(Mail::Message::Head->new);  # set
+ my $head = $msg->head;                 # get
+
+=back
+
+$obj-E<gt>B<nrLines>
+
+=over 4
+
+Returns the number of lines used for the whole message.
+
+=back
+
+$obj-E<gt>B<sender>
+
+=over 4
+
+Returns exactly one address, which is the originator of this message.
+The returned Mail::Address object is taken from the C<Sender> header
+field, unless that field does not exists, in which case the first
+address from the C<From> field is taken.  If none of both provide
+an address, C<undef> is returned.
+
+I<Example:> using sender() to get exactly one sender address
+
+
+ my $sender = $message->sender;
+ print "Reply to: ", $sender->format, "\n" if defined $sender;
+
+=back
+
+$obj-E<gt>B<study>(FIELDNAME)
+
+=over 4
+
+Study the content of a field, like L<get()|Mail::Message/"The header"> does, with as main difference
+that a L<Mail::Message::Field::Full|Mail::Message::Field::Full> object is returned.  These objects
+stringify to an utf8 decoded representation of the data contained in
+the field, where L<get()|Mail::Message/"The header"> does not decode.
+See L<Mail::Message::Field::study()|Mail::Message::Field/"Access to the content">.
+
+I<Example:> the study() short-cut for header fields
+
+
+ print $msg->study('to'), "\n";
+
+Is equivalent to:
+
+ print $msg->head->study('to'), "\n";       # and
+ print $msg->head->get('to')->study, "\n";
+
+=back
+
+$obj-E<gt>B<subject>
+
+=over 4
+
+Returns the message's subject, or the empty string.
+
+I<Example:> using subject() to get the message's subject
+
+
+ print $msg->subject;
+
+=back
+
+$obj-E<gt>B<timestamp>
+
+=over 4
+
+Get a good timestamp for the message, doesn't matter how much work it is.
+The value returned is compatible with the platform dependent result of
+function time().
+
+In these days, the timestamp as supplied by the message (in the C<Date>
+field) is not trustable at all: many spammers produce illegal or
+unreal dates to influence their location in the displayed folder.
+
+To start, the received headers are tried for a date (see
+L<Mail::Message::Head::Complete::recvstamp()|Mail::Message::Head::Complete/"About the body">) and only then the C<Date>
+field.  When no date was found, C<undef> will be returned.  This may be
+very usual, because MailBox message constructors add a Date automatically.
+
+=back
+
+$obj-E<gt>B<to>
+
+=over 4
+
+Returns the addresses which are specified on the C<To> header line (or lines).
+A list of Mail::Address objects is returned.  The people addressed
+here are the targets of the content, and should read it contents
+carefully.
+
+I<Example:> using to() to get all primar destination addresses
+
+
+ my @to = $message->to;
+
+=back
+
+=head2 The body
+
+
+$obj-E<gt>B<body>([BODY])
+
+=over 4
+
+Return the body of this message.  BE WARNED that this returns
+you an object which may be encoded: use decoded() to get a body
+with usable data.
+
+With options, a new BODY is set for this message.  This is B<not>
+for normal use unless you understand the consequences: you change
+the message content without changing the message-ID.  The right
+way to go is via
+
+ $message = Mail::Message->buildFromBody($body);  # or
+ $message = Mail::Message->build($body);          # or
+ $message = $origmsg->forward(body => $body);
+
+The BODY must be an (sub-)class of L<Mail::Message::Body|Mail::Message::Body>.  In this case,
+information from the specified body will be copied into the header.  The
+body object will be encoded if needed, because messages written to file
+or transmitted shall not contain binary data.  The converted body
+is returned.
+
+When BODY is C<undef>, the current message body will be dissected from
+the message.  All relation will be cut.  The body is returned, and
+can be connected to a different message.
+
+I<Example:> 
+
+ my $body      = $msg->body;
+ my @encoded   = $msg->body->lines;
+
+ my $new       = Mail::Message::Body->new(mime_type => 'text/html');
+ my $converted = $msg->body($new);
+
+=back
+
+$obj-E<gt>B<decoded>(OPTIONS)
+
+=over 4
+
+Decodes the body of this message, and returns it as a body object.  If there
+was no encoding, the body object as read from file is passed on, however,
+some more work will be needed when a serious encoding is encountered.
+The OPTIONS control how the conversion takes place.
+
+ Option       Defined in       Default       
+ keep                          <false>       
+ result_type                   <type of body>
+
+. keep BOOLEAN
+
+=over 4
+
+Controls whether the decoded result will be kept.  If not, the decoding
+may be performed more than once.  However, it will consume extra
+resources...
+
+=back
+
+. result_type BODYTYPE
+
+=over 4
+
+Specifies which kind of body should be used for the final result, and
+eventual intermediate conversion stages.  It is not sure that this
+will be the type of the body returned.  BODYTYPE extends
+L<Mail::Message::Body|Mail::Message::Body>.
+
+=back
+
+I<Example:> 
+
+ $message->decoded->print(\*OUT);
+ $message->decoded->print;
+
+ my $dec = $message->body($message->decoded);
+ my $dec = $message->decoded(keep => 1);   # same
+
+=back
+
+$obj-E<gt>B<encode>(OPTIONS)
+
+=over 4
+
+Encode the message to a certain format.  Read the details in the
+dedicated manual page L<Mail::Message::Body::Encode|Mail::Message::Body::Encode>.  The OPTIONS which
+can be specified here are those of the L<Mail::Message::Body::encode()|Mail::Message::Body::Encode/"Constructing a body">
+method.  
+
+=back
+
+$obj-E<gt>B<isMultipart>
+
+=over 4
+
+Check whether this message is a multipart message (has attachments).  To
+find this out, we need at least the header of the message; there is no
+need to read the body of the message to detect this.
+
+=back
+
+$obj-E<gt>B<isNested>
+
+=over 4
+
+Returns C<true> for C<message/rfc822> messages and message parts.
+
+=back
+
+$obj-E<gt>B<parts>(['ALL'|'ACTIVE'|'DELETED'|'RECURSE'|FILTER])
+
+=over 4
+
+Returns the I<parts> of this message. Usually, the term I<part> is used
+with I<multipart> messages: messages which are encapsulated in the body
+of a message.  To abstract this concept: this method will return you
+all header-body combinations which are stored within this message
+B<except> the multipart and message/rfc822 wrappers.
+Objects returned are C<Mail::Message>'s and L<Mail::Message::Part|Mail::Message::Part>'s.
+
+The option default to 'ALL', which will return the message itself for
+single-parts, the nested content of a message/rfc822 object, respectively
+the parts of a multipart without recursion.  In case of 'RECURSE', the
+parts of multiparts will be collected recursively.  This option cannot
+be combined with the other options, which you may want: it that case
+you have to test yourself.
+
+'ACTIVE' and 'DELETED' check for the deleted flag on messages and
+message parts.  The FILTER is a code reference, which is called for
+each part of the messagei; each part as C<RECURSE> would return.
+
+I<Example:> 
+
+ my @parts = $msg->parts;           # $msg not multipart: returns ($msg)
+ my $parts = $msg->parts('ACTIVE'); # returns ($msg)
+
+ $msg->delete;
+ my @parts = $msg->parts;           # returns ($msg)
+ my $parts = $msg->parts('ACTIVE'); # returns ()
+
+=back
+
+=head2 Flags
+
+
+$obj-E<gt>B<delete>
+
+=over 4
+
+Flag the message to be deleted, which is a shortcut for
+ $msg->label(deleted => time);
+The real deletion only takes place on a synchronization of the folder.
+See L<deleted()|Mail::Message/"Flags"> as well.
+
+The time stamp of the moment of deletion is stored as value, but that
+is not always preserved in the folder (depends on the implementation).
+When the same message is deleted more than once, the first time stamp
+will stay.
+
+I<Example:> 
+
+ $message->delete;
+ $message->deleted(1);  # exactly the same
+ $message->label(deleted => 1);
+ delete $message;
+
+=back
+
+$obj-E<gt>B<deleted>([BOOLEAN])
+
+=over 4
+
+Set the delete flag for this message.  Without argument, the method
+returns the same as L<isDeleted()|Mail::Message/"Flags">, which is prefered.  When a true
+value is given, L<delete()|Mail::Message/"Flags"> is called.
+
+I<Example:> 
+
+ $message->deleted(1);          # delete
+ $message->delete;              # delete (prefered)
+
+ $message->deleted(0);          # undelete
+
+ if($message->deleted) {...}    # check
+ if($message->isDeleted) {...}  # check (prefered)
+
+=back
+
+$obj-E<gt>B<isDeleted>
+
+=over 4
+
+Short-cut for
+ $msg->label('deleted')
+
+For some folder types, you will get the time of deletion in return.  This
+depends on the implementation.
+
+I<Example:> 
+
+ next if $message->isDeleted;
+
+ if(my $when = $message->isDeleted) {
+    print scalar localtime $when;
+ }
+
+=back
+
+$obj-E<gt>B<isModified>
+
+=over 4
+
+Returns whether this message is flagged as being modified.  Modifications
+are changes in header lines, when a new body is set to the message
+(dangerous), or when labels change.
+
+=back
+
+$obj-E<gt>B<label>(LABEL|PAIRS)
+
+=over 4
+
+Return the value of the LABEL, optionally after setting some values.  In
+case of setting values, you specify key-value PAIRS.
+
+Labels are used to store knowledge about handling of the message within
+the folder.  Flags about whether a message was read, replied to, or
+scheduled for deletion.
+
+Some labels are taken from the header's C<Status> and C<X-Status> lines,
+however folder types like MH define a separate label file.
+
+I<Example:> 
+
+ print $message->label('seen');
+ if($message->label('seen')) {...};
+ $message->label(seen => 1);
+
+ $message->label(deleted => 1);  # same as $message->delete
+
+=back
+
+$obj-E<gt>B<labels>
+
+=over 4
+
+Returns all known labels.  In SCALAR context, it returns the knowledge
+as reference to a hash.  This is a reference to the original data, but
+you shall *not* change that data directly: call C<label> for
+changes!
+
+In LIST context, you get a list of names which are defined.  Be warned
+that they will not all evaluate to true, although most of them will.
+
+=back
+
+$obj-E<gt>B<labelsToStatus>
+
+=over 4
+
+When the labels were changed, that may effect the C<Status> and/or
+C<X-Status> header lines of mbox messages.  Read about the relation
+between these fields and the labels in the DETAILS chapter.
+
+The method will carefully only affect the result of L<modified()|Mail::Message/"Flags"> when
+there is a real change of flags, so not for each call to L<label()|Mail::Message/"Flags">.
+
+=back
+
+$obj-E<gt>B<modified>([BOOLEAN])
+
+=over 4
+
+Returns (optionally after setting) whether this message is flagged as
+being modified.  See isModified().
+
+=back
+
+$obj-E<gt>B<statusToLabels>
+
+=over 4
+
+Update the labels according the status lines in the header.  See the
+description in the DETAILS chapter.
+
+=back
+
+=head2 The whole message as text
+
+
+$obj-E<gt>B<file>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<lines>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<printStructure>([FILEHANDLE][, INDENT])
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+$obj-E<gt>B<string>
+
+=over 4
+
+See L<Mail::Message::Construct::Text/"The whole message as text">
+
+=back
+
+=head2 Internals
+
+
+$obj-E<gt>B<isDelayed>
+
+=over 4
+
+Check whether the message is delayed (not yet read from file).  Returns
+true or false, dependent on the body type.
+
+=back
+
+$obj-E<gt>B<readBody>(PARSER, HEAD [, BODYTYPE])
+
+=over 4
+
+Read a body of a message.  The PARSER is the access to the folder's
+file, and the HEAD is already read.  Information from the HEAD is used
+to create expectations about the message's length, but also to determine
+the mime-type and encodings of the body data.
+
+The BODYTYPE determines which kind of body will be made and defaults to
+the value specified by new(body_type).
+BODYTYPE may be the name of a body class, or a reference
+to a routine which returns the body's class when passed the HEAD as only
+argument.
+
+=back
+
+$obj-E<gt>B<readFromParser>(PARSER, [BODYTYPE])
+
+=over 4
+
+Read one message from file.  The PARSER is opened on the file.  First
+L<readHead()|Mail::Message/"Internals"> is called, and the head is stored in the message.  Then
+L<readBody()|Mail::Message/"Internals"> is called, to produce a body.  Also the body is added to
+the message without decodings being done.
+
+The optional BODYTYPE may be a body class or a reference to a code
+which returns a body-class based on the header.
+
+=back
+
+$obj-E<gt>B<readHead>(PARSER [,CLASS])
+
+=over 4
+
+Read a head into an object of the specified CLASS.  The CLASS defaults to
+L<new(head_type)|Mail::Message/"Constructors">.  The PARSER is the access to the folder's file.
+
+=back
+
+$obj-E<gt>B<recursiveRebuildPart>(PART, OPTIONS)
+
+=over 4
+
+See L<Mail::Message::Construct::Rebuild/"Internals">
+
+=back
+
+$obj-E<gt>B<storeBody>(BODY)
+
+=over 4
+
+Where the L<body()|Mail::Message/"The body"> method can be used to set and get a body, with all
+the necessary checks, this method is bluntly adding the specified body
+to the message.  No conversions, not checking.
+
+=back
+
+$obj-E<gt>B<takeMessageId>([STRING])
+
+=over 4
+
+Take the message-id from the STRING, or create one when the C<undef>
+is specified.  If not STRING nor C<undef> is given, the current header
+of the message is requested for the value of the C<'Message-ID'> field.
+
+Angles (if present) are removed from the id. 
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Message::Construct/"METHODS">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Message-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Message-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Message-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<shortSize>([VALUE])
+
+Mail::Message-E<gt>B<shortSize>([VALUE])
+
+=over 4
+
+Represent an integer VALUE representing the size of file or memory,
+(which can be large) into a short string using M and K (Megabytes
+and Kilobytes).  Without VALUE, the size of the message head is used.
+
+=back
+
+$obj-E<gt>B<shortString>
+
+=over 4
+
+Convert the message header to a short string, representing the most
+important facts (for debugging purposes only).
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+When a message is to accessible anymore by any user's reference, Perl
+will call DESTROY for final clean-up.  In this case, the head and
+body are released, and de-registered for the folder.  You shall not call
+this yourself!
+
+=back
+
+$obj-E<gt>B<destruct>
+
+=over 4
+
+Remove the information contained in the message object.  This will be
+ignored when more than one reference to the same message object exists,
+because the method has the same effect as assigning C<undef> to the
+variable which contains the reference.  Normal garbage collection will
+call L<DESTROY()|Mail::Message/"Cleanup"> when possible.
+
+This method is only provided to hide differences with messages which are
+located in folders: their L<Mail::Box::Message::destruct()|Mail::Box::Message/"Cleanup"> works quite
+differently.
+
+I<Example:> of Mail::Message destruct
+
+
+ my $msg = Mail::Message->read;
+ $msg->destruct;
+ $msg = undef;    # same
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot include forward source as $include.
+
+Unknown alternative for the L<forward(include)|Mail::Message::Construct::Forward/"Constructing a message">.  Valid choices are
+C<NO>, C<INLINE>, C<ATTACH>, and C<ENCAPSULATE>.
+
+I<Error:> Cannot include reply source as $include.
+
+Unknown alternative for the C<include> option of L<reply()|Mail::Message::Construct::Reply/"Constructing a message">.  Valid
+choices are C<NO>, C<INLINE>, and C<ATTACH>.
+
+I<Error:> No address to create forwarded to.
+
+If a forward message is created, a destination address must be specified.
+
+I<Error:> No default mailer found to send message.
+
+The message L<send()|Mail::Message/"The Message"> mechanism had not enough information to automatically
+find a mail transfer agent to sent this message.  Specify a mailer
+explicitly using the C<via> options.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> forwardAttach requires a preamble object
+
+
+I<Error:> forwardEncapsulate requires a preamble object
+
+
+I<Error:> no rebuild rule $name defined.
+
+
+
+=head1 DETAILS
+
+
+=head2 Structure of a Message
+
+A MIME-compliant message is build upon two parts: the I<header> and the
+I<body>.
+
+=head3 The header
+
+The header is a list of fields, some spanning more than one line
+(I<folded>) each telling something about the message. Information stored
+in here are for instance the sender of the message, the receivers of
+the message, when it was transported, how it was transported, etc.
+Headers can grow quite large.
+
+In MailBox, each message object manages exactly one header object
+(a L<Mail::Message::Head|Mail::Message::Head>) and one body object (a L<Mail::Message::Body|Mail::Message::Body>).
+The header contains a list of header fields, which are represented by
+L<Mail::Message::Field|Mail::Message::Field> objects.
+
+=head3 The body
+
+The body contains the "payload": the data to be transfered.
+The data can be encoded, only accessible with a specific application,
+and may use some weird character-set, like Vietnamese; the MailBox
+distribution tries to assist you with handling these e-mails without
+the need to know all the details.  This additional information
+("meta-information") about the body data is stored in the header.
+The header contains more information, for instance about the message
+transport and relations to other messages.
+
+=head2 Message object implementation
+
+The general idea about the structure of a message is
+
+ Mail::Message
+  |  |
+  |  `-has-one--Mail::Message::Body
+  |
+  `----has-one--Mail::Message::Head
+                  |
+                  `-has-many--Mail::Message::Field
+
+However: there are about 7 kinds of body objects, 3 kinds of headers and
+3 kinds of fields.  You will usually not see too much of these kinds,
+because they are merely created for performance reasons and can be used
+all the same, with the exception of the multipart bodies.
+
+A multipart body is either a L<Mail::Message::Body::Multipart|Mail::Message::Body::Multipart>
+(mime type C<multipart/*>) or a L<Mail::Message::Body::Nested|Mail::Message::Body::Nested>
+(mime type C<message/rfc822>).  These bodies are more complex:
+
+ Mail::Message::Body::Multipart
+  |
+  `-has-many--Mail::Message::Part
+               |  |
+               |  `-has-one--Mail::Message::Body
+               |
+               `----has-one--Mail::Message::Head
+
+Before you try to reconstruct multiparts or nested messages yourself,
+you can better take a look at L<Mail::Message::Construct::Rebuild|Mail::Message::Construct::Rebuild>.
+
+=head2 Message class implementation
+
+The class structure of messages is very close to that of folders.  For
+instance, a L<Mail::Box::File::Message|Mail::Box::File::Message> relates to a L<Mail::Box::File|Mail::Box::File>
+folder.
+
+As extra level of inheritance, it has a L<Mail::Message|Mail::Message>, which
+is a message without location.  And there is a special case of
+message: L<Mail::Message::Part|Mail::Message::Part> is a message encapsulated in a
+multipart body.
+
+The message types are:
+
+ Mail::Box::Mbox::Message            Mail::Box::POP3::Message
+ |  Mail::Box::Dbx::Message      Mail::Box::IMAP4::Message  |
+ |  |                                                    |  |
+ Mail::Box::File::Message             Mail::Box::Net::Message
+         |                                      |
+         |       Mail::Box::Maildir::Message    |
+         |       |   Mail::Box::MH::Message     |
+         |       |   |                          |
+         |       Mail::Box::Dir::Message        |
+         |                |                     |
+         `------------.   |   .-----------------'
+                      |   |   |
+                   Mail::Box::Message    Mail::Message::Part
+                          |                     |
+                          |       .-------------'
+                          |       |
+                      Mail::Message
+                          |
+                          |
+                    Mail::Reporter (general base class)
+
+By far most folder features are implemented in L<Mail::Box|Mail::Box>, so
+available to all folder types.  Sometimes, features which appear
+in only some of the folder types are simulated for folders that miss
+them, like sub-folder support for MBOX.
+
+Two strange other message types are defined:
+the L<Mail::Message::Dummy|Mail::Message::Dummy>, which fills holes in
+L<Mail::Box::Thread::Node|Mail::Box::Thread::Node> lists, and a L<Mail::Box::Message::Destructed|Mail::Box::Message::Destructed>,
+this is an on purpose demolished message to reduce memory consumption.
+
+=head2 Labels
+
+Labels (also named "Flags") are used to indicate some special condition on
+the message, primary targeted on organizational issues: which messages are
+already read or should be deleted.  There is a very strong user relation
+to labels.
+
+The main complication is that each folder type has its own way of storing
+labels.  To give an indication: MBOX folders use C<Status> and C<X-Status>
+header fields, MH uses a C<.mh-sequences> file, MAILDIR encodes the flags
+in the message's filename, and IMAP has flags as part of the protocol.
+
+Besides, some folder types can store labels with user defined names,
+where other lack that feature.  Some folders have case-insensitive
+labels, other don't. Read all about the specifics in the manual page of
+the message type you actually have.
+
+=head3 Predefined labels
+
+To standardize the folder types, MailBox has defined the following labels,
+which can be used with the L<label()|Mail::Message/"Flags"> and L<labels()|Mail::Message/"Flags"> methods on all kinds
+of messages:
+
+=over 4
+
+=item * deleted
+
+This message is flagged to be deleted once the folder closes.  Be very
+careful about the concept of 'delete' in a folder context : it is only a
+flag, and does not involve immediate action!  This means, for instance,
+that the memory which is used by Perl to store the message is not released
+immediately (see L<destruct()|Mail::Message/"Cleanup"> if you need to).
+
+The methods L<delete()|Mail::Message/"Flags">, L<deleted()|Mail::Message/"Flags">, and L<isDeleted()|Mail::Message/"Flags"> are only
+short-cuts for managing the C<delete> label (as of MailBox 2.052).
+
+=item * draft
+
+The user has prepared this message, but is has not been send (yet).  This
+flag is not automatically added to a message by MailBox, and has only
+a meaning in user applications.
+
+=item * flagged
+
+Messages can be I<flagged> for some purpose, for instance as result of
+a search for spam in a folder.  The L<Mail::Box::messages()|Mail::Box/"The messages"> method
+can be used to collect all these flagged messages from the folder.
+
+Probably it is more useful to use an understandable name (like C<spam>)
+for these selections, however these self-defined labels can not stored
+in all folder types.
+
+=item * old
+
+The message was already in the folder when it was opened the last time,
+so was not recently added to the folder.  This flag will never automatically
+be set by MailBox, because it would probably conflict with the user's
+idea of what is old.
+
+=item * replied
+
+The user (or application) has sent a message back to the sender of
+the message, as response of this one.  This flag is automatically
+set if you use L<reply()|Mail::Message::Construct::Reply/"Constructing a message">, but not with L<forward()|Mail::Message::Construct::Forward/"Constructing a message"> or L<bounce()|Mail::Message::Construct::Bounce/"Constructing a message">.
+
+=item * seen
+
+When this flag is set, the receiver of the message has consumed the message.
+A mail user agent (MUA) will set this flag when the user has opened the
+message once.
+
+=back
+
+=head3 Status and X-Status fields
+
+Mbox folders have no special means of storing information about messages
+(except the message separator line), and therefore have to revert to
+adding fields to the message header when something special comes up.
+This feature is also enabled for POP3, although whether that works
+depends on the POP server.
+
+All applications which can handle mbox folders support the C<Status> and
+C<X-Status> field convensions.  The following encoding is used:
+
+ Flag   Field       Label
+ R      Status   => seen    (Read)
+ O      Status   => old     (not recent)
+ A      X-Status => replied (Answered)
+ F      X-Status => flagged
+
+There is no special flag for C<deleted>, which most other folders support:
+messages flagged to be deleted will never be written to a folder file when
+it is closed.
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Reporter.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Reporter.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Reporter.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,228 @@
+use strict;
+use warnings;
+
+package Mail::Reporter;
+use vars '$VERSION';
+$VERSION = '2.055';
+
+use Carp;
+use Scalar::Util 'dualvar';
+
+
+my @levelname = (undef, qw(DEBUG NOTICE PROGRESS WARNING ERROR NONE INTERNAL));
+
+my %levelprio = (ERRORS => 5, WARNINGS => 4, NOTICES => 2);
+for(my $l = 1; $l < @levelname; $l++)
+{   $levelprio{$levelname[$l]} = $l;
+    $levelprio{$l} = $l;
+}
+
+sub new(@)
+{   my $class = shift;
+#confess "Parameter list has odd length: @_" if @_ % 2;
+    (bless {}, $class)->init({@_});
+}
+
+my $default_log   = $levelprio{WARNINGS};
+my $default_trace = $levelprio{WARNINGS};
+
+sub init($)
+{   my ($self, $args) = @_;
+    $self->{MR_log}   = $levelprio{$args->{log}   || $default_log};
+    $self->{MR_trace} = $levelprio{$args->{trace} || $default_trace};
+    $self;
+}
+
+#------------------------------------------
+
+
+sub defaultTrace(;$$)
+{   my $thing = shift;
+
+    if(@_)
+    {   my ($log, $trace) = @_==1 ? ($_[0], $_[0]) : @_;
+
+        $default_log   = $levelprio{$log}
+           or croak "Undefined log level $log";
+
+        $default_trace = $levelprio{$trace}
+           or croak "Undefined trace level $trace";
+    }
+
+    ( $thing->logPriority($default_log), $thing->logPriority($default_trace) );
+}
+
+#------------------------------------------
+
+
+sub trace(;$)
+{   my $self = shift;
+
+    return $self->logPriority($self->{MR_trace})
+        unless @_;
+
+    my $level = shift;
+    my $prio  = $levelprio{$level}
+        or croak "Unknown trace-level $level.";
+
+    $self->{MR_trace} = $prio;
+}
+
+#------------------------------------------
+
+
+# Implementation detail: the C code avoids calls back to Perl by
+# checking the trace-level itself.  In the perl code of this module
+# however, just always call the log() method, and let it check
+# whether or not to display it.
+
+sub log(;$@)
+{   my $thing = shift;
+
+    if(ref $thing)   # instance call
+    {   return $thing->logPriority($thing->{MR_log})
+            unless @_;
+
+        my $level = shift;
+        my $prio  = $levelprio{$level}
+            or croak "Unknown log-level $level";
+
+        return $thing->{MR_log} = $prio unless @_;
+
+        my $text    = join '', @_;
+        $text      .= "\n" unless (substr $text, -1) eq "\n";
+
+        warn "$level: $text"
+            if $prio >= $thing->{MR_trace};
+
+        push @{$thing->{MR_report}[$prio]}, $text
+            if $prio >= $thing->{MR_log};
+    }
+    else             # class method
+    {   my $level = shift;
+        my $prio  = $levelprio{$level}
+            or croak "Unknown log-level $level";
+
+        return $thing unless $prio >= $default_trace;
+
+        my $text    = join '', @_;
+        $text      .= "\n" unless (substr $text, -1) eq "\n";
+
+        warn "$level: $text";
+    }
+
+    $thing;
+}
+
+
+#------------------------------------------
+
+
+sub report(;$)
+{   my $self    = shift;
+    my $reports = $self->{MR_report} || return ();
+
+    if(@_)
+    {   my $level = shift;
+        my $prio  = $levelprio{$level}
+            or croak "Unknown report level $level.";
+
+        return $reports->[$prio] ? @{$reports->[$prio]} : ();
+    }
+
+    my @reports;
+    for(my $prio = 1; $prio < @$reports; $prio++)
+    {   next unless $reports->[$prio];
+        my $level = $levelname[$prio];
+        push @reports, map { [ $level, $_ ] } @{$reports->[$prio]};
+    }
+
+    @reports;
+}
+
+#-------------------------------------------
+
+
+sub addReport($)
+{   my ($self, $other) = @_;
+    my $reports = $other->{MR_report} || return ();
+
+    for(my $prio = 1; $prio < @$reports; $prio++)
+    {   push @{$self->{MR_report}[$prio]}, @{$reports->[$prio]}
+            if exists $reports->[$prio];
+    }
+    $self;
+}
+    
+#-------------------------------------------
+
+
+sub reportAll(;$)
+{   my $self = shift;
+    map { [ $self, @$_ ] } $self->report(@_);
+}
+
+#-------------------------------------------
+
+
+sub errors(@)   {shift->report('ERRORS')}
+
+#-------------------------------------------
+
+
+sub warnings(@) {shift->report('WARNINGS')}
+
+#-------------------------------------------
+
+
+sub notImplemented(@)
+{   my $self    = shift;
+    my $package = ref $self || $self;
+    my $sub     = (caller 1)[3];
+
+    $self->log(ERROR => "Package $package does not implement $sub.");
+    confess "Please warn the author, this shouldn't happen.";
+}
+
+#------------------------------------------
+
+
+sub logPriority($)
+{   my $level = $levelprio{$_[1]} or return undef;
+    dualvar $level, $levelname[$level];
+}
+
+#-------------------------------------------
+
+
+sub logSettings()
+{  my $self = shift;
+   (log => $self->{MR_log}, trace => $self->{MR_trace});
+}
+
+#-------------------------------------------
+
+
+sub AUTOLOAD(@)
+{   my $thing   = shift;
+    our $AUTOLOAD;
+    my $class   = ref $thing || $thing;
+    (my $method = $AUTOLOAD) =~ s/^.*\:\://;
+
+    $Carp::MaxArgLen=20;
+    confess "Method $method() is not defined for a $class.\n";
+}
+
+#-------------------------------------------
+
+
+my $global_destruction;
+END {$global_destruction++}
+sub inGlobalDestruction() {$global_destruction}
+
+#-------------------------------------------
+
+
+sub DESTROY {shift}
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Reporter.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Reporter.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Reporter.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,349 @@
+
+=head1 NAME
+
+Mail::Reporter - base-class and error reporter for Mail::Box
+
+
+
+=head1 SYNOPSIS
+
+ $folder->log(WARNING => 'go away');
+ print $folder->trace;        # current level
+ $folder->trace('PROGRESS');  # set level
+ print $folder->errors;
+ print $folder->report('PROGRESS');
+
+
+=head1 DESCRIPTION
+
+The C<Mail::Reporter> class is the base class for all classes, except
+L<Mail::Message::Field::Fast|Mail::Message::Field::Fast> because it would become slow...  This
+base class is used during initiation of the objects, and for configuring
+and logging error messages.
+
+
+
+=head1 METHODS
+
+The C<Mail::Reporter> class is the base for nearly all other
+objects.  It can store and report problems, and contains the general
+constructor L<new()|Mail::Reporter/"Constructors">.
+
+=head2 Constructors
+
+
+Mail::Reporter-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+This error container is also the base constructor for all modules, (as long
+as there is no need for an other base object)  The constructor always accepts
+the following OPTIONS related to error reports.
+
+ Option  Defined in       Default      
+ log                      C<'WARNINGS'>
+ trace                    C<'WARNINGS'>
+
+. log LEVEL
+
+=over 4
+
+Log messages which have a priority higher or equal to the specified
+level are stored internally and can be retrieved later.  The global
+default for this option can be changed with L<defaultTrace()|Mail::Reporter/"Error handling">.
+
+Known levels are C<INTERNAL>, C<ERRORS>, C<WARNINGS>, C<PROGRESS>,
+C<NOTICES> C<DEBUG>, and C<NONE>.  The C<PROGRESS> level relates to
+the reading and writing of folders.  C<NONE> will cause only C<INTERNAL>
+errors to be logged.
+By the way: C<ERROR> is an alias for C<ERRORS>, as C<WARNING> is an alias
+for C<WARNINGS>, and C<NOTICE> for C<NOTICES>.
+
+=back
+
+. trace LEVEL
+
+=over 4
+
+Trace messages which have a level higher or equal to the specified level
+are directly printed using warn.  The global default for this option can
+be changed with L<defaultTrace()|Mail::Reporter/"Error handling">.
+
+=back
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+By default, produce a nice warning if the sub-classes cannot resolve
+a method.
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+Add the report from other OBJECT to the report of this object. This is
+useful when complex actions use temporary objects which are not returned
+to the main application but where the main application would like to know
+about any problems.
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Reporter-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+Reports the default trace and log LEVEL which is used for object as list
+of two elements.  When not explicitly set, both are set to C<WARNINGS>.
+Two values are returned: the first is the log level, the second represents
+the trace level.  Both are special variables: in numeric context they
+deliver a value (the internally used value), and in string context the
+string name.  Be warned that the string is always singular!
+
+You may specify one or two arguments.  In case of one argument, the
+default log and trace levels will both be set to that value.  When two
+levels are specified, the first represent the default log-level and
+the second the default trace level.
+
+I<Example:> 
+
+ my ($loglevel, $tracelevel) = Mail::Reporter->defaultTrace;
+ Mail::Reporter->defaultTrace('NOTICES');
+
+ my ($l, $t) = Mail::Reporter->defaultTrace('WARNINGS', 'DEBUG');
+ print $l;     # prints "WARNING"  (no S!)
+ print $l+0;   # prints "4"
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+Equivalent to
+
+ $folder->report('ERRORS')
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Reporter-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+As instance method this function has three different purposes.  Without
+any argument, it returns one scalar containing the number which is internally
+used to represent the current log level, and the textual representation of
+the string at the same time. See Scalar::Util method C<dualvar> for
+an explanation.
+
+With one argument, a new level of logging detail is set (specify a number
+of one of the predefined strings).  With more arguments, it is a report
+which may need to be logged or traced.
+
+As class method, only a message can be passed.  The global configuration
+value set with L<defaultTrace()|Mail::Reporter/"Error handling"> is used to decide whether the message is
+shown or ignored.
+
+Each log-entry has a LEVEL and a text string which will
+be constructed by joining the STRINGS.  If there is no newline, it will
+be added.
+
+I<Example:> 
+
+ print $message->log;      # may print "NOTICE"
+ print $message->log +0;   # may print "3"
+ $message->log('ERRORS');  # sets a new level, returns the numeric value
+
+ $message->log(WARNING => "This message is too large.");
+ $folder ->log(NOTICE  => "Cannot read from file $filename.");
+ $manager->log(DEBUG   => "Hi there!", reverse sort @l);
+
+ Mail::Message->log(ERROR => 'Unknown');
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Reporter-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+One error level (log or trace) has more than one representation: a
+numeric value and one or more strings.  For instance, C<4>, C<'WARNING'>,
+and C<'WARNINGS'> are all the same.  You can specify any of these,
+and in return you get a dualvar (see Scalar::Util method C<dualvar>)
+back, which contains the number and the singular form.
+
+The higher the number, the more important the message.
+Only messages about C<INTERNAL> problems are more important than C<NONE>.
+
+I<Example:> 
+
+ my $r = Mail::Reporter->logPriority('WARNINGS');
+ my $r = Mail::Reporter->logPriority('WARNING');    # same
+ my $r = Mail::Reporter->logPriority(4);            # same, deprecated
+ print $r;      # prints 'WARNING'  (no S!)
+ print $r + 0;  # prints 4
+ if($r < Mail::Reporter->logPriority('ERROR')) {..} # true
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+Returns a list of C<(key => value)> pairs which can be used to initiate
+a new object with the same log-settings as this one.
+
+I<Example:> 
+
+ $head->new($folder->logSettings);
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+A special case of L<log()|Mail::Reporter/"Error handling">, which logs a C<INTERNAL>-error
+and then croaks.  This is used by extension writers.
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+Get logged reports, as list of strings.  If a LEVEL is specified, the log
+for that level is returned.
+
+In case no LEVEL is specified, you get all messages each as reference
+to a tuple with level and message.
+
+I<Example:> 
+
+ my @warns = $message->report('WARNINGS');
+   # previous indirectly callable with
+   my @warns = $msg->warnings;
+
+ print $folder->report('ERRORS');
+
+ if($folder->report('DEBUG')) {...}
+
+ my @reports = $folder->report;
+ foreach (@reports) {
+    my ($level, $text) = @$_;
+    print "$level report: $text";
+ }
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+Report all messages which were produced by this object and all the objects
+which are maintained by this object.  This will return a list of triplets,
+each containing a reference to the object which caught the report, the
+level of the report, and the message.
+
+I<Example:> 
+
+ my $folder = Mail::Box::Manager->new->open(folder => 'inbox');
+ my @reports = $folder->reportAll;
+ foreach (@reports) {
+    my ($object, $level, $text) = @$_;
+
+    if($object->isa('Mail::Box')) {
+       print "Folder $object: $level: $message";
+    } elsif($object->isa('Mail::Message') {
+       print "Message ".$object->seqnr.": $level: $message";
+    }
+ }
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+Change the trace LEVEL of the object. When no arguments are specified, the
+current level is returned only.  It will be returned in one scalar which
+contains both the number which is internally used to represent the level,
+and the string which represents it.  See L<logPriority()|Mail::Reporter/"Error handling">.
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+Equivalent to
+
+ $folder->report('WARNINGS')
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+Cleanup the object.
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+Returns whether the program is breaking down.  This is used in L<DESTROY()|Mail::Reporter/"Cleanup">,
+where during global destructions references cannot be used.
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Exim.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Exim.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Exim.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,58 @@
+use strict;
+use warnings;
+
+package Mail::Transport::Exim;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Transport::Send';
+
+use Carp;
+
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    $args->{via} = 'exim';
+
+    $self->SUPER::init($args) or return;
+
+    $self->{MTS_program}
+      = $args->{proxy}
+     || ( -x '/usr/sbin/exim4' ? '/usr/sbin/exim4' : undef)
+     || $self->findBinary('exim', '/usr/exim/bin')
+     || return;
+
+    $self;
+}
+
+#------------------------------------------
+
+
+sub trySend($@)
+{   my ($self, $message, %args) = @_;
+
+    my $from = $args{from} || $message->sender;
+    $from    = $from->address if $from->isa('Mail::Address');
+    my @to   = map {$_->address} $self->destinations($message, $args{to});
+
+    my $program = $self->{MTS_program};
+    if(open(MAILER, '|-')==0)
+    {   { exec $program, '-i', '-f', $from, @to; }  # {} to avoid warning
+        $self->log(NOTICE => "Errors when opening pipe to $program: $!");
+        return 0;
+    }
+
+    $self->putContent($message, \*MAILER, undisclosed => 1);
+
+    unless(close MAILER)
+    {   $self->log(ERROR => "Errors when closing Exim mailer $program: $!");
+        $? ||= $!;
+        return 0;
+    }
+
+    1;
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Exim.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Exim.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Exim.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,322 @@
+
+=head1 NAME
+
+Mail::Transport::Exim - transmit messages using external Exim program
+
+
+=head1 INHERITANCE
+
+ Mail::Transport::Exim
+   is a Mail::Transport::Send
+   is a Mail::Transport
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my $sender = Mail::Transport::Exim->new(...);
+ $sender->send($message);
+
+
+=head1 DESCRIPTION
+
+Implements mail transport using the external C<'Exim'> program.
+When instantiated, the mailer will look for the binary in specific system
+directories, and the first version found is taken.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Transport::Exim-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+If you have Exim installed in a non-standard location, you will need to 
+specify the path, using L<new(proxy)|Mail::Transport/"METHODS">.
+
+ Option      Defined in       Default       
+ executable  L<Mail::Transport>  C<undef>      
+ hostname    L<Mail::Transport>  C<'localhost'>
+ interval    L<Mail::Transport>  C<30>         
+ log         L<Mail::Reporter>  C<'WARNINGS'> 
+ password    L<Mail::Transport>  undef         
+ port        L<Mail::Transport>  undef         
+ proxy       L<Mail::Transport>  undef         
+ retry       L<Mail::Transport>  <false>       
+ timeout     L<Mail::Transport>  C<120>        
+ trace       L<Mail::Reporter>  C<'WARNINGS'> 
+ username    L<Mail::Transport>  undef         
+ via         L<Mail::Transport>  C<'exim'>     
+
+. executable FILENAME
+
+. hostname HOSTNAME|ARRAY-OF-HOSTNAMES
+
+. interval SECONDS
+
+. log LEVEL
+
+. password STRING
+
+. port INTEGER
+
+. proxy PATH
+
+. retry NUMBER|undef
+
+. timeout SECONDS
+
+. trace LEVEL
+
+. username STRING
+
+. via CLASS|NAME
+
+=back
+
+=head2 Sending mail
+
+
+$obj-E<gt>B<destinations>(MESSAGE, [ADDRESS|ARRAY-OF-ADDRESSES])
+
+=over 4
+
+See L<Mail::Transport::Send/"Sending mail">
+
+=back
+
+$obj-E<gt>B<putContent>(MESSAGE, FILEHANDLE, OPTIONS)
+
+=over 4
+
+See L<Mail::Transport::Send/"Sending mail">
+
+=back
+
+$obj-E<gt>B<send>(MESSAGE, OPTIONS)
+
+=over 4
+
+See L<Mail::Transport::Send/"Sending mail">
+
+=back
+
+$obj-E<gt>B<trySend>(MESSAGE, OPTIONS)
+
+=over 4
+
+=back
+
+=head2 Server connection
+
+
+$obj-E<gt>B<findBinary>(NAME [, DIRECTORIES])
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+$obj-E<gt>B<remoteHost>
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+$obj-E<gt>B<retry>
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Transport::Exim-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Transport::Exim-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Transport::Exim-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Errors when closing Exim mailer $program: $!
+
+The Exim mail transfer agent did start, but was not able to handle the message
+correctly.
+
+I<Warning:> Message has no destination
+
+It was not possible to figure-out where the message is intended to go
+to.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Warning:> Resent group does not specify a destination
+
+The message which is sent is the result of a bounce (for instance
+created with L<Mail::Message::bounce()|Mail::Message::Construct::Bounce/"Constructing a message">), and therefore starts with a
+C<Received> header field.  With the C<bounce>, the new destination(s)
+of the message are given, which should be included as C<Resent-To>,
+C<Resent-Cc>, and C<Resent-Bcc>.
+
+The C<To>, C<Cc>, and C<Bcc> header information is only used if no
+C<Received> was found.  That seems to be the best explanation of the RFC.
+
+As alternative, you may also specify the C<to> option to some of the senders
+(for instance L<Mail::Transport::SMTP::send(to)|Mail::Transport::Send/"Sending mail"> to overrule any information
+found in the message itself about the destination.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/IMAP4.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/IMAP4.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/IMAP4.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,449 @@
+
+use strict;
+use warnings;
+
+package Mail::Transport::IMAP4;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Transport::Receive';
+
+use Digest::HMAC_MD5;   # only availability check for CRAM_MD5
+use Mail::IMAPClient;
+
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    my $imap = $args->{imap_client} || 'Mail::IMAPClient';
+    if(ref $imap)
+    {   $args->{port}     = $imap->Port;
+        $args->{hostname} = $imap->Server;
+	$args->{username} = $imap->User;
+	$args->{password} = $imap->Password;
+    }
+    else
+    {   $args->{port}   ||= 143;
+    }
+
+    $args->{via}          = 'imap4';
+
+    $self->SUPER::init($args) or return;
+
+    $self->authentication($args->{authenticate} || 'AUTO');
+    $self->{MTI_domain} = $args->{domain};
+
+    unless(ref $imap)
+    {   $imap = $self->createImapClient($imap) or return undef;
+    }
+ 
+    $self->imapClient($imap);
+    $self->login or return undef;
+}
+
+#------------------------------------------
+
+
+sub url()
+{   my $self = shift;
+    my ($host, $port, $user, $pwd) = $self->remoteHost;
+    my $name = $self->folderName;
+    "imap4://$user:$pwd\@$host:$port$name";
+}
+
+#------------------------------------------
+
+
+our $ntml_installed;
+
+sub authentication(@)
+{   my ($self, @types) = @_;
+    return @{$self->{MTI_auth}} unless @types;
+
+    unless(defined $ntml_installed)
+    {   eval "require Authen::NTML";
+        die "NTML errors:\n$@" if $@ && $@ !~ /Can't locate/;
+        $ntml_installed = ! $@;
+    }
+
+    if(@types == 1 && $types[0] eq 'AUTO')
+    {   @types = ('CRAM-MD5', ($ntml_installed ? 'NTLM' : ()), 'PLAIN');
+    }
+
+    my @auth;
+    foreach my $auth (@types)
+    {   push @auth,
+             ref $auth eq 'ARRAY' ? $auth
+           : $auth eq 'NTLM'      ? [NTLM  => \&Authen::NTLM::ntlm ]
+           :                        [$auth => undef];
+    }
+
+    $self->log(WARNING => 'module Authen::NTLM is not installed')
+        if grep { !ref $_ &&  $_ eq 'NTLM' } @auth;
+
+    $self->{MTI_auth} = \@auth;
+}
+
+#------------------------------------------
+
+
+sub domain(;$)
+{   my $self = shift;
+    return $self->{MTI_domain} = shift if @_;
+    $self->{MTI_domain} || ($self->remoteHost)[0];
+}
+
+#------------------------------------------
+
+
+#------------------------------------------
+
+
+sub imapClient(;$)
+{   my $self = shift;
+    @_ ? ($self->{MTI_client} = shift) : $self->{MTI_client};
+}
+
+#------------------------------------------
+
+
+sub createImapClient($)
+{   my ($self, $class) = @_;
+
+    my ($host, $port) = $self->remoteHost;
+
+    my $debug_level = $self->logPriority('DEBUG')+0;
+    my @debug;
+    if($self->log <= $debug_level || $self->trace <= $debug_level)
+    {   tie *dh, 'Mail::IMAPClient::Debug', $self;
+        @debug = (Debug => 1, Debug_fh => \*dh);
+    }
+
+    my $client = $class->new
+     ( Server => $host, Port => $port
+     , User   => undef, Password => undef   # disable auto-login
+     , Uid    => 1                          # Safer
+     , Peek   => 1                          # Don't set \Seen automaticly
+     , @debug
+     );
+
+    $self->log(ERROR => $@), return undef if $@;
+    $client;
+}
+
+#------------------------------------------
+
+
+sub login(;$)
+{   my $self = shift;
+    my $imap = $self->imapClient;
+
+    return $self if $imap->IsAuthenticated;
+
+    my ($interval, $retries, $timeout) = $self->retry;
+
+    my ($host, $port, $username, $password) = $self->remoteHost;
+    unless(defined $username)
+    {   $self->log(ERROR => "IMAP4 requires a username and password");
+        return;
+    }
+    unless(defined $password)
+    {   $self->log(ERROR => "IMAP4 username $username requires a password");
+        return;
+    }
+
+    while(1)
+    {
+        foreach my $auth ($self->authentication)
+        {   my ($mechanism, $challange) = @$auth;
+
+            $imap->User(undef);
+            $imap->Password(undef);
+            $imap->Authmechanism(undef);   # disable auto-login
+            $imap->Authcallback(undef);
+
+            unless($imap->connect)
+	    {   $self->log(ERROR => "IMAP cannot connect to $host: "
+	                          , $imap->LastError);
+		return undef;
+	    }
+
+            if($mechanism eq 'NTLM')
+            {   Authen::NTLM::ntlm_reset();
+                Authen::NTLM::ntlm_user($username);
+                Authen::NTLM::ntlm_domain($self->domain);
+                Authen::NTLM::ntlm_password($password);
+            }
+
+            $imap->User($username);
+            $imap->Password($password);
+            $imap->Authmechanism($mechanism) unless $mechanism eq 'PLAIN';
+            $imap->Authcallback($challange) if defined $challange;
+
+            if($imap->login)
+            {
+	       $self->log(NOTICE =>
+        "IMAP4 authenication $mechanism to $username\@$host:$port successful");
+                return $self;
+            }
+        }
+
+        $self->log(ERROR => "Couldn't contact to $username\@$host:$port")
+            , return undef if $retries > 0 && --$retries == 0;
+
+        sleep $interval if $interval;
+    }
+
+    undef;
+}
+
+#------------------------------------------
+
+
+sub folder(;$)
+{   my $self = shift;
+    return $self->{MTI_folder} unless @_;
+
+    my $name = shift;
+    return $name if $name eq ($self->{MTI_folder} || '/');
+
+    my $imap = $self->imapClient or return;
+    $imap->select($name)         or return;
+    $self->{MTI_folder} = $name;
+    $imap;
+}
+
+#------------------------------------------
+
+
+sub folders(;$)
+{   my $self = shift;
+    my $imap = $self->imapClient or return ();
+    my @top  = @_ && $_[0] eq '/' ? () : shift;
+    $imap->folders(@top);
+}
+
+#------------------------------------------
+
+
+sub ids($)
+{   my $self = shift;
+    my $imap = $self->imapClient or return ();
+    $imap->messages;
+}
+
+#------------------------------------------
+
+
+# Explanation in Mail::Box::IMAP4::Message chapter DETAILS
+my %flags2labels =
+ ( '\Seen'     => [seen     => 1]
+ , '\Answered' => [replied  => 1]
+ , '\Flagged'  => [flagged  => 1]
+ , '\Deleted'  => [deleted  => 1]
+ , '\Draft'    => [draft    => 1]
+ , '\Recent'   => [old      => 0]
+ );
+
+my %labels2flags;
+while(my ($k, $v) = each %flags2labels)
+{  $labels2flags{$v->[0]} = [ $k => $v->[1] ];
+}
+
+# where IMAP4 supports requests for multiple flags at once, we here only
+# request one set of flags a time (which will be slower)
+
+sub getFlags($$)
+{   my ($self, $id) = @_;
+    my $imap  = $self->imapClient or return ();
+
+    my %flags;
+    $flags{$_}++ foreach $imap->flags($id);
+
+    my @labels;
+    while(my ($k, $v) = each %flags2labels)
+    {   my ($label, $positive) = @$v;
+        push @labels, $label => (exists $flags{$k} ? $positive : !$positive);
+    }
+
+    @labels;
+}
+
+#------------------------------------------
+
+
+# Mail::IMAPClient can only set one value a time, however we do more...
+sub setFlags($@)
+{   my ($self, $id) = (shift, shift);
+
+    my $imap = $self->imapClient or return ();
+    my (@set, @unset, @nonstandard);
+
+    while(@_)
+    {   my ($label, $value) = (shift, shift);
+        if(my $r = $labels2flags{$label})
+        {   my $flag = $r->[0];
+            $value = $value ? $r->[1] : !$r->[1];
+	        # exor can not be used, because value may be string
+            $value ? (push @set, $flag) : (push @unset, $flag);
+        }
+	else
+	{   push @nonstandard, ($label => $value);
+        }
+    }
+
+    $imap->set_flag($_, $id)   foreach @set;
+    $imap->unset_flag($_, $id) foreach @unset;
+
+    @nonstandard;
+}
+
+#------------------------------------------
+
+
+sub labelsToFlags(@)
+{   my $thing = shift;
+    my @set;
+    if(@_==1)
+    {   my $labels = shift;
+        while(my ($label, $value) = each %$labels)
+        {   if(my $r = $labels2flags{$label})
+            {   push @set, $r->[0] if ($value ? $r->[1] : !$r->[1]);
+            }
+        }
+    }
+    else
+    {   while(@_)
+        {   my ($label, $value) = (shift, shift);
+            if(my $r = $labels2flags{$label})
+            {   push @set, $r->[0] if ($value ? $r->[1] : !$r->[1]);
+            }
+        }
+    }
+
+    join(" ", @set);
+}
+
+#------------------------------------------
+
+
+sub getFields($@)
+{   my ($self, $id) = (shift, shift);
+    my $imap   = $self->imapClient or return ();
+    my $parsed = $imap->parse_headers($id, @_) or return ();
+
+    my @fields;
+    while(my($n,$c) = each %$parsed)
+    {   push @fields, map { Mail::Message::Field::Fast->new($n, $_) } @$c;
+    }
+
+    @fields;
+}
+
+#------------------------------------------
+
+
+sub getMessageAsString($)
+{   my $imap = shift->imapClient or return;
+    my $uid = ref $_[0] ? shift->unique : shift;
+    $imap->message_string($uid);
+}
+
+#------------------------------------------
+
+
+sub fetch($@)
+{   my ($self, $msgs, @info) = @_;
+    return () unless @$msgs;
+    my $imap   = $self->imapClient or return ();
+
+    my %msgs   = map { ($_->unique => {message => $_} ) } @$msgs;
+    my $lines  = $imap->fetch( [keys %msgs], @info );
+
+    # It's a pity that Mail::IMAPClient::fetch_hash cannot be used for
+    # single messages... now I had to reimplement the decoding...
+    while(@$lines)
+    {   my $line = shift @$lines;
+        next unless $line =~ /\(.*?UID\s+(\d+)/i;
+	my $id   = $+;
+	my $info = $msgs{$id} or next;  # wrong uid
+
+        if($line =~ s/^[^(]* \( \s* //x )
+        {   while($line =~ s/(\S+)   # field
+	                     \s+
+                             (?:     # value
+                                 \" ( (?:\\.|[^"])+ ) \"
+                               | \( ( (?:\\.|[^)])+ ) \)
+                               |  (\w+)
+                             )//xi)
+            {   $info->{uc $1} = $+;
+            }
+
+	    if( $line =~ m/^\s* (\S+) [ ]*$/x )
+	    {   # Text block expected
+	        my ($key, $value) = (uc $1, '');
+	        while(@$lines)
+		{   my $extra = shift @$lines;
+		    $extra =~ s/\r\n$/\n/;
+		    last if $extra eq ")\n";
+		    $value .= $extra;
+		}
+		$info->{$key} = $value;
+            }
+        }
+
+    }
+
+    values %msgs;
+}
+
+#------------------------------------------
+
+
+sub appendMessage($$)
+{   my ($self, $message, $foldername) = @_;
+    my $imap   = $self->imapClient or return ();
+
+    $imap->append_string
+     ( $foldername, $message->string
+     , $self->labelsToFlags($message->labels)
+     );
+}
+
+#------------------------------------------
+
+
+sub destroyDeleted()
+{   my $imap = shift->imapClient or return ();
+    $imap->expunge;
+}
+
+#------------------------------------------
+
+
+sub DESTROY()
+{   my $self = shift;
+    my $imap = $self->imapClient;
+
+    $self->SUPER::DESTROY;
+    $imap->logout if defined $imap;
+}
+
+#------------------------------------------
+
+package Mail::IMAPClient::Debug;
+use vars '$VERSION';
+$VERSION = '2.055';
+
+# Tied filehandle translates IMAP's debug system into Mail::Reporter
+# calls.
+sub TIEHANDLE($)
+{   my ($class, $logger) = @_;
+    bless \$logger, $class;
+}
+
+sub PRINT(@)
+{   my $logger = ${ (shift) };
+    $logger->log(DEBUG => @_);
+}
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/IMAP4.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/IMAP4.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/IMAP4.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,560 @@
+
+=head1 NAME
+
+Mail::Transport::IMAP4 - proxy to Mail::IMAPClient
+
+
+=head1 INHERITANCE
+
+ Mail::Transport::IMAP4
+   is a Mail::Transport::Receive
+   is a Mail::Transport
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my $imap = Mail::Transport::IMAP4->new(...);
+ my $message = $imap->receive($id);
+ $imap->send($message);
+
+
+=head1 DESCRIPTION
+
+****** UNDER DEVELOPMENT *****, cannot be used (yet)
+
+The IMAP4 protocol is quite complicated: it is feature rich and allows
+verious asynchronous actions.  The main document describing IMAP is
+rfc3501 (which obsoleted the original specification of protocol 4r1
+in rfc2060 in March 2003).
+
+This package, as part of MailBox, does not implement the actual
+protocol itself but uses Mail::IMAPClient to do the work.  The task
+for this package is to hide as many differences between that module's
+interface and the common L<Mail::Box|Mail::Box> folder types.  Multiple
+L<Mail::Box::IMAP4|Mail::Box::IMAP4> folders can share one L<Mail::Transport::IMAP4|Mail::Transport::IMAP4>
+connection.
+
+
+
+=head1 METHODS
+
+
+$obj-E<gt>B<url>
+
+=over 4
+
+Represent this imap4 connection as URL.
+
+=back
+
+=head2 Constructors
+
+
+Mail::Transport::IMAP4-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+Create the IMAP connection to the server.  IMAP servers can handle
+multiple folders for a single user, which means that connections
+may get shared.  This is sharing is hidden for the user.
+
+When an C<imap_client> is specified, then the options C<hostname>,
+C<port>, C<username>, and C<password> are extracted from it.
+
+ Option        Defined in       Default                             
+ authenticate                   C<'AUTO'>                           
+ domain                         <server_name>                       
+ executable    L<Mail::Transport>  C<undef>                            
+ hostname      L<Mail::Transport>  C<'localhost'>                      
+ imap_client                    L<Mail::IMAPClient|Mail::IMAPClient>
+ interval      L<Mail::Transport>  C<30>                               
+ log           L<Mail::Reporter>  C<'WARNINGS'>                       
+ password      L<Mail::Transport>  undef                               
+ port          L<Mail::Transport>  143                                 
+ proxy         L<Mail::Transport>  undef                               
+ retry         L<Mail::Transport>  <false>                             
+ timeout       L<Mail::Transport>  C<120>                              
+ trace         L<Mail::Reporter>  C<'WARNINGS'>                       
+ username      L<Mail::Transport>  undef                               
+ via           L<Mail::Transport>  C<'imap'>                           
+
+. authenticate TYPE|ARRAY-OF-TYPES
+
+=over 4
+
+Authenthication method to L<login()|Mail::Transport::IMAP4/"Protocol [internals]">, which will be passed to
+L<Mail::IMAPClient> method authenticate().  See the latter method for
+the available types.
+
+=back
+
+. domain WINDOWS_DOMAIN
+
+=over 4
+
+Used for NTLM authentication.
+
+=back
+
+. executable FILENAME
+
+. hostname HOSTNAME|ARRAY-OF-HOSTNAMES
+
+. imap_client OBJECT|CLASS
+
+=over 4
+
+When an OBJECT is supplied, that client will be used for the implementation
+of the IMAP4 protocol. Information about server and such are extracted from
+the OBJECT to have the accessors to produce correct results. The OBJECT
+shall be a L<Mail::IMAPClient|Mail::IMAPClient>.
+
+When a CLASS is given, an object of that type is created for you.  The created
+object can be retreived via L<imapClient()|Mail::Transport::IMAP4/"Protocol [internals]">, and than configured as
+defined by L<Mail::IMAPClient|Mail::IMAPClient>.
+
+=back
+
+. interval SECONDS
+
+. log LEVEL
+
+. password STRING
+
+. port INTEGER
+
+. proxy PATH
+
+. retry NUMBER|undef
+
+. timeout SECONDS
+
+. trace LEVEL
+
+. username STRING
+
+. via CLASS|NAME
+
+=back
+
+=head2 Receiving mail
+
+
+$obj-E<gt>B<receive>([UNIQUE-MESSAGE-ID])
+
+=over 4
+
+See L<Mail::Transport::Receive/"Receiving mail">
+
+=back
+
+=head2 Server connection
+
+
+$obj-E<gt>B<findBinary>(NAME [, DIRECTORIES])
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+$obj-E<gt>B<remoteHost>
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+$obj-E<gt>B<retry>
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+=head2 Attributes
+
+
+$obj-E<gt>B<authentication>(['AUTO'|TYPE|LIST-OF-TYPES])
+
+=over 4
+
+Returned is a list of pairs (ref arrays) each describing one possible
+way to contact the server. Each pair contains a mechanism name and
+a challange callback (which may be C<undef>).
+
+The settings are used by L<login()|Mail::Transport::IMAP4/"Protocol [internals]"> to get server access.  The initial
+value origins from L<new(authenticate)|Mail::Transport::IMAP4/"METHODS">, but may be changed later.
+
+Available basic TYPES are C<CRAM-MD5> and C<PLAIN>.  The latter is sending
+username and password in plain text, and is therefore tried as last
+resort.
+
+The C<NTLM> authentication requires Authen::NTLM to be installed.  Other
+methods may be added later.  Besides, you may also specify a CODE
+reference which implements some authentication.
+
+When C<AUTO> is given, then C<CRAM-MD5>, C<NTLM> and C<PLAIN> are tried,
+in that specific order.  When the Authen::NTLM is not installed it
+will silently be skipped.  Be warned that, because of C<PLAIN>, erroneous
+username/password combinations will be passed readible as last attempt!
+
+An ARRAY as TYPE can be used to specify both mechanism as callback.  When
+no array is used, callback of the pair is set to C<undef>.  See
+L<Mail::IMAPCleint/authenticate> for the gory details.
+
+I<Example:> 
+
+ $transporter->authentication('CRAM-MD5', [MY_AUTH => \&c], 'PLAIN');
+
+ foreach my $pair ($transporter->authentication)
+ {   my ($mechanism, $challange) = @$pair;
+     ...
+ }
+
+=back
+
+$obj-E<gt>B<domain>([DOMAIN])
+
+=over 4
+
+Used in NTLM authentication to define the Windows domain which is
+accessed.  Initially set by L<new(domain)|Mail::Transport::IMAP4/"METHODS"> and defaults to the
+server's name.
+
+=back
+
+=head2 Exchanging Information
+
+
+=head2 Protocol [internals]
+
+The follow methods handle protocol internals, and should not be used
+by a normal user of this class.
+
+$obj-E<gt>B<appendMessage>(MESSAGE, FOLDERNAME)
+
+=over 4
+
+Write the message to the server.
+
+=back
+
+$obj-E<gt>B<createImapClient>(CLASS)
+
+=over 4
+
+Create an object of CLASS, which extends L<Mail::IMAPClient>.
+
+=back
+
+$obj-E<gt>B<destroyDeleted>
+
+=over 4
+
+Command the server to delete for real all messages which are flagged to
+be deleted.
+
+=back
+
+$obj-E<gt>B<fetch>(ARRAY-OF-MESSAGES, INFO)
+
+=over 4
+
+Get some INFO about the MESSAGES from the server.  The specified messages
+shall extend L<Mail::Box::Net::Message|Mail::Box::Net::Message>, Returned is a list
+of hashes, each info about one result.  The contents of the hash
+differs per INFO, but at least a C<message> field will be present, to
+relate to the message in question.
+
+The right folder should be selected before this method is called. When
+the connection was lost, C<undef> is returned.  Without any
+messages, and empty array is returned.  The retrieval is done by
+L<Mail::IMAPClient|Mail::IMAPClient> method C<fetch()>, which is then
+parsed.
+
+=back
+
+$obj-E<gt>B<folder>([FOLDERNAME])
+
+=over 4
+
+Be sure that the specific FOLDER is the current one selected.
+If the folder is already selected, no IMAP traffic will be produced.
+The imap connection is returned on succes
+
+=back
+
+$obj-E<gt>B<folders>([FOLDERNAME])
+
+=over 4
+
+Returns a list of folder names which are sub-folders of the specified
+FOLDERNAME.  Without FOLDERNAME, the top-level foldernames are returned.
+
+=back
+
+$obj-E<gt>B<getFields>(UID, NAME, [NAME, ...])
+
+=over 4
+
+Get the records with the specified NAMES from the header.  The header
+fields are returned as list of L<Mail::Message::Field::Fast|Mail::Message::Field::Fast> objects.
+When the name is C<ALL>, the whole header is returned.
+
+=back
+
+$obj-E<gt>B<getFlags>(FOLDER, ID)
+
+=over 4
+
+Returns the values of all flags which are related to the message with the
+specified ID.  These flags are translated into the names which are
+standard for the MailBox suite.  Names which do not appear will also provide
+a value in the return list: the negative for the value is it was present.
+
+=back
+
+$obj-E<gt>B<getMessageAsString>(MESSAGE|UID)
+
+=over 4
+
+Returns the whole text of the specified message: the head and the body.
+
+=back
+
+$obj-E<gt>B<ids>
+
+=over 4
+
+Returns a list of UIDs which are defined by the IMAP server.
+
+=back
+
+$obj-E<gt>B<imapClient>
+
+=over 4
+
+Returns the object which implements the IMAP4 protocol, an instance
+of a Mail::IMAPClient, which is logged-in and ready to use.
+
+If the contact to the server was still present or could be established,
+an Mail::IMAPClient object is returned.  Else, C<undef> is returned and
+no further actions should be tried on the object.
+
+=back
+
+$obj-E<gt>B<labelsToFlags>(HASH|PAIRS)
+
+Mail::Transport::IMAP4-E<gt>B<labelsToFlags>(HASH|PAIRS)
+
+=over 4
+
+Convert MailBox labels into IMAP flags.  Returned is a string.  Unsupported
+labels are ignored.
+
+=back
+
+$obj-E<gt>B<login>
+
+=over 4
+
+Establish a new connection to the IMAP4 server, using username and password.
+
+=back
+
+$obj-E<gt>B<setFlags>(ID, LABEL, VALUE, [LABEL, VALUE], ...)
+
+=over 4
+
+Change the flags on the message which are represented by the label.  The
+value which can be related to the label will be lost, because IMAP only
+defines a boolean value, where MailBox labels can contain strings.
+
+Returned is a list of LABEL=>VALUE pairs which could not be send to
+the IMAP server.  These values may be cached in a different way.
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Transport::IMAP4-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Transport::IMAP4-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Transport::IMAP4-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+The connection is cleanly terminated when the program is
+terminated.
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot connect to $host:$port for IMAP4: $!
+
+
+I<Error:> IMAP cannot connect to $host: $@
+
+
+I<Notice:> IMAP4 authenication $mechanism to $host:$port successful
+
+
+I<Error:> IMAP4 requires a username and password
+
+
+I<Error:> IMAP4 username $username requires a password
+
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> module Authen::NTLM is not installed
+
+You try to establish an IMAP4 connection which explicitly uses NTLM
+authentication, but the optional Authen::NTLM, which implements this is
+not installed on your system.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Mailx.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Mailx.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Mailx.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,97 @@
+use strict;
+use warnings;
+
+package Mail::Transport::Mailx;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Transport::Send';
+
+use Carp;
+
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    $args->{via} = 'mailx';
+
+    $self->SUPER::init($args) or return;
+
+    $self->{MTM_program}
+      = $args->{proxy}
+     || $self->findBinary('mailx')
+     || $self->findBinary('Mail')
+     || $self->findBinary('mail')
+     || return;
+
+    $self->{MTM_style}
+      = defined $args->{style}                       ? $args->{style}
+      : $^O =~ m/linux|freebsd|bsdos|netbsd|openbsd/ ? 'BSD'
+      :                                                'RFC822';
+
+    $self;
+}
+
+#------------------------------------------
+
+
+sub _try_send_bsdish($$)
+{   my ($self, $message, $args) = @_;
+
+    my @options = ('-s' => $message->subject);
+
+    {   local $" = ',';
+        my @cc  = map {$_->format} $message->cc;
+        push @options, ('-c' => "@cc")  if @cc;
+
+        my @bcc = map {$_->format} $message->bcc;
+        push @options, ('-b' => "@bcc") if @bcc;
+    }
+
+    my @to      = map {$_->format} $message->to;
+    my $program = $self->{MTM_program};
+
+    if((open MAILER, '|-')==0)
+    {   close STDOUT;
+        { exec $program, @options, @to }
+        $self->log(NOTICE => "Cannot start contact to $program: $!");
+        return 0;
+    }
+ 
+    $self->putContent($message, \*MAILER, body_only => 1);
+
+    my $msgid = $message->messageId;
+
+    if(close MAILER) { $self->log(PROGRESS => "Message $msgid send.") }
+    else
+    {   $self->log(ERROR => "Sending via mailx mailer $program failed: $! ($?)");
+        return 0;
+    }
+
+    1;
+}
+
+sub trySend($@)
+{   my ($self, $message, %args) = @_;
+
+    return $self->_try_send_bsdish($message, \%args)
+        if $self->{MTM_style} eq 'BSD';
+
+    my $program = $self->{MTM_program};
+    unless(open MAILER, '|-', $program, '-t')
+    {   $self->log(NOTICE => "Cannot start contact to $program: $!");
+        return 0;
+    }
+ 
+    $self->putContent($message, \*MAILER);
+
+    unless(close MAILER)
+    {   $self->log(ERROR => "Sending via mailx mailer $program failed: $! ($?)");
+        return 0;
+    }
+
+    1;
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Mailx.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Mailx.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Mailx.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,345 @@
+
+=head1 NAME
+
+Mail::Transport::Mailx - transmit messages using external mailx program
+
+
+=head1 INHERITANCE
+
+ Mail::Transport::Mailx
+   is a Mail::Transport::Send
+   is a Mail::Transport
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my $sender = Mail::Transport::Mailx->new(...);
+ $sender->send($message);
+
+
+=head1 DESCRIPTION
+
+Implements mail transport using the external programs C<'mailx'>,
+C<Mail>, or C<'mail'>.  When instantiated, the mailer will look for
+any of these binaries in specific system directories, and the first
+program found is taken.
+
+B<WARNING: There are many security issues with mail and mailx. DO NOT USE
+these commands to send messages which contains data derived from any
+external source!!!>
+
+Under Linux, freebsd, and bsdos the C<mail>, C<Mail>, and C<mailx> names are
+just links to the same binary.  The implementation is very primitive, pre-MIME
+standard,  what may cause many headers to be lost.  For these platforms (and
+probably for other platforms as well), you can better not use this transport
+mechanism.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Transport::Mailx-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option      Defined in       Default       
+ executable  L<Mail::Transport>  C<undef>      
+ hostname    L<Mail::Transport>  C<'localhost'>
+ interval    L<Mail::Transport>  C<30>         
+ log         L<Mail::Reporter>  C<'WARNINGS'> 
+ password    L<Mail::Transport>  undef         
+ port        L<Mail::Transport>  undef         
+ proxy       L<Mail::Transport>  undef         
+ retry       L<Mail::Transport>  <false>       
+ style                        <autodetect>  
+ timeout     L<Mail::Transport>  C<120>        
+ trace       L<Mail::Reporter>  C<'WARNINGS'> 
+ username    L<Mail::Transport>  undef         
+ via         L<Mail::Transport>  C<'mailx'>    
+
+. executable FILENAME
+
+. hostname HOSTNAME|ARRAY-OF-HOSTNAMES
+
+. interval SECONDS
+
+. log LEVEL
+
+. password STRING
+
+. port INTEGER
+
+. proxy PATH
+
+. retry NUMBER|undef
+
+. style 'BSD'|'RFC822'
+
+=over 4
+
+There are two version of the C<mail> program.  The newest accepts
+RFC822 messages, and automagically collect information about where
+the message is to be send to.  The BSD style mail command predates
+MIME, and expects lines which start with a C<'~'> (tilde) to specify
+destinations and such.  This field is autodetect, however on some
+platforms both versions of C<mail> can live (like various Linux
+distributions).
+
+=back
+
+. timeout SECONDS
+
+. trace LEVEL
+
+. username STRING
+
+. via CLASS|NAME
+
+=back
+
+=head2 Sending mail
+
+
+$obj-E<gt>B<destinations>(MESSAGE, [ADDRESS|ARRAY-OF-ADDRESSES])
+
+=over 4
+
+See L<Mail::Transport::Send/"Sending mail">
+
+=back
+
+$obj-E<gt>B<putContent>(MESSAGE, FILEHANDLE, OPTIONS)
+
+=over 4
+
+See L<Mail::Transport::Send/"Sending mail">
+
+=back
+
+$obj-E<gt>B<send>(MESSAGE, OPTIONS)
+
+=over 4
+
+See L<Mail::Transport::Send/"Sending mail">
+
+=back
+
+$obj-E<gt>B<trySend>(MESSAGE, OPTIONS)
+
+=over 4
+
+=back
+
+=head2 Server connection
+
+
+$obj-E<gt>B<findBinary>(NAME [, DIRECTORIES])
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+$obj-E<gt>B<remoteHost>
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+$obj-E<gt>B<retry>
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Transport::Mailx-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Transport::Mailx-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Transport::Mailx-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> Message has no destination
+
+It was not possible to figure-out where the message is intended to go
+to.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Warning:> Resent group does not specify a destination
+
+The message which is sent is the result of a bounce (for instance
+created with L<Mail::Message::bounce()|Mail::Message::Construct::Bounce/"Constructing a message">), and therefore starts with a
+C<Received> header field.  With the C<bounce>, the new destination(s)
+of the message are given, which should be included as C<Resent-To>,
+C<Resent-Cc>, and C<Resent-Bcc>.
+
+The C<To>, C<Cc>, and C<Bcc> header information is only used if no
+C<Received> was found.  That seems to be the best explanation of the RFC.
+
+As alternative, you may also specify the C<to> option to some of the senders
+(for instance L<Mail::Transport::SMTP::send(to)|Mail::Transport::Send/"Sending mail"> to overrule any information
+found in the message itself about the destination.
+
+I<Error:> Sending via mailx mailer $program failed: $! ($?)
+
+Mailx (in some shape: there are many different implementations) did start
+accepting messages, but did not succeed sending it.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/POP3.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/POP3.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/POP3.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,422 @@
+
+use strict;
+use warnings;
+
+package Mail::Transport::POP3;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Transport::Receive';
+
+use IO::Socket  ();
+use Socket      qw/$CRLF/;
+
+use Digest::MD5 ();
+
+
+sub init($)
+{   my ($self, $args) = @_;
+    $args->{via}    = 'pop3';
+    $args->{port} ||= 110;
+
+    $self->SUPER::init($args) or return;
+
+    $self->{MTP_auth}    = $args->{authenticate} || 'AUTO';
+    return unless $self->socket;   # establish connection
+
+    $self;
+}
+
+#------------------------------------------
+
+
+sub ids(;@)
+{   my $self = shift;
+    return unless $self->socket;
+    wantarray ? @{$self->{MTP_n2uidl}} : $self->{MTP_n2uidl};
+}
+
+#------------------------------------------
+
+
+sub messages()
+{   my $self = shift;
+
+    $self->log(ERROR =>"Cannot get the messages of pop3 via messages()."), return ()
+       if wantarray;
+
+    $self->{MTP_messages};
+}
+
+#------------------------------------------
+
+
+sub folderSize() { shift->{MTP_total} }
+
+#------------------------------------------
+
+
+sub header($;$)
+{   my ($self, $uidl) = (shift, shift);
+    return unless $uidl;
+    my $bodylines = shift || 0;;
+
+    my $socket    = $self->socket      or return;
+    my $n         = $self->id2n($uidl) or return;
+
+    $self->sendList($socket, "TOP $n $bodylines$CRLF");
+}
+
+#------------------------------------------
+
+
+sub message($;$)
+{   my ($self, $uidl) = @_;
+    return unless $uidl;
+
+    my $socket  = $self->socket      or return;
+    my $n       = $self->id2n($uidl) or return;
+    my $message = $self->sendList($socket, "RETR $n$CRLF");
+
+    return unless $message;
+
+    # Some POP3 servers add a trailing empty line
+    pop @$message if @$message && $message->[-1] =~ m/^[\012\015]*$/;
+
+    $self->{MTP_fetched}{$uidl} = undef   # mark this ID as fetched
+        unless exists $self->{MTP_nouidl};
+
+    $message;
+}
+
+#------------------------------------------
+
+
+sub messageSize($)
+{   my ($self, $uidl) = @_;
+    return unless $uidl;
+
+    my $list;
+    unless($list = $self->{MTP_n2length})
+    {   my $socket = $self->socket or return;
+        my $raw = $self->sendList($socket, "LIST$CRLF") or return;
+        my @n2length;
+        foreach (@$raw)
+        {   m#^(\d+) (\d+)#;
+            $n2length[$1] = $2;
+        }   
+        $self->{MTP_n2length} = $list = \@n2length;
+    }
+
+    my $n = $self->id2n($uidl) or return;
+    $list->[$n];
+}
+
+#------------------------------------------
+
+
+sub deleted($@)
+{   my $dele = shift->{MTP_dele} ||= {};
+    (shift) ? @$dele{ @_ } = () : delete @$dele{ @_ };
+}
+
+
+#------------------------------------------
+
+
+sub deleteFetched()
+{   my $self = shift;
+    $self->deleted(1, keys %{$self->{MTP_fetched}});
+}
+
+#------------------------------------------
+
+
+sub disconnect()
+{   my $self = shift;
+
+    my $quit;
+    if($self->{MTP_socket}) # can only disconnect once
+    {   if(my $socket = $self->socket)
+        {   my $dele  = $self->{MTP_dele} || {};
+            while(my $uidl = each %$dele)
+            {   my $n = $self->id2n($uidl) or next;
+                $self->send($socket, "DELE $n$CRLF") or last;
+            }
+
+            $quit = $self->send($socket, "QUIT$CRLF");
+            close $socket;
+        }
+    }
+
+    delete @$self{ qw(
+     MTP_socket
+     MTP_dele
+     MTP_uidl2n
+     MTP_n2uidl
+     MTP_n2length
+     MTP_fetched
+    ) };
+
+    OK($quit);
+}
+
+#------------------------------------------
+
+
+sub fetched(;$)
+{   my $self = shift;
+    return if exists $self->{MTP_nouidl};
+    $self->{MTP_fetched};
+}
+
+#------------------------------------------
+
+
+sub id2n($;$) { shift->{MTP_uidl2n}{shift()} }
+
+#------------------------------------------
+
+
+#------------------------------------------
+
+
+sub socket(;$)
+{   my $self = shift;
+
+    my $socket = $self->_connection;
+    return $socket if $socket;
+
+    if(exists $self->{MTP_nouidl})
+    {   $self->log(ERROR =>
+           "Can not re-connect reliably to server which doesn't support UIDL");
+        return;
+    }
+
+    return unless $socket = $self->login;
+    return unless $self->status( $socket );
+
+# Save socket in the object and return it
+
+    $self->{MTP_socket} = $socket;
+}
+
+#------------------------------------------
+
+
+sub send($$)
+{   my $self = shift;
+    my $socket = shift;
+    my $response;
+   
+    if(eval {print $socket @_})
+    {   $response = <$socket>;
+        $self->log(ERROR => "Cannot read POP3 from socket: $!")
+           unless defined $response;
+    }
+    else
+    {   $self->log(ERROR => "Cannot write POP3 to socket: $@");
+    }
+    $response;
+}
+
+#------------------------------------------
+
+
+sub sendList($$)
+{   my $self     = shift;
+    my $socket   = shift;
+    my $response = $self->send($socket, @_) or return;
+
+    return unless OK($response);
+
+    my @list;
+    local $_; # make sure we don't spoil it for the outside world
+    while(<$socket>)
+    {   last if m#^\.\r?\n#s;
+        s#^\.##;
+	push @list, $_;
+    }
+
+    \@list;
+}
+
+#------------------------------------------
+
+sub DESTROY()
+{   my $self = shift;
+    $self->SUPER::DESTROY;
+    $self->disconnect if $self->{MTP_socket}; # only do if not already done
+}
+
+#------------------------------------------
+
+sub OK($;$) { substr(shift || '', 0, 3) eq '+OK' }
+
+#------------------------------------------
+
+sub _connection(;$)
+{   my $self = shift;
+    my $socket = $self->{MTP_socket} or return undef;
+
+    # Check if we (still) got a connection
+    eval {print $socket "NOOP$CRLF"};
+    if($@ || ! <$socket> )
+    {   delete $self->{MTP_socket};
+        return undef;
+    }
+
+    $socket;
+}
+
+#------------------------------------------
+
+
+sub login(;$)
+{   my $self = shift;
+
+# Check if we can make a TCP/IP connection
+
+    local $_; # make sure we don't spoil it for the outside world
+    my ($interval, $retries, $timeout) = $self->retry;
+    my ($host, $port, $username, $password) = $self->remoteHost;
+    unless($username && $password)
+    {   $self->log(ERROR => "POP3 requires a username and password.");
+        return;
+    }
+
+    my $socket = eval {IO::Socket::INET->new("$host:$port")};
+    unless($socket)
+    {   $self->log(ERROR => "Cannot connect to $host:$port for POP3: $!");
+        return;
+    }
+
+# Check if it looks like a POP server
+
+    my $connected;
+    my $authenticate = $self->{MTP_auth};
+    my $welcome = <$socket>;
+    unless(OK($welcome))
+    {   $self->log(ERROR =>
+           "Server at $host:$port does not seem to be talking POP3.");
+        return;
+    }
+
+# Check APOP login if automatic or APOP specifically requested
+
+    if($authenticate eq 'AUTO' || $authenticate eq 'APOP')
+    {   if($welcome =~ m#^\+OK .*(<\d+\.\d+\@[^>]+>)#)
+        {   my $md5 = Digest::MD5::md5_hex($1.$password);
+            my $response = $self->send($socket, "APOP $username $md5$CRLF")
+	        or return;
+            $connected = OK($response);
+        }
+    }
+
+# Check USER/PASS login if automatic and failed or LOGIN specifically requested
+
+    unless($connected)
+    {   if($authenticate eq 'AUTO' || $authenticate eq 'LOGIN')
+        {   my $response = $self->send($socket, "USER $username$CRLF")
+               or return;
+
+            if(OK($response))
+	    {   $response = $self->send($socket, "PASS $password$CRLF")
+                   or return;
+                $connected = OK($response);
+            }
+        }
+    }
+
+# If we're still not connected now, we have an error
+
+    unless($connected)
+    {   $self->log(ERROR => $authenticate eq 'AUTO' ?
+         "Could not authenticate using any login method" :
+         "Could not authenticate using '$authenticate' method");
+        return;
+    }
+
+    $socket;
+}
+
+#------------------------------------------
+
+
+sub status($;$)
+{   my ($self,$socket) = @_;
+
+# Check if we can do a STAT
+
+    my $stat = $self->send($socket, "STAT$CRLF") or return;
+    if($stat =~ m#^\+OK (\d+) (\d+)#)
+    {   @$self{qw(MTP_messages MTP_total)} = ($1,$2);
+    }
+    else
+    {   delete $self->{MTP_messages};
+        delete $self->{MTP_size};
+        $self->log(ERROR => "POP3 Could not do a STAT");
+        return;
+    }
+
+# Check if we can do a UIDL
+
+    my $uidl = $self->send($socket, "UIDL$CRLF") or return;
+    $self->{MTP_nouidl} = undef;
+    delete $self->{MTP_uidl2n}; # lose the reverse lookup: UIDL -> number
+    if(OK($uidl))
+    {   my @n2uidl;
+        $n2uidl[$self->{MTP_messages}] = undef; # optimization, sets right size
+        while(<$socket>)
+        {   last if substr($_, 0, 1) eq '.';
+            s#\r?\n$##; m#^(\d+) (.+)#;
+            $n2uidl[$1] = $2;
+        }
+        shift @n2uidl; # make message 1 into index 0
+        $self->{MTP_n2uidl} = \@n2uidl;
+        delete $self->{MTP_n2length};
+        delete $self->{MTP_nouidl};
+    }
+
+# We can't do UIDL, we need to fake it
+
+    else
+    {   my $list = $self->send($socket, "LIST$CRLF") or return;
+        my @n2length;
+        my @n2uidl;
+        if(OK($list))
+        {   my $messages = $self->{MTP_messages};
+            my ($host, $port) = $self->remoteHost;
+            $n2length[$messages] = $n2uidl[$messages] = undef; # optimization
+            while(<$socket>)
+            {   last if substr($_, 0, 1) eq '.';
+                m#^(\d+) (\d+)#;
+                $n2length[$1] = $2;
+                $n2uidl[$1] = "$host:$port:$1"; # fake UIDL, for id only
+            }
+            shift @n2length; shift @n2uidl; # make 1st message in index 0
+        }
+        $self->{MTP_n2length} = \@n2length;
+        $self->{MTP_n2uidl} = \@n2uidl;
+    }
+
+    my $i = 1;
+    my %uidl2n;
+    foreach(@{$self->{MTP_n2uidl}})
+    {   $uidl2n{$_} = $i++;
+    }
+    $self->{MTP_uidl2n} = \%uidl2n;
+    1;
+}
+
+#------------------------------------------
+
+
+sub url(;$)
+{   my ($host, $port, $user, $pwd) = shift->remoteHost;
+    "pop3://$user:$pwd\@$host:$port";
+}
+
+#------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/POP3.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/POP3.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/POP3.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,546 @@
+
+=head1 NAME
+
+Mail::Transport::POP3 - receive messages via POP3
+
+
+=head1 INHERITANCE
+
+ Mail::Transport::POP3
+   is a Mail::Transport::Receive
+   is a Mail::Transport
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my $receiver = Mail::Transport::POP3->new(...);
+ my $message = $receiver->receive($id);
+
+
+=head1 DESCRIPTION
+
+Receive messages via the POP3 protocol from one remote server, as specified
+in rfc1939.  This object hides much of the complications in the protocol and
+recovers broken connections automatically.  Although it is part of the
+MailBox distribution, this object can be used separately.
+
+You probably should B<not use this> module, but L<Mail::Box::POP3|Mail::Box::POP3>.  This
+module is the interface to POP3, whereas L<Mail::Box::POP3|Mail::Box::POP3> hides the
+protocol weirdness and works as any other mail folder.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Transport::POP3-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+Create a new pop3 server connection.  One object can only handle one
+connection: for a single user to one single server.  If the server
+could not be reached, or when the login fails, this instantiating C<new>
+will return C<undef>.
+
+ Option        Defined in       Default       
+ authenticate                   C<'AUTO'>     
+ executable    L<Mail::Transport>  C<undef>      
+ hostname      L<Mail::Transport>  C<'localhost'>
+ interval      L<Mail::Transport>  C<30>         
+ log           L<Mail::Reporter>  C<'WARNINGS'> 
+ password      L<Mail::Transport>  undef         
+ port          L<Mail::Transport>  C<110>        
+ proxy         L<Mail::Transport>  undef         
+ retry         L<Mail::Transport>  <false>       
+ timeout       L<Mail::Transport>  C<120>        
+ trace         L<Mail::Reporter>  C<'WARNINGS'> 
+ username      L<Mail::Transport>  undef         
+ via           L<Mail::Transport>  C<'sendmail'> 
+
+. authenticate 'LOGIN'|'APOP'|'AUTO'
+
+=over 4
+
+Authenthication method.  The standard defines two methods, named LOGIN and
+APOP.  The first sends the username and password in plain text to the server
+to get permission, the latter encrypts this data using MD5.  When AUTO is
+used, first APOP is tried, and then LOGIN.
+
+=back
+
+. executable FILENAME
+
+. hostname HOSTNAME|ARRAY-OF-HOSTNAMES
+
+. interval SECONDS
+
+. log LEVEL
+
+. password STRING
+
+. port INTEGER
+
+. proxy PATH
+
+. retry NUMBER|undef
+
+. timeout SECONDS
+
+. trace LEVEL
+
+. username STRING
+
+. via CLASS|NAME
+
+=back
+
+=head2 Receiving mail
+
+
+$obj-E<gt>B<receive>([UNIQUE-MESSAGE-ID])
+
+=over 4
+
+See L<Mail::Transport::Receive/"Receiving mail">
+
+=back
+
+=head2 Exchanging information
+
+
+$obj-E<gt>B<deleteFetched>
+
+=over 4
+
+Mark all messages that have been fetched with L<message()|Mail::Transport::POP3/"Exchanging information"> for deletion.
+See L<fetched()|Mail::Transport::POP3/"Exchanging information">.
+
+=back
+
+$obj-E<gt>B<deleted>(BOOLEAN, ID's)
+
+=over 4
+
+Either mark the specified message(s) to be deleted on the remote server or
+unmark them for deletion (if the first parameter is false).  Deletion of
+messages will take place B<only> when the connection is specifically
+disconnected or the last reference to the object goes out of scope.
+
+=back
+
+$obj-E<gt>B<disconnect>
+
+=over 4
+
+Break contact with the server, if that (still) exists.  Returns true if
+successful.  Please note that even if the disconnect was not successful,
+all knowledge of messages etc. will be removed from the object: the object
+basically has reverted to the state in which it was before anything was done
+with the mail box.
+
+=back
+
+$obj-E<gt>B<fetched>
+
+=over 4
+
+Returns a reference to a list of ID's that have been fetched using
+L<message()|Mail::Transport::POP3/"Exchanging information">.  This can be used to update a database of messages that
+were fetched (but maybe not yet deleted) from the mailbox.
+
+Please note that if the POP3 server did not support the UIDL command, this
+method will always return undef because it is not possibly to reliably
+identify messages between sessions (other than looking at the contents of
+the messages themselves).
+
+See also L<deleteFetched()|Mail::Transport::POP3/"Exchanging information">.
+
+=back
+
+$obj-E<gt>B<folderSize>
+
+=over 4
+
+Returns the total number of octets used by the mailbox on the remote server.
+
+=back
+
+$obj-E<gt>B<header>(ID, [BODYLINES])
+
+=over 4
+
+Returns a reference to an array which contains the header of the message
+with the specified ID.  C<undef> is returned if something has gone wrong.
+
+The optional integer BODYLINES specifies the number of lines from the body
+which should be added, by default none.
+
+I<Example:> 
+
+ my $ref_lines = $pop3->header($uidl);
+ print @$ref_lines;
+
+=back
+
+$obj-E<gt>B<id2n>(ID)
+
+=over 4
+
+Translates the unique ID of a message into a sequence number which
+represents the message as long a this connection to the POP3 server
+exists.  When the message has been deleted for some reason, C<undef>
+is returned.
+
+=back
+
+$obj-E<gt>B<ids>
+
+=over 4
+
+Returns a list (in list context) or a reference to a list (in scalar context)
+of all ID's which are known by the server on this moment.
+
+=back
+
+$obj-E<gt>B<message>(ID)
+
+=over 4
+
+Returns a reference to an array which contains the lines of the
+message with the specified ID.  Returns C<undef> if something has gone
+wrong.
+
+I<Example:> 
+
+ my $ref_lines = $pop3->message($uidl);
+ print @$ref_lines;
+
+=back
+
+$obj-E<gt>B<messageSize>(ID)
+
+=over 4
+
+Returns the size of the message which is indicated by the ID, in octets.
+If the message has been deleted on the remote server, this will return
+C<undef>.
+
+=back
+
+$obj-E<gt>B<messages>
+
+=over 4
+
+Returns (in scalar context only) the number of messages that are known
+to exist in the mailbox.
+
+=back
+
+=head2 Protocol internals
+
+The follow methods handle protocol internals, and should not be used
+by a normal user of this class.
+
+$obj-E<gt>B<login>
+
+=over 4
+
+Establish a new connection to the POP3 server, using username and password.
+
+=back
+
+$obj-E<gt>B<send>(SOCKET, data)
+
+=over 4
+
+Send data to the indicated socket and return the first line read from
+that socket.  Logs an error if either writing to or reading from socket failed.
+
+This method does B<not> attempt to reconnect or anything: if reading or
+writing the socket fails, something is very definitely wrong.
+
+=back
+
+$obj-E<gt>B<sendList>(SOCKET, COMMAND)
+
+=over 4
+
+Sends the indicated COMMAND to the specified socket, and retrieves the
+response.  It returns a reference to an array with all the lines that
+were reveived after the first C<+OK> line and before the end-of-message
+delimiter (a single dot on a line).  Returns C<undef>
+whenever something has gone wrong.
+
+=back
+
+$obj-E<gt>B<socket>
+
+=over 4
+
+Returns a connection to the POP3 server.  If there was no connection yet,
+it will be created transparently.  If the connection with the POP3 server
+was lost, it will be reconnected and the assures that internal
+state information (STAT and UIDL) is up-to-date in the object.
+
+If the contact to the server was still present, or could be established,
+an IO::Socket::INET object is returned.  Else, C<undef> is returned and
+no further actions should be tried on the object.
+
+=back
+
+$obj-E<gt>B<status>(SOCKET)
+
+=over 4
+
+Update the current status of folder on the remote POP3 server.
+
+=back
+
+=head2 Server connection
+
+
+$obj-E<gt>B<findBinary>(NAME [, DIRECTORIES])
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+$obj-E<gt>B<remoteHost>
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+$obj-E<gt>B<retry>
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+$obj-E<gt>B<url>
+
+=over 4
+
+Represent this pop3 connection as URL.
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Transport::POP3-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Transport::POP3-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Transport::POP3-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Cannot connect to $host:$port for POP3: $!
+
+Unsuccesful in connecting to the remote POP3 server.
+
+I<Error:> Cannot get the messages of pop3 via messages()
+
+It is not possible to retreive all messages on a remote POP3 folder
+at once: each shall be taken separately.  The POP3 folder will hide this
+for you.
+
+I<Error:> Cannot re-connect reliably to server which doesn't support UIDL.
+
+The connection to the remote POP3 was lost, and cannot be re-established
+because the server's protocol implementation lacks the necessary information.
+
+I<Error:> Cannot read POP3 from socket: $!
+
+It is not possible to read the success status of the previously given POP3
+command.  Connection lost?
+
+I<Error:> Cannot write POP3 to socket: $@
+
+It is not possible to send a protocol command to the POP3 server.  Connection
+lost?
+
+I<Error:> Could not authenticate using '$some' method.
+
+The authenication method to get access to the POP3 server did not result in
+a connection.  Maybe you need a different authentication protocol, or your
+username with password are invalid.
+
+I<Error:> Could not authenticate using any login method.
+
+No authentication method was explicitly prescribed, so both AUTH and APOP were
+tried.  However, both failed.  There are other authentication methods, which
+are not defined by the main POP3 RFC rfc1939.  These protocols are not
+implemented yet.  Please contribute your implementation.
+
+I<Error:> POP3 Could not do a STAT
+
+For some weird reason, the server does not respond to the STAT call.
+
+I<Error:> POP3 requires a username and password.
+
+No username and/or no password specified for this POP3 folder, although
+these are obligatory parts in the protocol.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Error:> Server at $host:$port does not seem to be talking POP3.
+
+The remote server did not respond to an initial exchange of messages as is
+expected by the POP3 protocol.  The server has probably a different
+service on the specified port.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Qmail.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Qmail.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Qmail.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,53 @@
+use strict;
+use warnings;
+
+package Mail::Transport::Qmail;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Transport::Send';
+
+use Carp;
+
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    $args->{via} = 'qmail';
+
+    $self->SUPER::init($args) or return;
+
+    $self->{MTM_program}
+      = $args->{proxy}
+     || $self->findBinary('qmail-inject', '/var/qmail/bin')
+     || return;
+
+    $self;
+}
+
+#------------------------------------------
+
+
+sub trySend($@)
+{   my ($self, $message, %args) = @_;
+
+    my $program = $self->{MTM_program};
+    if(open(MAILER, '|-')==0)
+    {   { exec $program; }
+        $self->log(NOTICE => "Errors when opening pipe to $program: $!");
+        return 0;
+    }
+ 
+    $self->putContent($message, \*MAILER, undisclosed => 1);
+
+    unless(close MAILER)
+    {   $self->log(ERROR => "Errors when closing Qmail mailer $program: $!");
+        $? ||= $!;
+        return 0;
+    }
+
+    1;
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Qmail.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Qmail.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Qmail.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,318 @@
+
+=head1 NAME
+
+Mail::Transport::Qmail - transmit messages using external Qmail program
+
+
+=head1 INHERITANCE
+
+ Mail::Transport::Qmail
+   is a Mail::Transport::Send
+   is a Mail::Transport
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my $sender = Mail::Transport::Qmail->new(...);
+ $sender->send($message);
+
+
+=head1 DESCRIPTION
+
+Implements mail transport using the external programs C<'qmail-inject'>,
+part of the qmail mail-delivery system.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Transport::Qmail-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option      Defined in       Default          
+ executable  L<Mail::Transport>  C<undef>         
+ hostname    L<Mail::Transport>  C<'localhost'>   
+ interval    L<Mail::Transport>  C<30>            
+ log         L<Mail::Reporter>  C<'WARNINGS'>    
+ password    L<Mail::Transport>  undef            
+ port        L<Mail::Transport>  undef            
+ proxy       L<Mail::Transport>  C<'qmail-inject'>
+ retry       L<Mail::Transport>  <false>          
+ timeout     L<Mail::Transport>  C<120>           
+ trace       L<Mail::Reporter>  C<'WARNINGS'>    
+ username    L<Mail::Transport>  undef            
+ via         L<Mail::Transport>  C<'qmail'>       
+
+. executable FILENAME
+
+. hostname HOSTNAME|ARRAY-OF-HOSTNAMES
+
+. interval SECONDS
+
+. log LEVEL
+
+. password STRING
+
+. port INTEGER
+
+. proxy PATH
+
+. retry NUMBER|undef
+
+. timeout SECONDS
+
+. trace LEVEL
+
+. username STRING
+
+. via CLASS|NAME
+
+=back
+
+=head2 Sending mail
+
+
+$obj-E<gt>B<destinations>(MESSAGE, [ADDRESS|ARRAY-OF-ADDRESSES])
+
+=over 4
+
+See L<Mail::Transport::Send/"Sending mail">
+
+=back
+
+$obj-E<gt>B<putContent>(MESSAGE, FILEHANDLE, OPTIONS)
+
+=over 4
+
+See L<Mail::Transport::Send/"Sending mail">
+
+=back
+
+$obj-E<gt>B<send>(MESSAGE, OPTIONS)
+
+=over 4
+
+See L<Mail::Transport::Send/"Sending mail">
+
+=back
+
+$obj-E<gt>B<trySend>(MESSAGE, OPTIONS)
+
+=over 4
+
+=back
+
+=head2 Server connection
+
+
+$obj-E<gt>B<findBinary>(NAME [, DIRECTORIES])
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+$obj-E<gt>B<remoteHost>
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+$obj-E<gt>B<retry>
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Transport::Qmail-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Transport::Qmail-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Transport::Qmail-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Errors when closing Qmail mailer $program: $!
+
+The Qmail mail transfer agent did start, but was not able to handle the
+message for some specific reason.
+
+I<Warning:> Message has no destination
+
+It was not possible to figure-out where the message is intended to go
+to.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Warning:> Resent group does not specify a destination
+
+The message which is sent is the result of a bounce (for instance
+created with L<Mail::Message::bounce()|Mail::Message::Construct::Bounce/"Constructing a message">), and therefore starts with a
+C<Received> header field.  With the C<bounce>, the new destination(s)
+of the message are given, which should be included as C<Resent-To>,
+C<Resent-Cc>, and C<Resent-Bcc>.
+
+The C<To>, C<Cc>, and C<Bcc> header information is only used if no
+C<Received> was found.  That seems to be the best explanation of the RFC.
+
+As alternative, you may also specify the C<to> option to some of the senders
+(for instance L<Mail::Transport::SMTP::send(to)|Mail::Transport::Send/"Sending mail"> to overrule any information
+found in the message itself about the destination.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Receive.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Receive.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Receive.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,15 @@
+use strict;
+use warnings;
+
+package Mail::Transport::Receive;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Transport';
+
+
+sub receive(@) {shift->notImplemented}
+
+#------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Receive.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Receive.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Receive.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,263 @@
+
+=head1 NAME
+
+Mail::Transport::Receive - receive messages
+
+
+=head1 INHERITANCE
+
+ Mail::Transport::Receive
+   is a Mail::Transport
+   is a Mail::Reporter
+
+ Mail::Transport::Receive is extended by
+   Mail::Transport::IMAP4
+   Mail::Transport::POP3
+
+
+=head1 SYNOPSIS
+
+ my $receiver = Mail::Transport::POP3->new(...);
+ my $message = $receiver->receive($id);
+
+
+=head1 DESCRIPTION
+
+Each object which extends L<Mail::Transport::Receive|Mail::Transport::Receive> implement
+a protocol which can get messages into your application.  The internals
+of each implementation can differ quite a lot, so have a look at each
+separate manual page as well.
+
+Current message receivers:
+
+=over 4
+
+=item * L<Mail::Transport::POP3|Mail::Transport::POP3>
+
+Implements the POP3 protocol.  See also L<Mail::Box::POP3|Mail::Box::POP3>.
+
+=back
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Transport::Receive-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+See L<Mail::Transport/"METHODS">
+
+=back
+
+=head2 Receiving mail
+
+
+$obj-E<gt>B<receive>([UNIQUE-MESSAGE-ID])
+
+=over 4
+
+Receive one message from the remote server.  Some receivers will provide
+the next message automatically, other are random access and use the
+specified ID.
+
+=back
+
+=head2 Server connection
+
+
+$obj-E<gt>B<findBinary>(NAME [, DIRECTORIES])
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+$obj-E<gt>B<remoteHost>
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+$obj-E<gt>B<retry>
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Transport::Receive-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Transport::Receive-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Transport::Receive-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> Avoid program abuse: specify an absolute path for $exec.
+
+Specifying explicit locations for executables of email transfer agents
+should only be done with absolute file names, to avoid various pontential
+security problems.
+
+I<Warning:> Executable $exec does not exist.
+
+The explicitly indicated mail transfer agent does not exists. The normal
+settings are used to find the correct location.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/SMTP.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/SMTP.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/SMTP.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,179 @@
+use strict;
+use warnings;
+
+package Mail::Transport::SMTP;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Transport::Send';
+
+use Net::SMTP;
+
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    my $hosts   = $args->{hostname};
+    unless($hosts)
+    {   require Net::Config;
+        $hosts  = $Net::Config::NetConfig{smtp_hosts};
+        undef $hosts unless @$hosts;
+        $args->{hostname} = $hosts;
+    }
+
+    $args->{via}  ||= 'smtp';
+    $args->{port} ||= '25';
+
+    $self->SUPER::init($args) or return;
+
+    my $helo = $args->{helo}
+      || eval { require Net::Config; $Net::Config::inet_domain }
+      || eval { require Net::Domain; Net::Domain::hostfqdn() };
+
+    $self->{MTS_net_smtp_opts}
+       = { Hello   => $helo
+         , Debug   => ($args->{smtp_debug} || 0)
+         };
+
+    $self;
+}
+
+#------------------------------------------
+
+
+sub trySend($@)
+{   my ($self, $message, %args) = @_;
+
+    # From whom is this message.
+    my $from = $args{from} || $message->sender || '<>';
+    $from = $from->address if ref $from && $from->isa('Mail::Address');
+
+    # Who are the destinations.
+    if(defined $args{To})
+    {   $self->log(WARNING =>
+   "Use option `to' to overrule the destination: `To' would refer to a field");
+    }
+
+    my @to = map {$_->address} $self->destinations($message, $args{to});
+
+    unless(@to)
+    {   $self->log(NOTICE =>
+            'No addresses found to send the message to, no connection made');
+        return 1;
+    }
+
+    # Prepare the header
+    my @header;
+    require IO::Lines;
+    my $lines = IO::Lines->new(\@header);
+    $message->head->printUndisclosed($lines);
+
+    #
+    # Send
+    #
+
+    if(wantarray)
+    {   # In LIST context
+        my $server;
+        return (0, 500, "Connection Failed", "CONNECT", 0)
+            unless $server = $self->contactAnyServer;
+
+        return (0, $server->code, $server->message, 'FROM', $server->quit)
+            unless $server->mail($from);
+
+        foreach (@to)
+        {     next if $server->to($_);
+# must we be able to disable this?
+# next if $args{ignore_erroneous_destinations}
+              return (0, $server->code, $server->message,"To $_",$server->quit);
+        }
+
+        $server->data;
+        $server->datasend($_) foreach @header;
+        my $bodydata = $message->body->file;
+
+        if(ref $bodydata eq 'GLOB') { $server->datasend($_) while <$bodydata> }
+        else    { while(my $l = $bodydata->getline) { $server->datasend($l) } }
+
+        return (0, $server->code, $server->message, 'DATA', $server->quit)
+            unless $server->dataend;
+
+        return ($server->quit, $server->code, $server->message, 'QUIT',
+                $server->code);
+    }
+
+    # in SCALAR context
+    my $server;
+    return 0 unless $server = $self->contactAnyServer;
+
+    $server->quit, return 0
+        unless $server->mail($from);
+
+    foreach (@to)
+    {
+          next if $server->to($_);
+# must we be able to disable this?
+# next if $args{ignore_erroneous_destinations}
+          $server->quit;
+          return 0;
+    }
+
+    $server->data;
+    $server->datasend($_) foreach @header;
+    my $bodydata = $message->body->file;
+
+    if(ref $bodydata eq 'GLOB') { $server->datasend($_) while <$bodydata> }
+    else    { while(my $l = $bodydata->getline) { $server->datasend($l) } }
+
+    $server->quit, return 0
+        unless $server->dataend;
+
+    $server->quit;
+}
+
+#------------------------------------------
+
+
+sub contactAnyServer()
+{   my $self = shift;
+
+    my ($enterval, $count, $timeout) = $self->retry;
+    my ($host, $port, $username, $password) = $self->remoteHost;
+    my @hosts = ref $host ? @$host : $host;
+
+    foreach my $host (@hosts)
+    {   my $server = $self->tryConnectTo
+         ( $host, Port => $port,
+         , %{$self->{MTS_net_smtp_opts}}, Timeout => $timeout
+         );
+
+        defined $server or next;
+
+        $self->log(PROGRESS => "Opened SMTP connection to $host.\n");
+
+        if(defined $username)
+        {   if($server->auth($username, $password))
+            {    $self->log(PROGRESS => "$host: Authentication succeeded.\n");
+            }
+            else
+            {    $self->log(ERROR => "Authentication failed.\n");
+                 return undef;
+            }
+        }
+
+        return $server;
+    }
+
+    undef;
+}
+
+#------------------------------------------
+
+
+sub tryConnectTo($@)
+{   my ($self, $host) = (shift, shift);
+    Net::SMTP->new($host, @_);
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/SMTP.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/SMTP.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/SMTP.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,421 @@
+
+=head1 NAME
+
+Mail::Transport::SMTP - transmit messages without external program
+
+
+=head1 INHERITANCE
+
+ Mail::Transport::SMTP
+   is a Mail::Transport::Send
+   is a Mail::Transport
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my $sender = Mail::Transport::SMTP->new(...);
+ $sender->send($message);
+
+ $message->send(via => 'smtp');
+
+
+=head1 DESCRIPTION
+
+This module implements transport of C<Mail::Message> objects by negotiating
+to the destination host directly by using the SMTP protocol, without help of
+C<sendmail>, C<mail>, or other programs on the local host.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Transport::SMTP-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option      Defined in       Default           
+ executable  L<Mail::Transport>  C<undef>          
+ helo                         <from Net::Config>
+ hostname    L<Mail::Transport>  <from Net::Config>
+ interval    L<Mail::Transport>  C<30>             
+ log         L<Mail::Reporter>  C<'WARNINGS'>     
+ password                     undef             
+ port        L<Mail::Transport>  C<25>             
+ proxy       L<Mail::Transport>  <from Net::Config>
+ retry       L<Mail::Transport>  <false>           
+ smtp_debug                   <false>           
+ timeout                      120               
+ trace       L<Mail::Reporter>  C<'WARNINGS'>     
+ username                     undef             
+ via         L<Mail::Transport>  C<'smtp'>         
+
+. executable FILENAME
+
+. helo HOST
+
+=over 4
+
+The fully qualified name of the sender's host (your system) which
+is used for the greeting message to the receiver.  If not specified,
+Net::Config or else Net::Domain are questioned to find it.
+When even these do not supply a valid name, the name of the domain in the
+C<From> line of the message is assumed.
+
+=back
+
+. hostname HOSTNAME|ARRAY-OF-HOSTNAMES
+
+. interval SECONDS
+
+. log LEVEL
+
+. password STRING
+
+=over 4
+
+The password to be used with the new(username) to log in to the remote
+server.
+
+=back
+
+. port INTEGER
+
+. proxy PATH
+
+. retry NUMBER|undef
+
+. smtp_debug BOOLEAN
+
+=over 4
+
+Simulate transmission: the SMTP protocol output will be sent to your
+screen.
+
+=back
+
+. timeout SECONDS
+
+=over 4
+
+The number of seconds to wait for a valid response from the server before
+failing.
+
+=back
+
+. trace LEVEL
+
+. username STRING
+
+=over 4
+
+Use SASL authentication to contact the remote SMTP server (RFC2554).
+This username in combination with new(password) is passed as arguments
+to Net::SMTP method auth.  Other forms of authentication are not
+supported by Net::SMTP.  The C<username> can also be specified as an
+Authen::SASL object.
+
+=back
+
+. via CLASS|NAME
+
+=back
+
+=head2 Sending mail
+
+
+$obj-E<gt>B<destinations>(MESSAGE, [ADDRESS|ARRAY-OF-ADDRESSES])
+
+=over 4
+
+See L<Mail::Transport::Send/"Sending mail">
+
+=back
+
+$obj-E<gt>B<putContent>(MESSAGE, FILEHANDLE, OPTIONS)
+
+=over 4
+
+See L<Mail::Transport::Send/"Sending mail">
+
+=back
+
+$obj-E<gt>B<send>(MESSAGE, OPTIONS)
+
+=over 4
+
+See L<Mail::Transport::Send/"Sending mail">
+
+=back
+
+$obj-E<gt>B<trySend>(MESSAGE, OPTIONS)
+
+=over 4
+
+Try to send the MESSAGE once.   This may fail, in which case this
+method will return C<false>.  In list context, the reason for failure
+can be caught: in list context C<trySend> will return a list of
+five values:
+
+ (success, error code, error text, error location, quit success)
+
+Success and quit success are booleans.  The error code and -text are
+protocol specific codes and texts.  The location tells where the
+problem occurred.
+
+ Option  Defined in       Default    
+ from                     E<lt> E<gt>
+ to                       []         
+
+. from ADDRESS
+
+=over 4
+
+Your own identification.  This may be fake.  If not specified, it is
+taken from L<Mail::Message::sender()|Mail::Message/"The header">, which means the content of the
+C<Sender> field of the message or the first address of the C<From>
+field.  This defaults to "E<lt> E<gt>", which represents "no address".
+
+=back
+
+. to ADDRESS|[ADDRESSES]
+
+=over 4
+
+Alternative destinations.  If not specified, the C<To>, C<Cc> and C<Bcc>
+fields of the header are used.  An address is a string or a Mail::Address
+object.
+
+=back
+
+=back
+
+=head2 Server connection
+
+
+$obj-E<gt>B<contactAnyServer>
+
+=over 4
+
+Creates the connection to the SMTP server.  When more than one hostname
+was specified, the first which accepts a connection is taken.  An
+IO::Socket::INET object is returned.
+
+=back
+
+$obj-E<gt>B<findBinary>(NAME [, DIRECTORIES])
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+$obj-E<gt>B<remoteHost>
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+$obj-E<gt>B<retry>
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+$obj-E<gt>B<tryConnectTo>(HOST, OPTIONS)
+
+=over 4
+
+Try to establish a connection to deliver SMTP to the specified HOST.  The
+OPTIONS are passed to the C<new> method of Net::SMTP.
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Transport::SMTP-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Transport::SMTP-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Transport::SMTP-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> Message has no destination
+
+It was not possible to figure-out where the message is intended to go
+to.
+
+I<Notice:> No addresses found to send the message to, no connection made
+
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Warning:> Resent group does not specify a destination
+
+The message which is sent is the result of a bounce (for instance
+created with L<Mail::Message::bounce()|Mail::Message::Construct::Bounce/"Constructing a message">), and therefore starts with a
+C<Received> header field.  With the C<bounce>, the new destination(s)
+of the message are given, which should be included as C<Resent-To>,
+C<Resent-Cc>, and C<Resent-Bcc>.
+
+The C<To>, C<Cc>, and C<Bcc> header information is only used if no
+C<Received> was found.  That seems to be the best explanation of the RFC.
+
+As alternative, you may also specify the C<to> option to some of the senders
+(for instance L<Mail::Transport::SMTP::send(to)|Mail::Transport::Send/"Sending mail"> to overrule any information
+found in the message itself about the destination.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Send.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Send.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Send.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,104 @@
+use strict;
+use warnings;
+
+package Mail::Transport::Send;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Transport';
+
+use Carp;
+use File::Spec;
+use Errno 'EAGAIN';
+
+
+sub new(@)
+{   my $class = shift;
+    return $class->SUPER::new(@_) if $class ne __PACKAGE__;
+
+    require Mail::Transport::Sendmail;
+    Mail::Transport::Sendmail->new(@_);
+}
+
+#------------------------------------------
+
+
+sub send($@)
+{   my ($self, $message, %args) = @_;
+
+    unless($message->isa('Mail::Message'))  # avoid rebless.
+    {   $message = Mail::Message->coerce($message);
+        confess "Unable to coerce object into Mail::Message."
+            unless defined $message;
+    }
+
+    return 1 if $self->trySend($message, %args);
+    return 0 unless $?==EAGAIN;
+
+    my ($interval, $retry) = $self->retry;
+    $interval = $args{interval} if exists $args{interval};
+    $retry    = $args{retry}    if exists $args{retry};
+
+    while($retry!=0)
+    {   sleep $interval;
+        return 1 if $self->trySend($message, %args);
+        return 0 unless $?==EAGAIN;
+        $retry--;
+    }
+
+    0;
+}
+
+#------------------------------------------
+
+
+sub trySend($@)
+{   my $self = shift;
+    $self->log(ERROR => "Transporters of type ".ref($self). " cannot send.");
+}
+
+#------------------------------------------
+
+
+sub putContent($$@)
+{   my ($self, $message, $fh, %args) = @_;
+
+       if($args{body_only})   { $message->body->print($fh) }
+    elsif($args{undisclosed}) { $message->Mail::Message::print($fh) }
+    else
+    {   $message->head->printUndisclosed($fh);
+        $message->body->print($fh);
+    }
+
+    $self;
+}
+
+#------------------------------------------
+
+
+sub destinations($;$)
+{   my ($self, $message, $overrule) = @_;
+    my @to;
+
+    if(defined $overrule)      # Destinations overruled by user.
+    {   my @addr = ref $overrule eq 'ARRAY' ? @$overrule : ($overrule);
+        @to = map { ref $_ && $_->isa('Mail::Address') ? ($_)
+                    : Mail::Address->parse($_) } @addr;
+    }
+    elsif(my @rgs = $message->head->resentGroups)
+    {   @to = $rgs[0]->destinations;
+        $self->log(WARNING => "Resent group does not specify a destination"), return ()
+            unless @to;
+    }
+    else
+    {   @to = $message->destinations;
+        $self->log(WARNING => "Message has no destination"), return ()
+            unless @to;
+    }
+
+    @to;
+}
+
+#------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Send.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Send.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Send.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,419 @@
+
+=head1 NAME
+
+Mail::Transport::Send - send a message
+
+
+=head1 INHERITANCE
+
+ Mail::Transport::Send
+   is a Mail::Transport
+   is a Mail::Reporter
+
+ Mail::Transport::Send is extended by
+   Mail::Transport::Exim
+   Mail::Transport::Mailx
+   Mail::Transport::Qmail
+   Mail::Transport::SMTP
+   Mail::Transport::Sendmail
+
+
+=head1 SYNOPSIS
+
+ my $message = Mail::Message->new(...);
+
+ # Some extensions implement sending:
+ $message->send;
+ $message->send(via => 'sendmail');
+
+ my $sender = Mail::Transport::SMTP->new(...);
+ $sender->send($message);
+
+
+=head1 DESCRIPTION
+
+Send a message to the destinations as specified in the header.  The
+C<Mail::Transport::Send> module is capable of autodetecting which of the
+following modules work on your system; you may simply call C<send>
+without C<via> options to get a message transported.
+
+=over 4
+
+=item * L<Mail::Transport::Sendmail|Mail::Transport::Sendmail>
+
+Use sendmail to process and deliver the mail.  This requires the
+C<sendmail> program to be installed on your system.  Whether this
+is an original sendmail, or a replacement from Postfix does matter.
+
+=item * L<Mail::Transport::Exim|Mail::Transport::Exim>
+
+Use C<exim> to distribute the message.
+
+=item * L<Mail::Transport::Qmail|Mail::Transport::Qmail>
+
+Use C<qmail-inject> to distribute the message.
+
+=item * L<Mail::Transport::SMTP|Mail::Transport::SMTP>
+
+In this case, Perl is handling mail transport on its own.  This is less
+desired but more portable than sending with sendmail or qmail.
+The advantage is that this sender is environment independent, and easier to
+configure.  However, there is no daemon involved which means that your
+program will wait until the message is delivered, and the message is
+lost when your program is interrupted during delivery (which may
+take hours to complete).
+
+=item * L<Mail::Transport::Mailx|Mail::Transport::Mailx>
+
+Use the external C<mail>, C<mailx>, or C<Mail> programs to send the
+message.  Usually, the result is poor, because some versions of these
+programs do not support MIME headers.  Besides, these programs are
+known to have exploitable security breaches.
+
+=back
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Transport::Send-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option      Defined in       Default       
+ executable  L<Mail::Transport>  C<undef>      
+ hostname    L<Mail::Transport>  C<'localhost'>
+ interval    L<Mail::Transport>  C<30>         
+ log         L<Mail::Reporter>  C<'WARNINGS'> 
+ password    L<Mail::Transport>  undef         
+ port        L<Mail::Transport>  undef         
+ proxy       L<Mail::Transport>  undef         
+ retry       L<Mail::Transport>  <false>       
+ timeout     L<Mail::Transport>  C<120>        
+ trace       L<Mail::Reporter>  C<'WARNINGS'> 
+ username    L<Mail::Transport>  undef         
+ via         L<Mail::Transport>  C<'sendmail'> 
+
+. executable FILENAME
+
+. hostname HOSTNAME|ARRAY-OF-HOSTNAMES
+
+. interval SECONDS
+
+. log LEVEL
+
+. password STRING
+
+. port INTEGER
+
+. proxy PATH
+
+. retry NUMBER|undef
+
+. timeout SECONDS
+
+. trace LEVEL
+
+. username STRING
+
+. via CLASS|NAME
+
+=back
+
+=head2 Sending mail
+
+
+$obj-E<gt>B<destinations>(MESSAGE, [ADDRESS|ARRAY-OF-ADDRESSES])
+
+=over 4
+
+Determine the destination for this message.  If a valid ADDRESS is defined,
+this is used to overrule the addresses within the message.  If the ADDRESS
+is C<undef> it is ignored.
+
+If no ADDRESS is specified, the message is scanned for resent groups
+(see L<Mail::Message::Head::Complete::resentGroups()|Mail::Message::Head::Complete/"Access to the header">).  The addresses
+found in the first (is latest added) group are used.  If no resent groups
+are found, the normal C<To>, C<Cc>, and C<Bcc> lines are taken.
+
+=back
+
+$obj-E<gt>B<putContent>(MESSAGE, FILEHANDLE, OPTIONS)
+
+=over 4
+
+Print the content of the MESSAGE to the FILEHANDLE.
+
+ Option       Defined in       Default
+ body_only                     <false>
+ undisclosed                   <false>
+
+. body_only BOOLEAN
+
+=over 4
+
+Print only the body of the message, not the whole.
+
+=back
+
+. undisclosed BOOLEAN
+
+=over 4
+
+Do not print the C<Bcc> and C<Resent-Bcc> lines.  Default false, which
+means that they are not printed.
+
+=back
+
+=back
+
+$obj-E<gt>B<send>(MESSAGE, OPTIONS)
+
+=over 4
+
+Transmit the MESSAGE, which may be anything what can be coerced into a
+L<Mail::Message|Mail::Message>, so including Mail::Internet and MIME::Entity
+messages.  It returns true when the transmission was successfully completed.
+
+ Option    Defined in       Default                                   
+ interval                   L<new(interval)|Mail::Transport/"METHODS">
+ retry                      L<new(retry)|Mail::Transport/"METHODS">   
+ to                         C<undef>                                  
+
+. interval SECONDS
+
+. retry INTEGER
+
+. to STRING
+
+=over 4
+
+Overrules the destination(s) of the message, which is by default taken
+from the (Resent-)To, (Resent-)Cc, and (Resent-)Bcc.
+
+=back
+
+=back
+
+$obj-E<gt>B<trySend>(MESSAGE, OPTIONS)
+
+=over 4
+
+Try to send the message. This will return true if successful, and
+false in case some problems where detected.  The C<$?> contains
+the exit status of the command which was started.
+
+=back
+
+=head2 Server connection
+
+
+$obj-E<gt>B<findBinary>(NAME [, DIRECTORIES])
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+$obj-E<gt>B<remoteHost>
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+$obj-E<gt>B<retry>
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Transport::Send-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Transport::Send-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Transport::Send-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> Message has no destination
+
+It was not possible to figure-out where the message is intended to go
+to.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Warning:> Resent group does not specify a destination
+
+The message which is sent is the result of a bounce (for instance
+created with L<Mail::Message::bounce()|Mail::Message::Construct::Bounce/"Constructing a message">), and therefore starts with a
+C<Received> header field.  With the C<bounce>, the new destination(s)
+of the message are given, which should be included as C<Resent-To>,
+C<Resent-Cc>, and C<Resent-Bcc>.
+
+The C<To>, C<Cc>, and C<Bcc> header information is only used if no
+C<Received> was found.  That seems to be the best explanation of the RFC.
+
+As alternative, you may also specify the C<to> option to some of the senders
+(for instance L<Mail::Transport::SMTP::send(to)|Mail::Transport::Send/"Sending mail"> to overrule any information
+found in the message itself about the destination.
+
+I<Error:> Transporters of type $class cannot send.
+
+The L<Mail::Transport|Mail::Transport> object of the specified type can not send messages,
+but only receive message.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Sendmail.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Sendmail.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Sendmail.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,55 @@
+use strict;
+use warnings;
+
+package Mail::Transport::Sendmail;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Transport::Send';
+
+use Carp;
+
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    $args->{via} = 'sendmail';
+
+    $self->SUPER::init($args) or return;
+
+    $self->{MTS_program}
+      = $args->{proxy}
+     || $self->findBinary('sendmail')
+     || return;
+
+    $self->{MTS_opts} = $args->{sendmail_options} || [];
+    $self;
+}
+
+#------------------------------------------
+
+
+sub trySend($@)
+{   my ($self, $message, %args) = @_;
+
+    my $program = $self->{MTS_program};
+    if(open(MAILER, '|-')==0)
+    {   my $options = $args{sendmail_options} || [];
+        { exec $program, '-it', @{$self->{MTS_opts}}; }  # {} to avoid warning
+        $self->log(NOTICE => "Errors when opening pipe to $program: $!");
+        return 0;
+    }
+ 
+    $self->putContent($message, \*MAILER, undisclosed => 1);
+
+    unless(close MAILER)
+    {   $self->log(NOTICE => "Errors when closing sendmail mailer $program: $!");
+        $? ||= $!;
+        return 0;
+    }
+
+    1;
+}
+
+#------------------------------------------
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Sendmail.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Sendmail.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport/Sendmail.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,334 @@
+
+=head1 NAME
+
+Mail::Transport::Sendmail - transmit messages using external Sendmail program
+
+
+=head1 INHERITANCE
+
+ Mail::Transport::Sendmail
+   is a Mail::Transport::Send
+   is a Mail::Transport
+   is a Mail::Reporter
+
+
+=head1 SYNOPSIS
+
+ my $sender = Mail::Transport::Sendmail->new(...);
+ $sender->send($message);
+
+
+=head1 DESCRIPTION
+
+Implements mail transport using the external C<'Sendmail'> program.
+When instantiated, the mailer will look for the binary in specific system
+directories, and the first version found is taken.
+
+Some people use Postfix as MTA.  Postfix can be installed as replacement
+for Sendmail: is provides a program with the same name and options.  So,
+this module supports postfix as well.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Transport::Sendmail-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option            Defined in       Default       
+ executable        L<Mail::Transport>  C<undef>      
+ hostname          L<Mail::Transport>  C<'localhost'>
+ interval          L<Mail::Transport>  C<30>         
+ log               L<Mail::Reporter>  C<'WARNINGS'> 
+ password          L<Mail::Transport>  undef         
+ port              L<Mail::Transport>  undef         
+ proxy             L<Mail::Transport>  undef         
+ retry             L<Mail::Transport>  <false>       
+ sendmail_options                   []            
+ timeout           L<Mail::Transport>  C<120>        
+ trace             L<Mail::Reporter>  C<'WARNINGS'> 
+ username          L<Mail::Transport>  undef         
+ via               L<Mail::Transport>  C<'sendmail'> 
+
+. executable FILENAME
+
+. hostname HOSTNAME|ARRAY-OF-HOSTNAMES
+
+. interval SECONDS
+
+. log LEVEL
+
+. password STRING
+
+. port INTEGER
+
+. proxy PATH
+
+. retry NUMBER|undef
+
+. sendmail_options ARRAY
+
+=over 4
+
+Add to the command-line of the started sendmail MTU a list of
+separate words.  So say C< [ '-f', $file ] > and not C< [ "-f $file" ] >,
+because the latter will be taken by sendmail as one word only.
+
+=back
+
+. timeout SECONDS
+
+. trace LEVEL
+
+. username STRING
+
+. via CLASS|NAME
+
+=back
+
+=head2 Sending mail
+
+
+$obj-E<gt>B<destinations>(MESSAGE, [ADDRESS|ARRAY-OF-ADDRESSES])
+
+=over 4
+
+See L<Mail::Transport::Send/"Sending mail">
+
+=back
+
+$obj-E<gt>B<putContent>(MESSAGE, FILEHANDLE, OPTIONS)
+
+=over 4
+
+See L<Mail::Transport::Send/"Sending mail">
+
+=back
+
+$obj-E<gt>B<send>(MESSAGE, OPTIONS)
+
+=over 4
+
+See L<Mail::Transport::Send/"Sending mail">
+
+=back
+
+$obj-E<gt>B<trySend>(MESSAGE, OPTION)
+
+=over 4
+
+=back
+
+=head2 Server connection
+
+
+$obj-E<gt>B<findBinary>(NAME [, DIRECTORIES])
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+$obj-E<gt>B<remoteHost>
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+$obj-E<gt>B<retry>
+
+=over 4
+
+See L<Mail::Transport/"Server connection">
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Transport::Sendmail-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Transport::Sendmail-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Transport::Sendmail-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Error:> Errors when closing sendmail mailer $program: $!
+
+The was no problem starting the sendmail mail transfer agent, but for
+some specific reason the message could not be handled correctly.
+
+I<Warning:> Message has no destination
+
+It was not possible to figure-out where the message is intended to go
+to.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+I<Warning:> Resent group does not specify a destination
+
+The message which is sent is the result of a bounce (for instance
+created with L<Mail::Message::bounce()|Mail::Message::Construct::Bounce/"Constructing a message">), and therefore starts with a
+C<Received> header field.  With the C<bounce>, the new destination(s)
+of the message are given, which should be included as C<Resent-To>,
+C<Resent-Cc>, and C<Resent-Bcc>.
+
+The C<To>, C<Cc>, and C<Bcc> header information is only used if no
+C<Received> was found.  That seems to be the best explanation of the RFC.
+
+As alternative, you may also specify the C<to> option to some of the senders
+(for instance L<Mail::Transport::SMTP::send(to)|Mail::Transport::Send/"Sending mail"> to overrule any information
+found in the message itself about the destination.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,121 @@
+use strict;
+use warnings;
+
+package Mail::Transport;
+use vars '$VERSION';
+$VERSION = '2.055';
+use base 'Mail::Reporter';
+
+use Carp;
+use File::Spec;
+
+
+my %mailers =
+ ( exim     => '::Exim'
+ , mail     => '::Mailx'
+ , mailx    => '::Mailx'
+ , pop      => '::POP3'
+ , pop3     => '::POP3'
+ , postfix  => '::Sendmail'
+ , qmail    => '::Qmail'
+ , sendmail => '::Sendmail'
+ , smtp     => '::SMTP'
+ );
+
+#------------------------------------------
+
+
+sub new(@)
+{   my $class = shift;
+
+    return $class->SUPER::new(@_)
+        unless $class eq __PACKAGE__ || $class eq "Mail::Transport::Send";
+
+    #
+    # auto restart by creating the right transporter.
+    #
+
+    my %args  = @_;
+    my $via   = lc($args{via} || '')
+        or croak "No transport protocol provided";
+
+    $via      = 'Mail::Transport'.$mailers{$via}
+       if exists $mailers{$via};
+
+    eval "require $via";
+    return undef if $@;
+
+    $via->new(@_);
+}
+
+sub init($)
+{   my ($self, $args) = @_;
+
+    $self->SUPER::init($args);
+
+    $self->{MT_hostname}
+       = defined $args->{hostname} ? $args->{hostname} : 'localhost';
+
+    $self->{MT_port}     = $args->{port};
+    $self->{MT_username} = $args->{username};
+    $self->{MT_password} = $args->{password};
+    $self->{MT_interval} = $args->{interval} || 30;
+    $self->{MT_retry}    = $args->{retry}    || -1;
+    $self->{MT_timeout}  = $args->{timeout}  || 120;
+    $self->{MT_proxy}    = $args->{proxy};
+
+    if(my $exec = $args->{executable} || $args->{proxy})
+    {   $self->{MT_exec} = $exec;
+
+        $self->log(WARNING => "Avoid program abuse: specify an absolute path for $exec.")
+           unless File::Spec->file_name_is_absolute($exec);
+
+        unless(-x $exec)
+        {   $self->log(WARNING => "Executable $exec does not exist.");
+            return undef;
+        }
+    }
+
+    $self;
+}
+
+#------------------------------------------
+
+
+sub remoteHost()
+{   my $self = shift;
+    @$self{ qw/MT_hostname MT_port MT_username MT_password/ };
+}
+
+#------------------------------------------
+
+
+sub retry()
+{   my $self = shift;
+    @$self{ qw/MT_interval MT_retry MT_timeout/ };
+}
+
+#------------------------------------------
+
+
+my @safe_directories
+   = qw(/usr/local/bin /usr/bin /bin /sbin /usr/sbin /usr/lib);
+
+sub findBinary($@)
+{   my ($self, $name) = (shift, shift);
+
+    return $self->{MT_exec}
+        if exists $self->{MT_exec};
+
+    foreach (@_, @safe_directories)
+    {   my $fullname = File::Spec->catfile($_, $name);
+        return $fullname if -x $fullname;
+    }
+
+    undef;
+}
+
+#------------------------------------------
+
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport.pod
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport.pod	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/lib/Mail/Transport.pod	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,369 @@
+
+=head1 NAME
+
+Mail::Transport - base class for message exchange
+
+
+=head1 INHERITANCE
+
+ Mail::Transport
+   is a Mail::Reporter
+
+ Mail::Transport is extended by
+   Mail::Transport::Receive
+   Mail::Transport::Send
+
+
+=head1 SYNOPSIS
+
+ my $message = Mail::Message->new(...);
+
+ # Some extensions implement sending:
+ $message->send;
+ $message->send(via => 'sendmail');
+
+ my $sender = Mail::Transport::SMTP->new(...);
+ $sender->send($message);
+
+ # Some extensions implement receiving:
+ my $receiver = Mail::Transport::POP3->new(...);
+ $message = $receiver->receive;
+
+
+=head1 DESCRIPTION
+
+Objects which extend C<Mail::Transport> implement sending and/or
+receiving of messages, using various protocols.
+
+L<Mail::Transport::Send|Mail::Transport::Send> extends this class, and offers general
+functionality for send protocols, like SMTP.  L<Mail::Transport::Receive|Mail::Transport::Receive>
+also extends this class, and offers receive method.  Some transport
+protocols will implement both sending and receiving.
+
+
+
+=head1 METHODS
+
+
+=head2 Constructors
+
+
+Mail::Transport-E<gt>B<new>(OPTIONS)
+
+=over 4
+
+ Option      Defined in       Default       
+ executable                   C<undef>      
+ hostname                     C<'localhost'>
+ interval                     C<30>         
+ log         L<Mail::Reporter>  C<'WARNINGS'> 
+ password                     undef         
+ port                         undef         
+ proxy                        undef         
+ retry                        <false>       
+ timeout                      C<120>        
+ trace       L<Mail::Reporter>  C<'WARNINGS'> 
+ username                     undef         
+ via                          C<'sendmail'> 
+
+. executable FILENAME
+
+=over 4
+
+If you specify an executable, the module does not need to search the
+system directories to figure-out where the client lives.  Using this
+decreases the flexible usage of your program: moving your program
+to other systems may involve changing the path to the executable,
+which otherwise would work auto-detect and unmodified.
+
+=back
+
+. hostname HOSTNAME|ARRAY-OF-HOSTNAMES
+
+=over 4
+
+The host on which the server runs.  Some protocols accept an array
+of alternatives for this option.
+
+=back
+
+. interval SECONDS
+
+=over 4
+
+The time between tries to contact the remote server for sending or
+receiving a message in SECONDS.  This number must be larger than 0.
+
+=back
+
+. log LEVEL
+
+. password STRING
+
+=over 4
+
+Some protocols require a password to be given, usually in combination
+with a password.
+
+=back
+
+. port INTEGER
+
+=over 4
+
+The port number behind which the service is hiding on the remote server.
+
+=back
+
+. proxy PATH
+
+=over 4
+
+The name of the proxy software (the protocol handler).  This must be
+the name (preferable the absolute path) of your mail delivery
+software.
+
+=back
+
+. retry NUMBER|undef
+
+=over 4
+
+The number of retries before the sending will fail.  If C<undef>, the
+number of retries is unlimited.
+
+=back
+
+. timeout SECONDS
+
+=over 4
+
+SECONDS till time-out while establishing the connection to a remote server.
+
+=back
+
+. trace LEVEL
+
+. username STRING
+
+=over 4
+
+Some protocols require a user to login.
+
+=back
+
+. via CLASS|NAME
+
+=over 4
+
+Which CLASS (extending C<Mail::Transport>) will transport the data.
+Some predefined NAMEs avoid long class names: C<mail> and C<mailx>
+are handled by the L<Mail::Transport::Mailx|Mail::Transport::Mailx> module, C<sendmail>
+and C<postfix> belong to L<Mail::Transport::Sendmail|Mail::Transport::Sendmail>, and C<smtp>
+is implemented in L<Mail::Transport::SMTP|Mail::Transport::SMTP>.  The C<pop> or C<pop3>
+protocol implementation can be found in L<Mail::Transport::POP3|Mail::Transport::POP3>.
+
+=back
+
+=back
+
+=head2 Server connection
+
+
+$obj-E<gt>B<findBinary>(NAME [, DIRECTORIES])
+
+=over 4
+
+Look for a binary with the specified NAME in the directories which
+are defined to be safe.  The list of standard directories is followed
+by the optional DIRECTORIES.  The full pathname is returned.
+
+You may specify L<new(proxy)|Mail::Transport/"METHODS">, which specifies the absolute name
+of the binary to be used.
+
+=back
+
+$obj-E<gt>B<remoteHost>
+
+=over 4
+
+Returns the hostname, port number, username and password to be used to
+establish the connection to the server for sending or receiving mail.
+
+=back
+
+$obj-E<gt>B<retry>
+
+=over 4
+
+Returns the retry interval, retry count, and timeout for the connection.
+
+=back
+
+=head2 Error handling
+
+
+$obj-E<gt>B<AUTOLOAD>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<addReport>(OBJECT)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+Mail::Transport-E<gt>B<defaultTrace>([LEVEL, [LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<errors>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<log>([LEVEL [,STRINGS]])
+
+Mail::Transport-E<gt>B<log>([LEVEL [,STRINGS]])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logPriority>(LEVEL)
+
+Mail::Transport-E<gt>B<logPriority>(LEVEL)
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<logSettings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<notImplemented>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<report>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<reportAll>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<trace>([LEVEL])
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+$obj-E<gt>B<warnings>
+
+=over 4
+
+See L<Mail::Reporter/"Error handling">
+
+=back
+
+=head2 Cleanup
+
+
+$obj-E<gt>B<DESTROY>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+$obj-E<gt>B<inGlobalDestruction>
+
+=over 4
+
+See L<Mail::Reporter/"Cleanup">
+
+=back
+
+
+
+=head1 DIAGNOSTICS
+
+I<Warning:> Avoid program abuse: specify an absolute path for $exec.
+
+Specifying explicit locations for executables of email transfer agents
+should only be done with absolute file names, to avoid various pontential
+security problems.
+
+I<Warning:> Executable $exec does not exist.
+
+The explicitly indicated mail transfer agent does not exists. The normal
+settings are used to find the correct location.
+
+I<Error:> Package $package does not implement $method.
+
+Fatal error: the specific package (or one of its superclasses) does not
+implement this method where it should. This message means that some other
+related classes do implement this method however the class at hand does
+not.  Probably you should investigate this and probably inform the author
+of the package.
+
+
+
+
+
+
+=head1 REFERENCES
+
+See the MailBox website at L<http://perl.overmeer.net/mailbox/> for more details.
+
+=head1 COPYRIGHTS
+
+Distribution version 2.055.
+Written by Mark Overmeer (mark at overmeer.net).  See the ChangeLog for
+other contributors.
+
+Copyright (c) 2001-2003 by the author(s). All rights reserved.
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+

Added: packages/libmail-box-perl/branches/upstream/current/scripts/lsmail
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/scripts/lsmail	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/scripts/lsmail	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,243 @@
+#!/usr/bin/perl -w
+
+use strict;
+use lib '.';
+use Mail::Box::Manager;
+
+my $VERSION = '2.019';
+
+Mail::Box->VERSION($VERSION);
+
+=head1 NAME
+
+lsmail - list a mailbox
+
+=head1 SYNOPSIS
+
+lsmail [--entities][--header][--nheader][--size]
+       [--threads][--verbose][--help] mailboxes
+
+=cut
+
+sub usage($)
+{   my $rc = shift;
+
+    warn <<USAGE;
+Usage: $0 [options] mailbox
+options:
+    --entities      number of entities                
+    --header        print only mails containting 
+                    a key=value pair in header
+    --nheader       same as --header, but negated
+    --size          print size
+    --threads       list in threads
+    --verbose       print what is done including warnings etc.
+    --help  -?      show this help
+USAGE
+
+    exit $rc;
+}
+
+my %option =
+  ( entitities => 0
+  , size       => 0
+  , threads    => 0
+  , help       => 0 
+  , verbose    => 0
+  );
+
+sub get_options()
+{   use Getopt::Long;
+
+    GetOptions(\%option, 
+        'entities',
+        'size',
+        'threads', 
+        'help|?!', 
+        'verbose',
+        'header=s%',
+        'nheader=s%'
+         );
+}
+
+sub trace(@) { warn @_,"\n" if $option{verbose} }
+
+sub format_item ($) {
+    my $message = shift;
+    chomp(my $ret = $message->head->get('subject') || '<no subject>');
+    eval {
+        $ret .= " - ".scalar $message->parts if $option{entities};
+    };
+    return $ret;
+}
+
+#####
+##### MAIN
+#####
+
+usage 22 unless get_options;
+usage 0  if $option{help};
+
+open STDERR, ">/dev/null" if not $option{verbose};
+
+my @mailboxes = @ARGV;
+my $mgr = Mail::Box::Manager->new;
+
+#
+# Open the folders.
+#
+
+my @folders;
+my @open_options =
+  ( access   => 'r'
+  , extract  => 'LAZY'
+  );
+
+if(@mailboxes)
+{   foreach my $mailbox (@mailboxes)
+    {   trace "Opening folder $mailbox.";
+
+        my $folder = $mgr->open(folder => $mailbox, @open_options);
+
+        die "Mailbox $mailbox cannot be opened.\n"
+            unless $folder;
+
+        push @folders, $folder;
+    }
+}
+else
+{   trace "Opening default folder";
+
+    my $folder = $mgr->open(@open_options);
+
+    die "Default mailbox cannot be read.\n"
+        unless $folder;
+
+    push @folders, $folder;
+}
+
+#
+# List the folders
+#
+
+if($option{threads})
+{   trace "Collecting threads for all folders.";
+    my $threads = $mgr->threads(folders => \@folders);
+
+    trace "Dumping threads.";
+    foreach my $thread ($threads->sortedAll){   
+        print $thread->threadToString(\&format_item) unless not $thread;
+    }
+}
+else
+{   trace "List subjects.";
+    foreach my $folder (@folders) {   
+        open STDERR, ">/dev/null";
+        
+        MESSAGE:
+        foreach my $message ($folder->messages) {   
+                
+            if($option{header}) {
+                for my $h (keys %{$option{header}}) {
+                    my $pat = $option{header}{$h};
+                    next MESSAGE unless $message->head->get($h) =~ /$pat/;
+                }
+            }
+
+            if($option{nheader}) {
+                for my $h (keys %{$option{nheader}}) {
+                    my $pat = $option{nheader}{$h};
+                    next MESSAGE if $message->head->get($h) =~ /$pat/;
+                }
+            }
+            
+            eval { 
+                my $subject = $message->head->get('subject') 
+                    || '<no subject>';
+                print "subject: ", $subject, "\n";
+            };
+
+            # check further options
+            printf "size: %.1fK\n", $message->size / 1024 if $option{size};
+            printf "entities: %d\n", scalar $message->parts
+                if $option{entities}; 
+                
+            print "-" x 40, "\n";
+        }
+    }
+}
+
+#
+# Close folders
+#
+
+$mgr->closeAllFolders;
+
+exit 0;
+#-------------------------------------------
+
+__END__
+
+=head1 DESCRIPTION
+
+List the contents of one or more mailboxes.  Specifying more than one
+name is only useful when you read in threads, in which case the messages
+of both folders are merged.
+
+Options:
+
+=over 4
+
+=item --entities =E<gt> BOOLEAN
+
+(or C<-e>) show the number of MIME-entities in messages. When --threads is
+also given, the number is appended to the subject.  Slows down lsmail
+significantly since a mail message must be fully parsed to get the entities
+information.
+
+=item --size =E<gt> BOOLEAN
+
+(or C<-s>) also show size of message in non-threaded output.
+
+=item --header HEADER-FIELD=PATTERN
+
+only display mails whose HEADER-FIELD (for instance 'subject' or 'from')
+contains PATTERN.
+
+=item --nheader HEADER-FIELD=PATTERN
+
+do not display mails whose HEADER-FIELD contains PATTERN.
+
+=item --threads =E<gt> BOOLEAN
+
+(or C<-t> or C<-nothreads> or C<-not>) list the messages in threads.  The
+threads are sorted by time: the thread with the oldest starting message comes
+first.
+
+=item --help =E<gt> BOOLEAN
+
+(or C<--help> or C<-?>) Print a brief help
+
+=item --verbose =E<gt> BOOLEAN
+
+(or C<--verbose> or C<--noverbose>) Be verbose about the progress of the
+program.  This is especially useful for debugging purposes.
+
+=back
+
+=head1 AUTHOR
+
+Mark Overmeer (F<Mark at Overmeer.net>).
+All rights reserved.  This program is free software; you can redistribute
+it and/or modify it under the same terms as Perl itself.
+
+Additions by Tassilo v. Parseval (F<tassilo.parseval at post.rwth-aachen.de>)
+
+=head1 VERSION
+
+This code is beta, version 2.019
+
+=cut
+
+1;
+

Added: packages/libmail-box-perl/branches/upstream/current/scripts/mailbox2html
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/scripts/mailbox2html	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/scripts/mailbox2html	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,548 @@
+#!/usr/bin/perl -w
+
+use strict;
+use lib '/home/markov/fake';
+use Mail::Box::Manager;
+
+my $VERSION = '2.019';
+
+Mail::Box->VERSION($VERSION);
+
+# file-globals.
+my ($manager, @folderpage, @messagepage);
+
+sub create_folder(@);
+sub create_message(@);
+sub clean_dir($);
+sub default_folderpage();
+sub default_messagepage();
+
+=head1 NAME
+
+mailbox2html - EXPERIMENTAL: convert mail folders into an HTML structure
+
+=head1 SYNOPSIS
+
+mail2html [-src folder] [-dest directory] [-norecurse]
+
+=cut
+
+sub usage($)
+{   my $rc = shift;
+
+    warn <<USAGE;
+Usage: $0 [options]
+    options:
+       -cleanup              clean the destination directory before producing
+       -dest directory       output location of translated
+       -folderpage filename  template for folder-pages
+       -help  -?             show this help
+       -index filename       name of the directory-index
+       -messagepage filename template for message-pages
+       -norecurse            descend into sub-folders
+       -src folder           folder(-directory) to be translated into html
+       -template             the page-template file
+       -verbose              verbose messages
+USAGE
+
+    exit $rc;
+}
+
+my %option =
+  ( cleanup     => 0
+  , dest        => exists $ENV{TMPDIR} ? '$ENV{TMPDIR}/mail2html'
+                 : -d '/var/tmp'       ? '/var/tmp/mail2html'
+                 : -d '/tmp'           ? '/tmp/mail2html'
+                 :                       '.'
+  , folderpage  => undef
+  , help        => 0
+  , index       => 'index.html'
+  , messagepage => undef
+  , recurse     => 1
+  , src         => exists $ENV{MAIL}   ? $ENV{MAIL}
+                 : exists $ENV{mail}   ? $ENV{mail}
+                 : exists $ENV{HOME} && -d '$ENV{HOME}/Mail' ? '$ENV{HOME}/Mail'
+                 : exists $ENV{home} && -d '$ENV{home}/Mail' ? '$ENV{home}/Mail'
+                 : '.'
+
+  , verbose     => 0
+  );
+
+sub get_options()
+{   use Getopt::Long;
+
+    GetOptions(\%option
+, 'src=s'
+, 'dest=s'
+, 'folderpage=s'
+, 'index=s'
+, 'messagepage=s'
+, 'recurse!'
+, 'verbose!'
+, 'cleanup!'
+, 'help|?!'
+              );
+}
+
+sub trace(@) { warn @_,"\n" if $option{verbose} }
+
+sub clean_dir($)
+{   my $dir = shift;
+    trace "cleaning $dir.\n";
+
+    opendir DIR, $dir or return;
+    my (@files, @directories);
+
+    while(my $entry = readdir DIR)
+    {   next if $entry =~ m/^\.\.?$/;
+        if(-d $entry) {push @directories, $entry}
+        else          {push @files, $entry}
+    }
+
+    closedir DIR;
+
+    unlink "$dir/$_"    foreach @files;
+    clean_dir "$dir/$_" foreach @directories;
+    unlink $dir;
+}
+
+sub create_uplinks(@)
+{   return () unless @_;
+    my @links = ('<B>'.(pop).'</B>');
+    my $href  = '..';
+    while(@_)
+    {   unshift @links, "<A HREF=$href>".(pop)."</A>";
+        $href .= '/..';
+    }
+    @links;
+}
+
+sub create_folder(@)
+{   my %args       = @_;
+    my $folder     = $args{folder};
+    my $name       = $folder->name;
+
+    #
+    # Output location
+    #
+
+    my $dirname    = "$args{dest}/$name";
+    for($dirname)      # some cleanups.
+    {   s!/\./!/!g;
+        s!/\=(/|$)!/!g;
+    }
+    unless(-d $dirname)
+    {   trace "Create directory $dirname.";
+        mkdir $dirname, 0700
+           or die "Cannot create directory $dirname: $!\n";
+    }
+    my $filename   = "$dirname/$option{index}";
+
+    #
+    # Sub-directory preparations.
+    #
+
+    my @subfolders;
+    if($option{recurse})
+    {    my @subs  = sort $folder->listSubFolders;
+         my $prev;
+
+         for(my $i=0; $i<@subs; $i++)
+         {
+             my @path = $args{path} ? @{$args{path}} : ();
+             my $sub  = $folder->openSubFolder($subs[$i]);
+             my $sum  = create_folder
+               ( folder   => $sub
+               , dest     => $args{dest}
+               , path     => [ @path , $name]
+               , previous => ($i <= 0 ? ''
+                 : "Previous:&nbsp;<A HREF=\"../$subs[$i-1]\">$subs[$i-1]</A>")
+               , next     => ($i >= @subs-1 ? ''
+                 : "Next:&nbsp;<A HREF=\"../$subs[$i+1]\">$subs[$i+1]</A>")
+               );
+             push @subfolders, $sum;
+         }
+    }
+
+    #
+    # Summerize data about this folder.
+    #
+
+    trace "processing folder $name";
+
+    my @uplinks  = create_uplinks @{$args{path}};
+    my @messages = $folder->messages;
+
+    my %sum      =              # collect info for super-folder, so no place
+      ( foldername    => $name  # for sub-folder stuff.
+      , foldersize    => 0
+      , seen_messages => 0
+      , nr_messages   => scalar @messages
+      , nr_subfolders => scalar @subfolders
+      );
+
+    $sum{foldersize} += $_->{foldersize} foreach @subfolders;
+    $sum{newest} = $sum{oldest} = $messages[0]->timestamp if @messages;
+
+    foreach my $message (@messages)
+    {   $sum{deleted}++       if $message->deleted;
+        $sum{seen_messages}++ if $message->label('seen');
+        $sum{foldersize}    += $message->size;
+        if(my $timestamp = $message->timestamp)
+        {   $sum{newest_message} = $timestamp if $timestamp > $sum{newest};
+            $sum{oldest_message} = $timestamp if $timestamp < $sum{oldest};
+        }
+
+        create_message
+         ( message   => $message
+         , folder    => $folder
+         , manager   => $manager
+         , dirname   => $dirname
+         );
+    }
+
+    $sum{new_messages} = @messages - $sum{seen_messages};
+
+    #
+    # Page output.
+    #
+
+    open HTML, '>', $filename
+        or die "Cannot create $filename: $!\n";
+
+    my $oldout = select HTML;
+
+    use_template
+       ( template   => \@folderpage
+       , folder     => $folder
+       , subfolders => \@subfolders
+       , messages   => \@messages
+       , manager    => $manager
+       , %sum
+       );
+
+    select $oldout;
+    close HTML;
+
+    \%sum;
+}
+
+sub create_message(@)
+{   my %args         = @_;
+    my $message      = $args{message};
+
+    # f.i. usable for constructing links, because all specials are stripped.
+    my $clean_id     = $message->messageID;
+    for($clean_id)
+    {   s/^\s*\<(.*?)\>\s*$/$1/g;
+        tr/a-zA-Z0-9_/-/cs;
+    }
+    my $filename     = "$args{dirname}/${clean_id}.html";
+    my $subject      = $message->head->get('subject') || '&lt;no subject&gt;';
+    chomp $subject;
+
+    $message->setLabel
+     ( clean_id => $clean_id
+     , filename => $filename
+     , subject  => $subject
+     );
+
+    open HTML, '>', $filename
+        or die "Cannot create $filename: $!\n";
+
+    my $oldout = select HTML;
+
+    use_template
+     ( template => \@messagepage
+     , message  => $message
+     , filename => $filename
+     , folder   => $args{folder}
+     , subject  => $subject
+     , manager  => $manager
+     , indexfile=> $option{index}
+     );
+
+    select $oldout;
+    close HTML;
+}
+
+sub parse_template($@)
+{   my $name = shift;
+    my @parts;
+    my $rest;
+    while(@_)
+    {   $rest .= shift;
+        while($rest =~ m/\<\#perl\b/)
+        {   push @parts, $`;
+            $rest     = $';
+            $rest    .= shift while @_ && $rest !~ m/\#\>/;
+
+            die "Perl part not closed in $name.\n"
+                unless $rest =~ m/\#\>/;
+
+            (my $code, $rest) = split /\s*\#\>\s*/, $rest, 2;
+            if($code =~ s/^\s*BEGIN\s+//)
+            {   WEBPAGE::run_code($code);
+                $rest = (pop @parts).$rest;
+            }
+            else
+            {   push @parts, $code;
+            }
+        }
+    }
+    push @parts, $rest;
+
+    @parts;
+}
+
+sub use_template(@)
+{   my %args  = @_;
+
+    foreach (keys %args)
+    {   no strict 'refs';
+        ${"WEBPAGE::$_"} = $args{$_};
+    }
+
+    my $template = $args{template};
+    my $lines    = @$template;
+    for(my $t=0; $t<$lines; $t++)
+    {   print $template->[$t++];
+        WEBPAGE::run_code($template->[$t]) if $t<$lines;
+    }
+}
+
+package WEBPAGE;
+no strict;
+sub run_code($)
+{   eval shift;
+    die $@ if $@;
+}
+
+package main;
+use strict;
+
+#####
+##### MAIN
+#####
+
+usage 22 unless get_options;
+usage 0 if $option{help};
+
+# Prepare destination directory.
+
+clean_dir $option{dest}
+    if $option{cleanup} && -d $option{dest};
+
+unless(-d $option{dest})
+{   trace "Creating $option{dest}.";
+    mkdir $option{dest}, 0700
+       or die "Cannot create destination directory $option{dest}: $!\n";
+}
+
+#
+# Get the configuration
+#
+
+# Parse folderpage.
+
+if(my $foldtempl = $option{folderpage})
+{   trace "Parsing folderpage-template from $foldtempl.";
+    open TEMPLATE, $foldtempl
+        or die "Cannot read $foldtempl: $!\n";
+
+    @folderpage = parse_template 'folderpage', <TEMPLATE>;
+    close TEMPLATE;
+}
+else
+{   trace "Taking default folderpage template.";
+    @folderpage = parse_template 'default folderpage', default_folderpage;
+}
+
+# Parse messagepage.
+
+if(my $msgtempl = $option{messagepage})
+{   trace "Parsing messagepage-template from $msgtempl.";
+    open TEMPLATE, $msgtempl
+        or die "Cannot read $msgtempl: $!\n";
+
+    @messagepage = parse_template 'messagepage', <TEMPLATE>;
+    close TEMPLATE;
+}
+else
+{   trace "Taking default messagepage template.";
+    @messagepage = parse_template 'default messagepage', default_messagepage;
+}
+
+#
+# Start handling the folder
+#
+
+trace "Start folder manager.";
+$manager  = Mail::Box::Manager->new;
+
+trace "Opening folder `$option{src}'.";
+my $folder = $manager->open
+  ( folderdir  => $option{src}
+  , folder     => '='          # open folderdir
+  , extract    => 'ALWAYS'     # need all messages anyway.
+  );
+
+die "Cannot open folder `$option{src}'.\n"
+    unless $folder;
+
+trace "Folder-type is ",ref $folder, ".";
+
+create_folder
+  ( dest   => $option{dest}
+  , folder => $folder
+  );
+
+#-------------------------------------------
+
+sub default_folderpage()
+{   <<'DEFAULT_FOLDERPAGE';
+<#perl BEGIN
+
+  use File::Basename;
+
+  sub nicemessage($)
+  {   my $msg = shift;
+      '<A HREF="'.(basename $msg->label('filename')).'">'
+      . $msg->label('subject') . '</A>';
+  }
+
+  sub polish($)
+  {   my @lines = split /\n/, shift;
+      foreach (@lines)
+      {   if( my ($layout,$rest) = m/^(.*?)(\<.*)$/ )
+          {  $layout =~ s/ /&nbsp;/g;
+             $_ = "<TT>$layout</TT>$rest";
+          }
+          s/$/<BR>\n/;
+      }
+      @lines;
+  }
+#>
+
+<HTML>
+<HEAD><TITLE><#perl print $foldername#></TITLE></HEAD>
+<BODY BGCOLOR=#FFFFFF TEXT=#000000>
+See the templates as included in the Mail::Box-package for nicer output
+and more detailed examples.
+<#perl
+print "SUB: $nr_subfolders ".@$subfolders."\n";
+print "NR=$nr_subfolders, NR=".@$subfolders."\n";
+  if($nr_subfolders)
+  {   print "<H4>$nr_subfolders subfolders:</H4>\n";
+      foreach (@$subfolders)
+      {   my $subname = basename $_->{foldername};
+          print "<A HREF=\"$subname/$indexfile\">$subname</A> "
+              , "($_->{nr_messages} messages)<BR>\n";
+      }
+  }
+
+  if($nr_messages)
+  {   print "\n<H4>$nr_messages messages:</H4>\n";
+      print polish($_->threadToString(\&nicemessage))
+         foreach $manager->threads(folder => $folder)->sortedAll;
+  }
+
+ #>
+</BODY></HTML>
+DEFAULT_FOLDERPAGE
+}
+
+sub default_messagepage()
+{   <<'DEFAULT_MESSAGEPAGE';
+
+<HTML><HEAD><TITLE><#perl print $subject#></TITLE></HEAD>
+
+<BODY BGCOLOR=#FFFFFF TEXT=#000000>
+<PRE>
+<#perl if($message) {$message->print(select)} else {print '<undef>'} #>
+</PRE>
+</BODY></HTML>
+DEFAULT_MESSAGEPAGE
+}
+
+#-------------------------------------------
+
+__END__
+
+=head1 DESCRIPTION
+
+Convert various kinds of mail folders to HTML, permitting them to be
+read by a web browser.
+
+Options:
+
+=over 4
+
+=item -cleanup =E<gt> BOOLEAN
+
+(or C<-cleanup> or C<-nocleanup>) removes the directory before generating
+the data.
+
+=item -dest =E<gt> DIRECTORY
+
+The output directory. When this option is not specified, the program will
+try to create a sub-directory named C<mail2html> in the directory pointed
+to by the environment variable TMPDIR or tmpdir, otherwise the output will
+be in C</var/tmp> or C</tmp>.
+
+=item -folderpage =E<gt> FILENAME
+
+# DWC Hm... 2nd sentence doesn't make sense
+The template which is used to create folder pages.  See the examples with
+the distribution of this code for examples.
+
+=item -help =E<gt> BOOLEAN
+
+(or C<-help> or C<-?>) Print a brief help
+
+=item -index =E<gt> FILENAME
+
+The filename which the web server loads when the user specifies only the
+name of the directory in a URL. This option is set to C<index.html> by
+default.
+
+=item -messagepage =E<gt> FILENAME
+
+# DWC Hm... 2nd sentence doesn't make sense
+The template which is used to create one page per message.
+See the examples with the distribution of this code for examples.
+
+=item -recurse =E<gt> BOOLEAN
+
+(or C<-recurse> or <-norecurse>) Recurse through subfolders.  By default,
+recursive production is enabled.
+
+=item -src =E<gt> FILE | DIRECTORY
+
+Start with the folder(-directory) which can be found at the specified
+location.  The type of folder is auto-detected.  By default, the contents
+of the directory specified by the C<MAIL> or C<mail> environment variable
+are used. If these variables are not defined, C<HOME> and C<home> are
+checked for a sub-directory named C<Mail>.  If these are unsuccessful as
+well, the current directory is used.
+
+=item -verbose =E<gt> BOOLEAN
+
+(or C<-verbose> or C<-noverbose>) Be verbose about the progress of the
+program.  This is especially useful for debugging purposes.
+
+=back
+
+=head1 AUTHOR
+
+Mark Overmeer (F<Mark at Overmeer.net>).
+All rights reserved.  This program is free software; you can redistribute
+it and/or modify it under the same terms as Perl itself.
+
+=head1 VERSION
+
+This code is beta, version 2.019
+
+=cut
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/scripts/takemail
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/scripts/takemail	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/scripts/takemail	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,257 @@
+#! /usr/bin/perl -w
+
+use strict;
+use Getopt::Long;
+use lib '../../Mail';
+use Mail::Box::Manager;
+
+my $VERSION = '2.019';
+
+#-----------
+# prototypes
+#-----------
+sub open_mailboxes();
+sub create_outboxes();
+sub parse_mailboxes();
+sub compile_regex();
+sub configure_sigs();
+sub get_options();
+sub surpress_werr();
+sub trace($);
+sub usage($);
+
+my @Mailboxes;
+my $Outbox;
+my %option = (    verbose => 0, 
+                werr => 0, 
+             );
+get_options;
+
+
+usage 2 if not @ARGV;
+usage 0 if $option{help};
+
+surpress_werr if not $option{werr};
+compile_regex;
+
+my $Manager = Mail::Box::Manager->new;
+configure_sigs;
+$Outbox = create_outboxes;
+open_mailboxes;
+parse_mailboxes;
+$Manager->closeAllFolders;
+
+#-----
+# subs
+#-----
+
+sub open_mailboxes() {
+
+    for my $item (@ARGV) {
+    
+        # $item is a directory
+        if (-d $item) {
+            opendir DIR, $item or die "Error: Could not open $item: $!";
+            my @mboxes = readdir DIR;
+            for my $mb (@mboxes) {
+                next if $mb =~ /^\.\.?$/; 
+                trace "Opening folder $mb. ";
+
+                if(my $mbox = $Manager->open(
+                    folder => "$item/$mb", access => 'r', extract => 'LAZY',
+                    trace => 'NONE'))
+                {   trace "Success.\n";
+                    push @Mailboxes, $mbox;
+                }
+                else { trace "Failed! $item/$mb\n" }
+            }
+            closedir DIR;
+        }
+
+        # $item is a file
+        if (-f $item) {
+            trace "Opening folder $item. ";
+            my $mbox = $Manager->open(  folder => $item, 
+                                        access => 'r',
+                                        extract => 'LAZY',
+                                        trace   => 'NONE');
+            if ($mbox) {
+                    trace "Success.\n";
+                    push @Mailboxes, $mbox;
+            }
+            else { trace "Failed!\n" }
+        }
+    }
+}
+
+sub create_outboxes() {
+    my $outbox;
+    if ($option{outbox}) {
+        trace "Creating $option{outbox}. ";
+        $outbox = $Manager->open(   folder => $option{outbox}, 
+                                    access => 'w',
+                                    create => 1 );
+
+        if($outbox)   { trace "Success.\n" }
+        else          { trace "Failed!\n" }
+    }
+    return $outbox;
+}
+                    
+
+sub parse_mailboxes() {
+    for my $mbox (@Mailboxes) {
+        MESSAGE:
+        for my $msg ($mbox->messages) {
+
+            for my $h (keys %{$option{header}}) {
+                my $hd  = $msg->head->get($h);                
+                my $pat = $option{header}{$h};
+                next MESSAGE unless defined $hd && $hd =~ $pat; 
+            }
+            
+            for my $h (keys %{$option{nheader}}) {
+                my $hd  = $msg->head->get($h);
+                my $pat = $option{nheader}{$h};
+                last if not $hd; 
+                next MESSAGE if $hd =~ $pat;
+            }
+            
+            if($Outbox)     { $Manager->copyMessage($Outbox, $msg) }
+            else            { $msg->print }
+            
+        }
+    }
+}
+            
+sub compile_regex() {
+    for my $h (keys %{$option{header}}) {
+        my $pat = $option{header}{$h};
+        $option{header}{$h} = qr($pat);
+    }
+    for my $h (keys %{$option{nheader}}) {
+        my $pat = $option{nheader}{$h};
+        $option{nheader}{$h} = qr($pat);
+    }
+}
+
+sub configure_sigs() {
+    $SIG{INT} = sub {
+        print "Received sigint\n";
+        $Manager->closeAllFolders;
+        exit;
+    }
+}
+
+sub get_options() {
+    use Getopt::Long;
+    my $res = GetOptions(\%option,
+                    'outdir=s',
+                    'outbox=s',
+                    'header=s%',
+                    'nheader=s%',
+                    'werr',
+                    'verbose',
+                    'help|?');
+}
+
+sub surpress_werr() {
+    $SIG{__WARN__} = 0;
+}
+
+sub trace($) {
+    print STDERR shift if $option{verbose};
+}
+
+sub usage($) {
+    my $ec = shift;
+
+    warn <<USAGE;
+Usage: $0 [options] mailbox/mailbox-dir
+options:
+    --outdir <dir>            create new mailboxes in <dir>
+    --outbox <mbox>           output to <mbox> (defaults to stdout)
+    --header <field>=<regex>  capture mails applying to <regexp> 
+                              in header-<field>
+    --nheader <field>=<regex> capture mails not applying to <regexp>
+                              in header-<field>
+    --verbose                 print what is done
+    --werr                    print warnings and errors as well
+    --help                    print this help
+USAGE
+
+    exit $ec;
+}
+
+__END__
+
+=head1 NAME
+
+takemail - walk through mailboxes and grep for something
+
+=head1 SYNOPSIS
+
+takemail [--outbox][--outdir][--header][--nheader]
+         [--verbose][--werr][--help] mailbox/mailbox-dir
+
+=head1 DESCRIPTION
+
+Dump mails applying to regular expressions either to stdout or into a
+newly created mailbox.
+
+Options:
+
+=over 4
+
+=item --outbox FILE
+
+(or C<-c>) Create a new mailbox FILE and write the found messages into it.
+If omitted, output goes to stdout.
+
+=item --outdir DIR
+
+Nothing yet.
+
+=item --header HEADER-FIELD=REGEX
+
+Only find messages whose HEADER-FIELD(s) conform to REGEX. REGEX is a
+standard Perl regular expression, without the leading and trailing slash
+'/'. Multiple key=value pairs can be given by separating them with
+whitespace. Example:
+
+ takemail --header subject=[Hh]ello from=peter\|john ~/Mail
+
+Care must be taken when specifying patterns with special shell characters,
+especially those used for piping. This means that '|' etc. will probably
+need to be escaped with a backslash '\'.
+
+=item --nheader HEADER-FIELD=REGEX
+
+Only find messages whose HEADER-FIELD(s) do not conform to REGEX. Same
+usage as --header.
+
+=item --verbose
+
+(or C<-v>) In addition to normal output, print a log of what is being done
+to stderr.
+
+=item --werr
+
+Nothing yet.
+
+=item --help
+
+(or C<-?>) Print a short summary of options.
+
+=back
+
+=head1 AUTHOR
+
+Tassilo v. Parseval (F<tassilo.parseval at post.rwth-aachen.de>).
+
+All rights reserved.  This program is free software; you can redistribute
+it and/or modify it under the same terms as Perl itself.
+
+=head1 VERSION
+
+This code is beta, version 2.019

Added: packages/libmail-box-perl/branches/upstream/current/test.pl
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/test.pl	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/test.pl	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,239 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use File::Spec;
+use File::Basename;
+
+use lib 'tests';
+use Config;
+use Tools;             # test tools
+
+use IO::Dir;
+use Test::Harness qw($verbose);
+
+chdir 'tests'    ##### CHANGE DIR TO tests
+   or die "Cannot go to test scripts directory: $!\n";
+
+$verbose = 0;
+if(@ARGV && $ARGV[0] eq '-v')
+{   $verbose = 1;
+    shift @ARGV;
+}
+
+my $select_tests;
+if(@ARGV)
+{   my $pat = join '|', @ARGV;
+    $select_tests   = qr/$pat/o;
+}
+
+# The versions of the following packages are reported to help understanding
+# the environment in which the tests are run.  This is certainly not a
+# full list of all installed modules.
+my @show_versions = defined $select_tests ? ()
+ : qw/Mail::Box Mail::Box::Parser::C
+      User::Identity Object::Realize::Later MIME::Types
+      Test::Harness Encode
+     /;
+
+my $skip_tests = -f 'skiptests';
+sub package_of($);
+sub testnames($);
+sub run_in_harness(@);
+sub report();
+sub dl_format($@);
+
+warn <<'WARN' unless $select_tests;
+
+*
+* Testing MailBox
+WARN
+
+if($skip_tests)
+{   warn <<'WARN';
+* Tests are disabled, because you said so when the Makefile was created.
+* remove the file "skiptests" if you want to run them.
+*
+WARN
+    exit 0;
+}
+
+warn <<'WARN' unless $select_tests;
+*
+* Sometimes installing MailBox breaks because of the huge size
+* of the whole package. Simply restarting the installation is in
+* most cases enough to solve the problems.  You may require a new
+* version of ExtUtils::MakeMaker.
+*
+* On *Windows* you will get a large number of failing tests, but they
+* are usually harmless.  Please help me to get rit of them.
+*
+
+WARN
+
+warn "Running on $^O ($Config{archname} $Config{osvers}), with Perl $]\n";
+
+foreach my $package (@show_versions)
+{   eval "require $package";
+
+    my $report
+      = !$@                    ? "version ". ($package->VERSION || 'unknown')
+      : $@ =~ m/^Can't locate/ ? "not installed"
+      : "reports error";
+
+    warn "$package $report\n";
+}
+warn "\n";
+
+#
+# Get all the test-sets.
+#
+
+my $testdir = '.';
+my $setdir  = IO::Dir->new($testdir);
+die "Cannot open directory $testdir: $!"
+     unless $setdir;
+
+my @sets = sort grep { /^\d/ && -d File::Spec->catfile($testdir, $_) } 
+                  $setdir->read;
+
+$setdir->close;
+
+my (%success, %skipped);
+my $tests_run = 0;
+
+foreach my $set (@sets)
+{
+    my $script = File::Spec->catfile($testdir, $set, 'Definition.pm');
+
+    eval "require '$script'";
+    if($@)
+    {   warn "Errors while requiring $script:\n$@";
+        next;
+    }
+
+    my $package  = package_of $set;
+
+    if(my $reason = $package->skip)
+    {   $skipped{$set} = $reason;
+        printf "%-15s -- %s\n", $set, $reason;
+        next;
+    }
+
+    my @tests = testnames $set;
+    @tests    = grep { $_ =~ $select_tests } @tests
+       if defined $select_tests;
+
+    if(@tests)
+    {   printf "%-15.15s -- %d %s %s\n", $set, scalar @tests,
+           (@tests==1 ? "script; " : "scripts;"), $package->name;
+    }
+    elsif(defined $select_tests)  { ; }  # silence
+    else
+    {   printf "%-15.15s -- skip all tests for %s\n", $set, $package->name;
+    }
+
+    next unless @tests;
+
+    $success{$set} = run_in_harness @tests;
+    $tests_run += @tests;
+}
+
+my $critical = $tests_run ? report : 0;
+exit $critical;
+
+#
+# PACKAGE_OF SET
+# Returns the name of the package which contains details about the test-set.
+#
+
+sub package_of($) { "MailBox::Test::$_[0]::Definition" }
+
+#
+# TESTNAMES SET
+# Returns a list of all the test for a certain test-set.
+#
+
+sub testnames($)
+{   my $set = shift;
+    my $dirname = File::Spec->catdir($testdir, $set);
+
+    my $dir = IO::Dir->new($dirname)
+        or return ();
+
+    sort
+        map { File::Spec->catfile($dirname, $_) }
+            grep /\.t$/, $dir->read;
+}
+
+#
+# RUN_IN_HARNESS @files
+# Run the specified test files in a harness, but then the MailBox
+# way doin things.
+#
+
+sub run_in_harness(@)
+{   my @files = @_;
+    return 1 unless @files;
+
+    my ($tot, $failed) = Test::Harness::_run_all_tests(@files);
+    Test::Harness::_all_ok($tot);
+}
+
+#
+# PRINT_REPORT
+#
+
+sub report()
+{
+    print "--- Test report\n";
+
+    my @success = sort grep {$success{$_}} keys %success;
+
+    local $"    = ', ';
+    dl_format(Success => @success) if @success;
+
+    my @failed;
+    my $critical = 0;
+
+    foreach my $set (sort grep {not $success{$_}} keys %success)
+    {   push @failed, $set;
+
+        my $package = package_of $set;
+        if($package->critical)
+        {   $failed[-1] .= '(*)';
+            $critical++;
+        }
+    }
+
+    dl_format(Failure => @failed) if @failed;
+    print "    Marked (*) are critical errors.\n" if $critical;
+
+    my @skipped = sort keys %skipped;
+    dl_format(Skipped => @skipped)     if @skipped;
+
+    $critical;
+}
+
+#
+# DL_FORMAT DT, DD-LIST
+# Print in an HTML description-list fashion, with $" between the elements.
+#
+
+sub dl_format($@)
+{   my $line = (shift) . ': ';
+    my $elem = shift;
+
+    while(defined $elem)
+    {   $elem .= $" if @_;
+        if(length($line) + length($elem) > 72)
+        {   print "$line\n";
+            $line = "    ";
+        }
+        $line .= $elem;
+        $elem  = shift;
+    }
+
+    print "$line\n" if $line =~ /[^ ]/;
+}

Added: packages/libmail-box-perl/branches/upstream/current/tests/01platform/10crlf.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/01platform/10crlf.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/01platform/10crlf.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,63 @@
+#!/usr/bin/perl -T
+# On Windows, the test mailbox must be have lines which are
+# separated by CRLFs.  The mbox.src which is supplied is UNIX-style,
+# so only has LF line-terminations.  In this script, this is
+# translated.  The Content-Length of the messages is updated too.
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 1;
+
+use FileHandle;
+
+my $crlf = "\015\012";
+
+open SRC,  '<', $unixsrc  or die "Cannot open $unixsrc to read: $!\n";
+binmode SRC;
+
+open DEST, '>', $winsrc or die "Cannot open $winsrc for writing: $!\n";
+select DEST;
+binmode DEST;
+
+until(eof SRC)
+{
+    my ($lines, $bytes);
+
+  HEADER:
+    while(<SRC>)
+    {   s/[\012\015]*$/$crlf/;
+
+           if( m/^Content-Length\: / ) {$bytes = $' +0}
+        elsif( m/^Lines\: /          ) {$lines = $' +0}
+        elsif( m/^\s*$/              )
+        {   # End of header
+            if(defined $bytes && defined $lines)
+            {   $bytes += $lines;
+                print "Content-Length: $bytes\015\012";
+            }
+
+            print "Lines: $lines$crlf"
+                if defined $lines;
+
+            print $crlf;
+            last HEADER;
+        }
+        else {print}
+    }
+
+  BODY:
+    while(<SRC>)
+    {   s/[\012\015]*$/$crlf/;
+        print;
+        last BODY if m/^From /;
+    }
+}
+
+die "Errors in reading $unixsrc"  unless close SRC;
+die "Errors in writing $winsrc"   unless close DEST;
+
+pass("Folder conversion complete");

Added: packages/libmail-box-perl/branches/upstream/current/tests/01platform/Definition.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/01platform/Definition.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/01platform/Definition.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,8 @@
+
+package MailBox::Test::01platform::Definition;
+
+sub name     {"platform specific preparations"}
+sub critical {1}
+sub skip     { undef }
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/tests/10report/10errors.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/10report/10errors.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/10report/10errors.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,162 @@
+#!/usr/bin/perl -T
+#
+# Test reporting warnings, errors and family.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 85;
+
+use Mail::Reporter;
+
+#
+# Dualvar logPriority
+#
+
+my $a = Mail::Reporter->logPriority('WARNING');
+ok(defined $a);
+ok($a == 4);
+is($a, 'WARNING');
+
+my $b = Mail::Reporter->logPriority('WARNINGS');
+ok(defined $b);
+ok($b == 4);
+is($b, 'WARNING');
+
+my $c = Mail::Reporter->logPriority(4);
+ok(defined $c);
+ok($c == 4);
+is($c, 'WARNING');
+
+my $d = Mail::Reporter->logPriority('AAP');
+ok(!defined $d);
+my $e = Mail::Reporter->logPriority(8);
+ok(!defined $e);
+
+#
+# Set default trace
+#
+
+my ($l, $t) = Mail::Reporter->defaultTrace('DEBUG', 'ERRORS');
+ok(defined $l);
+ok(defined $t);
+
+is($l, 'DEBUG',                     'string log level');
+cmp_ok($l, '==',  1,                'numeric log level');
+
+is($t, 'ERROR',                     'string trace level');
+cmp_ok($t, '==',  5,                'string trace level');
+
+($l, $t) = Mail::Reporter->defaultTrace('PROGRESS');
+is($l, 'PROGRESS',                  'string log level');
+cmp_ok($l, '==',  3,                'numeric log level');
+
+is($t, 'PROGRESS',                  'string trace level');
+cmp_ok($t, '==',  3,                'string trace level');
+
+($l, $t) = Mail::Reporter->defaultTrace('WARNING', 'WARNINGS');
+is($l, 'WARNING',                   'string log level');
+cmp_ok($l, '==',  4,                'numeric log level');
+
+is($t, 'WARNING',                   'string trace level');
+cmp_ok($t, '==',  4,                'string trace level');
+
+#
+# Reporting levels
+#
+
+my $rep = Mail::Reporter->new;
+
+ok(defined $rep);
+is($rep->log, 'WARNING',            'Default log-level');
+cmp_ok($rep->log, '==', 4);
+$l = $rep->log;
+is($l, 'WARNING',                   'Default log-level');
+cmp_ok($l, '==', 4);
+
+is($rep->trace, 'WARNING',          'Default trace-level');
+cmp_ok($rep->trace, '==', 4);
+$t = $rep->trace;
+is($t, 'WARNING',                   'Default trace-level');
+cmp_ok($t, '==', 4);
+
+cmp_ok($rep->trace('ERROR'), '==', 5,   'Check error level numbers');
+
+my $catch;
+{  local $SIG{__WARN__} = sub { $catch = shift };
+   $rep->log(ERROR => 'a test');   # \n will be added
+}
+is($catch, "ERROR: a test\n",           'Stored one error text');
+cmp_ok($rep->report('ERRORS'), '==', 1, 'Counts one error');
+is(($rep->report('ERRORS'))[0], "a test\n", 'Correctly stored text');
+
+undef $catch;
+{  local $SIG{__WARN__} = sub { $catch = shift };
+   $rep->log(WARNING => "filter\n");
+}
+ok(!defined $catch,                       'No visible warnings');
+cmp_ok($rep->report('WARNING'), '==', 1,  'Count logged warnings');
+cmp_ok($rep->report('ERROR'), '==', 1,    'Count logged errors');
+cmp_ok($rep->report, '==', 2,             'Count all logged messages');
+is(($rep->report('WARNINGS'))[0], "filter\n", 'Just one \n');
+
+my @reps = $rep->report;
+is($reps[0][0], 'WARNING',                'Checking report()');
+is($reps[0][1], "filter\n");
+is($reps[1][0], 'ERROR');
+is($reps[1][1], "a test\n");
+
+ at reps = $rep->reportAll;
+is($reps[0][0], $rep,                     'Checking reportAll()');
+is($reps[0][1], 'WARNING');
+is($reps[0][2], "filter\n");
+is($reps[1][0], $rep);
+is($reps[1][1], 'ERROR');
+is($reps[1][2], "a test\n");
+
+cmp_ok($rep->errors, '==', 1,             'Check errors() short-cut');
+cmp_ok($rep->warnings, '==', 1,           'Check warnings() short-cut');
+
+#
+# Check merging reports
+#
+
+my $r2 = Mail::Reporter->new(trace => 'NONE', log => 'DEBUG');
+ok(defined $r2,                           'Another traceable object');
+isa_ok($r2, 'Mail::Reporter');
+ok($r2->log(WARNING => 'I warn you!'));
+ok($r2->log(ERROR => 'You are in error'));
+ok($r2->log(ERROR => 'I am sure!!'));
+ok($r2->log(NOTICE => 'Don\'t notice me'));
+$rep->addReport($r2);
+
+ at reps = $rep->reportAll;
+cmp_ok(@{$reps[0]}, '==', 3);
+is($reps[0][0], $rep,                     'Checking reportAll()');
+is($reps[0][1], 'NOTICE');
+is($reps[0][2], "Don't notice me\n");
+cmp_ok(@{$reps[1]}, '==', 3);
+is($reps[1][0], $rep);
+is($reps[1][1], 'WARNING');
+is($reps[1][2], "filter\n");
+cmp_ok(@{$reps[2]}, '==', 3);
+is($reps[2][0], $rep);
+is($reps[2][1], 'WARNING');
+is($reps[2][2], "I warn you!\n");
+cmp_ok(@{$reps[3]}, '==', 3);
+is($reps[3][0], $rep);
+is($reps[3][1], 'ERROR');
+is($reps[3][2], "a test\n");
+cmp_ok(@{$reps[4]}, '==', 3);
+is($reps[4][0], $rep);
+is($reps[4][1], 'ERROR');
+is($reps[4][2], "You are in error\n");
+cmp_ok(@{$reps[5]}, '==', 3);
+is($reps[5][0], $rep);
+is($reps[5][1], 'ERROR');
+is($reps[5][2], "I am sure!!\n");
+

Added: packages/libmail-box-perl/branches/upstream/current/tests/10report/Definition.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/10report/Definition.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/10report/Definition.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,8 @@
+
+package MailBox::Test::10report::Definition;
+
+sub name     {"Mail::Report; general base class"}
+sub critical {1}
+sub skip     { undef }
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/tests/11field/10cfws.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/11field/10cfws.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/11field/10cfws.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,59 @@
+#!/usr/bin/perl -T
+#
+# Test stripping CFWS  [comments and folding white spaces] as
+# specified by rfc2822.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 54;
+
+use Mail::Message::Field::Fast;
+use Mail::Address;
+
+my @tests =
+( 'aap noot mies'                              => 'aap noot mies'
+, '  aap  noot mies '                          => 'aap noot mies'
+, "aap\n noot\n"                               => 'aap noot'
+, "aap (comment) noot"                         => 'aap noot'
+, "aap () noot"                                => 'aap noot'
+, "(a) aap (comment) noot (c)"                 => 'aap noot'
+, "aap (com (nested) ment) noot"               => 'aap noot'
+, "aap ((nested) comment) noot"                => 'aap noot'
+, "aap (comment (nested)) noot"                => 'aap noot'
+, "aap (comment(nested)) noot"                 => 'aap noot'
+, "aap ((nested)comment(nested)) noot"         => 'aap noot'
+, "((nested)comment(nested)) noot"             => 'noot'
+, "aap ((nes(ted))comment(nested)) noot"       => 'aap noot'
+, "(nes(ted)comment(nested)) noot (aap)"       => 'noot'
+, "aap ((nes\n\nted)co\nmment(nested)\n) noot" => 'aap noot'
+, '"aap" noot'                                 => '"aap" noot'
+, '"aap" (noot) mies'                          => '"aap" mies'
+, '"aap" (noot) mies '                         => '"aap" mies'
+, '"aap" noot (mies) '                         => '"aap" noot'
+, 'aap "noot" (mies) '                         => 'aap "noot"'
+, 'aap (noot) "mies"'                          => 'aap "mies"'
+, 'aap (noot) "mies" '                         => 'aap "mies"'
+, 'aap (noot) "mies" (noot(nest)) aap'         => 'aap "mies" aap'
+, 'aap \( noot'                                => 'aap \( noot'
+, 'aap "(" noot'                               => 'aap "(" noot'
+, 'aap "(noot)" mies'                          => 'aap "(noot)" mies'
+, 'aap \"(noot) mies'                          => 'aap \" mies'
+);
+
+my @take = @tests;
+while(@take)
+{   my ($from, $to) = (shift @take, shift @take);
+    is(Mail::Message::Field->stripCFWS($from), $to );
+}
+
+ at take = @tests;
+while(@take)
+{   my ($from, $to) = (shift @take, shift @take);
+    my $field = Mail::Message::Field::Fast->new('Something' => $from);
+    is($field->stripCFWS, $to);
+}

Added: packages/libmail-box-perl/branches/upstream/current/tests/11field/20fast.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/11field/20fast.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/11field/20fast.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,173 @@
+#!/usr/bin/perl -T
+#
+# Test processing of header-fields with Mail::Message::Field::Fast.
+# Only single fields, not whole headers. This also doesn't cover reading
+# headers from file.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 68;
+
+use Mail::Message::Field::Fast;
+use Mail::Address;
+
+#
+# Processing unstructured lines.
+#
+
+my $a = Mail::Message::Field::Fast->new('A: B  ; C');
+is($a->name, 'a');
+is($a->body, 'B  ; C');
+ok(not defined $a->comment);
+
+# No folding permitted.
+
+my $b1 = ' B  ; C234290iwfjoj w etuwou   toiwutoi';
+my $b2 = ' wtwoetuw oiurotu 3 ouwout 2 oueotu2';
+my $b3 = ' fqweortu3';
+my $bbody = "$b1$b2$b3";
+
+my $b = Mail::Message::Field::Fast->new("A: $bbody");
+my @lines = $b->toString(100);
+cmp_ok(@lines, '==', 1);
+is($lines[0], "A:$bbody\n");
+
+ at lines = $b->toString(42);
+cmp_ok(@lines, '==', 3);
+is($lines[0], "A:$b1\n");
+is($lines[1], "$b2\n");
+is($lines[2], "$b3\n");
+is(' '.$b->body, $bbody);
+
+#
+# Processing of structured lines.
+#
+
+my $f = Mail::Message::Field::Fast->new('Sender:  B ;  C');
+ok($f->isStructured);
+is($f->name, 'sender');
+is($f->body, 'B');
+is($f, 'B ;  C');
+is($f->comment, 'C');
+
+# No comment, strip CR LF
+
+my $g = Mail::Message::Field::Fast->new("Sender: B\015\012\n");
+is($g->body, 'B');
+is($g->comment, '');
+
+# Separate head and body.
+
+my $h = Mail::Message::Field::Fast->new("Sender", "B\015\012\n");
+is($h->body, 'B');
+is($h->comment, '');
+
+my $i = Mail::Message::Field::Fast->new('Sender', 'B ;  C');
+is($i->name, 'sender');
+is($i->body, 'B');
+like($i->comment, qr/^\s*C\s*/);
+
+my $j = Mail::Message::Field::Fast->new('Sender', 'B', 'C');
+is($j->name, 'sender');
+is($j->body, 'B');
+like($j->comment, qr/^\s*C\s*/);
+
+# Check toString (for unstructured field, so no folding)
+
+my $k = Mail::Message::Field::Fast->new(A => 'short line');
+is($k->toString, "A: short line\n");
+my @klines = $k->toString;
+cmp_ok(@klines, '==', 1);
+
+my $l = Mail::Message::Field::Fast->new(A =>
+ 'oijfjslkgjhius2rehtpo2uwpefnwlsjfh2oireuqfqlkhfjowtropqhflksjhflkjhoiewurpq');
+my @llines = $k->toString;
+cmp_ok(@llines, '==', 1); 
+
+my $m = Mail::Message::Field::Fast->new(A =>
+  'roijfjslkgjhiu, rehtpo2uwpe, fnwlsjfh2oire, uqfqlkhfjowtrop, qhflksjhflkj, hoiewurpq');
+
+my @mlines = $m->toString;
+cmp_ok(@mlines, '==', 2);
+is($mlines[1], " hoiewurpq\n");
+
+my $n  = Mail::Message::Field::Fast->new(A => 7);
+my $x = $n + 0;
+ok($n ? 1 : 0);
+ok($x==7);
+ok($n > 6);
+ok($n < 8);
+cmp_ok($n, '==', 7);
+ok(6 < $n);
+ok(8 > $n);
+
+#
+# Check gluing addresses
+#
+
+my @mb = Mail::Address->parse('me at localhost, you at somewhere.nl');
+cmp_ok(scalar @mb, '==', 2);
+my $r  = Mail::Message::Field::Fast->new(Cc => $mb[0]);
+is($r->toString, "Cc: me\@localhost\n");
+
+$r     = Mail::Message::Field::Fast->new(Cc => \@mb);
+is($r->toString, "Cc: me\@localhost, you\@somewhere.nl\n");
+
+my $r2 = Mail::Message::Field::Fast->new(Bcc => $r);
+is($r2->toString, "Bcc: me\@localhost, you\@somewhere.nl\n");
+
+#
+# Checking attributes
+#
+
+my $charset = 'iso-8859-1';
+my $comment = qq(charset="iso-8859-1"; format=flowed);
+
+my $p = Mail::Message::Field::Fast->new("Content-Type: text/plain; $comment");
+is($p->comment, $comment);
+is($p->body, 'text/plain');
+is($p->attribute('charset'), $charset);
+is($p->attribute('format'), 'flowed');
+ok(!defined $p->attribute('boundary'));
+is($p->attribute(charset => 'us-ascii'), 'us-ascii');
+is($p->attribute('charset'), 'us-ascii');
+is($p->comment, 'charset="us-ascii"; format=flowed');
+is($p->attribute(format => 'newform'), 'newform');
+is($p->comment, 'charset="us-ascii"; format="newform"');
+is($p->attribute(newfield => 'bull'), 'bull');
+is($p->attribute('newfield'), 'bull');
+is($p->comment, 'charset="us-ascii"; format="newform"; newfield="bull"');
+
+my $q = Mail::Message::Field::Fast->new('Content-Type: text/plain');
+is($q->toString, "Content-Type: text/plain\n");
+is($q->attribute(charset => 'iso-10646'), 'iso-10646');
+is($q->attribute('charset'), 'iso-10646');
+is($q->comment, 'charset="iso-10646"');
+is($q->toString, qq(Content-Type: text/plain; charset="iso-10646"\n));
+
+#
+# Check preferred capitization of Labels
+#
+
+my @tests =
+( 'Content-Transfer-Encoding' => 'Content-Transfer-Encoding'
+, 'content-transfer-encoding' => 'Content-Transfer-Encoding'
+, 'CONTENT-TRANSFER-ENCODING' => 'Content-Transfer-Encoding'
+, 'cONTENT-tRANSFER-eNCODING' => 'Content-Transfer-Encoding'
+, 'mime-version'              => 'MIME-Version'
+, 'MIME-VERSION'              => 'MIME-Version'
+, 'Mime-vERSION'              => 'MIME-Version'
+, 'src-label'                 => 'SRC-Label'
+, 'my-src-label'              => 'My-SRC-Label'
+);
+
+while(@tests)
+{   my ($from, $to) = (shift @tests, shift @tests);
+    is(Mail::Message::Field->wellformedName($from), $to);
+}
+

Added: packages/libmail-box-perl/branches/upstream/current/tests/11field/30flex.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/11field/30flex.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/11field/30flex.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,126 @@
+#!/usr/bin/perl -T
+#
+# Test processing of header-fields in flexible format: only single fields,
+#  not whole headers.  This also doesn't cover reading headers from file.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 44;
+
+use Mail::Message::Field::Flex;
+use Mail::Address;
+
+#
+# Processing unstructured lines.
+#
+
+my $a = Mail::Message::Field::Flex->new('A: B  ; C');
+is($a->name, 'a');
+is($a->body, 'B  ; C');
+ok(not defined $a->comment);
+
+# No folding permitted.
+
+my $bbody = 'B  ; C234290iwfjoj w etuwou   toiwutoi wtwoetuw oiurotu 3 ouwout 2 oueotu2 fqweortu3';
+my $b = Mail::Message::Field::Flex->new("A: $bbody");
+my @lines = $b->toString(100);
+
+cmp_ok(@lines, '==', 1);
+is($lines[0], "A: $bbody\n");
+is($b->body, $bbody);
+
+ at lines = $b->toString(40);
+cmp_ok(@lines, '==', 3);
+is($lines[2], " oueotu2 fqweortu3\n");
+
+#
+# Processing of structured lines.
+#
+
+my $f = Mail::Message::Field::Flex->new('Sender:  B ;  C');
+is($f->name, 'sender');
+is($f->body, 'B');
+is($f, 'B ;  C');
+like($f->comment, qr/^\s*C\s*/);
+
+# No comment, strip CR LF
+
+my $g = Mail::Message::Field::Flex->new("Sender: B\015\012");
+is($g->body, 'B');
+is($g->comment, '');
+
+# Separate head and body.
+
+my $h = Mail::Message::Field::Flex->new("Sender", "B\015\012");
+is($h->body, 'B');
+is($h->comment, '');
+
+my $i = Mail::Message::Field::Flex->new('Sender', 'B ;  C');
+is($i->name, 'sender');
+is($i->body, 'B');
+like($i->comment, qr/^\s*C\s*/);
+
+my $j = Mail::Message::Field::Flex->new('Sender', 'B', [comment => 'C']);
+is($j->name, 'sender');
+is($j->body, 'B');
+like($j->comment, qr/^\s*C\s*/);
+
+# Check toString (for unstructured field, so no folding)
+
+my $k = Mail::Message::Field::Flex->new(A => 'short line');
+is($k->toString, "A: short line\n");
+my @klines = $k->toString;
+cmp_ok(@klines, '==', 1);
+
+my $l = Mail::Message::Field::Flex->new(A =>
+ 'oijfjslkgjhius2rehtpo2uwpefnwlsjfh2oireuqfqlkhfjowtropqhflksjhflkjhoiewurpq');
+my @llines = $k->toString;
+ok(@llines==1); 
+
+my $n  = Mail::Message::Field::Flex->new(A => 7);
+my $x = $n + 0;
+ok($n ? 1 : 0);
+ok($x==7);
+ok($n > 6);
+ok($n < 8);
+ok($n==7);
+ok(6 < $n);
+ok(8 > $n);
+
+#
+# Check gluing addresses
+#
+
+my @mb = Mail::Address->parse('me at localhost, you at somewhere.nl');
+cmp_ok(@mb, '==', 2);
+my $r  = Mail::Message::Field::Flex->new(Cc => $mb[0]);
+is($r->toString, "Cc: me\@localhost\n");
+$r     = Mail::Message::Field::Flex->new(Cc => \@mb);
+is($r->toString, "Cc: me\@localhost, you\@somewhere.nl\n");
+
+my $r2 = Mail::Message::Field::Flex->new(Bcc => $r);
+is($r2->toString, "Bcc: me\@localhost, you\@somewhere.nl\n");
+
+#
+# Checking attributes
+#
+
+my $charset = 'iso-8859-1';
+my $comment = qq(charset="iso-8859-1"; format=flowed);
+
+my $p = Mail::Message::Field::Flex->new("Content-Type: text/plain; $comment");
+is($p->comment, $comment);
+is($p->body, 'text/plain');
+is($p->attribute('charset'), $charset);
+
+my $q = Mail::Message::Field::Flex->new('Content-Type: text/plain');
+is($q->toString, "Content-Type: text/plain\n");
+is($q->attribute(charset => 'iso-10646'), 'iso-10646');
+is($q->attribute('charset'), 'iso-10646');
+is($q->comment, 'charset="iso-10646"');
+is($q->toString, qq(Content-Type: text/plain; charset="iso-10646"\n));

Added: packages/libmail-box-perl/branches/upstream/current/tests/11field/Definition.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/11field/Definition.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/11field/Definition.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,8 @@
+
+package MailBox::Test::11field::Definition;
+
+sub name     {"Mail::Message::Field; fields in headers"}
+sub critical {1}
+sub skip     { undef }
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/tests/12head/10create.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/12head/10create.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/12head/10create.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,129 @@
+#!/usr/bin/perl -T
+#
+# Test the processing of a whole message header, not the reading of a
+# header from file.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 25;
+use IO::Scalar;
+
+use Mail::Message::Head::Complete;
+
+my $h = Mail::Message::Head::Complete->new;
+{  my @o = $h->names;
+   cmp_ok(scalar @o, '==', 0);
+}
+
+# Adding a first.
+
+{  my $a = $h->add(From => 'me at home');
+   ok(ref $a);
+   isa_ok($a, 'Mail::Message::Field');
+}
+
+{  my @o = $h->names;
+   cmp_ok(@o, '==', 1);
+}
+
+{  my @f = $h->get('From'); # list context
+   cmp_ok(@f, '==', 1);
+   ok(ref $f[0]);
+   isa_ok($f[0], 'Mail::Message::Field');
+   is($f[0]->body, 'me at home');
+}
+
+{  my $f = $h->get('From'); # scalar context
+   is($f->body, 'me at home');
+}
+
+# Adding a second.
+
+$h->add(From => 'you2me');
+{  my @o = $h->names;
+   cmp_ok(@o, '==', 1);
+}
+
+{  my @f = $h->get('From'); # list context
+   cmp_ok(@f, '==', 2);
+   is($f[0]->body, 'me at home');
+   is($f[1]->body, 'you2me');
+}
+
+{  my $f = $h->get('From'); # scalar context
+   is($f->body, 'you2me');
+}
+
+# Missing
+
+{  my @f = $h->get('unknown');
+   cmp_ok(@f, '==', 0);
+}
+
+{  my $f = $h->get('unknown');
+   ok(! defined $f);
+}
+
+# Set
+
+{
+   $h->set(From => 'perl');
+   my @f = $h->get('From');
+   cmp_ok(@f, '==', 1);
+}
+
+{  my @o = $h->names;
+   cmp_ok(@o, '==', 1);
+}
+
+$h->set(New => 'test');
+{  my @o = sort $h->names;
+   cmp_ok(@o, '==', 2);
+   is($o[0], 'from');
+   is($o[1], 'new');
+}
+
+# Reset
+
+$h->reset('From');
+{  my @f = $h->get('From');
+   cmp_ok(@f, '==', 0);
+}
+
+{
+   my $l = Mail::Message::Field->new(New => 'other');
+   $h->reset('NEW', $h->get('new'), $l);
+}
+
+{  my @f = $h->get('neW');
+   cmp_ok(@f, '==', 2);
+}
+
+# Print
+
+$h->add(Subject => 'hallo!');
+$h->add(To => 'the world');
+$h->add(From => 'me');
+
+my $output;
+my $fakefile = new IO::Scalar \$output;
+
+$h->print($fakefile, 0);
+my $expected = <<'EXPECTED_OUTPUT';
+New: test
+New: other
+Subject: hallo!
+To: the world
+From: me
+
+EXPECTED_OUTPUT
+
+is($output, $expected);
+is($h->toString, $expected);
+
+$fakefile->close;

Added: packages/libmail-box-perl/branches/upstream/current/tests/12head/30partial.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/12head/30partial.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/12head/30partial.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,43 @@
+#!/usr/bin/perl -T
+#
+# Test the removing fields in partial headers.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 15;
+use IO::Scalar;
+
+use Mail::Message::Head::Complete;
+
+my $h = Mail::Message::Head::Complete->build
+ ( Subject => 'this is a test'
+ , To      => 'you'
+ , Top     => 'above'
+ , From    => 'me'
+ , 'Content-Length' => 12
+ , 'Content-Type'   => 'text/plain'
+ );  # lines = 6 fields + blank
+
+ok(defined $h);
+isa_ok($h, 'Mail::Message::Head::Complete');
+isnt(ref($h), 'Mail::Message::Head::Partial');
+cmp_ok($h->nrLines, '==', 7);
+
+ok(defined $h->removeFields('to'));
+isa_ok($h, 'Mail::Message::Head::Complete');
+isa_ok($h, 'Mail::Message::Head::Partial');
+cmp_ok($h->nrLines, '==', 6);
+ok(defined $h->get('top'));
+ok(! defined $h->get('to'));
+
+
+ok(defined $h->get('Content-Length'));
+ok(defined $h->removeFields( qr/^Content-/i ));
+isa_ok($h, 'Mail::Message::Head::Partial');
+cmp_ok($h->nrLines, '==', 4);
+ok(!defined $h->get('Content-Length'));

Added: packages/libmail-box-perl/branches/upstream/current/tests/12head/Definition.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/12head/Definition.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/12head/Definition.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,8 @@
+
+package MailBox::Test::12head::Definition;
+
+sub name     {"Mail::Message::Head; message headers"}
+sub critical {1}
+sub skip     { undef }
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/tests/13body/10string.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/13body/10string.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/13body/10string.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,70 @@
+#!/usr/bin/perl -T
+#
+# Test processing of message bodies which have their content stored
+# in a single string.  This does not test the reading of the bodies
+# from file.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use IO::Scalar;
+use Test::More tests => 30;
+
+use Mail::Message::Body::String;
+
+# Test to read a scalar from file.
+# Let's fake the file, for simplicity.
+
+my $filedata = <<'SIMULATED_FILE';
+This is a file
+with five lines, and it
+is used to test whether
+the reading into a scalar body
+would work (or not)
+SIMULATED_FILE
+
+my @filedata = split /^/, $filedata;
+cmp_ok(@filedata, '==', 5);
+
+my $f = IO::Scalar->new(\$filedata);
+my $body = Mail::Message::Body::String->new(file => $f);
+ok(defined $body);
+is($body->string, $filedata);
+cmp_ok($body->nrLines, '==', 5);
+cmp_ok($body->size, '==', length $filedata);
+
+my $fakeout;
+my $g = IO::Scalar->new(\$fakeout);
+$body->print($g);
+is($fakeout, $filedata);
+
+my @lines = $body->lines;
+cmp_ok(@lines, '==', 5);
+foreach (0..4) { is($lines[$_], $filedata[$_]) }
+
+# Reading data from lines.
+
+$body = Mail::Message::Body::String->new(data => [@filedata]);
+ok($body);
+is($body->string, $filedata);
+cmp_ok($body->nrLines, '==', 5);
+cmp_ok($body->size, '==', length $filedata);
+
+$fakeout = '';
+$body->print($g);
+is($fakeout, $filedata);
+
+ at lines = $body->lines;
+cmp_ok(@lines, '==', 5);
+foreach (0..4) { is($lines[$_], $filedata[$_]) }
+
+# Test overloading
+
+is("$body", $filedata);
+ at lines = @$body;
+cmp_ok(@lines, '==', 5);
+foreach (0..4) { is($lines[$_], $filedata[$_]) }

Added: packages/libmail-box-perl/branches/upstream/current/tests/13body/20lines.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/13body/20lines.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/13body/20lines.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,74 @@
+#!/usr/bin/perl -T
+#
+# Test processing of message bodies which have their content stored
+# in an array.  This does not test the reading of the bodies
+# from file.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 30;
+use IO::Scalar;
+
+use Mail::Message::Body::Lines;
+
+# Test to read a Lines from file.
+# Let's fake the file, for simplicity.
+
+my $filedata = <<'SIMULATED_FILE';
+This is a file
+with five lines, and it
+is used to test whether
+the reading into a lines body
+would work (or not)
+SIMULATED_FILE
+
+my $f = IO::Scalar->new(\$filedata);
+
+my $body = Mail::Message::Body::Lines->new(file => $f);
+ok($body,                                        "body from file is true");
+
+is($body->string, $filedata,                     "body strings to data");
+cmp_ok($body->nrLines, "==", 5,                  "body reports 5 lines");
+cmp_ok($body->size, "==", length $filedata,      "body size as data");
+
+my $fakeout;
+my $g = IO::Scalar->new(\$fakeout);
+$body->print($g);
+is($fakeout, $filedata,                          "body prints right data");
+
+my @lines = $body->lines;
+cmp_ok(@lines, "==", 5,                          "body produces five lines");
+
+my @filedata = split /^/, $filedata;
+cmp_ok(@filedata, "==", 5,                       "data 5 lines");
+
+foreach (0..4) { is($lines[$_], $filedata[$_],   "expected line $_") }
+
+# Reading data from lines.
+
+$body = Mail::Message::Body::Lines->new(data => [@filedata]);
+ok($body,                                        "body from array is true");
+
+is($body->string, $filedata,                     "body string is data");
+cmp_ok($body->nrLines, "==", 5,                  "body reports 5 lines");
+cmp_ok($body->size, "==", length $filedata,      "body reports correct size");
+
+$fakeout = '';
+$body->print($g);
+is($fakeout, $filedata,                          "body prints to data");
+
+ at lines = $body->lines;
+cmp_ok(@lines, "==", 5,                          "body produces 5 lines");
+foreach (0..4) { is($lines[$_], $filedata[$_],   "body line $_") }
+
+# Test overloading
+
+is("$body", $filedata,                           "stringification");
+ at lines = @$body;
+cmp_ok(@lines, "==", 5,                          "overload array-deref");
+foreach (0..4) { is($lines[$_], $filedata[$_],   "overload array $_") }

Added: packages/libmail-box-perl/branches/upstream/current/tests/13body/30file.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/13body/30file.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/13body/30file.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,79 @@
+#!/usr/bin/perl -T
+#
+# Test processing of message bodies which have their content stored
+# in a file.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 33;
+use IO::Scalar;
+
+use Mail::Message::Body::File;
+
+# Test to read a Lines from file.
+# Let's fake the file, for simplicity.
+
+my $filedata = <<'SIMULATED_FILE';
+This is a file
+with five lines, and it
+is used to test whether
+the reading into a lines body
+would work (or not)
+SIMULATED_FILE
+
+my $f = IO::Scalar->new(\$filedata);
+
+my $body = Mail::Message::Body::File->new(file => $f);
+ok($body,                                           'body creation from file');
+is($body->string, $filedata,                        'stringify');
+cmp_ok($body->nrLines, "==", 5,                     'nr lines');
+
+cmp_ok($body->size, "==", length $filedata,         'size');
+
+my $fakeout;
+my $g = IO::Scalar->new(\$fakeout);
+$body->print($g);
+is($fakeout, $filedata,                             'print');
+
+my @lines = $body->lines;
+cmp_ok(@lines, "==", 5,                             'count of lines');
+my @filedata = split /^/, $filedata;
+cmp_ok(@filedata, "==", 5,                          'count expected lines');
+foreach (0..4) { is($lines[$_], $filedata[$_],      "line $_") }
+
+# Reading data from lines.
+
+$body = Mail::Message::Body::File->new(data => [@filedata]);
+ok($body,                                           'creation from array of lines');
+is($body->string, $filedata,                        'data');
+cmp_ok($body->nrLines, "==", 5,                     'nr lines');
+cmp_ok($body->size, "==", length $filedata,         'size');
+
+$fakeout = '';
+$body->print($g);
+is($fakeout, $filedata,                             'result print');
+
+ at lines = $body->lines;
+cmp_ok(@lines, "==", 5,                             'count of lines');
+foreach (0..4) { is($lines[$_], $filedata[$_],      "line $_") }
+
+# Test overloading
+
+is("$body", $filedata,                              'overloaded stringification');
+ at lines = @$body;
+ok(@lines,                                          'overloaded ref array');
+cmp_ok(@lines, "==", 5,                             'count of lines');
+foreach (0..4) { is($lines[$_], $filedata[$_],      "line $_") }
+
+# Test cleanup
+
+my $filename = $body->tempFilename;
+ok(-f $filename,                                    'filename exists');
+undef $body;
+ok(! -f $filename,                                  'file cleaned up');
+

Added: packages/libmail-box-perl/branches/upstream/current/tests/13body/40multip.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/13body/40multip.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/13body/40multip.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,255 @@
+#!/usr/bin/perl -T
+#
+# Test processing of multipart message bodies.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 29;
+use IO::Scalar;
+
+use Mail::Message::Body::Lines;
+use Mail::Message::Body::Multipart;
+use Mail::Message::Head::Complete;
+
+my $body = Mail::Message::Body::Multipart->new
+ ( transfer_encoding => '8bit'
+ , boundary          => 'xyz'
+ );
+
+is($body->boundary, 'xyz');
+$body->boundary('part-separator');
+is($body->boundary, 'part-separator');
+is($body->mimeType, 'multipart/mixed');
+
+my $h1 = Mail::Message::Head::Complete->new;
+
+my $b1 = Mail::Message::Body::Lines->new
+ ( data              => ["p1 l1\n", "p1 l2\n" ]
+ , checked           => 1
+ , mime_type         => 'text/html'
+ , transfer_encoding => '8bit'
+ );
+
+ok($b1);
+is($b1->mimeType, 'text/html');
+is($b1->transferEncoding, '8bit');
+is($b1->disposition, 'none');
+
+my $p1 = Mail::Message->new(head => $h1);
+cmp_ok($p1->body($b1) , "==",  $b1);
+is($p1->get('Content-Type'), 'text/html');
+is($p1->get('Content-Transfer-Encoding'), '8bit');
+ok(!defined $p1->get('Content-Disposition'));
+
+my $h2 = Mail::Message::Head::Complete->new;
+
+my $b2 = Mail::Message::Body::Lines->new
+ ( data              => ["p2 l1\n", "p2 l2\n", "p2 l3\n", "p2 l4\n" ]
+ , mime_type         => 'text/plain'
+ , checked           => 1
+ , transfer_encoding => '8bit'
+ );
+
+ok($b2);
+
+my $p2 = Mail::Message->new(head => $h2);
+cmp_ok($p2->body($b2) , "==",  $b2);
+
+# Empty multipart
+
+my $fakeout;
+my $g = IO::Scalar->new(\$fakeout);
+cmp_ok($body->parts, "==", 0);
+$body->print($g);
+is($fakeout, "--part-separator--\n");
+
+# First attachment
+
+$fakeout = '';
+
+my $newbody = $body->attach($p1);
+ok($newbody != $body);
+cmp_ok($newbody->parts, "==", 1);
+$newbody->print($g);
+
+compare_message_prints($fakeout, <<'EXPECTED', 'print with attachment');
+--part-separator
+Content-Type: text/html
+Content-Length: 12
+Lines: 2
+Content-Transfer-Encoding: 8bit
+
+p1 l1
+p1 l2
+--part-separator--
+EXPECTED
+
+# Second attachment
+
+my $newerbody = $newbody->attach($p2);
+ok($newerbody != $newbody);
+cmp_ok($newerbody->parts, "==", 2);
+
+$fakeout = '';
+$newerbody->print($g);
+compare_message_prints($fakeout, <<'EXPECTED', 'print with two attachments');
+--part-separator
+Content-Type: text/html
+Content-Length: 12
+Lines: 2
+Content-Transfer-Encoding: 8bit
+
+p1 l1
+p1 l2
+--part-separator
+Content-Type: text/plain
+Content-Length: 24
+Lines: 4
+Content-Transfer-Encoding: 8bit
+
+p2 l1
+p2 l2
+p2 l3
+p2 l4
+--part-separator--
+EXPECTED
+
+# Add preamble and epilogue
+
+my $newestbody
+   = ref($newerbody)->new
+      ( based_on => $newerbody
+      , preamble => Mail::Message::Body::Lines->new
+         ( data => [ "preamb1\n", "preamb2\n" ]
+         , mime_type        => 'text/html'
+         , charset          => 'us-ascii'
+         , tranfer_encoding => '8bit'
+         )
+      , epilogue => Mail::Message::Body::Lines
+                ->new(data => [ "epilogue\n" ])
+      );
+ok($newestbody != $newbody);
+
+$fakeout = '';
+$newestbody->print($g);
+compare_message_prints($fakeout, <<'EXPECTED', 'with preamble and epilogue');
+preamb1
+preamb2
+--part-separator
+Content-Type: text/html
+Content-Length: 12
+Lines: 2
+Content-Transfer-Encoding: 8bit
+
+p1 l1
+p1 l2
+--part-separator
+Content-Type: text/plain
+Content-Length: 24
+Lines: 4
+Content-Transfer-Encoding: 8bit
+
+p2 l1
+p2 l2
+p2 l3
+p2 l4
+--part-separator--
+epilogue
+EXPECTED
+
+
+# Body to message.  The info on preamble is used to create a whole message
+# header.
+
+my $message = Mail::Message->buildFromBody($newestbody,
+    From => 'me', To => 'you', Date => 'now', 'Message-Id' => '<simple>');
+
+$fakeout = '';
+$message->print($g);
+compare_message_prints($fakeout, <<'EXPECTED', 'build from multipart body');
+From: me
+To: you
+Date: now
+Message-Id: <simple>
+Content-Type: multipart/mixed; boundary="part-separator"
+Content-Length: 287
+Lines: 24
+Content-Transfer-Encoding: 8bit
+MIME-Version: 1.0
+
+preamb1
+preamb2
+--part-separator
+Content-Type: text/html
+Content-Length: 12
+Lines: 2
+Content-Transfer-Encoding: 8bit
+
+p1 l1
+p1 l2
+--part-separator
+Content-Type: text/plain
+Content-Length: 24
+Lines: 4
+Content-Transfer-Encoding: 8bit
+
+p2 l1
+p2 l2
+p2 l3
+p2 l4
+--part-separator--
+epilogue
+EXPECTED
+
+my $m1 = Mail::Message->buildFromBody($body, From => 'me', To => 'you',
+   Date => 'now', 'Message-Id' => '<simple>');
+
+$fakeout = '';
+$m1->print($g);
+compare_message_prints($fakeout, <<'EXPECTED', 'build from multipart body');
+From: me
+To: you
+Date: now
+Message-Id: <simple>
+Content-Type: multipart/mixed; boundary="part-separator"
+Content-Length: 19
+Lines: 1
+Content-Transfer-Encoding: 8bit
+MIME-Version: 1.0
+
+--part-separator--
+EXPECTED
+
+my $m2 = Mail::Message->buildFromBody($b1, From => 'me', To => 'you',
+   Date => 'now', 'Message-Id' => '<simple>');
+
+$fakeout = '';
+$m2->print($g);
+compare_message_prints($fakeout, <<'EXPECTED', 'build from multipart body');
+From: me
+To: you
+Date: now
+Message-Id: <simple>
+Content-Type: text/html
+Content-Length: 12
+Lines: 2
+Content-Transfer-Encoding: 8bit
+MIME-Version: 1.0
+
+p1 l1
+p1 l2
+EXPECTED
+
+#
+# Check copying.
+#
+
+my $m3 = $message->clone;
+ok($m3);
+ok($m3 != $message);
+cmp_ok($m3->parts , "==",  $message->parts);

Added: packages/libmail-box-perl/branches/upstream/current/tests/13body/Definition.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/13body/Definition.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/13body/Definition.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,8 @@
+
+package MailBox::Test::13body::Definition;
+
+sub name     {"Mail::Message::Body; message bodies"}
+sub critical {1}
+sub skip     { undef }
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/10full.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/10full.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/10full.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,225 @@
+#!/usr/bin/perl -T
+#
+# Test processing of full fields, the most complex (and slowest) kind of fields.
+#
+
+use strict;
+use warnings;
+
+package Mail::Message::Field::Structured;   # define package name
+package main;
+
+use lib qw(. .. tests);
+use Tools;
+
+use utf8;
+use Test::More;
+
+BEGIN {
+   if($] < 5.007003)
+   {   plan skip_all => "Requires module Encode which requires Perl 5.7.3";
+       exit 0;
+   }
+
+   eval 'require Mail::Message::Field::Structured';
+   if($@)
+   {   plan skip_all => 'Extended attributes not available (install Encode?)';
+       exit 0;
+   }
+   else
+   {   plan tests => 69;
+       Encode->import('encode', 'decode');
+   }
+}
+
+
+my $mmfs = 'Mail::Message::Field::Structured';
+
+#
+# Test construction
+#
+
+my $a = $mmfs->new('a', '');
+isa_ok($a, $mmfs);
+
+#
+# Test adding comments
+#
+
+my @p =
+ ( 'abc'      => 'abc'
+ , '(abc)'    => '(abc)'
+ , 'a(bc)'    => 'a(bc)'
+ , '(ab)c'    => '(ab)c'
+ , '(a)b(c)'  => '(a)b(c)'
+ , '(a)(b)c'  => '(a)(b)c'
+ , '(a)b(c)'  => '(a)b(c)'
+ , '(a)(b)(c)'=> '(a)(b)(c)'
+ , '()abc'    => '()abc'
+ , 'ab()c'    => 'ab()c'
+ , 'abc()'    => 'abc()'
+ , '()a()b()c()' => '()a()b()c()'
+ , ')abc'     => '\)abc'
+ , '(abc'     => '\(abc'
+ , 'abc('     => 'abc\('
+ , 'abc)'     => 'abc\)'
+ , 'a)b(c'    => 'a\)b\(c'
+ , 'a)(bc'    => 'a\)\(bc'
+ , 'a))(bc'   => 'a\)\)\(bc'
+ , ')a)(bc'   => '\)a\)\(bc'
+ , '(a(b)c'   => '\(a(b)c'
+ , 'a\bc'     => 'a\bc'
+ , 'a\(bc'    => 'a\(bc'
+ , 'abc\('    => 'abc\('
+ , 'abc\\'    => 'abc'
+ , 'abc\\\\'  => 'abc'
+ , '\\'       => ''
+ );
+
+while(@p)
+{  my ($f, $t) = (shift @p, shift @p);
+   is($mmfs->createComment($f), "($t)",       "from $f");
+}
+
+#
+# Test adding phrases
+#
+
+ at p =
+ ( 'a'         => 'a'
+ , 'a b c'     => '"a b c"'
+ , 'a \b c'    => '"a \\\\b c"'     # even within ', you have to use \\
+ , 'a "b c'    => '"a \"b c"'
+ , 'a \\"b c'   => '"a \\\\\"b c"'
+ );
+
+while(@p)
+{  my ($f, $t) = (shift @p, shift @p);
+   is($mmfs->createPhrase($f), $t,  "from $f");
+}
+
+#
+# Test word encoding Quoted-Printable
+#
+
+my $b = $mmfs->new('b', '');
+isa_ok($b, $mmfs);
+
+is($b->encode('abc'), 'abc');
+is($b->encode('abc', force => 1), '=?us-ascii?q?abc?=');
+is($b->encode('abc', encoding => 'Q', force => 1), '=?us-ascii?Q?abc?=');
+
+my $utf8 = decode('ISO-8859-1', "\x{E4}bc");
+
+is($b->encode($utf8), '=?us-ascii?q?=3Fbc?=');   # conversion &auml; fails to \?
+is($b->encode($utf8, encoding => 'Q'), '=?us-ascii?Q?=3Fbc?=');
+
+is($b->encode($utf8, charset => 'iso-8859-1'), '=?iso-8859-1?q?=E4bc?=');
+is($b->encode($utf8, charset => 'ISO-8859-1'), '=?ISO-8859-1?q?=E4bc?=');
+is($b->encode($utf8, charset => 'ISO-8859-1', language => 'nl-BE'),
+      '=?ISO-8859-1*nl-BE?q?=E4bc?=');
+
+my $long;
+{  no utf8;
+   $long = 'This is a long @text, with !! a few w3iRD ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ­ ® ¯ ° ± ² ³ ´ characters in it...';
+}
+$utf8 = decode('iso-8859-1', $long);
+
+is($b->encode($utf8, charset => 'ISO-8859-9', language => 'nl-BE'),
+  '=?ISO-8859-9*nl-BE?q?This_is_a_long_ at text,_with_!!_a_few_w3iRD_=A1_=A2_=A3_?= '
+. '=?ISO-8859-9*nl-BE?q?=A4_=A5_=A6_=A7_=A8_=A9_=AA_=AB_=AC_=AD_=AE_=AF_=B0_=B1?= '
+. '=?ISO-8859-9*nl-BE?q?_=B2_=B3_=B4_characters_in_it...?='
+  );
+is($b->encode($utf8, charset => 'ISO-8859-9'),
+  '=?ISO-8859-9?q?This_is_a_long_ at text,_with_!!_a_few_w3iRD_=A1_=A2_=A3_=A4_=A5?= '
+. '=?ISO-8859-9?q?_=A6_=A7_=A8_=A9_=AA_=AB_=AC_=AD_=AE_=AF_=B0_=B1_=B2_=B3_=B4_?= '
+. '=?ISO-8859-9?q?characters_in_it...?='
+  );
+
+#
+# Test word encoding Base64
+#
+
+my $c = $mmfs->new('c', '');
+is($c->encode('abc', encoding => 'b'), '=?us-ascii?b?YWJj?=');
+is($c->encode('abc', encoding => 'B'), '=?us-ascii?B?YWJj?=');
+is($c->encode('abc', encoding => 'b', charset => 'iso-8859-1'), '=?iso-8859-1?b?YWJj?=');
+is($c->encode('abc', encoding => 'b', charset => 'ISO-8859-1'),
+       '=?ISO-8859-1?b?YWJj?=');
+is($c->encode('abc', encoding => 'b', charset => 'ISO-8859-1', language => 'nl-BE'),
+      '=?ISO-8859-1*nl-BE?b?YWJj?=');
+is($c->encode($long, encoding => 'b', charset => 'ISO-8859-9', language => 'nl-BE'),
+  '=?ISO-8859-9*nl-BE?b?VGhpcyBpcyBhIGxvbmcgQHRleHQsIHdpdGggISEgYSBmZXcgdzNp?= '
+. '=?ISO-8859-9*nl-BE?b?UkQgoSCiIKMgpCClIKYgpyCoIKkgqiCrIKwgrSCuIK8gsCCxILIg?= '
+. '=?ISO-8859-9*nl-BE?b?syC0IGNoYXJhY3RlcnMgaW4gaXQuLi4=?='
+);
+
+is($c->encode($long, encoding => 'b', charset => 'ISO-8859-9'),
+  '=?ISO-8859-9?b?VGhpcyBpcyBhIGxvbmcgQHRleHQsIHdpdGggISEgYSBmZXcgdzNpUkQg?= '
+. '=?ISO-8859-9?b?oSCiIKMgpCClIKYgpyCoIKkgqiCrIKwgrSCuIK8gsCCxILIgsyC0IGNo?= '
+. '=?ISO-8859-9?b?YXJhY3RlcnMgaW4gaXQuLi4=?='
+);
+
+#
+# Test word decoding Quoted-Printable
+#
+
+my $d = $mmfs->new('d', '');
+
+no utf8;   # Next list is typed in iso-8859-1  (latin-1)
+my @ex_qp =
+ ( # examples from rfc2047
+   '=?iso-8859-1?q?this=20is=20some=20text?=' => 'this is some text'
+ , '=?US-ASCII?Q?Keith_Moore?='               => 'Keith Moore'
+ , '=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?='    => 'Keld Jørn Simonsen'
+ , '=?ISO-8859-1?Q?Andr=E9?= Pirard'          => 'André Pirard'
+ , '=?ISO-8859-1?Q?Olle_J=E4rnefors?='        => 'Olle Järnefors'
+ , '=?ISO-8859-1?Q?Patrik_F=E4ltstr=F6m?='    => 'Patrik Fältström'
+ , '(=?ISO-8859-1?Q?a?=)'                     => '(a)'
+ , '(=?ISO-8859-1?Q?a?= b)'                   => '(a b)'
+ , '(=?ISO-8859-1?Q?a?= =?ISO-8859-1?Q?b?=)'  => '(ab)'
+ , '(=?ISO-8859-1?Q?a?=   =?ISO-8859-1?Q?b?=)'=> '(ab)'
+ , '(=?ISO-8859-1?Q?a?=
+       =?ISO-8859-1?Q?b?=)'                   => '(ab)'
+ , '(=?ISO-8859-1?Q?a_b?=)'                   => '(a b)'
+ , '(=?ISO-8859-1?Q?a?= =?ISO-8859-1?Q?_b?=)' => '(a b)'
+ , '(=?ISO-8859-1?Q?a_?= =?ISO-8859-1?Q?b?=)' => '(a b)'
+
+   # extra tests
+ , '=???abc?='                                => 'abc'  # illegal but accepted
+ , '=?ISO-8859-1*nl-BE?Q?a?='                 => 'a'
+ , '(a =?ISO-8859-1?Q?b?=)'                   => '(a b)'
+ );
+
+use utf8;
+
+while(@ex_qp)
+{   my ($from, $to) = (shift @ex_qp, shift @ex_qp);
+    my $utf8_to = decode('iso-8859-1', $to);
+    is($d->decode($from), $utf8_to);
+}
+
+#
+# Test word decoding Quoted-Printable
+#
+
+no utf8;   # Next list is typed in iso-8859-1  (latin-1)
+my @ex_b64 =
+ ( # examples from rfc2047
+
+   ' =?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?=
+     =?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?='
+         => ' If you can read this you understand the example.'
+
+
+# Hebrew example cannot be used: I do not know what it should look like.
+# =?iso-8859-8?b?7eXs+SDv4SDp7Oj08A==?=
+ );
+use utf8;
+
+while(@ex_b64)
+{   my ($from, $to) = (shift @ex_b64, shift @ex_b64);
+    my $utf8_to = decode('iso-8859-1', $to);
+    is($d->decode($from), $utf8_to);
+}
+

Added: packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/20attr.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/20attr.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/20attr.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,215 @@
+#!/usr/bin/perl -T
+#
+# Test processing of field attributes in their most expensive implementation!
+#
+
+use strict;
+use warnings;
+
+package Mail::Message::Field::Attribute;   # define package name
+package main;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More;
+
+BEGIN {
+   if($] < 5.007003)
+   {   plan skip_all => "Requires module Encode which requires Perl 5.7.3";
+       exit 0;
+   }
+
+   eval 'require Mail::Message::Field::Attribute';
+   if($@)
+   {   plan skip_all => 'Extended attributes not available (install Encode?)';
+       exit 0;
+   }
+   else
+   {   plan tests => 91;
+   }
+}
+
+my $mmfa = 'Mail::Message::Field::Attribute';
+
+#
+# Test construction
+#
+
+my $a = $mmfa->new('a');
+isa_ok($a, $mmfa);
+is($a->name, 'a');
+ok(defined $a,                           "object a creation");
+ok(!defined $a->charset,                 "charset undef");
+ok(!defined $a->language,                "language undef");
+
+my $b = $mmfa->new('b', charset => 'iso-8859-15', language => 'nl-BE');
+is($b->name, 'b');
+ok(defined $a,                           "object b creation");
+is($b->charset, 'iso-8859-15',           "charset pre-set");
+is($b->language, 'nl-BE',                "language pre-set");
+
+#
+# Test situations without encoding or continuations
+#
+
+is($a->value, '');
+
+ok($a->addComponent('a=test-any-field'), "simple component");
+is($a->value, "test-any-field",          "simple component set");
+is($a->string, "; a=test-any-field",     "simple component string");
+my $s = ($a->string)[0];
+is($s, "a=test-any-field",               "simple component string");
+
+ok($a->addComponent('a="test-any\"-field"'), "dq component");
+is($a->value, 'test-any"-field',         "dq component set");
+is($a->string, "; a=\"test-any\\\"-field\"", "dq component string");
+$s = ($a->string)[0];
+is($s, 'a="test-any\"-field"',           "dq component string");
+
+ok($a->addComponent("a='test-any\\'-field'"), "sq component");
+is($a->value, "test-any'-field",         "sq component set");
+is($a->string, "; a='test-any\\'-field'","sq component string");
+$s = ($a->string)[0];
+is($s, "a='test-any\\'-field'",           "sq component string");
+
+#
+# Tests for decoding without continuations
+#
+
+my $c = $mmfa->new('c', use_continuations => 0);
+isa_ok($c, $mmfa,                         "Construction of c");
+
+ok($c->addComponent("c*=''abc"),          "c without spec");
+ok(! defined $c->charset);
+ok(! defined $c->language);
+is($c->value, 'abc');
+
+ok($c->addComponent("c*=us-ascii''abc"),  "c with charset");
+is($c->charset, 'us-ascii');
+ok(! defined $c->language);
+is($c->value, 'abc');
+
+ok($c->addComponent("c*='en'abc"),        "c with language");
+ok(! defined $c->charset);
+is($c->language, 'en');
+is($c->value, 'abc');
+
+ok($c->addComponent("c*=us-ascii'en'abc"),"c with both");
+is($c->charset, 'us-ascii');
+is($c->language, 'en');
+is($c->value, 'abc');
+
+#
+# Tests for encoding without continuations
+#
+
+my $d = $mmfa->new('d', charset => 'iso-8859-1', use_continuations => 0);
+ok($d,                                     "Created d");
+is($d->value, '');
+is($d->value('abc'), 'abc');
+is($d->value, 'abc');
+
+my @s = $d->string;
+cmp_ok(scalar @s, '==', 1);
+is($s[0], "d*=iso-8859-1''abc"); 
+is($d->string, "; d*=iso-8859-1''abc");
+
+my @mq =
+ ( 'JHKU(@*#&$ASK(@CKH*#@DHKAFsfdsk\"{PO{}[2348*(&(234897(&(ws:\"<?>:LK:K@@'
+ , '4279234897 '
+ );
+
+my $m = join '', @mq;
+$m =~ s/\\"/"/g;
+
+my @me =
+ ( 'JHKU%28%40%2A%23%26%24ASK%28%40CKH%2A%23%40DHKAFsfdsk%22%7B'
+ , 'PO%7B%7D%5B2348%2A%28%26%28234897%28%26%28ws%3A%22%3C%3F%3E%3ALK%3AK%40'
+ , '%404279234897%20'
+ );
+my $me = join '', @me;
+
+is($d->value($m), $m);
+is($d->value, $m);
+ at s = $d->string;
+cmp_ok(scalar @s, '==', 1);
+is($s[0], "d*=iso-8859-1''$me"); 
+is($d->string, "; d*=iso-8859-1''$me");
+
+$d->addComponent("d*=iso-8859-2''$me"); 
+is($d->charset, 'iso-8859-2');
+ok(! defined $d->language);
+is($d->value, $m);
+
+#
+# Tests for encoding with continuations
+#
+
+my $e = $mmfa->new('e', charset => 'iso-8859-1', use_continuations => 1);
+ok($e,                                     "Created e");
+is($e->value, '');
+is($e->value('abc'), 'abc');
+is($e->value, 'abc');
+
+ at s = $e->string;
+cmp_ok(scalar @s, '==', 1);
+is($s[0], "e*=iso-8859-1''abc"); 
+
+is($e->value($m), $m);
+is($e->value, $m);
+ at s = $e->string;
+cmp_ok(scalar @s, '==', scalar @me);
+is($s[0], "e*0*=iso-8859-1''$me[0]"); 
+is($s[1], "e*1*=$me[1]"); 
+is($s[2], "e*2*=$me[2]"); 
+is($e->string, "; e*0*=iso-8859-1''$me[0]; e*1*=$me[1]; e*2*=$me[2]");
+
+is($e->value('abc'), 'abc',                 "Reset contination");
+is($e->value, 'abc');
+
+ at s = $e->string;
+cmp_ok(scalar @s, '==', 1);
+is($s[0], "e*=iso-8859-1''abc"); 
+
+#
+# Tests *NO* encoding with continuations
+#
+
+my $f = $mmfa->new('f', use_continuations => 1);
+ok($f,                                     "Created f");
+is($f->value, '');
+is($f->value('abc'), 'abc');
+is($f->value, 'abc');
+
+is($f->value($m), $m);
+is($f->value, $m);
+ at s = $f->string;
+cmp_ok(scalar @s, '==', 2);
+is($s[0], "f*0=\"$mq[0]\""); 
+is($s[1], "f*1=\"$mq[1]\""); 
+is($f->string, "; f*0=\"$mq[0]\"; f*1=\"$mq[1]\"");
+
+is($f->value('abc'), 'abc',                 "Reset contination");
+is($f->value, 'abc');
+
+ at s = $f->string;
+cmp_ok(scalar @s, '==', 1);
+is($s[0], 'f="abc"'); 
+
+#
+# Tests merging
+#
+
+my $g = $mmfa->new('g', use_continuations => 1);
+ok($g,                                     "Created g");
+my $h = $mmfa->new('h', use_continuations => 1);
+ok($h,                                     "Created h");
+
+$g->addComponent('g*1*=b');
+is($g->value, '[continuation missing]b',   "Merge no continuation");
+$h->addComponent('g*0*=a');
+is($h->value, 'a');
+
+ok($g->mergeComponent($h),                 "Merge with continuation");
+is($g->value, 'ab');

Added: packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/30unstr.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/30unstr.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/30unstr.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,103 @@
+#!/usr/bin/perl -T
+#
+# Test processing of unstructured fields
+#
+
+use strict;
+use warnings;
+
+package Mail::Message::Field::Unstructured;   # define package name
+package main;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More;
+
+BEGIN {
+   if($] < 5.007003)
+   {   plan skip_all => "Requires module Encode which requires Perl 5.7.3";
+       exit 0;
+   }
+
+   eval 'require Mail::Message::Field::Unstructured';
+   if($@)
+   {   plan skip_all => 'Extended attributes not available (install Encode?)';
+       exit 0;
+   }
+   else
+   {   plan tests => 28;
+   }
+}
+
+my $mmff = 'Mail::Message::Field::Full';
+my $mmfu = 'Mail::Message::Field::Unstructured';
+
+#
+# Test construction with simple body
+#
+
+my $a = $mmfu->new('a', 'new');
+ok(defined $a,                          "Created simplest version");
+isa_ok($a, $mmfu);
+isa_ok($a, $mmff);
+is($a->name, 'a',                       "Name of a");
+
+is($a->unfoldedBody, 'new',             "Unfolded body a");
+my @al = $a->foldedBody;
+cmp_ok(@al, '==', 1,                    "Folded body of a");
+is($al[0], " new\n");
+
+my $b = $mmfu->new('b');
+ok(defined $b,                          "No body specified: later");
+
+#
+# LINE without new lines (no folds)
+#
+
+$b = $mmfu->new('b: new');
+ok(defined $b,                          "Created b with body split");
+isa_ok($b, $mmfu);
+isa_ok($b, $mmff);
+is($b->name, 'b',                       "Name of b");
+
+is($b->unfoldedBody, 'new',             "Unfolded body b");
+my @bl = $b->foldedBody;
+cmp_ok(@bl, '==', 1,                    "Folded body of b");
+is($bl[0], " new\n");
+
+#
+# LINE with new-lines (folds)
+#
+
+my $c = $mmfu->new("c: new\n line\n");
+ok(defined $c,                          "Created c with body split");
+isa_ok($c, $mmfu);
+isa_ok($c, $mmff);
+is($c->name, 'c',                       "Name of c");
+
+is($c->unfoldedBody, 'new line',        "Unfolded body c");
+my @cl = $c->foldedBody;
+cmp_ok(@cl, '==', 2,                    "Folded body of c");
+is($cl[0], " new\n",                    "Folded c line 1");
+is($cl[1], " line\n",                   "Folded c line 2");
+
+#
+# Test encoding of line with separate body
+#
+
+my $d = $mmfu->new("d", "a\x{E4}b", charset => 'iso-8859-1');
+ok(defined $d,                          "Created d with included stranger");
+isa_ok($c, $mmfu);
+is($d->name, 'd',                       "Name of d");
+
+# encoding/decoding work in progress
+# is($d->unfoldedBody, '=?iso-8859-1?q?a=E4b?=', "Unfolded body d");
+
+my @dl = $d->foldedBody;
+cmp_ok(@dl, '==', 1,                    "Folded body of d");
+
+# encoding/decoding work in progress
+# is($dl[0], " =?iso-8859-1?q?a=E4b?=\n", "Folded d line 0");
+
+is($d->decodedBody, "a\x{E4}b");

Added: packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/40parse.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/40parse.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/40parse.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,89 @@
+#!/usr/bin/perl -T
+#
+# Test processing of general parsing of fields
+#
+
+use strict;
+use warnings;
+
+package Mail::Message::Field::Full;   # define package name
+package main;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More;
+
+BEGIN {
+   if($] < 5.007003)
+   {   plan skip_all => "Requires module Encode which requires Perl 5.7.3";
+       exit 0;
+   }
+
+   eval 'require Mail::Message::Field::Full';
+   if($@)
+   {
+warn $@;
+       plan skip_all => 'Extended attributes not available (install Encode?)';
+       exit 0;
+   }
+   else
+   {   plan tests => 38;
+   }
+}
+
+
+my $mmff = 'Mail::Message::Field::Full';
+
+#
+# Test consuming phrases
+#
+
+my @tests =
+ ( 'hi! this is me <tux>' => ['hi! this is me', '<tux>' ]
+ , ' aap, noot <tux>'     => ['aap', ', noot <tux>' ]
+ , '" aap, noot " <tux>'  => [' aap, noot ', ' <tux>' ]
+ , '"aap", "noot"'        => ['aap', ', "noot"' ]
+ , '"a\\"b\\"c" d'        => ['a"b"c', ' d' ]
+ , '"\\"b\\"" d'          => ['"b"', ' d' ]
+ , '"a\\)b\\(c" d'        => ['a\\)b\\(c', ' d' ]
+ , '<tux>'                => [ undef, '<tux>' ]
+ , ' <tux>'               => [ undef, ' <tux>' ]
+ , '" " <tux>'            => [ ' ', ' <tux>' ]
+ );
+
+while(@tests)
+{   my ($from, $to) = (shift @tests, shift @tests);
+    my ($exp_phrase, $exp_rest) = @$to;
+
+    my ($phrase, $rest) = $mmff->consumePhrase($from);
+    is($phrase, $exp_phrase,  $from);
+    is($rest, $exp_rest,      $from);
+}
+
+#
+# Test consuming comments
+#
+
+ at tests =
+ ( '(this is a comment) <tux>' => [ 'this is a comment', ' <tux>' ]
+ , '(this)'                    => [ 'this', '' ]
+ , 'this'                      => [ undef, 'this' ]
+ , ' (a(b)c) <tux>'            => [ 'a(b)c', ' <tux>' ]
+ , '((a)b(c)) <tux>'           => [ '(a)b(c)', ' <tux>' ]
+ , '((a)b(c) <tux>'            => [ undef, '((a)b(c) <tux>' ]
+ , '(a\(b) <tux>'              => [ 'a(b', ' <tux>' ]
+ , '(a <tux>'                  => [ undef, '(a <tux>' ]
+ , 'a) <tux>'                  => [ undef, 'a) <tux>' ]
+ );
+
+while(@tests)
+{   my ($from, $to) = (shift @tests, shift @tests);
+    my ($exp_comment, $exp_rest) = @$to;
+
+    my ($comment, $rest) = $mmff->consumeComment($from);
+    is($comment, $exp_comment,  $from);
+    is($rest, $exp_rest,      $from);
+}
+
+#

Added: packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/50userid.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/50userid.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/50userid.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,142 @@
+#!/usr/bin/perl -T
+#
+# Test processing in combination with User::Identity as documented in
+# Mail::Message::Field.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More;
+
+use Mail::Message::Field::Fast;
+
+my $mmf = 'Mail::Message::Field::Fast';
+
+BEGIN {
+   if($] < 5.007003)
+   {   plan skip_all => "Requires module Encode which requires Perl 5.7.3";
+       exit 0;
+   }
+
+   eval 'require User::Identity';
+   if($@)
+   {
+       plan skip_all => 'User::Identity failed';
+       exit 0;
+   }
+   else
+   {   plan tests => 22;
+   }
+}
+
+
+# A user's identity
+
+my $patrik = User::Identity->new
+ ( "patrik"
+ , full_name => "Patrik Fältström"  # from rfc
+ , charset   => "ISO-8859-1"
+ );
+
+isa_ok($patrik, 'User::Identity');
+
+my $email1 = $patrik->add
+ ( email     => 'home'
+ , address   => 'him at home.net'
+ );
+
+isa_ok($email1, 'Mail::Identity');
+
+# address based on Mail::Identity with user
+
+my $f1 = $mmf->new(To => $email1);
+isa_ok($f1, $mmf);
+is($f1, '=?ISO-8859-1?q?Patrik_F=E4ltstr=F6m?= <him at home.net>');
+
+my $f1b = $mmf->new(To => $patrik);
+isa_ok($f1b, $mmf);
+is($f1b, '=?ISO-8859-1?q?Patrik_F=E4ltstr=F6m?= <him at home.net>');
+
+# address based on Mail::Identity without user
+
+require Mail::Identity;
+my $email2 = Mail::Identity->new
+ ( 'work'
+ , address   => 'somewhere at example.com'
+ );
+my $f2 = $mmf->new(To => $email2);
+is($f2, 'somewhere at example.com');
+
+# A very complex address
+
+my $email3 = Mail::Identity->new
+ ( 'work'
+ , address   => 'somehow at example.com'
+ , phrase    => 'my " quote'
+ , comment   => 'make it ) hard'
+ );
+my $f3 = $mmf->new(To => $email3);
+is($f3, qq["my \\" quote" <somehow\@example.com> (make it \\) hard)]);
+
+# A collection of e-mails
+
+$patrik->add(email => $email3);
+my $emails = $patrik->collection('emails');
+isa_ok($emails, 'User::Identity::Collection::Emails');
+cmp_ok(@$emails, '==', 2);
+
+# An array of addresses
+
+my $f4 = $mmf->new
+  ( To =>
+     [ $email1
+     , "aap\@hok.nl"
+     , $email2
+     , $patrik->find(email => 'work')
+     ]
+  );
+
+is($f4->string, <<'FOLDED');
+To: =?ISO-8859-1?q?Patrik_F=E4ltstr=F6m?= <him at home.net>, aap at hok.nl,
+ somewhere at example.com, "my \" quote" <somehow at example.com> (make it \) hard)
+FOLDED
+
+# Test a collection which is linked to user
+
+my $f5 = $mmf->new(To => $emails);
+is($f5->string, <<'TWO');
+To: emails: "my \" quote" <somehow at example.com> (make it \) hard),
+ =?ISO-8859-1?q?Patrik_F=E4ltstr=F6m?= <him at home.net>;
+TWO
+
+require Mail::Message::Field::AddrGroup;
+
+# test a collection which is not linked to a user
+
+my $mmfg = 'Mail::Message::Field::AddrGroup';
+my $g = $mmfg->new(name => 'groupie');
+isa_ok($g, $mmfg);
+is($g->name, 'groupie');
+my @addrs = $g->addresses;
+cmp_ok(scalar @addrs, '==', 0);
+is($g->string, "groupie: ;");
+
+$g->addAddress($email1);
+ at addrs = $g->addresses;
+cmp_ok(scalar @addrs, '==', 1);
+is($g->string, 'groupie: him at home.net;');
+
+$g->addAddress($email3);
+ at addrs = $g->addresses;
+cmp_ok(scalar @addrs, '==', 2);
+is($g->string, 'groupie: "my \" quote" <somehow at example.com> (make it \) hard), him at home.net;');
+
+$g->addAddress('aap at hok.nl');
+ at addrs = $g->addresses;
+cmp_ok(scalar @addrs, '==', 3);
+is($g->string, 'groupie: "my \" quote" <somehow at example.com> (make it \) hard), aap at hok.nl, him at home.net;');
+

Added: packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/51addr.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/51addr.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/51addr.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,237 @@
+#!/usr/bin/perl -T
+#
+# Test processing of addresses
+#
+
+use strict;
+use warnings;
+
+package Mail::Message::Field::Addresses;   # define package name
+package main;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More;
+
+BEGIN {
+   if($] < 5.007003)
+   {   plan skip_all => "Requires module Encode which requires Perl 5.7.3";
+       exit 0;
+   }
+
+   eval 'require Mail::Message::Field::Addresses';
+   if($@)
+   {   plan skip_all => 'Extended attributes not available (install Encode?)';
+       exit 0;
+   }
+   else
+   {   plan tests => 96;
+   }
+}
+
+my $mmfa  = 'Mail::Message::Field::Address';
+my $mmfag = 'Mail::Message::Field::AddrGroup';
+my $mmfas = 'Mail::Message::Field::Addresses';
+
+#
+# Test single addresses
+#
+
+my $ad = $mmfa->new(phrase => 'Mark Overmeer', username => 'markov',
+   domain => 'cpan.org', comment => 'This is me!');
+ok(defined $ad,                                    'Created ad');
+isa_ok($ad, $mmfa);
+is($ad->name, 'Mark Overmeer');
+is($ad->address, 'markov at cpan.org');
+is($ad->comment, 'This is me!');
+is($ad->string, '"Mark Overmeer" <markov at cpan.org> (This is me!)');
+
+#
+# Test whole field (Addresses)
+#
+
+my $cc = $mmfas->new('Cc');
+ok(defined $cc,                                    'Create cc');
+isa_ok($cc, $mmfas);
+
+my $jd = '"John Doe" <jdoe at machine.example>';
+$cc = $mmfas->new(Cc => $jd);
+ok(defined $cc,                                    'parsing joe');
+my @g = $cc->groups;
+cmp_ok(scalar @g, '==', 1);
+my $g0 = $g[0];
+ok(defined $g0);
+isa_ok($g0, 'Mail::Message::Field::AddrGroup');
+is($g0->name, '');
+my @ga = $g0->addresses;
+cmp_ok(scalar @ga, '==', 1,                        'address from group');
+isa_ok($ga[0], 'Mail::Message::Field::Address');
+is($g0->string, $jd,                               'group string is ok'); 
+is("$g0", $jd,                                     'gr stringification is ok'); 
+
+my @a = $cc->addresses;
+cmp_ok(scalar @a, '==', 1,                         'all address');
+my $a0 = $a[0];
+ok(defined $a0);
+isa_ok($a0, 'Mail::Message::Field::Address');
+
+is($a0->name, 'John Doe');
+is($a0->address, 'jdoe at machine.example');
+is($a0->username, 'jdoe');
+is($a0->domain, 'machine.example');
+
+is($cc->string, "Cc: $jd\n",                       'line string');
+$cc->beautify;
+is($cc->string, "Cc: $jd\n",                       'line string');
+is("$cc", $jd,                                     'line stringification');
+
+#
+# Checking various strings which are mentioned in rfc2822
+#
+
+my $c = '"Joe Q. Public" <john.q.public at example.com>,
+ Mary Smith <mary at x.test>, jdoe at example.org, Who? <one at y-me.test>';
+$cc = $mmfas->new('Cc' => $c);
+ok(defined $cc,                           'Parsed Joe Q. Public');
+ at g = $cc->groups;
+cmp_ok(scalar @g, '==', 1,               'one group');
+$g0 = $g[0];
+ok(defined $g0);
+isa_ok($g0, 'Mail::Message::Field::AddrGroup');
+is($g0->name, '');
+ at a = $g0->addresses;
+cmp_ok(scalar @a, '==', 4,               'four addresses in group');
+
+# the collections are not ordered (hash), so we need to enforce some
+# order for the tests.
+ at a = sort { $a->address cmp $b->address } @a;
+
+ok(defined $a[0]);
+isa_ok($a[0], 'Mail::Message::Field::Address');
+isa_ok($a[1], 'Mail::Message::Field::Address');
+isa_ok($a[2], 'Mail::Message::Field::Address');
+isa_ok($a[3], 'Mail::Message::Field::Address');
+
+ok(!$a[0]->phrase,                       "checking on jdoe");
+ok(!$a[0]->comment);
+is($a[0]->username, 'jdoe');
+is($a[0]->domain, 'example.org');
+
+is($a[1]->phrase, 'Joe Q. Public',       "checking Joe's identity");
+is($a[1]->username, 'john.q.public');
+is($a[1]->domain, 'example.com');
+is($a[1]->address, 'john.q.public at example.com');
+is($a[1]->string, '"Joe Q. Public" <john.q.public at example.com>');
+
+is($a[2]->phrase, 'Mary Smith',          "checking Mary's id");
+is($a[2]->username, 'mary');
+is($a[2]->domain, 'x.test');
+
+is($a[3]->phrase, 'Who?',                "checking Who?");
+is($a[3]->username, 'one');
+is($a[3]->domain, 'y-me.test');
+is($a[3]->address, 'one at y-me.test');
+is($a[3]->string, 'Who? <one at y-me.test>');
+
+is($cc->string, "Cc: $c");
+$cc->beautify;
+is($cc->string, <<'REFOLDED');
+Cc: "Joe Q. Public" <john.q.public at example.com>, "Mary Smith" <mary at x.test>,
+ Who? <one at y-me.test>, jdoe at example.org
+REFOLDED
+
+# Next!
+
+my $c3 = <<'COMPLEX';
+<boss at nil.test>, "Giant; \"Big\" Box" <sysservices at example.net>,
+ A Group:Chris Jones <c at a.test>,joe at where.test,John <jdoe at one.test>;
+ Undisclosed recipients:;
+ "Mary Smith: Personal Account" <smith at home.example>,
+ Jane Brown <j-brown at other.example>
+COMPLEX
+
+$cc = $mmfas->new(Cc => $c3);
+ok(defined $cc,                                    'Parsed complex');
+ at g = $cc->groups;
+cmp_ok(scalar @g, '==', 3);
+ at g = sort {$a->name cmp $b->name} @g;
+
+is($g[0]->name, '');
+cmp_ok($g[0]->addresses, '==', 4);
+my @u = sort map {$_->username} $g[0]->addresses;
+cmp_ok(scalar @u, '==', 4);
+is($u[0], 'boss');
+is($u[1], 'j-brown');
+is($u[2], 'smith');
+is($u[3], 'sysservices');
+
+is($g[1]->name, 'A Group');
+cmp_ok($g[1]->addresses, '==', 3);
+
+is($g[2]->name, 'Undisclosed recipients');
+cmp_ok($g[2]->addresses, '==', 0);
+is($cc->string, "Cc: $c3");
+$cc->beautify;
+is($cc->string, <<'REFOLDED');
+Cc: "Giant; \"Big\" Box" <sysservices at example.net>,
+ "Jane Brown" <j-brown at other.example>,
+ "Mary Smith: Personal Account" <smith at home.example>, boss at nil.test,
+ A Group: "Chris Jones" <c at a.test>, John <jdoe at one.test>, joe at where.test;
+ Undisclosed recipients: ;
+REFOLDED
+
+# Next !
+
+my $c2 = <<'PETE';
+Pete(A wonderful \) chap) <pete(his account)@silly.test(his host)>,
+ A Group(Some people)
+     :Chris Jones <c@(Chris's host.)public.example>,
+         joe at example.org,
+  John <jdoe at one.test> (my dear friend); (the end of the group)
+PETE
+
+$cc = $mmfas->new(Cc => $c2);
+ok(defined $cc,                                    'Parsed pete');
+ at g = $cc->groups;
+cmp_ok(scalar @g, '==', 2);
+is($g[0]->name, '');
+is($g[1]->name, 'A Group');
+ at a = $g[0]->addresses;
+cmp_ok(scalar @a, '==', 1);
+$a0 = $a[0];
+is($a0->phrase, 'Pete');
+is($a0->username, 'pete');
+is($a0->domain, 'silly.test');
+is($a0->address, 'pete at silly.test');
+ok(!defined $a0->comment);
+
+ at a = $g[1]->addresses;
+cmp_ok(scalar @a, '==', 3);
+$a0 = $g[1]->find('Chris Jones');
+ok(defined $a0,                                    'found chris');
+is($a0->phrase, 'Chris Jones');
+is($a0->username, 'c');
+is($a0->domain, 'public.example');
+ok(!defined $a0->comment);
+
+$a0 = $g[1]->find('John');
+ok(defined $a0,                                    'found john');
+is($a0->phrase, 'John');
+is($a0->username, 'jdoe');
+is($a0->domain, 'one.test');
+is($a0->comment, 'my dear friend');
+
+is($g[1]->string, 'A Group: "Chris Jones" <c at public.example>, John <jdoe at one.test> (my dear friend), joe at example.org;');
+
+is($cc->string, "Cc: $c2");
+$cc->beautify;
+is($cc->string, <<'REFOLDED');
+Cc: Pete <pete at silly.test>, A Group: "Chris Jones" <c at public.example>,
+ John <jdoe at one.test> (my dear friend), joe at example.org;
+REFOLDED
+
+__END__
+Cc:(Empty list)(start)Undisclosed recipients  :(nobody(that I know))  ;
+From  : John Doe <jdoe at machine(comment).  example>
+Mary Smith <@machine.tld:mary at example.net>, , jdoe at test   . example

Added: packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/52uri.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/52uri.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/52uri.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,99 @@
+#!/usr/bin/perl -T
+#
+# Test processing of URIs
+#
+
+use strict;
+use warnings;
+
+package Mail::Message::Field::URIs;   # define package name
+package main;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More;
+
+BEGIN {
+   if($] < 5.007003)
+   {   plan skip_all => "Requires module Encode which requires Perl 5.7.3";
+       exit 0;
+   }
+
+   eval 'require Mail::Message::Field::URIs';
+   if($@)
+   {   plan skip_all => 'Extended attributes not available (install Encode?)';
+       exit 0;
+   }
+   else
+   {   plan tests => 33;
+   }
+}
+
+require Mail::Message::Field::Full;
+my $mmff  = 'Mail::Message::Field::Full';
+
+my $mmfu  = 'Mail::Message::Field::URIs';
+
+#
+# Test single URI
+#
+
+my $u = URI->new('http://x.org');
+ok(defined $u,                                  "uri creation");
+isa_ok($u, 'URI');
+is($u->scheme, 'http');
+
+my $uf = $mmfu->new('List-Post' => $u);
+ok(defined $uf,                                 "uri field creation");
+isa_ok($uf, $mmfu);
+is($uf->string, "List-Post: <http://x.org/>\n");
+is("$uf", '<http://x.org/>');
+my @u = $uf->URIs;
+cmp_ok(@u, '==', 1);
+isa_ok($u[0], 'URI');
+
+$uf = $mmfu->new('List-Post' => $u);
+my $u2 = $uf->addURI('mailto:x at example.com?subject=y');
+ok(defined $u2,                                 "auto-create URI");
+isa_ok($u2, "URI");
+ at u = $uf->URIs;
+cmp_ok(@u, '==', 2);
+isa_ok($u[1], 'URI');
+is($u[1]->scheme, "mailto");
+is($u[1]->to, 'x at example.com');
+
+my %headers = $u[1]->headers;
+is($headers{to}, 'x at example.com');
+is($headers{subject}, 'y');
+is($uf->string, <<'FOLDED');
+List-Post: <http://x.org/>, <mailto:x at example.com?subject=y>
+FOLDED
+
+is("$uf", '<http://x.org/>, <mailto:x at example.com?subject=y>');
+
+#
+# Test other constructions
+#
+
+$uf = $mmff->new("List-Post: <mailto:x\@y.com>, <http://A.org>\n");
+ok(defined $uf,                               "create from field");
+isa_ok($uf, $mmff);
+isa_ok($uf, $mmfu);
+ at u = $uf->URIs;
+cmp_ok(@u, '==', 2);
+isa_ok($u[0], 'URI');
+is($u[0]->scheme, "mailto");
+is($u[0]->to, 'x at y.com');
+is("$u[0]", 'mailto:x at y.com');
+isa_ok($u[1], 'URI');
+is($u[1]->scheme, "http");
+is("$u[1]", 'http://a.org/');  # modified by URI::canonical()
+
+is("$uf", '<mailto:x at y.com>, <http://A.org>');
+is($uf->string, <<'FOLDED');
+List-Post: <mailto:x at y.com>, <http://A.org>
+FOLDED
+
+$uf->beautify;
+is("$uf", '<http://a.org/>, <mailto:x at y.com>');

Added: packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/Definition.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/Definition.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/14fieldu/Definition.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,18 @@
+
+package MailBox::Test::14fieldu::Definition;
+
+sub name     {"Mail::Message::Field::Full; unicode fields"}
+sub critical {0}
+
+sub skip
+{
+   return "Requires module Encode, which requires at least Perl 5.7.3"
+       if $] < 5.007003;
+
+   eval "require Encode";
+   return "Module Encode is not installed or has errors." if $@;
+
+   undef;
+}
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/tests/20pparser/10field.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/20pparser/10field.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/20pparser/10field.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,67 @@
+#!/usr/bin/perl -T
+#
+# Test processing of header-fields: only single fields, not whole headers.
+# This also doesn't cover reading headers from file.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 15;
+
+use Mail::Message::Field;
+use Mail::Box::Parser::Perl;
+
+# Explictly ask for the Perl parser to fold lines.
+
+Mail::Box::Parser->defaultParserType('Mail::Box::Parser::Perl');
+
+#
+# Processing of structured lines.
+#
+
+my $f = Mail::Message::Field->new('Sender:  B ;  C');
+is($f->name, 'sender');
+is($f->body, 'B');
+like($f->comment , qr/^\s*C\s*/);
+
+# No comment, strip CR LF
+
+my $g = Mail::Message::Field->new("Sender: B\015\012");
+is($g->body, 'B');
+is($g->comment, "");
+
+# Check toString
+
+my $x = $f->toString;
+is($x, "Sender: B ;  C\n");
+
+$x = $g->toString;
+is($x, "Sender: B\n");
+
+# Now check folding.
+
+my $k = Mail::Message::Field->new(Sender => 'short line');
+is($k->toString, "Sender: short line\n");
+my @klines = $k->toString;
+cmp_ok(@klines, "==", 1);
+
+my $long = 'oijfjslkgjhius2rehtpo2uwpefnwlsjfh2oireuqfqlkhfjowtropqhflksjhflkjhoiewurpq';
+my $l = Mail::Message::Field->new(Sender => $long);
+my @llines = $l->toString;
+cmp_ok(@llines, "==", 1);
+
+my $m = Mail::Message::Field->new(Sender =>
+  'roijfjslkgjhiu, rehtpo2uwpe, fnwlsjfh2oire, uqfqlkhfjowtrop, qhflksjhflkj, hoiewurpq');
+
+cmp_ok($m->nrLines, "==", 2);
+$m->setWrapLength(35);
+cmp_ok($m->nrLines, "==", 3);
+
+my @mlines = $m->toString(72);
+cmp_ok(@mlines, "==", 2);
+is($mlines[0], "Sender: roijfjslkgjhiu, rehtpo2uwpe, fnwlsjfh2oire, uqfqlkhfjowtrop,\n");
+is($mlines[1], " qhflksjhflkj, hoiewurpq\n");

Added: packages/libmail-box-perl/branches/upstream/current/tests/20pparser/20head.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/20pparser/20head.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/20pparser/20head.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,69 @@
+#!/usr/bin/perl -T
+#
+# Test the processing of a message header, in this case purely the reading
+# from a file.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 16;
+
+use Mail::Message;
+use Mail::Message::Head;
+use Mail::Box::Parser::Perl;
+
+my $h = Mail::Message::Head->new;
+ok(defined $h);
+
+my $parser = Mail::Box::Parser::Perl->new(filename => $src);
+ok($parser);
+
+my $head = Mail::Message::Head->new;
+ok(defined $head);
+ok(! $head);  # no lines yet
+
+$parser->pushSeparator('From ');
+my ($where, $sep) = $parser->readSeparator;
+ok($sep);
+cmp_ok($where, "==", 0);
+like($sep , qr/^From mag.*2000$/);
+
+$head->read($parser);
+ok($head);  # now has lines
+cmp_ok($head->names, "==", 20);
+is($head->get('subject'), 'Re: File Conversion From HTML to PS and TIFF');
+
+my @received = $head->get('received');
+cmp_ok(@received, "==", 5);
+
+my $received = $head->get('received');  #last
+ok(defined $received);
+is($received->name, 'received');
+my $recb = "(from majordomo\@localhost)\tby unca-don.wizards.dupont.com (8.9.3/8.9.3) id PAA29389\tfor magick-outgoing";
+
+is($received->body, $recb);
+is($received->comment, 'Wed, 9 Feb 2000 15:38:42 -0500 (EST)');
+
+# Check parsing empty fields
+# Contributed by Marty Pauley
+
+my $message = <<'EOT';
+Date: Mon, 24 Feb 2003 11:07:36 +0000
+From: marty at kasei.com
+To: marty at kasei.com
+Subject: Test Message
+Message-ID: <20030224010736.GA32736 at phobos.kasei.com>
+Mime-Version: 1.0
+X-foo:
+Content-Type: text/plain
+Content-Disposition: inline
+
+This is a test message.
+EOT
+my $mm = Mail::Message->read($message);
+my $foo = $mm->head->get("x-foo")->string;
+is($foo, "X-foo: \n",               "X-foo ok");

Added: packages/libmail-box-perl/branches/upstream/current/tests/20pparser/30bodys.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/20pparser/30bodys.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/20pparser/30bodys.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,209 @@
+#!/usr/bin/perl -T
+#
+# Test the reading from file of message bodies which have their content
+# stored in a single string.
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 945;
+
+use Mail::Box::Parser::Perl;
+use Mail::Message::Body::String;
+use Mail::Message::Head;
+
+###
+### First carefully read the first message
+###
+
+my $parser = Mail::Box::Parser::Perl->new(filename  => $src);
+ok(defined $parser,                "creation of parser");
+exit 1 unless defined $parser;
+
+$parser->pushSeparator('From ');
+my ($where, $sep) = $parser->readSeparator;
+cmp_ok($where, "==", 0,            "begin at file-start");
+ok(defined $sep,                   "reading first separator");
+
+like($sep, qr/^From /,             "correctness first separator")
+    if defined $sep;
+
+my $head = Mail::Message::Head->new;
+ok(defined $head);
+
+$head->read($parser);
+ok(defined $head);
+ok($head,                          "overloaded boolean");
+
+my $hard_coded_lines_msg0  = 33;
+my $hard_coded_length_msg0 = 1280;
+my $binary_size = $hard_coded_length_msg0
+      + ($crlf_platform ? $hard_coded_lines_msg0 : 0);
+
+my $length = int $head->get('Content-Length');
+cmp_ok($length, "==", $binary_size, "first message size");
+
+my $lines  = int $head->get('Lines');
+cmp_ok($lines, "==", $hard_coded_lines_msg0,   "first message lines");
+
+my $body = Mail::Message::Body::String->new;
+$body->read($parser, $head, undef, $length, $lines);
+ok(defined $body,                  "reading of first body");
+
+my @lines = $body->lines;
+$length -= @lines if $crlf_platform;
+
+cmp_ok($body->size, "==", $length, "size of body");
+cmp_ok(@lines, "==", $lines,       "lines of body");
+
+#
+# Try to read the rest of the folder, with specified content-length
+# and lines if available.
+#
+
+my @msgs;
+
+push @msgs,  # first message already read.
+ { fields => scalar $head->names
+ , lines  => $hard_coded_lines_msg0
+ , size   => $hard_coded_length_msg0
+ , sep    => $sep
+ , subject=> $head->get('subject')
+ };
+
+while(1)
+{   my ($where, $sep) = $parser->readSeparator;
+    last unless $sep;
+
+    my $count = @msgs;
+    like($sep, qr/^From /,                     "1 from $count");
+
+    $head = Mail::Message::Head->new;
+    ok(defined $head,                          "1 head $count");
+
+    $head->read($parser);
+
+    my $cl    = int $head->get('Content-Length');
+    my $li    = int $head->get('Lines');
+    my $su    = $head->get('Subject');
+
+    $body = Mail::Message::Body::String->new
+        ->read($parser, $head, undef, $cl, $li);
+    ok(defined $body,                          "1 body $count");
+
+    my $size  = $body->size;
+    my $lines = $body->nrLines;
+
+    cmp_ok($li , "==",  $lines,                "1 lines $count")
+        if defined $li;
+
+    $cl -= $li if $crlf_platform;
+    cmp_ok($cl , "==",  $size,                 "1 size $count")
+        if defined $cl;
+
+    my $msg = 
+     { size   => $size
+     , lines  => $lines
+     , fields => scalar $head->names
+     , sep    => $sep
+     , subject=> $su
+     };
+
+    push @msgs, $msg;
+}
+
+cmp_ok(@msgs, "==", 45);
+$parser->stop;
+
+###
+### Now read the whole folder again, but without help of content-length
+### and nor lines.
+###
+
+undef $parser;
+
+$parser = Mail::Box::Parser::Perl->new(filename => $src);
+$parser->pushSeparator('From ');
+
+my $count = 0;
+while($sep = $parser->readSeparator)
+{   my $msg = $msgs[$count];
+
+    like($sep, qr/^From /,                      "2 from $count");
+
+    $head     = Mail::Message::Head->new->read($parser);
+    ok(defined $head,                           "2 head $count");
+
+    $body = Mail::Message::Body::String->new->read($parser, $head, undef);
+    ok(defined $body,                           "2 body $count");
+
+    my $su    = $head->get('Subject');
+    my $size  = $body->size;
+    my $lines = $body->nrLines;
+
+    cmp_ok($size, "==",  $msg->{size},           "2 size $count");
+    cmp_ok($lines, "==",  $msg->{lines},         "2 lines $count");
+
+    is($su, $msg->{subject},                     "2 subject $count")
+        if defined $su && defined $msg->{subject};
+
+    cmp_ok($head->names , "==",  $msg->{fields}, "2 names $count");
+    is($sep, $msg->{sep},                        "2 sep $count");
+
+    $count++;
+}
+
+$parser->stop;
+
+###
+### Now read the whole folder again, but with deceiving values for
+### content-length and lines
+###
+
+undef $parser;
+
+$parser = Mail::Box::Parser::Perl->new(filename => $src);
+$parser->pushSeparator('From ');
+
+$count = 0;
+while(1)
+{   my ($where, $sep) = $parser->readSeparator;
+    last unless $sep;
+
+    my $msg = $msgs[$count];
+
+    like($sep, qr/^From /,                       "3 From $count");
+
+    $head     = Mail::Message::Head->new->read($parser);
+    ok(defined $head,                            "3 Head $count");
+
+    $body = Mail::Message::Body::String->new;
+    $body->read($parser, $head, undef, $msg->{size}-15, $msg->{lines}-3);
+    ok(defined $body,                            "3 Body $count");
+
+    my $su    = $head->get('Subject');
+    my $size  = $body->size;
+    my $lines = $body->nrLines;
+
+    # two messages contain one trailing blank, which is removed because
+    # of the wrong number of lines.  The will have an extra OK.
+    my $wrong = $count==14 || $count==18;
+
+    cmp_ok($size, '==', $msg->{size},            "3 size $count")
+        unless $wrong;
+
+    cmp_ok($lines, '==', $msg->{lines},          "3 lines $count")
+        unless $wrong;
+
+    is($su, $msg->{subject}, "3 subject $count")
+        if defined $su && defined $msg->{subject};
+
+    cmp_ok($head->names, '==', $msg->{fields},   "3 name $count");
+    is($sep, $msg->{sep},                        "3 sep $count");
+
+    $count++;
+}
+

Added: packages/libmail-box-perl/branches/upstream/current/tests/20pparser/31bodyl.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/20pparser/31bodyl.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/20pparser/31bodyl.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,208 @@
+#!/usr/bin/perl -T
+#
+# Test the reading from file of message bodies which have their content
+# stored in a an array of lines.
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 945;
+
+use Mail::Box::Parser::Perl;
+use Mail::Message::Body::Lines;
+use Mail::Message::Head;
+
+###
+### First carefully read the first message
+###
+
+my $parser = Mail::Box::Parser::Perl->new(filename  => $src);
+ok(defined $parser,                "creation of parser");
+
+$parser->pushSeparator('From ');
+my ($where, $sep) = $parser->readSeparator;
+cmp_ok($where, "==", 0,            "begin at file-start");
+ok(defined $sep,                   "reading first separator");
+
+like($sep, qr/^From /,             "correctness first separator")
+    if defined $sep;
+
+my $head = Mail::Message::Head->new;
+ok(defined $head);
+
+$head->read($parser);
+ok(defined $head);
+ok($head,                         "overloaded boolean");
+
+my $hard_coded_lines_msg0  = 33;
+my $hard_coded_length_msg0 = 1280;
+
+my $binary_size = $hard_coded_length_msg0
+      + ($crlf_platform ? $hard_coded_lines_msg0 : 0);
+
+my $length = int $head->get('Content-Length');
+cmp_ok($length, "==", $binary_size,            "first message size");
+
+my $lines  = int $head->get('Lines');
+cmp_ok($lines, "==", $hard_coded_lines_msg0,   "first message lines");
+
+my $body = Mail::Message::Body::Lines->new;
+$body->read($parser, $head, undef, $length, $lines);
+ok(defined $body,                  "reading of first body");
+
+my @lines = $body->lines;
+$length -= @lines if $crlf_platform;
+
+cmp_ok($body->size, "==", $length, "size of body");
+cmp_ok(@lines, "==", $lines,       "lines of body");
+
+#
+# Try to read the rest of the folder, with specified content-length
+# and lines if available.
+#
+
+my @msgs;
+
+push @msgs,  # first message already read.
+ { fields => scalar $head->names
+ , lines  => $hard_coded_lines_msg0
+ , size   => $hard_coded_length_msg0
+ , sep    => $sep
+ , subject=> $head->get('subject')
+ };
+
+while(1)
+{   my ($where, $sep) = $parser->readSeparator;
+    last unless $sep;
+
+    my $count = @msgs;
+    like($sep, qr/^From /,                     "1 from $count");
+
+    $head = Mail::Message::Head->new;
+    ok(defined $head,                          "1 head count");
+
+    $head->read($parser);
+
+    my $cl    = int $head->get('Content-Length');
+    my $li    = int $head->get('Lines');
+    my $su    = $head->get('Subject');
+
+    $body = Mail::Message::Body::Lines->new
+        ->read($parser, $head, undef, $cl, $li);
+    ok(defined $body,                          "1 body $count");
+
+    my $size  = $body->size;
+    my $lines = $body->nrLines;
+
+    cmp_ok($li , "==",  $lines,                "1 lines $count")
+        if defined $li;
+
+    $cl -= $li if $crlf_platform;
+    cmp_ok($cl , "==",  $size,                 "1 size $count")
+        if defined $cl;
+
+    my $msg = 
+     { size   => $size
+     , lines  => $lines
+     , fields => scalar $head->names
+     , sep    => $sep
+     , subject=> $su
+     };
+
+    push @msgs, $msg;
+}
+
+cmp_ok(@msgs, "==", 45);
+$parser->stop;
+
+###
+### Now read the whole folder again, but without help of content-length
+### and nor lines.
+###
+
+undef $parser;
+
+$parser = Mail::Box::Parser::Perl->new(filename => $src);
+$parser->pushSeparator('From ');
+
+my $count = 0;
+while($sep = $parser->readSeparator)
+{   my $msg = $msgs[$count];
+
+    like($sep, qr/^From /,                      "2 from $count");
+
+    $head     = Mail::Message::Head->new->read($parser);
+    ok(defined $head,                           "2 head $count");
+
+    $body = Mail::Message::Body::Lines->new->read($parser, $head, undef);
+    ok(defined $body,                           "2 body $count");
+
+    my $su    = $head->get('Subject');
+    my $size  = $body->size;
+    my $lines = $body->nrLines;
+
+    cmp_ok($size, "==",  $msg->{size},           "2 size $count");
+    cmp_ok($lines, "==",  $msg->{lines},         "2 lines $count");
+
+    is($su, $msg->{subject},                     "2 subject $count")
+        if defined $su && defined $msg->{subject};
+
+    cmp_ok($head->names , "==",  $msg->{fields}, "2 names $count");
+    is($sep, $msg->{sep},                        "2 sep $count");
+
+    $count++;
+}
+
+$parser->stop;
+
+###
+### Now read the whole folder again, but with deceiving values for
+### content-length and lines
+###
+
+undef $parser;
+
+$parser = Mail::Box::Parser::Perl->new(filename => $src);
+$parser->pushSeparator('From ');
+
+$count = 0;
+while(1)
+{   my ($where, $sep) = $parser->readSeparator;
+    last unless $sep;
+
+    my $msg = $msgs[$count];
+
+    like($sep, qr/^From /,                       "3 From $count");
+
+    $head     = Mail::Message::Head->new->read($parser);
+    ok(defined $head,                            "3 Head $count");
+
+    $body = Mail::Message::Body::Lines->new;
+    $body->read($parser, $head, undef, $msg->{size}-15, $msg->{lines}-3);
+    ok(defined $body,                            "3 Body $count");
+
+    my $su    = $head->get('Subject');
+    my $size  = $body->size;
+    my $lines = $body->nrLines;
+
+    # two messages contain one trailing blank, which is removed because
+    # of the wrong number of lines.  The will have an extra OK.
+    my $wrong = $count==14 || $count==18;
+
+    cmp_ok($size, '==', $msg->{size},            "3 size $count")
+        unless $wrong;
+
+    cmp_ok($lines, '==', $msg->{lines},          "3 lines $count")
+        unless $wrong;
+
+    is($su, $msg->{subject}, "3 subject $count")
+        if defined $su && defined $msg->{subject};
+
+    cmp_ok($head->names, '==', $msg->{fields},   "3 name $count");
+    is($sep, $msg->{sep},                        "3 sep $count");
+
+    $count++;
+}

Added: packages/libmail-box-perl/branches/upstream/current/tests/20pparser/32bodyd.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/20pparser/32bodyd.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/20pparser/32bodyd.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,207 @@
+#!/usr/bin/perl -T
+#
+# Test the reading from file of message bodies which have their content
+# stored in a single string.
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 855;
+
+use Mail::Box::Parser::Perl;
+use Mail::Message::Body::Delayed;
+use Mail::Message::Head;
+
+###
+### First carefully read the first message
+###
+
+my $parser = Mail::Box::Parser::Perl->new(filename  => $src);
+ok(defined $parser,                "creation of parser");
+
+$parser->pushSeparator('From ');
+my ($where, $sep) = $parser->readSeparator;
+cmp_ok($where, "==", 0,            "begin at file-start");
+ok(defined $sep,                   "reading first separator");
+
+like($sep, qr/^From /,             "correctness first separator")
+    if defined $sep;
+
+my $head = Mail::Message::Head->new;
+ok(defined $head);
+
+$head->read($parser);
+ok(defined $head);
+ok($head,                          "overloaded boolean");
+
+my $hard_coded_lines_msg0  = 33;
+my $hard_coded_length_msg0 = 1280;
+
+my $binary_size = $hard_coded_length_msg0
+      + ($crlf_platform ? $hard_coded_lines_msg0 : 0);
+
+my $length = int $head->get('Content-Length');
+cmp_ok($length, "==", $binary_size, "first message size");
+
+my $lines  = int $head->get('Lines');
+cmp_ok($lines, "==", $hard_coded_lines_msg0,   "first message lines");
+
+my $message;  # dummy message, because all delayed objects must have one.
+my $body = Mail::Message::Body::Delayed->new(message => \$message);
+
+$body->read($parser, $head, undef, $length, $lines);
+ok(defined $body,                  "reading of first body");
+
+cmp_ok($body->guessSize, "==", $length, "guessed size of body");
+
+#
+# Try to read the rest of the folder, with specified content-length
+# and lines if available.
+#
+
+my @msgs;
+
+push @msgs,  # first message already read.
+ { fields => scalar $head->names
+ , lines  => $hard_coded_lines_msg0
+ , size   => $hard_coded_length_msg0
+ , sep    => $sep
+ , subject=> $head->get('subject')
+ };
+
+while(1)
+{   my ($where, $sep) = $parser->readSeparator;
+    last unless $sep;
+
+    my $count = @msgs;
+    like($sep, qr/^From /,                     "1 from $count");
+
+    $head = Mail::Message::Head->new;
+    ok(defined $head,                          "1 head count");
+
+    $head->read($parser);
+
+    my $cl    = int $head->get('Content-Length');
+    my $li    = int $head->get('Lines');
+    my $su    = $head->get('Subject');
+
+    $body = Mail::Message::Body::Delayed->new(message => \$message)
+        ->read($parser, $head, undef, $cl, $li);
+    ok(defined $body,                          "1 body $count");
+
+    my $size  = $body->guessSize;
+    cmp_ok($cl , "==",  $size,                 "1 size $count")
+        if defined $cl;
+
+    my $msg = 
+     { size   => $size
+     , fields => scalar $head->names
+     , sep    => $sep
+     , subject=> $su
+     };
+
+    push @msgs, $msg;
+}
+
+cmp_ok(@msgs, "==", 45);
+$parser->stop;
+
+###
+### Now read the whole folder again, but without help of content-length
+### and nor lines.
+###
+
+undef $parser;
+
+$parser = Mail::Box::Parser::Perl->new(filename => $src);
+$parser->pushSeparator('From ');
+
+my $count = 0;
+while($sep = $parser->readSeparator)
+{   my $msg = $msgs[$count];
+
+    like($sep, qr/^From /,                      "2 from $count");
+
+    $head     = Mail::Message::Head->new->read($parser);
+    ok(defined $head,                           "2 head $count");
+
+    $body = Mail::Message::Body::Delayed->new(message => \$message)
+        ->read($parser, $head, undef);
+
+    ok(defined $body,                           "2 body $count");
+
+    my $su    = $head->get('Subject');
+    my $size  = $body->guessSize;
+    my $lines = $msg->{lines} = $body->nrLines;
+
+    if($crlf_platform)
+    {   ok(1);    # too complicated to test
+    }
+    else
+    {   cmp_ok($size, "==",  $msg->{size},           "2 size $count");
+    }
+
+    is($su, $msg->{subject},                     "2 subject $count")
+        if defined $su && defined $msg->{subject};
+
+    cmp_ok($head->names , "==",  $msg->{fields}, "2 names $count");
+    is($sep, $msg->{sep},                        "2 sep $count");
+
+    $count++;
+}
+
+$parser->stop;
+
+###
+### Now read the whole folder again, but with deceiving values for
+### content-length and lines
+###
+
+undef $parser;
+
+$parser = Mail::Box::Parser::Perl->new(filename => $src);
+$parser->pushSeparator('From ');
+
+$count = 0;
+while(1)
+{   my ($where, $sep) = $parser->readSeparator;
+    last unless $sep;
+
+    my $msg = $msgs[$count];
+
+    like($sep, qr/^From /,                       "3 From $count");
+
+    $head     = Mail::Message::Head->new->read($parser);
+    ok(defined $head,                            "3 Head $count");
+
+    $body = Mail::Message::Body::Delayed->new(message => \$message);
+    $body->read($parser, $head, undef, $msg->{size}-15, $msg->{lines}-3);
+    ok(defined $body,                            "3 Body $count");
+
+    my $su    = $head->get('Subject');
+    my $size  = $body->guessSize;
+    my $lines = $body->nrLines;
+
+    # two messages contain one trailing blank, which is removed because
+    # of the wrong number of lines.  The will have an extra OK.
+    my $wrong = $count==14 || $count==18;
+
+    if($wrong)            { ; }
+    elsif($crlf_platform) { ok(1) }  # too hard to test
+    else { cmp_ok($size, '==', $msg->{size},     "3 size $count") }
+
+    cmp_ok($lines, '==', $msg->{lines},          "3 lines $count")
+        unless $wrong;
+
+    is($su, $msg->{subject}, "3 subject $count")
+        if defined $su && defined $msg->{subject};
+
+    cmp_ok($head->names, '==', $msg->{fields},   "3 name $count");
+    is($sep, $msg->{sep},                        "3 sep $count");
+
+    $count++;
+}
+

Added: packages/libmail-box-perl/branches/upstream/current/tests/20pparser/33bodyf.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/20pparser/33bodyf.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/20pparser/33bodyf.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,207 @@
+#!/usr/bin/perl -T
+#
+# Test the reading from file of message bodies which have their content
+# stored in external files as long as the folder is open.
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 945;
+
+use Mail::Box::Parser::Perl;
+use Mail::Message::Body::File;
+use Mail::Message::Head;
+
+###
+### First carefully read the first message
+###
+
+my $parser = Mail::Box::Parser::Perl->new(filename  => $src);
+ok(defined $parser,                "creation of parser");
+
+$parser->pushSeparator('From ');
+my ($where, $sep) = $parser->readSeparator;
+cmp_ok($where, "==", 0,            "begin at file-start");
+ok(defined $sep,                   "reading first separator");
+
+like($sep, qr/^From /,             "correctness first separator")
+    if defined $sep;
+
+my $head = Mail::Message::Head->new;
+ok(defined $head);
+
+$head->read($parser);
+ok(defined $head);
+ok($head,                          "overloaded boolean");
+
+my $hard_coded_lines_msg0  = 33;
+my $hard_coded_length_msg0 = 1280;
+
+my $binary_size = $hard_coded_length_msg0
+      + ($crlf_platform ? $hard_coded_lines_msg0 : 0);
+
+my $length = int $head->get('Content-Length');
+cmp_ok($length, "==", $binary_size, "first message size");
+
+my $lines  = int $head->get('Lines');
+cmp_ok($lines, "==", $hard_coded_lines_msg0,   "first message lines");
+
+my $body = Mail::Message::Body::File->new;
+$body->read($parser, $head, undef, $length, $lines);
+ok(defined $body,                    "reading of first body");
+
+cmp_ok($body->size, "==", $hard_coded_length_msg0,   "size of body");
+my @lines = $body->lines;
+cmp_ok(@lines, "==", $lines,         "lines of body");
+
+#
+# Try to read the rest of the folder, with specified content-length
+# and lines if available.
+#
+
+my @msgs;
+
+push @msgs,  # first message already read.
+ { fields => scalar $head->names
+ , lines  => $hard_coded_lines_msg0
+ , size   => $hard_coded_length_msg0
+ , sep    => $sep
+ , subject=> $head->get('subject')
+ };
+
+while(1)
+{   my ($where, $sep) = $parser->readSeparator;
+    last unless $sep;
+
+    my $count = @msgs;
+    like($sep, qr/^From /,                     "1 from $count");
+
+    $head = Mail::Message::Head->new;
+    ok(defined $head,                          "1 head count");
+
+    $head->read($parser);
+
+    my $cl    = int $head->get('Content-Length');
+    my $li    = int $head->get('Lines');
+    my $su    = $head->get('Subject');
+
+    $body = Mail::Message::Body::File->new
+        ->read($parser, $head, undef, $cl, $li);
+    ok(defined $body,                          "1 body $count");
+
+    my $size  = $body->size;
+    my $lines = $body->nrLines;
+
+    cmp_ok($li , "==",  $lines,                "1 lines $count")
+        if defined $li;
+
+    $cl -= $li if $crlf_platform;
+    cmp_ok($cl , "==",  $size,                 "1 size $count")
+        if defined $cl;
+
+    my $msg = 
+     { size   => $size
+     , lines  => $lines
+     , fields => scalar $head->names
+     , sep    => $sep
+     , subject=> $su
+     };
+
+    push @msgs, $msg;
+}
+
+cmp_ok(@msgs, "==", 45);
+$parser->stop;
+
+###
+### Now read the whole folder again, but without help of content-length
+### and nor lines.
+###
+
+undef $parser;
+
+$parser = Mail::Box::Parser::Perl->new(filename => $src);
+$parser->pushSeparator('From ');
+
+my $count = 0;
+while($sep = $parser->readSeparator)
+{   my $msg = $msgs[$count];
+
+    like($sep, qr/^From /,                      "2 from $count");
+
+    $head     = Mail::Message::Head->new->read($parser);
+    ok(defined $head,                           "2 head $count");
+
+    $body = Mail::Message::Body::File->new->read($parser, $head, undef);
+    ok(defined $body,                           "2 body $count");
+
+    my $su    = $head->get('Subject');
+    my $size  = $body->size;
+    my $lines = $body->nrLines;
+
+    cmp_ok($size, "==",  $msg->{size},           "2 size $count");
+    cmp_ok($lines, "==",  $msg->{lines},         "2 lines $count");
+
+    is($su, $msg->{subject},                     "2 subject $count")
+        if defined $su && defined $msg->{subject};
+
+    cmp_ok($head->names , "==",  $msg->{fields}, "2 names $count");
+    is($sep, $msg->{sep},                        "2 sep $count");
+
+    $count++;
+}
+
+$parser->stop;
+
+###
+### Now read the whole folder again, but with deceiving values for
+### content-length and lines
+###
+
+undef $parser;
+
+$parser = Mail::Box::Parser::Perl->new(filename => $src);
+$parser->pushSeparator('From ');
+
+$count = 0;
+while(1)
+{   my ($where, $sep) = $parser->readSeparator;
+    last unless $sep;
+
+    my $msg = $msgs[$count];
+
+    like($sep, qr/^From /,                       "3 From $count");
+
+    $head     = Mail::Message::Head->new->read($parser);
+    ok(defined $head,                            "3 Head $count");
+
+    $body = Mail::Message::Body::File->new;
+    $body->read($parser, $head, undef, $msg->{size}-15, $msg->{lines}-3);
+    ok(defined $body,                            "3 Body $count");
+
+    my $su    = $head->get('Subject');
+    my $size  = $body->size;
+    my $lines = $body->nrLines;
+
+    # two messages contain one trailing blank, which is removed because
+    # of the wrong number of lines.  The will have an extra OK.
+    my $wrong = $count==14 || $count==18;
+
+    cmp_ok($size, '==', $msg->{size},            "3 size $count")
+        unless $wrong;
+
+    cmp_ok($lines, '==', $msg->{lines},          "3 lines $count")
+        unless $wrong;
+
+    is($su, $msg->{subject}, "3 subject $count")
+        if defined $su && defined $msg->{subject};
+
+    cmp_ok($head->names, '==', $msg->{fields},   "3 name $count");
+    is($sep, $msg->{sep},                        "3 sep $count");
+
+    $count++;
+}
+

Added: packages/libmail-box-perl/branches/upstream/current/tests/20pparser/34bodymp.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/20pparser/34bodymp.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/20pparser/34bodymp.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,199 @@
+#!/usr/bin/perl -T
+#
+# Test the reading from file of message bodies which are multiparts
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 313;
+
+use Mail::Box::Parser::Perl;
+use Mail::Message::Body::Lines;
+use Mail::Message::Body::Multipart;
+use Mail::Message::Head;
+
+my $getbodytype = sub {'Mail::Message::Body::Lines'};
+
+###
+### First pass through all messages, with correct data, if available
+###
+
+my $parser = Mail::Box::Parser::Perl->new(filename  => $src);
+ok(defined $parser,                "creation of parser");
+
+$parser->pushSeparator('From ');
+
+my (@msgs, $msgnr);
+
+while(1)
+{   my (undef, $sep) = $parser->readSeparator;
+    last unless $sep;
+
+    $msgnr++;
+    my $count = @msgs;
+    like($sep, qr/^From /,                     "1 from $count");
+
+    my $head = Mail::Message::Head->new;
+    ok(defined $head,                          "1 head count");
+
+    $head->read($parser);
+
+    my $cl    = int $head->get('Content-Length');
+    my $li    = int $head->get('Lines');
+
+    unless($head->isMultipart)
+    {   # Skip non-multipart
+        Mail::Message::Body::Lines->new->read($parser, $head, undef, $cl, $li);
+        next;
+    }
+
+    my $message;
+    my $body = Mail::Message::Body::Multipart->new(message => \$message);
+
+    my $mp = $head->get('Content-Type')->comment;
+    if($mp =~ m/['"](.*?)["']/)
+    {   $body->boundary($1);
+    }
+
+    $body->read($parser, $head, $getbodytype, $cl, $li);
+    ok(defined $body,                          "1 body $count");
+
+    my $size  = $body->size;
+    my $lines = $body->nrLines;
+    my $su    = $head->get('Subject');
+
+    cmp_ok($li , "==",  $lines,                "1 lines $count")
+        if defined $li;
+
+    $cl -= $li if $crlf_platform;
+    cmp_ok($cl , "==",  $size,                 "1 size $count")
+        if defined $cl;
+
+    my $msg = 
+     { size   => $size
+     , lines  => $lines
+     , fields => scalar $head->names
+     , sep    => $sep
+     , subject=> $su
+     };
+
+    push @msgs, $msg;
+}
+
+cmp_ok(@msgs, "==", 3);
+$parser->stop;
+
+###
+### Now read the whole folder again, but without help of content-length
+### and nor lines.
+###
+
+undef $parser;
+
+$parser = Mail::Box::Parser::Perl->new(filename => $src);
+$parser->pushSeparator('From ');
+
+my $count = 0;
+while(1)
+{   my (undef, $sep) = $parser->readSeparator;
+    last unless $sep;
+
+    like($sep, qr/^From /,                      "2 from $count");
+
+    my $head = Mail::Message::Head->new->read($parser);
+    ok(defined $head,                           "2 head $count");
+
+    unless($head->isMultipart)
+    {   # Skip non-multipart
+        Mail::Message::Body::Lines->new->read($parser, $head, undef);
+        next;
+    }
+    my $msg = $msgs[$count];
+
+    my $message;
+    my $body = Mail::Message::Body::Multipart->new(message => \$message);
+    ok(defined $body,                           "2 body $count");
+
+    my $mp = $head->get('Content-Type')->comment;
+    if($mp =~ m/['"](.*?)["']/)
+    {   $body->boundary($1);
+    }
+
+    $body->read($parser, $head, $getbodytype);
+
+    my $su    = $head->get('Subject');
+    my $size  = $body->size;
+    my $lines = $body->nrLines;
+
+    cmp_ok($size, "==",  $msg->{size},           "2 size $count");
+    cmp_ok($lines, "==",  $msg->{lines},         "2 lines $count");
+
+    is($su, $msg->{subject},                     "2 subject $count")
+        if defined $su && defined $msg->{subject};
+
+    cmp_ok($head->names , "==",  $msg->{fields}, "2 names $count");
+    is($sep, $msg->{sep},                        "2 sep $count");
+
+    $count++;
+}
+
+$parser->stop;
+
+###
+### Now read the whole folder again, but with deceiving values for
+### content-length and lines
+###
+
+undef $parser;
+
+$parser = Mail::Box::Parser::Perl->new(filename => $src);
+$parser->pushSeparator('From ');
+
+$count = 0;
+while(1)
+{   my (undef, $sep) = $parser->readSeparator;
+    last unless $sep;
+
+    like($sep, qr/^From /,                       "3 From $count");
+
+    my $head = Mail::Message::Head->new->read($parser);
+    ok(defined $head,                            "3 Head $count");
+
+    unless($head->isMultipart)
+    {   # Skip non-multipart
+        Mail::Message::Body::Lines->new->read($parser, $head, undef);
+        next;
+    }
+
+    my $msg  = $msgs[$count];
+    my $message;
+    my $body = Mail::Message::Body::Multipart->new(message => \$message);
+    ok(defined $body,                            "3 Body $count");
+
+    my $mp = $head->get('Content-Type')->comment;
+    if($mp =~ m/['"](.*?)["']/)
+    {   $body->boundary($1);
+    }
+
+    $body->read($parser, $head, $getbodytype, $msg->{size}-15, $msg->{lines}-3);
+
+    my $su    = $head->get('Subject');
+    my $size  = $body->size;
+    my $lines = $body->nrLines;
+
+    cmp_ok($size, '==', $msg->{size},            "3 size $count");
+    cmp_ok($lines, '==', $msg->{lines},          "3 lines $count");
+
+    is($su, $msg->{subject}, "3 subject $count")
+        if defined $su && defined $msg->{subject};
+
+    cmp_ok($head->names, '==', $msg->{fields},   "3 name $count");
+    is($sep, $msg->{sep},                        "3 sep $count");
+
+    $count++;
+}
+

Added: packages/libmail-box-perl/branches/upstream/current/tests/20pparser/40readmp.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/20pparser/40readmp.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/20pparser/40readmp.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,145 @@
+#!/usr/bin/perl -T
+#
+# Test the reading from file of message bodies which are multiparts
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 66;
+use IO::File;
+
+use Mail::Message;
+
+#
+# From scalar
+#
+
+my $msg1 = Mail::Message->read("Subject: hello world\n\nbody1\nbody2\n");
+ok(defined $msg1);
+is(ref $msg1, 'Mail::Message');
+ok(defined $msg1->head);
+isa_ok($msg1->head, 'Mail::Message::Head');
+
+my $body1 = $msg1->body;
+ok(defined $body1);
+isa_ok($body1, 'Mail::Message::Body');
+ok(!$body1->isDelayed);
+
+cmp_ok(@$body1, "==", 2);
+is($body1->[0], "body1\n");
+is($body1->[1], "body2\n");
+is($msg1->subject, 'hello world');
+ok($msg1->messageId);
+ok($msg1->get('message-id'));
+
+#
+# From ref scalar
+#
+
+my $scalar = "Subject: hello world\n\nbody1\nbody2\n";
+my $msg2 = Mail::Message->read(\$scalar);
+ok(defined $msg2);
+is(ref $msg2, 'Mail::Message');
+ok(defined $msg2->head);
+isa_ok($msg2->head, 'Mail::Message::Head');
+
+my $body2 = $msg2->body;
+ok(defined $body2);
+isa_ok($body2, 'Mail::Message::Body');
+ok(!$body2->isDelayed);
+
+cmp_ok(@$body2, "==", 2);
+is($body2->[0], "body1\n");
+is($body2->[1], "body2\n");
+is($msg2->subject, 'hello world');
+ok($msg2->messageId);
+ok($msg2->get('message-id'));
+
+#
+# From array
+#
+
+my $array = [ "Subject: hello world\n", "\n", "body1\n", "body2\n" ];
+my $msg3 = Mail::Message->read($array);
+ok(defined $msg3);
+is(ref $msg3, 'Mail::Message');
+ok(defined $msg3->head);
+isa_ok($msg3->head, 'Mail::Message::Head');
+
+my $body3 = $msg3->body;
+ok(defined $body3);
+isa_ok($body3, 'Mail::Message::Body');
+ok(!$body3->isDelayed);
+
+cmp_ok(@$body3, "==", 2);
+is($body3->[0], "body1\n");
+is($body3->[1], "body2\n");
+is($msg3->subject, 'hello world');
+ok($msg3->messageId);
+ok($msg3->get('message-id'));
+
+#
+# From file glob
+#
+
+open OUT, '>', 'tmp' or die $!;
+print OUT $scalar;
+close OUT;
+
+open IN, '<', 'tmp' or die $!;
+my $msg4 = Mail::Message->read(\*IN);
+close IN;
+
+ok(defined $msg4);
+is(ref $msg4, 'Mail::Message');
+ok(defined $msg4->head);
+isa_ok($msg4->head, 'Mail::Message::Head');
+
+my $body4 = $msg4->body;
+ok(defined $body4);
+isa_ok($body4, 'Mail::Message::Body');
+ok(!$body4->isDelayed);
+
+cmp_ok(@$body4, "==", 2);
+is($body4->[0], "body1\n");
+is($body4->[1], "body2\n");
+is($msg4->subject, 'hello world');
+ok($msg4->messageId);
+ok($msg4->get('message-id'));
+
+
+#
+# From file handle
+#
+
+open OUT, '>', 'tmp' or die $!;
+print OUT $scalar;
+close OUT;
+
+my $in = IO::File->new('tmp', 'r');
+ok(defined $in);
+my $msg5 = Mail::Message->read($in);
+$in->close;
+
+ok(defined $msg5);
+is(ref $msg5, 'Mail::Message');
+ok(defined $msg5->head);
+isa_ok($msg5->head, 'Mail::Message::Head');
+
+my $body5 = $msg5->body;
+ok(defined $body5);
+isa_ok($body5, 'Mail::Message::Body');
+ok(!$body5->isDelayed);
+
+cmp_ok(@$body5, "==", 2);
+is($body5->[0], "body1\n");
+is($body5->[1], "body2\n");
+is($msg5->subject, 'hello world');
+ok($msg5->messageId);
+ok($msg5->get('message-id'));
+
+unlink 'tmp';

Added: packages/libmail-box-perl/branches/upstream/current/tests/20pparser/50nested.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/20pparser/50nested.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/20pparser/50nested.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,97 @@
+#!/usr/bin/perl -T
+#
+# Test processing a message/rfc822
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 2;
+use IO::Scalar;
+
+use Mail::Message;
+
+#
+# Reading a very complicate message from scalar
+#
+
+my $msg = Mail::Message->read(<<'END-OF-MESSAGE');
+From: "you" <You at your.place>
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="3/Cnt5Mj2+"
+Content-Transfer-Encoding: 7bit
+Message-ID: <15375.28519.265629.832146 at tradef1-fe>
+Date: Thu, 6 Dec 2001 14:15:19 +0100 (MET)
+To: me at example.com
+Subject: forwarded message from Pietje Puk
+Status: RO
+
+--3/Cnt5Mj2+
+Content-Type: text/plain; charset=us-ascii
+Content-Description: message body text
+Content-Transfer-Encoding: 7bit
+
+This is some text before a forwarded multipart!!
+
+--3/Cnt5Mj2+
+Content-Type: message/rfc822
+Content-Description: forwarded message
+Content-Transfer-Encoding: 7bit
+
+MIME-Version: 1.0
+Content-Type: multipart/alternative;
+	boundary="----=_NextPart_000_0017_01C17E5E.A5657580"
+Message-ID: <001a01c17e56$5fc02640$5f23643e at ibm5522ccd>
+From: "Someone" <tux at fish.aq>
+To: "Me" <me at example.com>
+Subject: A multipart alternative
+
+This is a multi-part message in MIME format.
+
+------=_NextPart_000_0017_01C17E5E.A5657580
+CONTENT-TRANSFER-ENCODING: quoted-printable
+Content-Type: text/plain;
+	charset="iso-8859-1"
+
+Send me a postcard if you read this.
+Oh, another line.
+
+------=_NextPart_000_0017_01C17E5E.A5657580
+CONTENT-TRANSFER-ENCODING: quoted-printable
+Content-Type: text/html;
+	charset="iso-8859-1"
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML><HEAD>
+<META http-equiv=3DContent-Type content=3D"text/html; =
+charset=3Diso-8859-1">
+</HEAD>
+<BODY bgColor=3D#ffffff>
+Send me a postcard if you read this.<BR>
+Oh, another line.<BR>
+</BODY></HTML>
+
+------=_NextPart_000_0017_01C17E5E.A5657580--
+
+--3/Cnt5Mj2+--
+END-OF-MESSAGE
+
+ok(defined $msg);
+
+my $dump;
+my $catch   = IO::Scalar->new(\$dump);
+$msg->printStructure($catch);
+
+# if 1550 bytes is reported for the whole message, then the Status
+# field hasn't been removed after reading.
+is($dump, <<'DUMP');
+multipart/mixed: forwarded message from Pietje Puk (1539 bytes)
+   text/plain (164 bytes)
+   message/rfc822 (1043 bytes)
+      multipart/alternative: A multipart alternative (942 bytes)
+         text/plain (148 bytes)
+         text/html (358 bytes)
+DUMP

Added: packages/libmail-box-perl/branches/upstream/current/tests/20pparser/Definition.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/20pparser/Definition.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/20pparser/Definition.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,8 @@
+
+package MailBox::Test::20pparser::Definition;
+
+sub name     {"Mail::Box::Parser::Perl; parser in pure perl"}
+sub critical {1}
+sub skip     { undef }
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/tests/30encode/10base64.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/30encode/10base64.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/30encode/10base64.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,60 @@
+#!/usr/bin/perl -T
+#
+# Encoding and Decoding of Base64
+# Could use some more tests....
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 11;
+
+use Mail::Message::Body::Lines;
+use Mail::Message::TransferEnc::Base64;
+
+my $decoded = <<DECODED;
+This text is used to test base64 encoding and decoding.  Let
+see whether it works.
+DECODED
+
+my $encoded = <<ENCODED;
+VGhpcyB0ZXh0IGlzIHVzZWQgdG8gdGVzdCBiYXNlNjQgZW5jb2RpbmcgYW5kIGRlY29kaW5nLiAg
+TGV0CnNlZSB3aGV0aGVyIGl0IHdvcmtzLgo=
+ENCODED
+
+my $codec = Mail::Message::TransferEnc::Base64->new;
+ok(defined $codec);
+is($codec->name, 'base64');
+
+# Test encoding
+
+my $body   = Mail::Message::Body::Lines->new
+  ( mime_type => 'text/html'
+  , data      => $decoded
+  );
+
+is($body->mimeType, 'text/html');
+
+my $enc    = $codec->encode($body);
+ok($body!=$enc);
+is($enc->mimeType, 'text/html');
+is($enc->transferEncoding, 'base64');
+is($enc->string, $encoded);
+
+# Test decoding
+
+$body   = Mail::Message::Body::Lines->new
+  ( transfer_encoding => 'base64'
+  , mime_type         => 'text/html'
+  , data              => $encoded
+  );
+
+my $dec = $codec->decode($body);
+ok($dec!=$body);
+is($enc->mimeType, 'text/html');
+is($dec->transferEncoding, 'none');
+is($dec->string, $decoded);
+

Added: packages/libmail-box-perl/branches/upstream/current/tests/30encode/20eight.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/30encode/20eight.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/30encode/20eight.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,45 @@
+#!/usr/bin/perl -T
+#
+# Encoding and Decoding of 8bit
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 6;
+
+use Mail::Message::Body::Lines;
+use Mail::Message::TransferEnc::EightBit;
+
+my $decoded = <<DECODED;
+yefoiuhéòsjhkw284ÊÈÓUe\000iouoi\013wei
+sdfulÓÈËäjlkjliua\000aba
+DECODED
+
+my $encoded = <<ENCODED;
+yefoiuhéòsjhkw284ÊÈÓUeiouoiwei
+sdfulÓÈËäjlkjliuaaba
+ENCODED
+
+my $codec = Mail::Message::TransferEnc::EightBit->new;
+ok(defined $codec);
+is($codec->name, '8bit');
+
+# Test encoding
+
+my $body   = Mail::Message::Body::Lines->new
+  ( mime_type => 'text/html'
+  , data      => $decoded
+  );
+
+my $enc    = $codec->encode($body);
+ok($body!=$enc);
+is($enc->mimeType, 'text/html');
+is($enc->transferEncoding, '8bit');
+is($enc->string, $encoded);
+
+# Test decoding
+

Added: packages/libmail-box-perl/branches/upstream/current/tests/30encode/30quoted.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/30encode/30quoted.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/30encode/30quoted.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,62 @@
+#!/usr/bin/perl -T
+#
+# Encoding and Decoding quoted-print bodies
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 10;
+
+use Mail::Message::Body::Lines;
+use Mail::Message::TransferEnc::QuotedPrint;
+
+my $src = <<SRC;
+In the source text, there are a few \010\r strange characters,
+which \200\201 must become encoded.  There is also a \010== long line, which must be broken into pieces, and
+there are = confusing constructions like this one: =0D, which looks
+encoded, but is not.
+SRC
+
+my $encoded = <<ENCODED;
+In the source text, there are a few =08=0D strange characters,
+which =80=81 must become encoded.  There is also a =08=3D=3D long line, whi=
+ch must be broken into pieces, and
+there are =3D confusing constructions like this one: =3D0D, which looks
+encoded, but is not.
+ENCODED
+
+my $codec = Mail::Message::TransferEnc::QuotedPrint->new;
+ok(defined $codec);
+is($codec->name, 'quoted-printable');
+
+# Test encoding
+
+my $body   = Mail::Message::Body::Lines->new
+  ( mime_type => 'text/html'
+  , data      => $src
+  );
+
+my $enc    = $codec->encode($body);
+ok($body!=$enc);
+is($enc->mimeType, 'text/html');
+is($enc->transferEncoding, 'quoted-printable');
+is($enc->string, $encoded);
+
+# Test decoding
+
+$body   = Mail::Message::Body::Lines->new
+  ( transfer_encoding => 'quoted-printable'
+  , mime_type         => 'text/html'
+  , data              => $encoded
+  );
+
+my $dec = $codec->decode($body);
+ok($dec!=$body);
+is($enc->mimeType, 'text/html');
+is($dec->transferEncoding, 'none');
+is($dec->string, $src);
+

Added: packages/libmail-box-perl/branches/upstream/current/tests/30encode/40seven.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/30encode/40seven.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/30encode/40seven.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,45 @@
+#!/usr/bin/perl -T
+#
+# Encoding and Decoding of 7bit
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 6;
+
+use Mail::Message::Body::Lines;
+use Mail::Message::TransferEnc::SevenBit;
+
+my $decoded = <<DECODED;
+yefoiuhéòsjhkw284ÊÈÓUe\000iouoi\013wei
+sdfulÓÈËäjlkjliua\000aba
+DECODED
+
+my $encoded = <<ENCODED;
+yefoiuhirsjhkw284JHSUeiouoiwei
+sdfulSHKdjlkjliuaaba
+ENCODED
+
+my $codec = Mail::Message::TransferEnc::SevenBit->new;
+ok(defined $codec);
+is($codec->name, '7bit');
+
+# Test encoding
+
+my $body   = Mail::Message::Body::Lines->new
+  ( mime_type => 'text/html'
+  , data      => $decoded
+  );
+
+my $enc    = $codec->encode($body);
+ok($body!=$enc);
+is($enc->mimeType, 'text/html');
+is($enc->transferEncoding, '7bit');
+is($enc->string, $encoded);
+
+# Test decoding
+

Added: packages/libmail-box-perl/branches/upstream/current/tests/30encode/90body.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/30encode/90body.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/30encode/90body.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,71 @@
+#!/usr/bin/perl -T
+#
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 13;
+use IO::Scalar;
+
+use Mail::Message;
+use Mail::Message::Body::Lines;
+use Mail::Message::TransferEnc::Base64;
+
+my $decoded = <<DECODED;
+This text is used to test base64 encoding and decoding.  Let
+see whether it works.
+DECODED
+
+my $encoded = <<ENCODED;
+VGhpcyB0ZXh0IGlzIHVzZWQgdG8gdGVzdCBiYXNlNjQgZW5jb2RpbmcgYW5kIGRlY29kaW5nLiAg
+TGV0CnNlZSB3aGV0aGVyIGl0IHdvcmtzLgo=
+ENCODED
+
+my $body   = Mail::Message::Body::Lines->new
+  ( mime_type => 'text/html'
+  , transfer_encoding => 'base64'
+  , data      => $encoded
+  );
+
+ok(defined $body);
+
+my $dec = $body->encode(transfer_encoding => 'none');
+ok(defined $dec);
+isa_ok($dec, 'Mail::Message::Body');
+ok(!$dec->checked);
+is($dec->string, $decoded);
+is($dec->transferEncoding, 'none');
+
+my $enc = $dec->encode(transfer_encoding => '7bit');
+ok(defined $enc);
+isa_ok($enc, 'Mail::Message::Body');
+ok(!$enc->checked);
+is($enc->string, $decoded);
+
+my $msg = Mail::Message->buildFromBody($enc, From => 'me', To => 'you',
+   Date => 'now', 'Message-Id' => '<simple>');
+ok($msg);
+ok($msg->body->checked);
+
+my $fakeout;
+my $g = IO::Scalar->new(\$fakeout);
+$msg->print($g);
+
+compare_message_prints($fakeout, <<'MSG', 'build from body');
+From: me
+To: you
+Date: now
+Message-Id: <simple>
+Content-Type: text/html
+Content-Length: 83
+Lines: 2
+Content-Transfer-Encoding: 7bit
+MIME-Version: 1.0
+
+This text is used to test base64 encoding and decoding.  Let
+see whether it works.
+MSG

Added: packages/libmail-box-perl/branches/upstream/current/tests/30encode/Definition.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/30encode/Definition.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/30encode/Definition.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,8 @@
+
+package MailBox::Test::30encode::Definition;
+
+sub name     {"Mail::Message::TransferEnc; transfer encodings"}
+sub critical {0}
+sub skip     { undef }
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/tests/31fgroups/10resent.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/31fgroups/10resent.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/31fgroups/10resent.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,149 @@
+#!/usr/bin/perl -T
+#
+# Test the processing of resent groups.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 26;
+use IO::Scalar;
+
+use Mail::Message::Head::ResentGroup;
+use Mail::Message::Head::Complete;
+
+#
+# Creation of a group
+#
+
+my $h = Mail::Message::Head::Complete->new;
+ok(defined $h);
+
+my $rg = Mail::Message::Head::ResentGroup->new
+ ( head     => $h
+ , From     => 'the.rg.group at example.com'
+ , Received => 'obligatory field'
+ );
+
+ok(defined $rg);
+isa_ok($rg, 'Mail::Message::Head::ResentGroup');
+
+my @fn = $rg->fieldNames;
+cmp_ok(scalar(@fn), '==', 2,           "Two fields");
+is($fn[0], 'Received');
+is($fn[1], 'Resent-From');
+
+{  my $from = $rg->from;
+   ok(ref $from);
+   isa_ok($from, 'Mail::Message::Field');
+   is($from->name, 'resent-from');
+}
+
+#
+# Interaction with a header
+#
+
+
+$h->add(From => 'me');
+$h->add(To => 'you');
+$h->addResentGroup($rg);
+
+{  my $output;
+   my $fh = IO::Scalar->new(\$output);
+   $h->print($fh);
+   $fh->close;
+
+   is($output, <<'EXPECTED');
+From: me
+To: you
+Received: obligatory field
+Resent-From: the.rg.group at example.com
+
+EXPECTED
+
+}
+
+my $rg2 = $h->addResentGroup
+ ( Received => 'now or never'
+ , Cc            => 'cc to everyone'
+ , Bcc           => 'undisclosed'
+ , 'Return-Path' => 'Appears before everything else'
+ , 'Message-ID'  => '<my own id>'
+ , Sender        => 'do not believe it'
+ , From          => 'should be added'
+ , To            => 'just to check every single field'
+ );
+
+ok(defined $rg2);
+ok(ref $rg2);
+isa_ok($rg2, 'Mail::Message::Head::ResentGroup');
+
+{  my $output;
+   my $fh = IO::Scalar->new(\$output);
+   $h->print($fh);
+   $fh->close;
+
+   is($output, <<'EXPECTED');
+From: me
+To: you
+Return-Path: Appears before everything else
+Received: now or never
+Resent-From: should be added
+Resent-Sender: do not believe it
+Resent-To: just to check every single field
+Resent-Cc: cc to everyone
+Resent-Bcc: undisclosed
+Resent-Message-ID: <my own id>
+Received: obligatory field
+Resent-From: the.rg.group at example.com
+
+EXPECTED
+}
+
+my $h2 = $h->clone;
+ok(defined $h2);
+isa_ok($h2, 'Mail::Message::Head::Complete');
+
+{  my @rgs = $h2->resentGroups;
+   cmp_ok(@rgs, '==', 2);
+   ok(defined $rgs[0]);
+   ok(ref $rgs[0]);
+   ok($rgs[0]->isa('Mail::Message::Head::ResentGroup'));
+
+   my $rg1 = $rgs[0];
+   is($rg1->messageId, '<my own id>');
+
+   my @of  = $rg1->orderedFields;
+   cmp_ok(@of, '==', 8);
+
+   @of     = $rgs[1]->orderedFields;
+   cmp_ok(@of, '==', 2);
+
+   # Now delete, and close scope to avoid accidental reference to
+   # fields which should get cleaned-up.
+   $rgs[0]->delete;
+}
+
+{  my @rgs = $h2->resentGroups;
+   cmp_ok(@rgs, '==', 1);
+
+   my @of  = $rgs[0]->orderedFields;
+   cmp_ok(@of, '==', 2);
+
+   my $output;
+   my $fh = IO::Scalar->new(\$output);
+   $h2->print($fh);
+   $fh->close;
+
+   is($output, <<'EXPECTED');
+From: me
+To: you
+Received: obligatory field
+Resent-From: the.rg.group at example.com
+
+EXPECTED
+
+}

Added: packages/libmail-box-perl/branches/upstream/current/tests/31fgroups/20list.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/31fgroups/20list.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/31fgroups/20list.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,242 @@
+#!/usr/bin/perl -T
+#
+# Test the processing of list groups.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More;
+use IO::Scalar;
+use File::Spec;
+
+use Mail::Message::Head::Complete;
+use Mail::Message;
+use Mail::Box::Mbox;
+
+BEGIN {
+   if($] < 5.007003)
+   {   plan skip_all => "Requires module Encode, which requires Perl 5.7.3";
+       exit 0;
+   }
+
+   eval 'require Mail::Message::Head::ListGroup';
+   if($@)
+   {   plan skip_all => 'Extended attributes not available (install Encode?)';
+       exit 0;
+   }
+   else
+   {   plan tests => 119;
+   }
+}
+
+#
+# Creation of a group
+#
+
+my $mailbox = '"Mail::Box development" <mailbox at perl.overmeer.net>';
+my $lg0 = Mail::Message::Head::ListGroup->new(address => $mailbox);
+
+ok(defined $lg0,                         'simple construction');
+my $addr = $lg0->address;
+
+ok(defined $addr,                        'address defined');
+isa_ok($addr, 'Mail::Message::Field::Address');
+is($addr->phrase, 'Mail::Box development');
+is($lg0->listname, 'Mail::Box development');
+is($addr->address, 'mailbox at perl.overmeer.net');
+is("$addr", $mailbox);
+is($lg0->address->string, $mailbox);
+
+ok(!defined $lg0->type);
+ok(!defined $lg0->software);
+ok(!defined $lg0->version);
+ok(!defined $lg0->rfc);
+
+#
+# Extraction of a group
+#
+
+my $h = Mail::Message::Head::Complete->new;
+ok(defined $h);
+
+my $lg = Mail::Message::Head::ListGroup->from($h);
+ok(!defined $lg,                     "no listgroup in empty header");
+
+#
+# Open folder with example messages
+#
+
+my $fn = 'mlfolder';
+$fn = File::Spec->catfile('31fgroups', $fn) unless -f $fn;
+$fn = File::Spec->catfile('tests', $fn)  unless -f $fn;
+die "Cannot find file with mailinglist examples ($fn)" unless -f $fn;
+
+my $folder = Mail::Box::Mbox->new(folder => $fn, extract => 'ALWAYS');
+ok(defined $folder,                   "open example folder");
+die unless defined $folder;
+
+my @msgs   = $folder->messages;
+my @expect =
+ ( {
+   }
+ , { type    => 'Mailman'
+   , version => '2.0rc1'
+   , address => 'templates at template-toolkit.org'
+   , listname=> 'templates'
+   , details => 'Mailman at templates at template-toolkit.org (2.0rc1), 11 fields'
+   , rfc     => 'rfc2369'
+   }
+ , { type    => 'Ezmlm'
+   , software=> undef
+   , version => undef
+   , address => 'perl5-porters at perl.org'
+   , listname=> 'perl5-porters'
+   , details => 'Ezmlm at perl5-porters at perl.org, 6 fields'
+   , rfc     => 'rfc2369'
+   }
+ , { type    => 'Smartlist'
+   , software=> undef
+   , version => undef
+   , address => 'debian-devel at lists.debian.org'
+   , listname=> 'debian-devel'
+   , details => 'Smartlist at debian-devel at lists.debian.org, 12 fields'
+   , rfc     => undef
+   }
+ , { type    => 'Majordomo'
+   , software=> undef
+   , version => undef
+   , address => 'london-pm at lists.dircon.co.uk'
+   , listname=> 'london-pm'
+   , details => 'Majordomo at london-pm at lists.dircon.co.uk, 2 fields'
+   , rfc     => undef
+   }
+ , { type    => 'Sympa'
+   , software=> undef
+   , version => undef
+   , address => 'noustestons at cru.fr'
+   , listname=> 'noustestons'
+   , details => 'Sympa at noustestons at cru.fr, 9 fields'
+   , rfc     => 'rfc2369'
+   }
+ , { type    => 'Listar'
+   , software=> 'Listar'
+   , version => 'v0.129a'
+   , address => 'adm at oasys.net'
+   , listname=> 'adm'
+   , details => 'Listar at adm at oasys.net (v0.129a), 8 fields'
+   , rfc     => undef
+   }
+ , { type    => 'YahooGroups'
+   , software=> undef
+   , version => undef
+   , address => 'ryokoforever at yahoogroups.com'
+   , listname=> 'ryokoforever'
+   , details => 'YahooGroups at ryokoforever at yahoogroups.com, 7 fields'
+   , rfc     => undef
+   }
+ , { type    => 'Mailman'
+   , software=> undef
+   , version => '2.0.1'
+   , address => 'London.pm Perl M[ou]ngers <london-pm at london.pm.org>'
+   , listname=> 'London.pm Perl M[ou]ngers <london.pm.london.pm.org>'
+   , details => 'Mailman at london.pm at london.pm.org (2.0.1), 6 fields'
+   , rfc     => 'rfc2919'
+   }
+ , { type    => 'Ecartis'
+   , software=> 'Ecartis'
+   , version => 'v1.0.0'
+   , address => 'adm at oasys.net'
+   , listname=> 'adm'
+   , details => 'Ecartis at adm at oasys.net (v1.0.0), 7 fields'
+   , rfc     => undef
+   }
+ , { type    => 'CommuniGatePro'
+   , software=> 'CommuniGate Pro'
+   , version => '4.0.6'
+   , address => 'Mail-ListDetector at gunzel.org'
+   , listname=> 'Mail-ListDetector.gunzel.org'
+   , details => 'CommuniGatePro at Mail-ListDetector at gunzel.org (CommuniGate Pro 4.0.6), 4 fields'
+   , rfc     => 'rfc2919'
+   }
+ , { type    => 'FML'
+   , software=> 'fml'
+   , version => '4.0 STABLE (20010208)'
+   , address => 'mlname at domain.example.com'
+   , listname=> 'mlname'
+   , details => 'FML at mlname at domain.example.com (fml 4.0 STABLE (20010208)), 10 fields'
+   , rfc     => 'rfc2369'
+   }
+ , { type    => 'FML'
+   , software=> 'fml'
+   , version => '4.0 STABLE (20010218)'
+   , address => 'Announce at mldetector.gr.jp'
+   , listname=> 'Announce'
+   , details => 'FML at Announce at mldetector.gr.jp (fml 4.0 STABLE (20010218)), 6 fields'
+   , rfc     => undef
+   }
+ , { type    => 'Listbox'             # based on sending address (old)
+   , software=> undef
+   , version => undef
+   , address => 'sample at v2.listbox.com'
+   , listname=> 'sample'
+   , details => 'Listbox at sample at v2.listbox.com, 5 fields'
+   , rfc     => 'rfc2919'
+   }
+ , { type    => 'Listbox'             # based on List-Software
+   , software=> 'listbox.com'
+   , version => 'v2.0'
+   , address => 'sample at v2.listbox.com'
+   , listname=> 'sample'
+   , details => 'Listbox at sample at v2.listbox.com (listbox.com v2.0), 6 fields'
+   , rfc     => 'rfc2919'
+   }
+ , { type    => 'Listserv'
+   , software=> 'LISTSERV-TCP/IP'
+   , version => '1.8e'
+   , address => '"EXAMPLE Discussion" <EXAMPLE at LISTSERV.EXAMPLE.COM>'
+   , listname=> 'EXAMPLE Discussion'
+   , details => 'Listserv at "EXAMPLE Discussion" <EXAMPLE at LISTSERV.EXAMPLE.COM> (LISTSERV-TCP/IP 1.8e), 1 fields'
+   , rfc     => undef
+   }
+ , { type    => 'Listserv'
+   , software=> 'LISTSERV-TCP/IP'
+   , version => '1.8d'
+   , address => '"Comedy Company" <COCO at LISTSERV.EXAMPLE.COM>'
+   , listname=> 'Comedy Company'
+   , details => 'Listserv at "Comedy Company" <COCO at LISTSERV.EXAMPLE.COM> (LISTSERV-TCP/IP 1.8d), 1 fields'
+   , rfc     => undef
+   }
+ , { type    => 'CommuniGate'
+   , software=> 'CommuniGate'
+   , version => '1.4'
+   , address => '<CGnet at total.example.com> (CGnet)'
+   , listname=> 'CGnet'
+   , details => 'CommuniGate at CGnet at total.example.com (1.4), 1 fields'
+   , rfc     => undef
+   }
+ );
+
+cmp_ok(scalar @msgs, '==', @expect,         "all messages");
+
+for(my $nr = 0; $nr < @msgs; $nr++)
+{  my $msg = $msgs[$nr];
+   my %exp = %{$expect[$nr]};
+
+   my $lg = $msg->head->listGroup;
+   if(! defined $lg)
+   {   ok(keys %exp == 0,                   "msg $nr is non-list message");
+       next;
+   }
+   isa_ok($lg, 'Mail::Message::Head::ListGroup', "msg $nr from $exp{type}");
+
+   is($lg->details, $exp{details},          "$nr details");
+   is($lg->type, $exp{type},                "$nr type");
+   is($lg->software, $exp{software},        "$nr software");
+   is($lg->version, $exp{version},          "$nr version");
+   is($lg->rfc, $exp{rfc},                  "$nr rfc");
+}
+

Added: packages/libmail-box-perl/branches/upstream/current/tests/31fgroups/30spam.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/31fgroups/30spam.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/31fgroups/30spam.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,127 @@
+#!/usr/bin/perl -T
+#
+# Test the processing of spam groups.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use File::Spec;
+use Test::More tests => 75;
+
+use Mail::Message::Head::Complete;
+use Mail::Message::Head::SpamGroup;
+use Mail::Box::Mbox;
+
+#
+# Creation of a group
+#
+
+my $sg = Mail::Message::Head::SpamGroup->new;
+
+ok(defined $sg,                           'simple construction');
+isa_ok($sg, 'Mail::Message::Head::SpamGroup');
+
+#
+# Extraction of a group
+#
+
+my $h = Mail::Message::Head::Complete->new;
+ok(defined $h);
+
+my @sgs = Mail::Message::Head::SpamGroup->from($h);
+ok(!@sgs,                                 "no spamgroups in empty header");
+
+#
+# Open folder with example messages
+#
+
+my $fn = 'sgfolder';
+$fn = File::Spec->catfile('31fgroups', $fn) unless -f $fn;
+$fn = File::Spec->catfile('tests', $fn)  unless -f $fn;
+die "Cannot find file with spam filter examples ($fn)" unless -f $fn;
+
+my $folder = Mail::Box::Mbox->new(folder => $fn, extract => 'ALWAYS');
+ok(defined $folder,                   "open example folder");
+die unless defined $folder;
+
+my @msgs   = $folder->messages;
+cmp_ok(scalar(@msgs), '==', 11,        "all expected messages present");
+
+for(my $nr=0; $nr<5; $nr++)
+{  my $msg = $folder->message($nr);
+   my @sgs = $msg->head->spamGroups;
+
+   cmp_ok(scalar(@sgs), '==', 1,      "spam group at $nr");
+   
+   my $sg = $sgs[0];
+   is($sg->type, "SpamAssassin");
+
+   $sg->delete;
+
+   @sgs   = $msg->head->spamGroups;
+   cmp_ok(scalar(@sgs), '==', 0,      "spam group $nr removed");
+}
+
+for(my $nr=5; $nr<10; $nr++)
+{   my $msg  = $folder->message($nr);
+    my $head = $msg->head;
+
+    my @sgs = $head->spamGroups;
+    cmp_ok(scalar(@sgs), '==', 1,      "spam group at $nr");
+    my $sg0 = $sgs[0];
+    is($sg0->type, "Habeas-SWE");
+
+    my $sg  = $msg->head->spamGroups('Habeas-SWE');
+    ok(defined $sg);
+    is($sg->type, "Habeas-SWE");
+
+    my $is_correct = ($nr==5 || $nr==6) ? 1 : undef;
+    cmp_ok($sg->habeasSweFieldsCorrect, '==', $is_correct, "spam in $nr");
+
+    cmp_ok( Mail::Message::Head::SpamGroup->habeasSweFieldsCorrect($msg)
+          , '==', $is_correct,          "spam in message $nr");
+
+    cmp_ok(Mail::Message::Head::SpamGroup->habeasSweFieldsCorrect($head)
+          , '==', $is_correct,          "spam in head of message $nr");
+
+    $sg->delete;
+
+    @sgs   = $msg->head->spamGroups;
+    cmp_ok(scalar(@sgs), '==', 0,       "spam group $nr removed");
+}
+
+my $msg  = $folder->message(10);
+my $head = $msg->head;
+ok(Mail::Message::Head::SpamGroup->habeasSweFieldsCorrect($msg));
+ok(Mail::Message::Head::SpamGroup->habeasSweFieldsCorrect($head));
+
+ at sgs     = sort {$a->type cmp $b->type} $head->spamGroups;
+cmp_ok(scalar(@sgs), '==', 2,           "message 11 with 2 groups");
+
+is($sgs[0]->type, 'Habeas-SWE');
+ok($sgs[0]->habeasSweFieldsCorrect);
+is($sgs[1]->type, 'SpamAssassin');
+
+my $sgs  = $head->spamGroups;
+cmp_ok($sgs, '==', 2,                   "scalar context = amount");
+
+my $sa   = $head->spamGroups('SpamAssassin');
+ok(defined $sa,                         "found spam assassin group");
+
+my $swe  = $head->spamGroups('Habeas-SWE');
+ok($swe->habeasSweFieldsCorrect);
+ok(defined $swe,                        "found habeas-swe group");
+
+$sa->delete;
+ at sgs     = $head->spamGroups;
+cmp_ok(scalar(@sgs), '==', 1,           "message 11 still 1 group");
+is($sgs[0]->type, 'Habeas-SWE');
+ok($sgs[0]->habeasSweFieldsCorrect);
+
+$swe->delete;
+ at sgs     = $head->spamGroups;
+cmp_ok(scalar(@sgs), '==', 0,           "message 11 without spam group");

Added: packages/libmail-box-perl/branches/upstream/current/tests/31fgroups/Definition.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/31fgroups/Definition.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/31fgroups/Definition.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,8 @@
+
+package MailBox::Test::31fgroups::Definition;
+
+sub name     {"Mail::Message::Head::FieldGroup; grouping fields"}
+sub critical {0}
+sub skip     { undef }
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/tests/31fgroups/mlfolder
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/31fgroups/mlfolder	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/31fgroups/mlfolder	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,1054 @@
+From root at home.etla.org Sat Jan 20 13:37:58 2001
+Envelope-to: usenet at home.etla.org
+Received: from root by pool.home.etla.org with local (Exim 3.12 #1 (Debian))
+	id 14JyDO-00006n-00
+	for <usenet at home.etla.org>; Sat, 20 Jan 2001 13:37:58 +0000
+To: usenet at home.etla.org
+Subject: innwatch warning: messages in /var/log/news/news.crit
+Message-Id: <E14JyDO-00006n-00 at pool.home.etla.org>
+From: root <root at home.etla.org>
+Date: Sat, 20 Jan 2001 13:37:58 +0000
+Status: RO
+Content-Length: 1824
+Lines: 34
+
+-rw-r--r--    1 root     news         1550 Jan 19 21:51 /var/log/news/news.crit
+-----
+Server running
+Allowing remote connections
+Parameters c 14 i 50 (0) l 1000000 o 1011 t 300 H 2 T 60 X 0 normal specified
+Not reserved
+Readers separate enabled
+Perl filtering enabled
+-----
+Nov  7 23:37:27 pool innd: SERVER shutdown received signal 15
+Nov  7 23:40:13 pool innd: SERVER shutdown received signal 15
+Nov  8 00:02:11 pool innd: SERVER shutdown received signal 15
+Nov  8 01:07:00 pool innd: SERVER shutdown received signal 15
+Nov  9 23:37:20 pool innd: SERVER shutdown received signal 15
+Nov 10 23:37:26 pool innd: SERVER shutdown received signal 15
+Nov 12 01:35:44 pool innd: SERVER shutdown received signal 15
+Nov 12 19:24:33 pool innd: SERVER shutdown received signal 15
+Nov 12 23:33:52 pool innd: SERVER shutdown received signal 15
+Nov 13 23:05:11 pool innd: SERVER shutdown received signal 15
+Nov 14 22:09:04 pool innd: SERVER shutdown received signal 15
+Nov 15 22:52:53 pool innd: SERVER shutdown received signal 15
+Nov 18 14:31:53 pool innd: SERVER shutdown received signal 15
+Nov 23 07:44:13 pool innd: SERVER shutdown received signal 15
+Nov 24 08:11:38 pool innd: SERVER shutdown received signal 15
+Nov 29 23:42:48 pool innd: SERVER shutdown received signal 15
+Dec 17 18:07:43 pool innd: SERVER shutdown received signal 15
+Dec 17 22:47:32 pool innd: SERVER shutdown received signal 15
+Dec 23 15:50:30 pool innd: SERVER shutdown received signal 15
+Jan 14 12:41:56 pool innd: SERVER shutdown received signal 15
+Jan 14 12:45:33 pool innd: SERVER shutdown received signal 15
+Jan 15 01:09:26 pool innd: SERVER shutdown received signal 15
+Jan 17 23:42:55 pool innd: SERVER shutdown received signal 15
+Jan 18 22:35:34 pool innd: SERVER shutdown received signal 15
+Jan 19 21:51:19 pool innd: SERVER shutdown received signal 15
+
+From templates-admin at template-toolkit.org Tue Nov 28 21:17:30 2000
+Envelope-to: mstevens at firedrake.org
+Received: from trinity.fluff.org [194.153.168.225] (mail)
+	by dayspring.firedrake.org with esmtp (Exim 3.12 #1 (Debian))
+	id 140s82-0007x1-00; Tue, 28 Nov 2000 21:17:30 +0000
+Received: from www.ourshack.com (dog.ourshack.com) [212.74.28.146] 
+	by trinity.fluff.org helo dog.ourshack.com with esmtp (Exim 3.12)
+	id 140s81-0003hh-00 for michael at etla.org
+	; Tue, 28 Nov 2000 21:17:29 +0000
+Received: from localhost.ourshack.com ([127.0.0.1] helo=dog.ourshack.com)
+	by dog.ourshack.com with esmtp (Exim 3.16 #1)
+	id 140t7Y-000KE6-00; Tue, 28 Nov 2000 22:21:04 +0000
+Received: from dayspring.firedrake.org ([195.82.105.251] ident=mail)
+	by dog.ourshack.com with esmtp (Exim 3.16 #1)
+	id 140t6i-000KDq-00
+	for templates at template-toolkit.org; Tue, 28 Nov 2000 22:20:12 +0000
+Received: from mstevens by dayspring.firedrake.org with local (Exim 3.12 #1 (Debian))
+	id 140s6M-0007sK-00; Tue, 28 Nov 2000 21:15:46 +0000
+From: Michael Stevens <michael at etla.org>
+To: templates at template-toolkit.org
+Message-ID: <20001128211546.A29664 at firedrake.org>
+Mail-Followup-To: templates at template-toolkit.org
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+User-Agent: Mutt/1.2.5i
+Subject: [Templates] ttree problems - the sequel
+Sender: templates-admin at template-toolkit.org
+Errors-To: templates-admin at template-toolkit.org
+X-BeenThere: templates at template-toolkit.org
+X-Mailman-Version: 2.0rc1
+Precedence: bulk
+List-Help: <mailto:templates-request at template-toolkit.org?subject=help>
+List-Post: <mailto:templates at template-toolkit.org>
+List-Subscribe: <http://www.template-toolkit.org/mailman/listinfo/templates>,
+	<mailto:templates-request at template-toolkit.org?subject=subscribe>
+List-Id: Template Toolkit mailing list <templates.template-toolkit.org>
+List-Unsubscribe: <http://www.template-toolkit.org/mailman/listinfo/templates>,
+	<mailto:templates-request at template-toolkit.org?subject=unsubscribe>
+List-Archive: <http://www.template-toolkit.org/pipermail/templates/>
+Date: Tue, 28 Nov 2000 21:15:46 +0000
+Status: RO
+
+Hi.
+  I finally had time to debug my problems with pre_process and ttree
+in more detail.
+
+It turned out that ttree thinks PRE_PROCESS and POST_PROCESS are
+multiple value fields, so it returns the values supplied for them as arrays,
+eg
+
+  pre_process = foo:bar
+
+is sent to Template as PRE_PROCESS => [ 'foo:bar' ]. The delimiter splitting
+routines in Template::Service only split up if values are scalars rather
+than array references, so it wasn't getting split, and therefore it tried
+to pre_process the file 'foo:bar'.
+
+ttree learnt that those two fields were arrays sometime between beta5 and
+rc2, I'm not sure why.
+
+One fix, as far as I can tell, is to apply this patch:
+
+--cut here for patch--
+diff -urN Template-Toolkit-2.00-rc2.orig/bin/ttree Template-Toolkit-2.00-rc2/bin/ttree
+--- Template-Toolkit-2.00-rc2.orig/bin/ttree	Tue Nov 28 20:56:28 2000
++++ Template-Toolkit-2.00-rc2/bin/ttree	Tue Nov 28 20:57:18 2000
+@@ -324,8 +324,8 @@
+ 	'template_pre_chomp|pre_chomp|prechomp',
+ 	'template_post_chomp|post_chomp|postchomp',
+ 	'template_trim|trim',
+-        'template_pre_process|pre_process|preprocess=s@',
+-        'template_post_process|post_process|postprocess=s@',
++        'template_pre_process|pre_process|preprocess=s',
++        'template_post_process|post_process|postprocess=s',
+         'template_process|process=s',
+         'template_default|default=s',
+         'template_error|error=s',
+--cut here for patch--
+
+Which reverts this change. However, if this was originally done for a good
+reason, it's not the end of the story. The modified version passes all tests
+still, but I can't see that they actually exercise ttree.
+
+Michael
+
+_______________________________________________
+templates mailing list
+templates at template-toolkit.org
+http://www.template-toolkit.org/mailman/listinfo/templates
+
+From nick at ccl4.org Sat Jan 20 22:25:52 2001
+Envelope-to: mstevens at firedrake.org
+Received: from paladin.globnix.org [195.11.247.40] 
+	by dayspring.firedrake.org with esmtp (Exim 3.12 #1 (Debian))
+	id 14K6SG-0006b2-00; Sat, 20 Jan 2001 22:25:52 +0000
+Received: from tmtowtdi.perl.org ([209.85.3.25] ident=qmailr)
+	from qmailr by paladin.globnix.org with smtp id 14K6SF-0008JY-00
+	for mstevens at globnix.org; Sat, 20 Jan 2001 22:25:52 +0000
+Received: (qmail 6144 invoked by uid 508); 20 Jan 2001 22:25:48 -0000
+Mailing-List: contact perl5-porters-help at perl.org; run by ezmlm
+Precedence: bulk
+list-help: <mailto:perl5-porters-help at perl.org>
+list-unsubscribe: <mailto:perl5-porters-unsubscribe at perl.org>
+list-post: <mailto:perl5-porters at perl.org>
+Delivered-To: mailing list perl5-porters at perl.org
+Received: (qmail 6135 invoked from network); 20 Jan 2001 22:25:47 -0000
+Received: from plum.flirble.org (exim at 195.40.6.20)
+  by tmtowtdi.perl.org with SMTP; 20 Jan 2001 22:25:47 -0000
+Received: from nick by plum.flirble.org with local (Exim 3.20 #3)
+	id 14K6SA-0003BQ-00
+	for perl5-porters at perl.org; Sat, 20 Jan 2001 22:25:46 +0000
+Date: Sat, 20 Jan 2001 22:22:51 +0000
+From: Nicholas Clark <nick at ccl4.org>
+To: perlbug at perl.org
+Subject: qu() exposes utf8 hash key problem
+Message-ID: <20010120222250.A10531 at plum.flirble.org>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=iso-8859-1
+Content-Disposition: inline
+Content-Transfer-Encoding: 8bit
+User-Agent: Mutt/1.2.5i
+X-Organisation: Tetrachloromethane
+Resent-From: nick at plum.flirble.org
+Resent-Date: Sat, 20 Jan 2001 22:25:46 +0000
+Resent-To: perl5-porters at perl.org
+Resent-Message-Id: <E14K6SA-0003BQ-00 at plum.flirble.org>
+Status: RO
+
+This is a bug report for perl from nick at talking.bollo.cx,
+generated with the help of perlbug 1.33 running under perl v5.7.0.
+
+
+-----------------------------------------------------------------
+[Please enter your report here]
+
+using the utf8 representation of codepoints 128-255 as a hash key seems to
+produce some undesirable effects.
+[I'm using a '£' (pound sterling) as my test character - if this gets stripped
+to 7 bit you will see hash '#'. The next hash after this sentence is in
+the OS version "2.2.17-rmk1 #9"]
+
+I assume that these occur with substr and utf8 scalars, but they are very
+easy to make with the new qu operator
+
+the strings are equal, which (I believe) is correct:
+
+perl -le '$uni = qu(£); $eight = "£"; print $uni eq $eight'
+1
+
+however, interesting things start happening with hash keys:
+
+perl  -MDevel::Peek -le '$a{qu(£)} = "foo"; $a{"£"} = "bar" ; foreach (keys %a) {Dump($_)}'
+SV = PVIV(0x20d8690) at 0x20d7e94
+  REFCNT = 2
+  FLAGS = (POK,FAKE,READONLY,pPOK)
+  IV = 168
+  PV = 0x20e40a0 "\243"
+  CUR = 1
+  LEN = 0
+SV = PVIV(0x20d86e0) at 0x20e25d0
+  REFCNT = 2
+  FLAGS = (POK,FAKE,READONLY,pPOK,UTF8)
+  IV = 6770
+  PV = 0x20e3eb8 "\302\243"
+  CUR = 2
+  LEN = 0
+
+I shouldn't get 2 hash entries should I?
+[for the FAKE,READONLY SV the hash value is cached in the IV, so you can see
+that the two representations have hashed to different numbers]
+
+perl -wle '$a{qu(£)} = "foo"; $a{qw(£)} = "bar" ; foreach (keys %a) {print $_};'
+£
+£
+Attempt to free non-existent shared string '£'.
+
+perl -wle '$uni = qu(£); $eight = "£"; $a{$uni} = "foo"; $a{$eight} = "bar"; foreach (keys %a) {print $a{$_}}' 
+bar
+foo
+
+perl -wle '$uni = qu(£); $eight = "£"; $a{$uni} = "foo"; $a{$eight} = "bar"; foreach (keys %a) {print $_; print $a{$_}}'
+£
+bar
+£
+Use of uninitialized value in print at -e line 1.
+
+Attempt to free non-existent shared string '£'.
+
+the warnings are explained by:
+
+perl -MDevel::Peek -wle '$uni = qu(£); $eight = "£"; $a{$uni} = "foo"; $a{$eight} = "bar"; foreach (keys %a) {print $_; Dump($_)}'
+£
+SV = PVIV(0x20d8690) at 0x20d7e94
+  REFCNT = 2
+  FLAGS = (POK,FAKE,READONLY,pPOK)
+  IV = 168
+  PV = 0x20e07e0 "\243"
+  CUR = 1
+  LEN = 0
+£
+SV = PVIV(0x20d86c0) at 0x20e25f8
+  REFCNT = 2
+  FLAGS = (POK,FAKE,READONLY,pPOK)
+  IV = 6770
+  PV = 0x20dbd88 "\243"
+  CUR = 1
+  LEN = 0
+Attempt to free non-existent shared string '£'.
+
+
+*something* is feeling quite happy to mess with a readonly scalar
+
+for information
+
+1: it seems no errors are currently being generated if shared strings remain
+   at global destruction time.
+2: SvREADONLY_off() is a scary thing. Perl_ck_require uses it indiscriminately
+   without force_normal to append ".pm" (would a patch be wanted for that?
+   It doesn't affect anything *yet*). I'm guessing something else is doing
+   something equally horrible on output.
+
+I guess we need a canonical representation for hash keys which at least
+one codepoint in the range 128-255 but none >255. Possibly downgraded to
+8 bit. Or possibly upgraded to utf8.
+
+
+Sorry, I have not patches for the above things.
+
+Nicholas Clark
+
+[Please do not change anything below this line]
+-----------------------------------------------------------------
+---
+Flags:
+    category=core
+    severity=medium
+---
+Site configuration information for perl v5.7.0:
+
+Configured by nick at Thu Jan 18 19:24:14 GMT 2001.
+
+Summary of my perl5 (revision 5.0 version 7 subversion 0) configuration:
+  Platform:
+    osname=linux, osvers=2.2.17-rmk1, archname=armv4l-linux
+    uname='linux bagpuss.unfortu.net 2.2.17-rmk1 #9 fri dec 8 23:52:12 gmt 2000 armv4l unknown '
+    config_args='-Dusedevel -Ubincompat5005 -Uinstallusrbinperl -Dcf_email=nick at talking.bollo.cx -Dperladmin=nick at talking.bollo.cx -Dinc_version_list=  -Dinc_version_list_init=0 -Duseperlio -des'
+    hint=recommended, useposix=true, d_sigaction=define
+    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
+    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
+    use64bitint=undef use64bitall=undef uselongdouble=undef
+  Compiler:
+    cc='cc', ccflags ='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
+    optimize='-O2',
+    cppflags='-fno-strict-aliasing -I/usr/local/include'
+    ccversion='', gccversion='2.95.2 20000220 (Debian GNU/Linux)', gccosandvers=''
+    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
+    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
+    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
+    alignbytes=4, usemymalloc=n, prototype=define
+  Linker and Libraries:
+    ld='cc', ldflags =' -L/usr/local/lib'
+    libpth=/usr/local/lib /lib /usr/lib
+    libs=-lnsl -lndbm -ldb -ldl -lm -lc -lposix -lcrypt -lutil
+    perllibs=-lnsl -ldl -lm -lc -lposix -lcrypt -lutil
+    libc=/lib/libc-2.1.3.so, so=so, useshrplib=false, libperl=libperl.a
+  Dynamic Linking:
+    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
+    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
+
+Locally applied patches:
+    DEVEL8452
+
+---
+ at INC for perl v5.7.0:
+    /usr/local/lib/perl5/5.7.0/armv4l-linux
+    /usr/local/lib/perl5/5.7.0
+    /usr/local/lib/perl5/site_perl/5.7.0/armv4l-linux
+    /usr/local/lib/perl5/site_perl/5.7.0
+    /usr/local/lib/perl5/site_perl
+    .
+
+---
+Environment for perl v5.7.0:
+    HOME=/home/nick
+    LANG (unset)
+    LANGUAGE (unset)
+    LC_CTYPE=en_GB.ISO-8859-1
+    LD_LIBRARY_PATH (unset)
+    LOGDIR (unset)
+    PATH=/home/nick/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/sbin:/usr/sbin:/usr/local/sbin
+    PERL_BADLANG (unset)
+    SHELL=/bin/bash
+
+From bounce-debian-devel=zal=debian.org at lists.debian.org Wed Jan  9 16:19:33 2002
+X-Envelope-From: bounce-debian-devel=zal=debian.org at lists.debian.org  Wed Jan  9 16:19:33 2002
+Return-Path: <bounce-debian-devel=zal=debian.org at lists.debian.org>
+Delivered-To: laz+debian at clustermonkey.org
+Received: from master.debian.org (master.debian.org [216.234.231.5])
+	by x-o.clustermonkey.org (Postfix) with ESMTP id 0DCF661EB84
+	for <laz+debian at clustermonkey.org>; Wed,  9 Jan 2002 16:19:33 -0500 (EST)
+Received: from murphy.debian.org [216.234.231.6] 
+	by master.debian.org with smtp (Exim 3.12 1 (Debian))
+	id 16OQ8C-0004ll-00; Wed, 09 Jan 2002 15:19:32 -0600
+Received: (qmail 22818 invoked by uid 38); 9 Jan 2002 21:07:42 -0000
+X-Envelope-Sender: debbugs at master.debian.org
+Received: (qmail 22385 invoked from network); 9 Jan 2002 21:07:37 -0000
+Received: from master.debian.org (mail at 216.234.231.5)
+  by murphy.debian.org with SMTP; 9 Jan 2002 21:07:37 -0000
+Received: from debbugs by master.debian.org with local (Exim 3.12 1 (Debian))
+	id 16OPvY-0003bQ-00; Wed, 09 Jan 2002 15:06:28 -0600
+X-Loop: owner at bugs.debian.org
+Subject: Bug#128487: ITP: ferite -- Ferite programming language
+Reply-To: Eric Dorland <eric at debian.org>, 128487 at bugs.debian.org
+Resent-From: Eric Dorland <eric at debian.org>
+Original-Sender: Eric <eric at apocalypse>
+Resent-To: debian-bugs-dist at lists.debian.org
+Resent-Cc: debian-devel at lists.debian.org, wnpp at debian.org
+Resent-Date: Wed, 09 Jan 2002 21:06:27 GMT
+Resent-Message-ID: <handler.128487.B.101061021111054 at bugs.debian.org>
+X-Debian-PR-Message: report 128487
+X-Debian-PR-Package: wnpp
+Received: via spool by submit at bugs.debian.org id=B.101061021111054
+          (code B ref -1); Wed, 09 Jan 2002 21:06:27 GMT
+From: Eric Dorland <eric at debian.org>
+To: Debian Bug Tracking System <submit at bugs.debian.org>
+X-Reportbug-Version: 1.41.14213
+X-Mailer: reportbug 1.41.14213
+Date: Wed, 09 Jan 2002 16:03:25 -0500
+Message-Id: <E16OPsb-0000u7-00 at apocalypse>
+Sender: Eric <eric at apocalypse.clustermonkey.org>
+Delivered-To: submit at bugs.debian.org
+X-Mailing-List: <debian-devel at lists.debian.org> archive/latest/105153
+X-Loop: debian-devel at lists.debian.org
+Precedence: list
+Resent-Sender: debian-devel-request at lists.debian.org
+Status: RO
+
+Package: wnpp
+Version: N/A; reported 2002-01-09
+Severity: wishlist
+
+* Package name    : ferite
+  Version         : 0.99.4
+  Upstream Author : Chris Ross (boris) <ctr at ferite.org>
+* URL             : http://www.ferite.org/
+* License         : BSD
+  Description     : Ferite programming language
+
+Ferite is a language that incorporates the design philosophies of other
+languages, but without many of their drawbacks. It has strong
+similiarities to perl, python, C, Java and pascal, while being both
+lightweight, modular, and embeddable.
+
+-- System Information
+Debian Release: 3.0
+Architecture: i386
+Kernel: Linux apocalypse 2.4.16 #1 Fri Nov 30 14:38:38 EST 2001 i686
+Locale: LANG=en_US, LC_CTYPE=
+
+
+
+-- 
+To UNSUBSCRIBE, email to debian-devel-request at lists.debian.org
+with a subject of "unsubscribe". Trouble? Contact listmaster at lists.debian.org
+
+From owner-london-pm at lists.dircon.co.uk Sun Jan 21 17:08:14 2001
+Envelope-to: michael at etla.org
+Received: from lists.dircon.co.uk [194.112.50.5] 
+	by dayspring.firedrake.org with esmtp (Exim 3.12 #1 (Debian))
+	id 14KNyQ-0007mp-00; Sun, 21 Jan 2001 17:08:14 +0000
+Received: (from majordom at localhost)
+	by lists.dircon.co.uk (8.9.3/8.9.3) id RAA28531
+	for michael at etla.org; Sun, 21 Jan 2001 17:08:13 GMT
+X-Authentication-Warning: lists.dircon.co.uk: majordom set sender to owner-london-pm at lists.dircon.co.uk using -f
+Received: from dayspring.firedrake.org (mail at dayspring.firedrake.org [195.82.105.251])
+	by lists.dircon.co.uk (8.9.3/8.9.3) with ESMTP id RAA28043
+	for <london-pm at lists.dircon.co.uk>; Sun, 21 Jan 2001 17:07:23 GMT
+Received: from mstevens by dayspring.firedrake.org with local (Exim 3.12 #1 (Debian))
+	id 14KNxb-0007mH-00; Sun, 21 Jan 2001 17:07:23 +0000
+Date: Sun, 21 Jan 2001 17:07:23 +0000
+From: Michael Stevens <michael at etla.org>
+To: london-pm at lists.dircon.co.uk
+Subject: Mail::ListDetector - please test
+Message-ID: <20010121170723.A29498 at firedrake.org>
+Mail-Followup-To: london-pm at lists.dircon.co.uk
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+User-Agent: Mutt/1.2.5i
+X-Phase-Of-Moon: The Moon is Waning Crescent (7% of Full)
+Sender: owner-london-pm at lists.dircon.co.uk
+Precedence: bulk
+Reply-To: london-pm at lists.dircon.co.uk
+Status: RO
+
+Hi.
+
+I have an (as yet unreleased) module called Mail::ListDetector,
+which takes a Mail::Internet object, and attempts to tell you if the
+message involved was posted to a mailing list, and if so, attempts to
+get some details about that list.
+
+I need testers - in particular, see if it builds and passes tests for
+you, and throw lots of messages at the sample script and see if you
+can get it to be inaccurate for any of them. If you can, please send
+me the message in question. (if you don't want to give out the content,
+just headers should do).
+
+Currently it should know about majordomo, smartlist, ezmlm, and mailman,
+although the majordomo and smartlist guessers are a bit experimental.
+
+It's at:
+
+http://www.etla.org/Mail-ListDetector-0.05.tar.gz
+
+Michael
+
+From - Wed Feb 14 09:49:48 2001
+Return-Path: <noustestons-owner at cru.fr>
+Received: from listes.cru.fr (listes.cru.fr [195.220.94.165])
+          by home.cru.fr (8.9.3/jtpda-5.3.1) with ESMTP id JAA26395
+          ; Wed, 14 Feb 2001 09:49:23 +0100
+Received: from (sympa at localhost)
+          by listes.cru.fr (8.9.3/jtpda-5.3.2) id JAA07499
+          ; Wed, 14 Feb 2001 09:49:23 +0100
+Sender: Olivier.Salaun at cru.fr
+Message-ID: <3A8A4691.70332989 at cru.fr>
+Date: Wed, 14 Feb 2001 09:49:21 +0100
+From: Olivier Salaun <olivier.salaun at cru.fr>
+Organization: CRU
+X-Mailer: Mozilla 4.74 [en] (X11; U; Linux 2.2.16-3 i686)
+X-Accept-Language: en
+MIME-Version: 1.0
+To: noustestons at cru.fr
+Subject: This is a sample message
+X-Loop: noustestons at cru.fr
+X-Sequence: 168
+Precedence: list
+List-Help: <mailto:sympa at cru.fr?subject=help>
+List-Subscribe: <mailto:sympa at cru.fr?subject=subscribe%20noustestons>
+List-Unsubscribe: <mailto:sympa at cru.fr?subject=unsubscribe%20noustestons>
+List-Post: <mailto:noustestons at cru.fr>
+List-Owner: <mailto:noustestons-request at cru.fr>
+List-Archive: <http://listes.cru.fr/wws/arc/noustestons>
+Content-type: multipart/mixed; boundary="----------=_982140563-24435-126"
+Content-Transfer-Encoding: 8bit
+X-Mozilla-Status: 8001
+X-Mozilla-Status2: 00000000
+
+This is a multi-part message in MIME format...
+
+------------=_982140563-24435-126
+Content-Type: text/plain; charset=iso-8859-1
+Content-Transfer-Encoding: 8bit
+
+Hope it helps....
+
+--
+Olivier Salaün
+Comité Réseaux des Universités
+
+------------=_982140563-24435-126
+Content-Type: text/plain; name="message.footer"
+Content-Disposition: inline; filename="message.footer"
+Content-Transfer-Encoding: 8bit
+
+fgdfgdfgdfdg
+
+------------=_982140563-24435-126--
+
+From adm-bounce at oasys.net  Mon Jun  4 06:41:14 2001
+Received: from thufir.oasys.net (oasys.net [216.227.134.4]) by
+    nani.mikomi.org (8.9.3/8.9.3) with ESMTP id GAA08314 for
+    <turner at mikomi.org>; Mon, 4 Jun 2001 06:41:13 -0400
+Received: from thufir (thufir [127.0.0.1]) by thufir.oasys.net (Postfix)
+    with ESMTP id 345138003; Mon,  4 Jun 2001 06:41:12 -0400 (EDT)
+Received: with LISTAR (v0.129a; list adm); Mon, 04 Jun 2001 06:41:12 -0400
+    (EDT)
+Delivered-To: adm at oasys.net
+Received: from nani.mikomi.org (nani.mikomi.org [216.227.135.6]) by
+    thufir.oasys.net (Postfix) with ESMTP id 8AF917FC1 for <adm at oasys.net>;
+    Mon,  4 Jun 2001 06:41:10 -0400 (EDT)
+Received: (from turner at localhost) by nani.mikomi.org (8.9.3/8.9.3) id
+    GAA08291; Mon, 4 Jun 2001 06:41:07 -0400
+X-Authentication-Warning: nani.mikomi.org: turner set sender to
+    turner at mikomi.org using -f
+Date: Mon, 4 Jun 2001 06:41:07 -0400
+From: Andrew Turner <turner at mikomi.org>
+To: Seikihyougen <seikihyougen at mikomi.org>
+Cc: adm at oasys.net
+Subject: [adm] Marvin Minsky AI Talk
+Message-Id: <20010604064107.A6940 at mikomi.org>
+Mail-Followup-To: Seikihyougen <seikihyougen at mikomi.org>, adm at oasys.net
+MIME-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+User-Agent: Mutt/1.3.14i
+X-Archive-Position: 161
+X-Listar-Version: Listar v0.129a
+Sender: adm-bounce at oasys.net
+Errors-To: adm-bounce at oasys.net
+X-Original-Sender: turner at mikomi.org
+Precedence: list
+Reply-To: adm at oasys.net
+X-List: adm
+Status: RO
+Content-Length: 498
+Lines: 21
+
+An intersting talk he gave at the Game Developers Conference 2001.
+
+Video:
+
+rtsp://media.cmpnet.com/twtoday_media/realtest/tnc-gdc2k1-prog.rm
+
+Audio:
+
+http://199.125.85.76/ftp/technetcast/mp3/tnc-0526-24.mp3
+
+Transcript:
+
+http://technetcast.ddj.com/tnc_play_stream.html?stream_id=526
+
+-- 
+Andy <turner at mikomi.org> - http://anime.mikomi.org/ - Community Anime Reviews
+  And the moral of this message is...
+    Let the meek inherit the earth -- they have it coming to them.
+    		-- James Thurber
+
+From sentto-482527-3071-992625570-turner=mikomi.org at returns.onelist.com  Fri Jun 15 13:21:26 2001
+Return-Path: <sentto-482527-3071-992625570-turner=mikomi.org at returns.onelist.com>
+Received: from ef.egroups.com (ef.egroups.com [64.211.240.229]) by
+    undef.jmac.org (8.11.0/8.11.0) with SMTP id f5FHLPl26276 for
+    <turner at mikomi.org>; Fri, 15 Jun 2001 13:21:26 -0400
+Received: from [10.1.4.54] by ef.egroups.com with NNFMP; 15 Jun 2001
+    17:19:30 -0000
+Received: (qmail 74089 invoked from network); 15 Jun 2001 17:19:29 -0000
+Received: from unknown (10.1.10.26) by l8.egroups.com with QMQP;
+    15 Jun 2001 17:19:29 -0000
+Received: from unknown (HELO c9.egroups.com) (10.1.2.66) by mta1 with SMTP;
+    15 Jun 2001 17:19:29 -0000
+X-Egroups-Return: turner at undef.jmac.org
+Received: from [10.1.2.91] by c9.egroups.com with NNFMP; 15 Jun 2001
+    17:19:28 -0000
+X-Egroups-Approved-BY: lordtenchimasaki at planetjurai.com via web; 15 Jun
+    2001 17:19:26 -0000
+X-Sender: turner at undef.jmac.org
+X-Apparently-To: ryokoforever at yahoogroups.com
+Received: (EGP: mail-7_1_3); 15 Jun 2001 15:04:27 -0000
+Received: (qmail 72431 invoked from network); 15 Jun 2001 15:04:26 -0000
+Received: from unknown (10.1.10.26) by l7.egroups.com with QMQP;
+    15 Jun 2001 15:04:26 -0000
+Received: from unknown (HELO undef.jmac.org) (199.232.41.30) by mta1 with
+    SMTP; 15 Jun 2001 15:04:26 -0000
+Received: (from turner at localhost) by undef.jmac.org (8.11.0/8.11.0) id
+    f5FF54H25878 for ryokoforever at yahoogroups.com; Fri, 15 Jun 2001 11:05:04
+    -0400
+To: ryokoforever at yahoogroups.com
+Message-Id: <20010615110504.F23926 at mikomi.org>
+References: <65.15c83c77.285a1ed0 at aol.com> <9gc0tj+9u4r at eGroups.com>
+User-Agent: Mutt/1.2.5i
+In-Reply-To: <9gc0tj+9u4r at eGroups.com>; from gensao at yahoo.com on Fri,
+    Jun 15, 2001 at 03:54:27AM -0000
+From: Andrew Turner <turner at mikomi.org>
+MIME-Version: 1.0
+Mailing-List: list ryokoforever at yahoogroups.com; contact
+    ryokoforever-owner at yahoogroups.com
+Delivered-To: mailing list ryokoforever at yahoogroups.com
+Precedence: list
+List-Unsubscribe: <mailto:ryokoforever-unsubscribe at yahoogroups.com>
+Date: Fri, 15 Jun 2001 11:05:04 -0400
+Reply-To: ryokoforever at yahoogroups.com
+Subject: [ryokoforever] Re: [ryokoforever] Re: Fan Fiction Websites
+Content-Type: text/plain; charset=US-ASCII
+Content-Transfer-Encoding: 7bit
+Status: RO
+Content-Length: 631
+Lines: 16
+
+Yeah, I'm really sorry about all this.  The stupid cable company has been
+very unhelpful in getting my cable modem back online... I'll be moving my
+machine (and thus, the domains hosted with it like tmffa.com) to a colo
+environment very soon, which should put an end to down time.
+
+--
+Andy <turner at mikomi.org>
+
+
+To unsubscribe from this group, send an email to:
+ryokoforever-unsubscribe at egroups.com
+
+ 
+
+Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
+
+
+
+
+
+From london.pm-admin at london.pm.org Fri Aug 17 13:47:55 2001
+Return-Path: <london.pm-admin at london.pm.org>
+Received: from punt-2.mail.demon.net by mailstore for
+    lpm at mirth.demon.co.uk id 998052475:20:20927:5; Fri, 17 Aug 2001 12:47:55
+    GMT
+Received: from penderel.state51.co.uk ([193.82.57.128]) by
+    punt-2.mail.demon.net id aa2103774; 17 Aug 2001 12:47 GMT
+Received: from penderel ([127.0.0.1] helo=penderel.state51.co.uk) by
+    penderel.state51.co.uk with esmtp (Exim 3.03 #1) id 15Xj23-0004Oi-00;
+    Fri, 17 Aug 2001 13:47:23 +0100
+Received: from plough.barnyard.co.uk ([195.149.50.61]) by
+    penderel.state51.co.uk with esmtp (Exim 3.03 #1) id 15Xj1T-0004OQ-00 for
+    london.pm at london.pm.org; Fri, 17 Aug 2001 13:46:47 +0100
+Received: from richardc by plough.barnyard.co.uk with local (Exim 3.13 #1)
+    id 15Xj1E-0006Wp-00 for london.pm at london.pm.org; Fri, 17 Aug 2001 13:46:32
+    +0100
+From: Richard Clamp <richardc at unixbeard.net>
+To: london.pm at london.pm.org
+Subject: Re: better header
+Message-Id: <20010817134539.A9368 at mirth.demon.co.uk>
+References: <170801229.13787 at webbox.com>
+    <20010817122254.B18192 at mccarroll.demon.co.uk>
+MIME-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+In-Reply-To: <20010817122254.B18192 at mccarroll.demon.co.uk>
+User-Agent: Mutt/1.3.20i
+Sender: london.pm-admin at london.pm.org
+Errors-To: london.pm-admin at london.pm.org
+X-Beenthere: london.pm at london.pm.org
+X-Mailman-Version: 2.0.1
+Precedence: bulk
+Reply-To: london.pm at london.pm.org
+List-Id: London.pm Perl M[ou]ngers <london.pm.london.pm.org>
+List-Archive: <http://london.pm.org/pipermail/london.pm/>
+Date: Fri, 17 Aug 2001 13:45:39 +0100
+Status: RO
+Content-Length: 439
+Lines: 12
+
+On Fri, Aug 17, 2001 at 12:22:54PM +0100, Greg McCarroll wrote:
+> testing a reply to the announce list
+
+Could someone extend the hacks committed into changing the
+headers and the like, then they'd not be auto-filtered to the same
+place by such fine modules as Mail::ListDetector or lesser homebrew
+systems such as my own.
+
+The announce lists rocks, but that'd just make it rock so much harder.
+
+-- 
+Richard Clamp <richardc at unixbeard.net>
+
+
+
+From adm-bounce at oasys.net  Mon Jun  4 06:41:14 2001
+Received: from thufir.oasys.net (oasys.net [216.227.134.4]) by
+    nani.mikomi.org (8.9.3/8.9.3) with ESMTP id GAA08314 for
+    <turner at mikomi.org>; Mon, 4 Jun 2001 06:41:13 -0400
+Received: from thufir (thufir [127.0.0.1]) by thufir.oasys.net (Postfix)
+    with ESMTP id 345138003; Mon,  4 Jun 2001 06:41:12 -0400 (EDT)
+Received: with ECARTIS (v1.0.0; list adm); Mon, 04 Jun 2001 06:41:12 -0400
+    (EDT)
+Delivered-To: adm at oasys.net
+Received: from nani.mikomi.org (nani.mikomi.org [216.227.135.6]) by
+    thufir.oasys.net (Postfix) with ESMTP id 8AF917FC1 for <adm at oasys.net>;
+    Mon,  4 Jun 2001 06:41:10 -0400 (EDT)
+Received: (from turner at localhost) by nani.mikomi.org (8.9.3/8.9.3) id
+    GAA08291; Mon, 4 Jun 2001 06:41:07 -0400
+X-Authentication-Warning: nani.mikomi.org: turner set sender to
+    turner at mikomi.org using -f
+Date: Mon, 4 Jun 2001 06:41:07 -0400
+From: Andrew Turner <turner at mikomi.org>
+To: Seikihyougen <seikihyougen at mikomi.org>
+Cc: adm at oasys.net
+Subject: [adm] Marvin Minsky AI Talk
+Message-Id: <20010604064107.A6940 at mikomi.org>
+Mail-Followup-To: Seikihyougen <seikihyougen at mikomi.org>, adm at oasys.net
+MIME-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+User-Agent: Mutt/1.3.14i
+X-Archive-Position: 161
+X-Ecartis-Version: Ecartis v1.0.0
+Sender: adm-bounce at oasys.net
+Errors-To: adm-bounce at oasys.net
+X-Original-Sender: turner at mikomi.org
+Precedence: list
+Reply-To: adm at oasys.net
+X-List: adm
+Status: RO
+Content-Length: 498
+Lines: 21
+
+An intersting talk he gave at the Game Developers Conference 2001.
+
+Video:
+
+rtsp://media.cmpnet.com/twtoday_media/realtest/tnc-gdc2k1-prog.rm
+
+Audio:
+
+http://199.125.85.76/ftp/technetcast/mp3/tnc-0526-24.mp3
+
+Transcript:
+
+http://technetcast.ddj.com/tnc_play_stream.html?stream_id=526
+
+-- 
+Andy <turner at mikomi.org> - http://anime.mikomi.org/ - Community Anime Reviews
+  And the moral of this message is...
+    Let the meek inherit the earth -- they have it coming to them.
+    		-- James Thurber
+
+
+
+
+
+From adm-bounce at oasys.net  Mon Jun  4 06:41:14 2001
+Return-Path: <Mail-ListDetector-report at gunzel.org>
+Received: from <mld at walker.wattle.id.au>
+  by freeonline.com.au (CommuniGate Pro RULES 4.0.6)
+  with RULES id 360012; Fri, 14 Mar 2003 01:00:12 +0000
+X-ListServer: CommuniGate Pro LIST 4.0.6
+List-Unsubscribe: <mailto:Mail-ListDetector-off at gunzel.org>
+List-ID: <Mail-ListDetector.gunzel.org>
+Message-ID: <list-360011 at freeonline.com.au>
+Reply-To: <Mail-ListDetector at gunzel.org>
+Sender: <Mail-ListDetector at gunzel.org>
+To: <Mail-ListDetector at gunzel.org>
+Precedence: list
+X-Original-Message-Id: <a05200e2dba96da10d185@[192.168.14.36]>
+Date: Fri, 14 Mar 2003 12:00:05 +1100
+From: Matthew Walker <mld at walker.wattle.id.au>
+Subject: Hello to the Mail-ListDetector Mailing List at gunzel.org
+MIME-Version: 1.0
+Content-Type: text/plain; charset="us-ascii" ; format="flowed"
+
+<x-flowed>This is a sample message for use in automated testing.
+
+Regards
+
+Matthew
+
+#############################################################
+This message is sent to you because you are subscribed to
+  the mailing list <Mail-ListDetector at gunzel.org>.
+To unsubscribe, E-mail to: <Mail-ListDetector-off at gunzel.org>
+To switch to the DIGEST mode, E-mail to <Mail-ListDetector-digest at gunzel.org>
+To switch to the INDEX mode, E-mail to <Mail-ListDetector-index at gunzel.org>
+Send administrative queries to  <Mail-ListDetector-request at gunzel.org>
+
+
+</x-flowed>
+
+From adm-bounce at oasys.net  Mon Jun  4 06:41:14 2001
+Date: Sun, 11 Nov 2001 02:19:29 +0900
+From: Foobar <foo at bar.com>
+Reply-To: mlname at domain.example.com
+Subject: [mlname:07389] add new member
+To: mlname at domain.example.com (mlname ML)
+Message-Id: <20011111021844.0836.foo at domain.example.com>
+X-ML-Name: mlname
+X-Mail-Count: 07389
+X-MLServer: fml [fml 4.0 STABLE (20010208)]; post only (only members can post)
+X-ML-Info: If you have a question, send e-mail with the body "help" (without quotes) to the address mlname-ctl at domain.example.com; help=<mailto:mlname-ctl at domain.example.com?body=help>
+X-Mailer: Becky! ver. 2.00.07
+Mime-Version: 1.0
+Content-Type: text/plain; charset="ISO-2022-JP"
+Content-Transfer-Encoding: 7bit
+Precedence: bulk
+Lines: 1
+List-Software: fml [fml 4.0 STABLE (20010208)]
+List-Post: <mailto:mlname at domain.example.com>
+List-Owner: <mailto:mlname-admin at domain.example.com>
+List-Help: <mailto:mlname-ctl at domain.example.com?body=help>
+List-Unsubscribe: <mailto:mlname-ctl at domain.example.com?body=unsubscribe>
+Status: RO
+
+This is a message
+
+From adm-bounce at oasys.net  Mon Jun  4 06:41:14 2001
+Received: from mldetector.net (msv-x05.mldetector.ne.jp [10.158.32.3])
+    by ml.mldetector.gr.jp (8.9.3p2/3.7W/) with ESMTP id AAA74508
+    for <announce at ml.mldetector.gr.jp>; Thu, 17 Jul 2003 01:52:35 +0900 (JST)
+Received: from denshadego (whrr.hou.mldetector.net [10.12.6.189])
+    (authenticated (0 bits))
+    by mldetector.net (8.12.5/8.11.2) with ESMTP id 732h6GFqXkO002877
+    for <announce at ml.mldetector.gr.jp>; Thu, 17 Jul 2003 01:52:32 +0900
+Date: Thu, 17 Jul 2003 01:52:22 +0900
+From: "Densha De Go" <densha at mldetector.net>
+Reply-To: Announce at mldetector.gr.jp
+Subject: [Announce:00089] Web mldetector
+To: <announce at ml.mldetector.gr.jp>
+Message-Id: <00a801c34bb2$4jhasjdh58udsc0 at orient.corp.mldetector.com>
+X-ML-Name: Announce
+X-Mail-Count: 00089
+X-MLServer: fml [fml 4.0 STABLE (20010218)](fml commands only mode); post only only members can post)
+X-ML-Info: If you have a question,
+    please contact Announce-admin at mldetector.gr.jp;
+    <mailto:Announce-admin at mldetector.gr.jp>
+X-Mailer: Microsoft Outlook Express 6.00.2800.1158
+Mime-Version: 1.0
+Content-Type: text/plain;
+    charset="iso-2022-jp"
+Content-Transfer-Encoding: 7bit
+Precedence: bulk
+List-Subscribe: <mailto:Announce-ctl at mldetector.gr.jp?body=subscribe>
+Resent-From: denshadego at yo.mldetector.or.jp
+Resent-To: Announce at mldetector.gr.jp (moderated)
+Resent-Date: Thu, 17 Jul 2003 00:52:57 +0900
+Resent-Message-Id: <200307170052.FMLAAB99994.Announce at mldetector.gr.jp>
+
+One line of body
+
+From adm-bounce at oasys.net  Mon Jun  4 06:41:14 2001
+Return-Path: <owner-sample at v2.listbox.com>
+Received: from rime.listbox.com ([216.65.124.73] verified) by
+    freeonline.com.au (CommuniGate Pro SMTP 4.0.6) with ESMTP id 452321 for
+    mld-listbox at walker.wattle.id.au; Tue, 17 Jun 2003 20:16:02 +0000
+Received: by rime.listbox.com (Postfix, from userid 440) id 7378ADF7381;
+    Tue, 17 Jun 2003 16:18:01 -0400 (EDT)
+Received: from umbrella.listbox.com (umbrella.listbox.com
+    [208.210.125.21]) by rime.listbox.com (Postfix) with ESMTP id 7378ADF7381
+    for <sample at v2.listbox.com@fast.exploders.listbox.com>;
+    Tue, 17 Jun 2003 16:18:00 -0400 (EDT)
+Received: by umbrella.listbox.com (Postfix, from userid 440) id
+    7378ADF7381; Tue, 17 Jun 2003 16:17:01 -0400 (EDT)
+Received: from freeonline.com.au (a.mx.freeonline.com.au
+    [127.0.0.126]) by umbrella.listbox.com (Postfix) with SMTP id
+    7378ADF7381 for <sample at v2.listbox.com>; Tue, 17 Jun 2003 16:16:59
+    -0400 (EDT)
+Message-Id: <7378ADF7381aTjhj36 at x>
+Date: Tue, 17 Jun 2003 13:17:17 -0700
+To: sample at v2.listbox.com
+From: "Listbox Sample" <mld+listbox at walker.wattle.id.au>
+Subject: [sample] Archive
+Sender: owner-sample at v2.listbox.com
+Precedence: list
+Reply-To: sample at v2.listbox.com
+List-Id: <sample at v2.listbox.com>
+List-Help: <http://v2.listbox.com/help?list_name=sample@v2.listbox.com>
+List-Subscribe: <mailto:subscribe-sample at v2.listbox.com>,
+    <http://v2.listbox.com/subscribe/?listname=sample@v2.listbox.com>
+List-Unsubscribe: <mailto:unsubscribe-sample at v2.listbox.com>,
+    <http://v2.listbox.com/member/unsubscribe/?listname=sample@v2.listbox.com>
+
+An archive for this list is there ?
+
+-------
+Sample: http://example.com/
+Archives at http://archives.listbox.com/sample/current/
+To unsubscribe, change your address, or temporarily deactivate your
+ubscription,
+please go to http://v2.listbox.com/member/?listname=sample@v2.listbox.com
+
+From adm-bounce at oasys.net  Mon Jun  4 06:41:14 2001
+Return-Path: <owner-sample at v2.listbox.com>
+Received: from rime.listbox.com ([216.65.124.73] verified) by
+    freeonline.com.au (CommuniGate Pro SMTP 4.0.6) with ESMTP id 452321 for
+    mld-listbox at walker.wattle.id.au; Tue, 17 Jun 2003 20:16:02 +0000
+Received: by rime.listbox.com (Postfix, from userid 440) id 7378ADF7381;
+    Tue, 17 Jun 2003 16:18:01 -0400 (EDT)
+Received: from umbrella.listbox.com (umbrella.listbox.com
+    [208.210.125.21]) by rime.listbox.com (Postfix) with ESMTP id 7378ADF7381
+    for <sample at v2.listbox.com@fast.exploders.listbox.com>;
+    Tue, 17 Jun 2003 16:18:00 -0400 (EDT)
+Received: by umbrella.listbox.com (Postfix, from userid 440) id
+    7378ADF7381; Tue, 17 Jun 2003 16:17:01 -0400 (EDT)
+Received: from freeonline.com.au (a.mx.freeonline.com.au
+    [127.0.0.126]) by umbrella.listbox.com (Postfix) with SMTP id
+    7378ADF7381 for <sample at v2.listbox.com>; Tue, 17 Jun 2003 16:16:59
+    -0400 (EDT)
+Message-Id: <7378ADF7381aTjhj36 at x>
+Date: Tue, 17 Jun 2003 13:17:17 -0700
+To: sample at v2.listbox.com
+From: "Listbox Sample" <mld+listbox at walker.wattle.id.au>
+Subject: [sample] Archive
+Sender: owner-sample at v2.listbox.com
+Precedence: list
+Reply-To: sample at v2.listbox.com
+List-Id: <sample at v2.listbox.com>
+List-Help: <http://v2.listbox.com/help?list_name=sample@v2.listbox.com>
+List-Subscribe: <mailto:subscribe-sample at v2.listbox.com>,
+    <http://v2.listbox.com/subscribe/?listname=sample@v2.listbox.com>
+List-Unsubscribe: <mailto:unsubscribe-sample at v2.listbox.com>,
+    <http://v2.listbox.com/member/unsubscribe/?listname=sample@v2.listbox.com>
+List-Software: listbox.com v2.0
+
+An archive for this list is there ?
+
+-------
+Sample: http://example.com/
+Archives at http://archives.listbox.com/sample/current/
+To unsubscribe, change your address, or temporarily deactivate your
+ubscription,
+please go to http://v2.listbox.com/member/?listname=sample@v2.listbox.com
+
+From adm-bounce at oasys.net Mon Jun  4 06:41:14 2001
+Received: from lmailexample1.example.com ([10.22.163.233] verified)
+  by example.com.au (CommuniGate Pro SMTP 4.1)
+  with ESMTP id 946911982 for matthew at EXAMPLE.COM.AU;
+  Wed, 12 Aug 2001 21:49:00 0000
+Received: from LISTSERV.EXAMPLE.COM (tem01.mx.example.com) by
+  lmailexample1.example.com (LSMTP for Windows NT v1.1b) with SMTP id
+  <0.940293 at lmailexample1.example.com>; Wed, 12 Aug 2001 21:29:46 +0400
+Received: from LISTSERV.EXAMPLE.COM by LISTSERV.EXAMPLE.COM (LISTSERV-TCP/IP
+  release 1.8e) with spool id 8932592 for EXAMPLE at LISTSERV.EXAMPLE.COM;
+  Wed, 12 Aug 2001 20:58:31 +0400
+MIME-Version: 1.0
+Content-Type: text/plain; charset=us-ascii; format=flowed
+Content-Transfer-Encoding: 7bit
+Message-ID:  <DEADCAFE.3289872 at example.net>
+Date:         Wed, 12 Aug 2001 20:58:11 -0200
+Reply-To:     EXAMPLE Discussion <EXAMPLE at LISTSERV.EXAMPLE.COM>
+Sender:       EXAMPLE Discussion <EXAMPLE at LISTSERV.EXAMPLE.COM>
+From:         I. EXAMPLE <iiiii at EXAMPLE.NET>
+Subject: Boring sample message
+To:           EXAMPLE at LISTSERV.EXAMPLE.COM
+In-Reply-To:  <7834BADFE3125E.90301 at example.com>
+Precedence: list
+
+This is a really boring example Listserv message.
+
+--
+EXAMPLE - http://www.example.com/
+
+To Remove yourself from this list, simply send an email to
+<listserv at listserv.example.com> with the
+body of "SIGNOFF EXAMPLE" in the email message. You can leave the Subject:
+field of your email blank.
+
+From adm-bounce at oasys.net Mon Jun  4 06:41:14 2001
+Return-Path: <>
+Received: from listserv.example.com (listserv.example.com
+    [10.51.0.6]) by listserv.example.com (8.11.6p2/8.11.6) with ESMTP
+    id h32hgds039; Wed, 10 Apr 2001 20:48:08 -0500 (EST)
+Received: from LISTSERV.EXAMPLE.COM by LISTSERV.EXAMPLE.COM
+    (LISTSERV-TCP/IP release 1.8d) with spool id 137738 for
+    COCO at LISTSERV.EXAMPLE.COM; Wed, 10 Apr 2001 19:13:57 -0500
+Approved-BY: spcadmin at EXAMPLE.COM
+Received: from relay.example.com (relay.example.com
+    [10.51.0.1]) by listserv.example.com (8.11.6p2/8.11.6) with ESMTP
+    id h31L8r26559 for <coco at listserv.example.net>; Wed,
+    1 Apr 2003 16:52:55 -0500 (EST)
+Received: from cp.example.com (cp.example.com [10.51.0.1]) by
+    relay.example.com (Switch-2.2.6/Switch-2.2.5) with ESMTP id
+    htyLqsv14600 for <coco at example.com>; Wed, 10 Apr 2001 15:26:55
+    -0500 (EST)
+Received: (from nobody at localhost) by cp.example.com (8.11.6/8.11.6) id
+    h31LqsX16086; Wed, 10 Apr 2001 15:25:54 -0500 (EST)
+Message-Id: <200104102125.h31LqsX16086 at cp.example.com>
+Date: Wed, 10 Apr 2001 15:25:54 -0500
+Reply-To: vibrant_newsletters at EXAMPLE.NET
+Sender: Comedy Company <COCO at LISTSERV.EXAMPLE.COM>
+From: Comedy Company <spcadmin at EXAMPLE.COM>
+Subject: Another boring sample message
+To: COCO at LISTSERV.EXAMPLE.COM
+Status: U
+
+And here's another one but the Reply-To is not set to the list.
+
+From adm-bounce at oasys.net Mon Jun  4 06:41:14 2001
+Received: from [10.80.0.8] by mail.example.com
+       (SMTPD32-3.04) id A3CCCC1700AC; Mon, 02 Feb 1998 20:25:33 -0700
+Received: from total.example.com (du-226.example.com [10.80.0.226])
+       by poseidon.example.com (8.8.6/8.8) with SMTP id QBB30808; Mon, 2 Feb
+	1998 04:08:00 GMT
+Subject: CommuniGate List example
+Message-Id: <00000038942968439085 at total.example.com>
+To: subscribers:;
+X-ListServer: CommuniGate List 1.4
+From: test at example.com (Test Account)
+Sender: CGnet at total.example.com (CGnet)
+Date: Mon, 02 Feb 1998 13:57:22 +1000
+Organization: Example Limited
+X-Mailer: CommuniGate 2.9.8
+Errors-To: Greene at total.example.com
+Reply-To: CGnet at total.example.com
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="__==========0000000003894==total.example.com==__"
+
+
+This is a MIME-encapsulated message
+ If you read this, you may want to switch to a better mailer
+--__==========0000000003894==total.example.com==__
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: 8bit
+
+
+List content goes here.
+
+--__==========0000000003894==total.example.com==__
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: 8bit
+
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+You have received this message because you are subscribed to
+Gnet.
+
+To unsubscribe, send any message to: CGnet-off at total.example.com
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+--__==========0000000003894==total.example.com==__--
+

Added: packages/libmail-box-perl/branches/upstream/current/tests/31fgroups/sgfolder
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/31fgroups/sgfolder	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/31fgroups/sgfolder	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,863 @@
+From melanie.mcdonald_el at freemail.it  Mon Aug 11 08:16:21 2003
+Return-Path: <melanie.mcdonald_el at freemail.it>
+Delivered-To: markov at speeltuin.atcomputing.nl
+Received: from pandora.cs.kun.nl (pandora.cs.kun.nl [131.174.33.4])
+	by speeltuin.ATComputing.nl (Postfix) with ESMTP id 9319C39AD
+	for <mark at overmeer.net>; Mon, 11 Aug 2003 08:16:20 +0200 (CEST)
+Received: from turk.net by pandora.cs.kun.nl
+	via 12-221-78-16.client.insightBB.com [12.221.78.16] with ESMTP for <markov at cs.kun.nl>
+	id h7B6KvKc009534 (8.12.9/3.58); Mon, 11 Aug 2003 08:20:59 +0200 (MET DST)
+Message-ID: <3F3736A8.09D1E60C at freemail.it>
+From: "Melanie Mcdonald" <melanie.mcdonald_el at freemail.it>
+To: markov at cs.kun.nl
+Subject: Did you lose my ICQ?
+Date: Mon, 11 Aug 2003 06:24:40 +0000
+MIME-Version: 1.0
+User-Agent: Mozilla/5.030 (X11; U; FreeBSD i386; U; NT4.0; en-us) Gecko/25250101
+X-Accept-Language: en
+Content-Type: text/html
+Content-Transfer-Encoding: 8bit
+X-Spam-Status: Yes, hits=5.9 required=5.0
+ tests=CLICK_BELOW,HTML_70_80,HTML_MESSAGE,MIME_HTML_ONLY,
+ OBFUSCATING_COMMENT,RCVD_IN_NJABL,RCVD_IN_UNCONFIRMED_DSBL,
+ REPLY_TO_EMPTY,USER_AGENT_MOZILLA_UA,VIAGRA_ONLINE,
+ X_ACCEPT_LANG version=2.55
+X-Spam-Level: *****
+X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp)
+X-Spam-Report:  This mail is probably spam. The original message has been
+ attached along with this report,
+ so you can recognize or block similar unwanted mail in future. See
+ http://spamassassin.org/tag/ for more details. Content preview: Get Viagra
+ online Now ! We are the cheapest supplier on the net 100 % guarantee ! at 3 $
+ a dose, try it now. URI:http://www.xcellentresults.biz/index.php?id™99 Click
+ here URI:http://www.xcellentresults.biz/optout.php Discontinue receiving
+ offers jb80v63snt3fht3tr6135os80 5bbdjf2r52f
+ qopu343yz1frdybc3od6n0j4rq8ct26mhfo 1v5qat38wft9a 2ryjqw25fiate2oi11727 [...]
+ Content analysis details: (5.90 points,
+ 5 required) REPLY_TO_EMPTY (0.5 points) Reply-To: is empty
+ USER_AGENT_MOZILLA_UA (0.0 points) User-Agent header indicates a non-spam MUA
+ (Mozilla) X_ACCEPT_LANG (-0.1 points) Has a X-Accept-Language header
+ VIAGRA_ONLINE (0.7 points) BODY: Fast Viagra Delivery HTML_MESSAGE (0.1
+ points) BODY: HTML included in message HTML_70_80 (0.5 points) BODY: Message
+ is 70% to 80% HTML RCVD_IN_NJABL (0.9 points) RBL: Received via a relay in
+ dnsbl.njabl.org [RBL check: found 16.78.221.12.dnsbl.njabl.org.,] [type:
+ 127.0.0.9] RCVD_IN_UNCONFIRMED_DSBL (0.5 points) RBL: Received via a relay in
+ unconfirmed.dsbl.org [RBL check: found 16.78.221.12.unconfirmed.dsbl.org.]
+ CLICK_BELOW (0.1 points) Asks you to click below MIME_HTML_ONLY (0.1 points)
+ Message only has text/html MIME parts OBFUSCATING_COMMENT (2.6 points) HTML
+ comments which obfuscate text
+X-Spam-Flag: YES
+Content-Length: 1240
+Lines: 9
+
+<p>G<!--xxt7od1m0td9u-->et Vi<!--kto44m2scyal-->a<!--jjucrv2vfym5u-->gra o<!--lxmqpo14b4hw3-->nline N<!--r3whfi3g7n-->ow <!--mfcojn2fmgr7b2-->! <br>
+  <br>
+  W<!--0mdtl620yv4s51-->e ar<!--csvon910nvcbh-->e th<!--9gl83c16u2a-->e che<!--zgls8b1pyf2u-->ape<!--w55kyx1pph-->st sup<!--3ep5li2d78i6q-->plier o<!--hoxvr5y20s-->n <!--evi8w61sksnv-->the n<!--ifbq0kysy5h-->et <br>
+  10<!--jkra3i1wko7-->0 <!--7cjl052ne82w-->% g<!--q6a5d3unp5od2-->uarant<!--4w2u7vtcqqv8-->ee !<br>
+  a<!--ck29rq33yq-->t 3 <!--gg6dbl1giso90-->$ a<!--ufcjia12s2yby1--> do<!--mr0ihii9g2-->se, tr<!--nhuwuz1lo9174-->y i<!--yctwfg2mwmv8-->t no<!--vhwdjz1gw4kqj-->w. <a href="http://www.xcellentresults.biz/index.php?id=9999">C<!--atbdqi3lfun2-->lic<!--j5r0tueppwf-->k 
+  he<!--t32fbv3bszm-->re</a></p>
+<br><br><br><br><br>
+<p><!--kiu3jkyq7l--><a href="http://www.xcellentresults.biz/optout.php"><!--4tqyy72fzmzk--><font size="-1">Disc<!--0dzlpe235cfc-->ontin<!--30vo8q36lmx1-->ue</font><!--7n1rou234ir4ec--></a><!--gy25vp33je8lp3--><font size="-1"> 
+  re<!--schi633v2kj5m2-->ceiv<!--xa8jthul694j6-->ing off<!--nkhryt3jugkr5-->ers jb80v63snt3fht3tr6135os80 5bbdjf2r52f qopu343yz1frdybc3od6n0j4rq8ct26mhfo 1v5qat38wft9a 2ryjqw25fiate2oi11727</font><!--pc1fqhkbko661--></p>
+
+From ueybt082vz at terra.es  Mon Aug 11 10:00:38 2003
+Return-Path: <ueybt082vz at terra.es>
+Delivered-To: markov at speeltuin.atcomputing.nl
+Received: from 195.108.229.26 (unknown [202.109.97.239])
+	by speeltuin.ATComputing.nl (Postfix) with SMTP id C0D8339AD
+	for <mark at overmeer.net>; Mon, 11 Aug 2003 10:00:31 +0200 (CEST)
+Received: from (HELO llyrfu) [131.190.221.35]
+	by 195.108.229.26 with ESMTP id <288253-09166>;
+	Fri, 01 Mar 2002 14:21:45 +0200
+Message-ID: <1-n6o1zyzz1i0b--2aquh-347i at twbg9ccjh>
+From: "Jewel Jacobson" <ueybt082vz at terra.es>
+Reply-To: "Jewel Jacobson" <ueybt082vz at terra.es>
+To: mark at overmeer.net
+Subject: RE:leukemia B anned kcvl   jrghbvw
+Date: Fri, 01 Mar 2002 14:21:45 +0200
+MIME-Version: 1.0
+Content-Type: multipart/alternative;
+	boundary="538B6B3B604.0D."
+X-Spam-Status: No, hits=3.1 required=5.0
+ tests=BASE64_ENC_TEXT,HTML_50_60,HTML_MESSAGE,
+ MIME_HTML_NO_CHARSET,MIME_HTML_ONLY version=2.55
+X-Spam-Level: ***
+X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp)
+Status: RO
+Content-Length: 3201
+Lines: 52
+
+--538B6B3B604.0D.
+Content-Type: text/html;
+Content-Transfer-Encoding: base64
+
+PGh0bWw+DQo8Zm9udCBzaXplPSIxIj5kZXJieXNoaXJlIGRpb24gIG8gY2d0aXINCmpkYmdi
+bnl5a3pwcXl1IGwmbmJzcDsgZWxpemFiZXRoYW48L2ZvbnQ+DQo8dGFibGUgYm9yZGVyPSIw
+IiB3aWR0aD0iNTclIiBjZWxsc3BhY2luZz0iMCI+DQogIDx0cj4NCiAgICA8dGQgd2lkdGg9
+IjEwMCUiPg0KICAgICAgPHAgYWxpZ249ImNlbnRlciI+PGltZyBib3JkZXI9IjAiIHNyYz0i
+aHR0cDovL21lZHMyNDcuaW5mby9jZC9hZHMuanBnIiBhbHQ9ImFzZGZhc2RmYXNkZmFzZCAg
+YXNkZmFzZGZhc2QgYXNkZmFzZGZhc2QgYWZzZGZhc2RmYXNkZnNkZiBzZGZzZGZzZGZzZGZz
+ZCI+PC90ZD4NCiAgPC90cj4NCiAgPHRyPg0KICAgIDx0ZCB3aWR0aD0iMTAwJSI+DQogICAg
+ICA8cCBhbGlnbj0iY2VudGVyIj4NCiZuYnNwOyBIaSw8Zm9udCBzaXplPSIyIj5NYXJrPC9m
+b250PiwgSQ0KICAgICAgaGF2ZSBiZWVuIHJlY2VpdmluZyBlbWFpbHMgc2F5aW5nIHRoYXQg
+SSdtIGNvbnRyaWJ1dGluZyB0byB0aGUgJnF1b3Q7bW9yYWwNCiAgICAgIGRlY2F5IG9mIHNv
+Y2lldHkmcXVvdDsgYnkgc2VsbGluZyB0aGUgQmFubmVkIEMgRC4gVGhhdCBtYXkgYmUsIGJ1
+dCBJIGZlZWwNCiAgICAgIFN0cm9uZ2x5IHRoYXQgeW91IGhhdmUgYSByaWdodCB0byBiZW5l
+Zml0IGZyb20gdGhpcyBoYXJkLXRvLWZpbmQNCiAgICAgIGluZm9ybWF0aW9uLiBTbyBJIGFt
+IGdpdmluZyB5b3Ugb25lIGxhc3QgY2hhbmNlIHRvIG9yZGVyIHRoZSBCYW5uZWQgQyBEIQ0K
+ICAgICAgV2l0aCB0aGlzIHBvd2VyZnVsIEMgRCwgeW91IHdpbGwgYmUgYWJsZSB0byBpbnZl
+c3RpZ2F0ZSB5b3VyIGZyaWVuZHMsDQogICAgICBlbmVtaWVzIGFuZCBsb3ZlcnMgaW4ganVz
+dCBtaW51dGVzIHVzaW5nIHRoZSBJbnRlcm5ldC4gWW91IGNhbiB0cmFjayBkb3duDQogICAg
+ICBvbGQgZmxhbWVzIGZyb20gY29sbGVnZSwgb3IgeW91IGNhbiBkaWcgdXAgc29tZSBkaXJ0
+IG9uIHlvdXIgYm9zcyB0byBtYWtlDQogICAgICBzdXJlIHlvdSBnZXQgdGhhdCBuZXh0IHBy
+b21vdGlvbiEgPGJyPg0KICAgICAgV2h5IGFyZSB0aGV5IHNvIHVwc2V0PyBCZWNhdXNlIHRo
+aXMgQyBEIGdpdmVzIHlvdSBmcmVlZG9tLiBBbmQgeW91IGNhbid0DQogICAgICBidXkgZnJl
+ZWRvbSBhdCB5b3VyIGxvY2FsIFdhbG1hcnQuIFlvdSB3aWxsIGhhdmUgdGhlIGZyZWVkb20g
+dG8gYXZvaWQgYyByZWRpdG9ycywganVkZ21lbnRzLCBsYXdzdWl0cywgSVJTIHRheGNvbGxl
+Y3RvcnMsIGNyaW1pbmFsIGluZGljdG1lbnRzLA0KICAgICAgeW91ciBncmVlZHkgZXgtd2lm
+ZSBvciBleC1odXNiYW5kLCBhbmQgbXVjaCBtb3JlISA8YSBocmVmPSJodHRwOi8vbWVkczI0
+Ny5pbmZvL0NEL2luZGV4Lmh0bSI+PGZvbnQgc2l6ZT0iMiI+U2VlJm5ic3A7DQogICAgICBO
+b3c8L2ZvbnQ+PC9hPjxmb250IHNpemU9IjIiPiA8L2ZvbnQ+PC9wPg0KICAgICAgPGRpdiBh
+bGlnbj0ibGVmdCI+DQogICAgICAgIDxmb250IGNvbG9yPSIjMDAwMDAwIiBmYWNlPSJBcmlh
+bCIgc2l6ZT0iMSI+IA0KICAgICAgICA8YSBocmVmPSJodHRwOi8vbWVkc2QyNDcuaW5mby9E
+ZWJ0Mi9ydGgucGhwIj4NCm4mbmJzcDsmbmJzcDsmbmJzcDsgbyZuYnNwOyZuYnNwOyBtJm5i
+c3A7Jm5ic3A7IGEmbmJzcDsmbmJzcDsgaSZuYnNwOyZuYnNwOyZuYnNwOw0KbDwvYT48L2Zv
+bnQ+DQogICAgICA8L2Rpdj4NCiAgICAgIDxkaXYgYWxpZ249ImxlZnQiPg0KICAgICAgICA8
+Zm9udCBzaXplPSIxIj5hJm5ic3A7Jm5ic3A7IGxhdXJlbmNlJm5ic3A7ICUgUkFORE9NX0NI
+QVImbmJzcDsNCiAgICAgICAgcXVhZHJpcGFydGl0ZSZuYnNwOzwvZm9udD4NCiAgICAgIDwv
+ZGl2Pg0KICAgICAgPGRpdiBhbGlnbj0ibGVmdCI+DQogICAgICAgIDxmb250IHNpemU9IjEi
+PmNsYXNzaWMmbmJzcDsgeWYgYWdzIHVsdQ0KcyB4ICAgYSZuYnNwOyZuYnNwOyBhJm5ic3A7
+Jm5ic3A7Jm5ic3A7DQogICAgICAgIGFsYW48L2ZvbnQ+DQogICAgICA8L2Rpdj4NCiAgICAg
+IDxkaXYgYWxpZ249ImxlZnQiPg0KICAgICAgICA8Zm9udCBzaXplPSIxIj5kb3JvdGh5Jm5i
+c3A7IGplYmRsY29zc2RyaWFucGsgDQp0aHltZ24NCg0KIGR4IGVkYXJyaSAgJm5ic3A7Jm5i
+c3A7IHUmbmJzcDsmbmJzcDsmbmJzcDsNCiAgICAgICA8L2ZvbnQ+DQogICAgICA8L2Rpdj4N
+CiAgICAgIDxkaXYgYWxpZ249ImxlZnQiPg0KICAgICAgPC9kaXY+DQogICAgPC90ZD4NCiAg
+PC90cj4NCjwvdGFibGU+DQo8L2h0bWw+bCBlcW9paWd5dnNweHpyb2xydncgbSB3c2Z0IGEN
+CnZpZnBocCBheW9wDQp3empyDQp3dGI=
+
+
+
+--538B6B3B604.0D.--
+
+
+From xuzeq307 at yahoo.ca  Mon Aug 11 10:20:21 2003
+Return-Path: <xuzeq307 at yahoo.ca>
+Delivered-To: markov at speeltuin.atcomputing.nl
+Received: from PROXY (unknown [203.197.217.130])
+	by speeltuin.ATComputing.nl (Postfix) with SMTP id E6C5939AB
+	for <solutions at overmeer.net>; Mon, 11 Aug 2003 10:20:15 +0200 (CEST)
+Received: from [169.14.160.200] by PROXY id Sl8tcqcbBmL2; Mon, 11 Aug 2003 02:21:46 -0700
+Message-ID: <5225$2$t-9t2dh9vr$14 at lcfpb0>
+From: "Aurelia Grover" <xuzeq307 at yahoo.ca>
+Reply-To: "Aurelia Grover" <xuzeq307 at yahoo.ca>
+To: <solutions at overmeer.net>
+Subject: Solutions Free ebay course for you attestation
+Date: Mon, 11 Aug 03 02:21:46 GMT
+X-Mailer: Microsoft Outlook, Build 10.0.2616
+MIME-Version: 1.0
+Content-Type: multipart/alternative;
+	boundary="D_FD_0_5E_1"
+X-Priority: 1
+X-MSMail-Priority: High
+X-Spam-Status: Yes, hits=10.9 required=5.0
+ tests=CASHCASHCASH,DATE_IN_PAST_06_12,FORGED_MUA_OUTLOOK,
+ FROM_ENDS_IN_NUMS,HTML_30_40,HTML_FONT_BIG,
+ HTML_FONT_COLOR_BLUE,HTML_FONT_COLOR_GREEN,
+ HTML_FONT_COLOR_RED,HTML_FONT_FACE_ODD,HTML_MESSAGE,
+ MIME_HTML_NO_CHARSET,MIME_HTML_ONLY,MISSING_MIMEOLE,
+ X_PRIORITY_HIGH version=2.55
+X-Spam-Level: **********
+X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp)
+X-Spam-Report:  This mail is probably spam. The original message has been
+ attached along with this report,
+ so you can recognize or block similar unwanted mail in future. See
+ http://spamassassin.org/tag/ for more details. Content preview: eBay FREE
+ Training Conference eBay and You Let's Get You making $$$ Stop buying your
+ products from the Middle Man Attend a Free Online Product Sales and
+ Acquisition Conference [...] Content analysis details: (10.90 points,
+ 5 required) X_PRIORITY_HIGH (1.9 points) Sent with 'X-Priority' set to high
+ FROM_ENDS_IN_NUMS (0.7 points) From: ends in numbers HTML_30_40 (0.9 points)
+ BODY: Message is 30% to 40% HTML HTML_FONT_FACE_ODD (0.3 points) BODY: HTML
+ font face is not a commonly used face HTML_FONT_COLOR_RED (0.1 points) BODY:
+ HTML font color is red HTML_MESSAGE (0.1 points) BODY: HTML included in
+ message HTML_FONT_COLOR_GREEN (0.8 points) BODY: HTML font color is green
+ HTML_FONT_BIG (0.3 points) BODY: FONT Size +2 and up or 3 and up
+ HTML_FONT_COLOR_BLUE (0.1 points) BODY: HTML font color is blue
+ MIME_HTML_NO_CHARSET (0.8 points) RAW: Message text in HTML without specified
+ charset DATE_IN_PAST_06_12 (0.8 points) Date: is 6 to 12 hours before
+ Received: date MISSING_MIMEOLE (0.5 points) Message has X-MSMail-Priority,
+ but no X-MimeOLE MIME_HTML_ONLY (0.1 points) Message only has text/html MIME
+ parts FORGED_MUA_OUTLOOK (3.5 points) Forged mail pretending to be from MS
+ Outlook CASHCASHCASH (0.0 points) Contains at least 3 dollar signs in a row
+X-Spam-Flag: YES
+Status: RO
+Content-Length: 2529
+Lines: 69
+
+--D_FD_0_5E_1
+Content-Type: text/html;
+Content-Transfer-Encoding: quoted-printable
+
+<html>
+<head>
+        <title>eBay FREE Training Conference</title>
+</head>
+
+<body>
+<table width=3D"400" align=3D"center">
+<tr align=3D"center"><td>
+<b><font face=3D"MS Serif" size=3D"+1" color=3D"Green">
+eBay and You <br>
+Let's Get You making $$$ <br>
+Stop buying your products from the Middle Man</font> <br> <br>
+
+Attend a Free Online <font face=3D"MS Serif" color=3D"Green"><i>Product Sa=
+les and Acquisition Conference</i></font> </b><br> <br>
+</td></tr>
+<tr><td><b>
+To make money on eBay and the Internet you need to get the source product =
+at deep
+discounts. In this free online conference you will <br><i><font face=3D"Ar=
+ial" color=3D"Red">learn how to acquire thousands of
+products directly from the manufacturers</font> </i>&nbsp;&nbsp;&nbsp;(cut=
+ the middlemen and buying clubs) at
+wholesale or less - including overstocks and discontinued items for pennie=
+s on the dollar. <br><br><br>
+
+<font color=3D"Blue">Who is this conference for? </font><br> <br></b>
+
+<font color=3D"Blue"><b>Beginners</b></font> - that want to do it the righ=
+t way from the start <br>
+<font color=3D"Blue"><b>Intermediate</b></font> - Have had some fun and ma=
+de a little money and now want to get serious <br>
+<font color=3D"Blue"><b>Advanced</b></font> - Increase your profit margins=
+ and double or triple the money you make. <br><br><br>
+
+
+<em><font color=3D"Red"><b>Remember this</b></font></em> - you make your m=
+oney when you buy the product - you realize your 
+profit when you sell the product. <br> <br>
+
+<b>In this FREE online training conference you will learn:</b> <br> <br>
+
+<li type=3D"disc">How to Buy and Sell For Maximum Profits <br>
+<li type=3D"disc">eBay Listing and Launching Secrets of the Experts
+<li type=3D"disc">What licensing is needed to work directly with manufactu=
+rers 
+<li type=3D"disc">How a Web Presence can double your gross revenues 
+<li type=3D"disc">Automating your auctions for even larger profits 
+<li type=3D"disc">How to generate several streams of auction and Internet =
+revenue <br> <br> <br> 
+
+<b>
+<a href=3D"http://www.emty-too.com.br/ada/amj/">Register HERE for the powe=
+rful training right now</a> - The training is taught live and at the 
+comfort of your own personal computer and it is FREE! <br> <br> </b>
+
+<div align=3D"center"><font color=3D"Green">(You can remove yourself at th=
+e website.)</font></div> <br></td></tr>
+</table>
+</body>
+</html>flmsmybnyvy
+ddtpfs n hcjkd bx vcut
+
+--D_FD_0_5E_1--
+
+
+From pfx2hdcrd at yahoo.com  Mon Aug 11 08:02:06 2003
+Return-Path: <pfx2hdcrd at yahoo.com>
+Delivered-To: markov at speeltuin.atcomputing.nl
+Received: from 195.108.229.26 (unknown [218.80.66.24])
+	by speeltuin.ATComputing.nl (Postfix) with SMTP id 3769539AD
+	for <mailtools at overmeer.net>; Mon, 11 Aug 2003 08:02:01 +0200 (CEST)
+Received: from [24.64.72.48]
+	by 195.108.229.26 with ESMTP id 8808DCFF8E1;
+	Mon, 11 Aug 2003 02:55:26 -0400
+Message-ID: <a0$9mrz$q9-jt1hn-ykv00t427f5y at bjd.u.j064>
+From: "Pauline Ayala" <pfx2hdcrd at yahoo.com>
+Reply-To: "Pauline Ayala" <pfx2hdcrd at yahoo.com>
+To: <mailtools at overmeer.net>
+Subject: Here's A Quick Way To Take A Dream Vacation
+Date: Mon, 11 Aug 03 02:55:26 GMT
+X-Mailer: eGroups Message Poster
+MIME-Version: 1.0
+Content-Type: multipart/alternative;
+	boundary="0.B36E4258335494.299EC_"
+X-Priority: 3
+X-MSMail-Priority: Normal
+X-Spam-Status: Yes, hits=11.4 required=5.0
+ tests=DATE_IN_PAST_03_06,FORGED_YAHOO_RCVD,HTML_60_70,
+ HTML_FONT_BIG,HTML_FONT_COLOR_RED,HTML_MESSAGE,
+ MIME_HTML_NO_CHARSET,MIME_HTML_ONLY,MISSING_MIMEOLE,
+ MISSING_OUTLOOK_NAME,RATWARE_EGROUPS,VACATION_SCAM version=2.55
+X-Spam-Level: ***********
+X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp)
+X-Spam-Report:  This mail is probably spam. The original message has been
+ attached along with this report,
+ so you can recognize or block similar unwanted mail in future. See
+ http://spamassassin.org/tag/ for more details. Content preview: If you are
+ paying more than 4.6% on your mortgage we can save you money
+ URI:http://www.aspserver3.com/L02/freequote.aspx Click for quote To be
+ excluded for the list,
+ URI:http://www.pickrate.com/something.html Press [...] Content analysis
+ details: (11.40 points,
+ 5 required) RATWARE_EGROUPS (4.3 points) Bulk email software fingerprint
+ (eGroups) found in headers VACATION_SCAM (1.9 points) BODY: Vacation Offers
+ HTML_60_70 (0.1 points) BODY: Message is 60% to 70% HTML HTML_FONT_COLOR_RED
+ (0.1 points) BODY: HTML font color is red HTML_MESSAGE (0.1 points) BODY:
+ HTML included in message HTML_FONT_BIG (0.3 points) BODY: FONT Size +2 and up
+ or 3 and up MIME_HTML_NO_CHARSET (0.8 points) RAW: Message text in HTML
+ without specified charset DATE_IN_PAST_03_06 (0.3 points) Date: is 3 to 6
+ hours before Received: date FORGED_YAHOO_RCVD (2.3 points) 'From' yahoo.com
+ does not match 'Received' headers MISSING_MIMEOLE (0.5 points) Message has
+ X-MSMail-Priority, but no X-MimeOLE MIME_HTML_ONLY (0.1 points) Message only
+ has text/html MIME parts MISSING_OUTLOOK_NAME (0.6 points) Message looks like
+ Outlook, but isn't
+X-Spam-Flag: YES
+Content-Length: 1058
+Lines: 40
+
+--0.B36E4258335494.299EC_
+Content-Type: text/html;
+Content-Transfer-Encoding: quoted-printable
+
+<HTML>
+<BODY>
+<P>
+<TABLE cellSpacing=3D1 cellPadding=3D1 width=3D"80%" border=3D0>
+  
+  <TR>
+    <TD>
+      <FONT face=3DArial size=3D2>
+If you are paying more than <BR><font face=3Darial size=3D2 color=3Dred><b=
+><FONT face=3DArial size=3D4>4.6% <FONT face=3DArial size=3D2>on your mort=
+gage</b></font><BR><font face=3Darial size=3D2 color=3Dblack>we can save y=
+ou money<Br><A 
+      href=3D"http://www.aspserver3.com/L02/freequote.aspx"><FONT face=3DA=
+rial size=3D2>Click for quote
+      </FONT></A>  
+      <P></P></TD></TR>
+  <TR>
+    <TD style=3D"HEIGHT: 200px" height=3D200><FONT face=3DArial></FONT></T=
+D></TR>
+  <TR>
+    <TD><FONT face=3DArial size=3D2>To be excluded for the list, </FONT><A=
+ 
+      href=3D"http://www.pickrate.com/something.html"><FONT face=3DArial s=
+ize=3D2>Press</FONT></A></TD></TR></TABLE></P>
+
+</BODY>
+</HTML>
+hfj yszwonn efeuhiwfc
+nw llubxlduckshsmucnqv
+dblm
+n fjtupz  yrqduf d b  gv
+gujw 
+lm 
+
+--0.B36E4258335494.299EC_--
+
+From PitBoss at onlinebetting.net  Mon Aug 11 09:08:25 2003
+Return-Path: <PitBoss at onlinebetting.net>
+Delivered-To: markov at speeltuin.atcomputing.nl
+Received: from onlinebetting.net (host58-49.pool21756.interbusiness.it [217.56.49.58])
+	by speeltuin.ATComputing.nl (Postfix) with SMTP id 0931839AD
+	for <mark at overmeer.net>; Mon, 11 Aug 2003 09:08:23 +0200 (CEST)
+Message-ID: <037e01c35fd0$b51b08f0$4b3ed51b at qiimq>
+Reply-To: PitBoss at onlinebetting.net
+From: PitBoss at onlinebetting.net
+To: "Winner" <mark at overmeer.net>
+Subject: Get up to $200.00 FREE!!!
+Date: Mon, 11 Aug 2003 03:20:49 -0300
+MIME-Version: 1.0
+Content-Type: multipart/alternative;
+	boundary="----=_NextPart_101_8BBC_812B8B48.CBDE6294"
+X-Priority: 3
+X-MSMail-Priority: Normal
+X-Mailer: Microsoft Outlook Express 6.00.2800.1106
+X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
+X-Spam-Status: Yes, hits=8.8 required=5.0
+ tests=FRONTPAGE,HTML_80_90,HTML_IMAGE_ONLY_02,
+ HTML_IMAGE_RATIO_02,HTML_MESSAGE,NO_REAL_NAME,PLING_PLING,
+ RCVD_IN_NJABL,RCVD_IN_UNCONFIRMED_DSBL,SUBJ_FREE_CAP,
+ X_NJABL_OPEN_PROXY version=2.55
+X-Spam-Level: ********
+X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp)
+X-Spam-Report:  This mail is probably spam. The original message has been
+ attached along with this report,
+ so you can recognize or block similar unwanted mail in future. See
+ http://spamassassin.org/tag/ for more details. Content preview: Casino On Net,
+ World's Largest Online Casino.
+ URI:http://www.entercasino.com/main.cgi?refererID05037
+ URI:http://www.onlinebettingreview.com/images/550x640_NewsLetter_Ca_01.gif
+ [...] Content analysis details: (8.80 points,
+ 5 required) NO_REAL_NAME (0.8 points) From: does not include a real name
+ SUBJ_FREE_CAP (0.7 points) Subject contains "FREE" in CAPS HTML_80_90 (0.5
+ points) BODY: Message is 80% to 90% HTML HTML_MESSAGE (0.1 points) BODY: HTML
+ included in message HTML_IMAGE_RATIO_02 (0.5 points) BODY: HTML has a low
+ ratio of text to image area HTML_IMAGE_ONLY_02 (1.9 points) BODY: HTML has
+ images with 0-200 bytes of words FRONTPAGE (0.7 points) BODY: Frontpage used
+ to create the message RCVD_IN_NJABL (0.9 points) RBL: Received via a relay in
+ dnsbl.njabl.org [RBL check: found 58.49.56.217.dnsbl.njabl.org.]
+ RCVD_IN_UNCONFIRMED_DSBL (0.5 points) RBL: Received via a relay in
+ unconfirmed.dsbl.org [RBL check: found 58.49.56.217.unconfirmed.dsbl.org.]
+ X_NJABL_OPEN_PROXY (0.5 points) RBL: NJABL: sender is
+ proxy/relay/formmail/spam-source PLING_PLING (1.7 points) Subject has lots of
+ exclamation marks
+X-Spam-Flag: YES
+Content-Length: 2440
+Lines: 81
+
+This is a multi-part message in MIME format.
+------=_NextPart_101_8BBC_812B8B48.CBDE6294
+Content-Type: text/plain;
+	charset="iso-8859-1"
+Content-Transfer-Encoding: quoted-printable
+
+
+------=_NextPart_101_8BBC_812B8B48.CBDE6294
+Content-Type: text/html;
+	charset="iso-8859-1"
+Content-Transfer-Encoding: quoted-printable
+
+<html>
+
+<head>
+<meta name=3D"GENERATOR" content=3D"Microsoft FrontPage 4.0">
+<meta name=3D"ProgId" content=3D"FrontPage.Editor.Document">
+<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dwindo=
+ws-1252">
+<title>Casino On Net, World's Largest Online Casino. </title>
+
+</head>
+
+<body>
+
+<div align=3D"center">
+  <table style=3D"width: 412.5pt" cellSpacing=3D"0" cellPadding=3D"0" w=
+idth=3D"550" border=3D"0">
+    <tr>
+      <td style=3D"padding: 0in">
+      <p class=3D"MsoNormal"><font color=3D"black"><span style=3D"color=
+: black">
+      <a href=3D"http://www.entercasino.com/main.cgi?refererID=3D305037=
+ ">
+      <img id=3D"_x0000_i1026" src=3D"http://www.onlinebettingreview.co=
+m/images/550x640_NewsLetter_Ca_01.gif" border=3D"0" width=3D"550" height=
+=3D"242"></a></span></font></td>
+    </tr>
+    <tr>
+      <td style=3D"padding: 0in">
+      <p class=3D"MsoNormal"><font face=3D"Times New Roman" color=3D"bl=
+ack" size=3D"3">
+      <span style=3D"text-decoration: none; font-size:12pt; color:black=
+">
+      <a href=3D"http://www.entercasino.com/download.cgi?refererID=3D30=
+5037 ">
+      <img id=3D"_x0000_i1027" src=3D"http://www.onlinebettingreview.co=
+m/images/550x640_NewsLetter_Ca_02.gif" border=3D"0" width=3D"550" height=
+=3D"167"></a></span></font></td>
+    </tr>
+    <tr>
+      <td style=3D"padding: 0in">
+      <p class=3D"MsoNormal"><font color=3D"black"><span style=3D"color=
+: black">
+      <a href=3D"http://www.entercasino.com/download.cgi?refererID=3D30=
+5037 ">
+      <img id=3D"_x0000_i1028" src=3D"http://www.onlinebettingreview.co=
+m/images/550x640_NewsLetter_Ca_03.gif" border=3D"0" width=3D"550" height=
+=3D"231"></a></span></font>
+      <p class=3D"MsoNormal">&nbsp;</td>
+    </tr>
+    
+    <tr>
+      <td style=3D"padding: 0in">
+      </td>
+    </tr>
+  </table>
+</div>
+<p style=3D"margin-left: 0in; margin-right: 0in; margin-top: 0in; margi=
+n-bottom: 0pt">
+<font face=3D"Times New Roman" color=3D"black" size=3D"3">
+<span style=3D"display: none; font-size: 12pt; color: black">&nbsp;</sp=
+an></font></p>
+
+</body>
+
+</html>
+
+
+------=_NextPart_101_8BBC_812B8B48.CBDE6294--
+
+From lists at woobling.org  Thu Jul 10 18:49:52 2003
+Return-Path: <lists at woobling.org>
+Delivered-To: markov at speeltuin.atcomputing.nl
+Received: from eris.woobling.org (unknown [192.117.109.177])
+	by speeltuin.ATComputing.nl (Postfix) with ESMTP id 93D9F39AC
+	for <Mark at Overmeer.net>; Thu, 10 Jul 2003 18:49:51 +0200 (CEST)
+Received: from eris (eris [192.168.2.2])
+	by eris.woobling.org (Postfix) with ESMTP
+	id B1EB939C09B; Thu, 10 Jul 2003 19:53:50 +0300 (IDT)
+Date: Thu, 10 Jul 2003 19:53:26 +0300 (IDT)
+From: Yuval Kojman <lists at woobling.org>
+To: Mark Overmeer <Mark at Overmeer.net>
+Cc: Tim Sellar <tim.sellar at dsvr.co.uk>,
+	Mail-Box Mailinglist <mailbox at perl.overmeer.net>
+Subject: Re: Mail::Box::DBI (was Re: Mail::Box v2.043)
+In-Reply-To: <20030710125253.L5754 at speeltuin.ATComputing.nl>
+Message-ID: <Pine.OSX.4.56.0307101923360.2007 at revf>
+References: <20030710103707.J5754 at speeltuin.ATComputing.nl>
+ <1057832283.1546.60.camel at frodo> <20030710125253.L5754 at speeltuin.ATComputing.nl>
+X-PGP-Key: http://nothingmuch.woobling.org/gpg-key-0xEBD27418.asc
+X-Habeas-SWE-1: winter into spring
+X-Habeas-SWE-2: brightly anticipated
+X-Habeas-SWE-3: like Habeas SWE (tm)
+X-Habeas-SWE-4: Copyright 2002 Habeas (tm)
+X-Habeas-SWE-5: Sender Warranted Email (SWE) (tm). The sender of this
+X-Habeas-SWE-6: email in exchange for a license for this Habeas
+X-Habeas-SWE-7: warrant mark warrants that this is a Habeas Compliant
+X-Habeas-SWE-8: Message (HCM) and not spam. Please report use of this
+X-Habeas-SWE-9: mark in spam to <http://www.habeas.com/report/>.
+MIME-Version: 1.0
+Content-Type: TEXT/PLAIN; charset=US-ASCII
+Status: RO
+Content-Length: 2948
+Lines: 71
+
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+
+> It would help if I receive two or three existing implementations (I will
+> not publish that code) to see what people are doing.  Maybe, I can create
+> a base class DBI implementation which can be extended to personal needs...
+> Anyone?
+
+i have a few ideas:
+
+the DBI layer and a Mail::Box::DBI should be seperate in my views, in
+terms of database specifics. I think there should be another type of
+object, which is created from a default set but can be filled in by some
+externally constructed one, which allows the definition of the table
+structure, columns, et cetera. I think it'll also be wise to plan it so
+that you can have it work the the other way round, providing a DBI
+interface to Mail::Box objects for backups or whatever.
+
+If the Mail::Box::DBI (or whatever it'll be) mailbox driver uses this
+mediator object to create SQL queries for it, this will also allow for
+greater flexibility and optimisations between database servers, and
+provide a means to allow emphasis on specific details - will message
+reading be optimised for skimming - like in a quarenteen database, will
+it be low volume personal mail, etc.
+
+Since i tend to babble, if nobody understood what the hell i wanted i'd
+be glad to draw a little doodle explaining everything... =)
+
+> > I hope it would also
+> > assist in provding POP/IMAP access to quarantined mail in the future.
+> > Over all would this be the better solution?
+>
+> You are talking about POP and IMAP servers here... that will be a lot
+> of work.
+>
+
+I'm up to it, and i have some plans, and dillemas I was going to bring
+up on the list this week, when i'll have more time.
+
+the main problem is the current memory performance of the perl thread
+model, and it's 'experimental' status, which is a bit of a taboo
+regarding production environments, versus real forking, which has it's
+obvious disadvantages aswell.
+
+it'd also be cool to hack SGI::FAM into the mess for local mailboxes,
+and create an similarly functioning interface with IMAP's IDLE command
+when the Mail::Box::IMAP4 module is ready... i think a new method call
+("monitor"?) which blocks, and another which registers with a
+global (Mail::Box::Manager global, that is) which allows monitoring
+of multiple mailboxes would be useful both for a server, and
+for real MUAs, not just the scripts we all write to munge our mail...
+
+bah. i better stop.
+
+ciao ciao!
+
+- -- 
+Yuval Kogman  ( nothingmuch at woobling.org | nothingmuch at altern.org )
+kung foo master: /me sushi-spin-kicks : neeyah!!!!!!!!!!!!!!!!!!!!!
+et perl hacker. !@# http://nothingmuch.woobling.org/ gpg:0xEBD27418
+http://wecanstopspam.org/                    http://www.habeas.com/
+
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.2.2 (Darwin)
+Comment: pgpenvelope 2.10.2 - http://pgpenvelope.sourceforge.net/
+
+iEYEARECAAYFAj8NmhwACgkQVCwRwOvSdBg9NgCgoGYEcKqqaUO3zyWBahRPmXNx
+mkEAmgNNVYoYUxXypaMpTWKKnbAgV/bN
+=QsQN
+-----END PGP SIGNATURE-----
+
+From mailbox-owner at perl.overmeer.net  Tue Jul 15 03:02:18 2003
+Return-Path: <mailbox-owner at perl.overmeer.net>
+Delivered-To: markov at speeltuin.atcomputing.nl
+Received: by speeltuin.ATComputing.nl (Postfix, from userid 65)
+	id 6EC6039FC; Tue, 15 Jul 2003 03:02:18 +0200 (CEST)
+Delivered-To: mailbox at speeltuin.atcomputing.nl
+Received: from mail.woobling.org (unknown [192.117.109.177])
+	by speeltuin.ATComputing.nl (Postfix) with ESMTP id 61AED39A3
+	for <mailbox at perl.overmeer.net>; Tue, 15 Jul 2003 03:02:11 +0200 (CEST)
+Received: by mail.woobling.org (Postfix, from userid 502)
+	id 66D713D1108; Tue, 15 Jul 2003 04:06:16 +0300 (IDT)
+Date: Tue, 15 Jul 2003 04:06:12 +0300 (IDT)
+From: Yuval Kojman <lists at woobling.org>
+To: mailbox at perl.overmeer.net
+Subject: mailbox imap/pop server plans
+Message-ID: <Pine.OSX.4.56.0307150404001.22084 at revf>
+X-PGP-Key: http://nothingmuch.woobling.org/gpg-key-0xEBD27418.asc
+X-Habeas-SWE-1: winter into spring
+X-Habeas-SWE-2: brightly anticipated
+X-Habeas-SWE-3: like Habeas SWE (tm)
+X-Habeas-SWE-4: Copyright 2002 Habeas (tm)
+X-Habeas-SWE-5: Sender Warranted Email (SWE) (tm). The sender of this
+X-Habeas-SWE-6: email in exchange for a license for this Habeas
+X-Habeas-SWE-7: warrant mark warrants that this is a Habeas Compliant
+X-Habeas-SWE-8: Message (HCM) and not spam. Please report use of this
+X-Habeas-SWE-9: mark in spam to <http://www.habeas.com/report/>.
+MIME-Version: 1.0
+Content-Type: TEXT/PLAIN; charset=US-ASCII
+Sender: nothingmuch at mail.woobling.org
+X-Loop: mailbox at perl.overmeer.net
+X-Sequence: 1014
+Errors-To: mailbox-owner at perl.overmeer.net
+Precedence: list
+List-Id: <mailbox at perl.overmeer.net>
+List-Help: <mailto:sympa at perl.overmeer.net?subject=help>
+List-Subscribe: <mailto:sympa at perl.overmeer.net?subject=subscribe%20mailbox>
+List-Unsubscribe: <mailto:sympa at perl.overmeer.net?subject=unsubscribe%20mailbox>
+List-Post: <mailto:mailbox at perl.overmeer.net>
+List-Owner: <mailto:mailbox-request at perl.overmeer.net>
+Status: RO
+X-Status: A
+Content-Length: 854
+Lines: 28
+
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+http://nothingmuch.woobling.org/mailboxd.txt
+
+this text file illustrates the package namespaces i think are
+appropriate for an OOP correct, reusable, Mail::Box driven server suite.
+
+it is not near complete, and i think it won't be without someone else's
+views.
+
+TIA
+
+- -- 
+Yuval Kogman  ( nothingmuch at woobling.org | nothingmuch at altern.org )
+kung foo master: /me whallops greyface with a fnord: neeyah!!!!!!!!
+et perl hacker. !@# http://nothingmuch.woobling.org/ gpg:0xEBD27418
+http://wecanstopspam.org/                    http://www.habeas.com/
+
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.2.2 (Darwin)
+Comment: pgpenvelope 2.10.2 - http://pgpenvelope.sourceforge.net/
+
+iEYEARECAAYFAj8TU4cACgkQVCwRwOvSdBjpWQCgiubIEzLaMb4iQq4GnnHKnKiG
+KyIAoIM856aogzcUYeUh9YHq6qmdUETF
+=JlV/
+-----END PGP SIGNATURE-----
+
+From mailbox-owner at perl.overmeer.net  Tue Jul 15 03:02:18 2003
+Return-Path: <mailbox-owner at perl.overmeer.net>
+Delivered-To: markov at speeltuin.atcomputing.nl
+Date: Tue, 15 Jul 2003 04:06:12 +0300 (IDT)
+From: Yuval Kojman <lists at woobling.org>
+To: mailbox at perl.overmeer.net
+Subject: mailbox imap/pop server plans
+Message-ID: <correct-message at localhost>
+X-PGP-Key: http://nothingmuch.woobling.org/gpg-key-0xEBD27418.asc
+X-Habeas-SWE-1: winter into spring
+X-Habeas-SWE-2: brightly anticipated
+X-Habeas-SWE-3: like Habeas SWE (tm)
+X-Habeas-SWE-4: This line is wrong on purpose!!!!
+X-Habeas-SWE-5: Sender Warranted Email (SWE) (tm). The sender of this
+X-Habeas-SWE-6: email in exchange for a license for this Habeas
+X-Habeas-SWE-7: warrant mark warrants that this is a Habeas Compliant
+X-Habeas-SWE-8: Message (HCM) and not spam. Please report use of this
+X-Habeas-SWE-9: mark in spam to <http://www.habeas.com/report/>.
+MIME-Version: 1.0
+Content-Length: 854
+Lines: 28
+
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+http://nothingmuch.woobling.org/mailboxd.txt
+
+this text file illustrates the package namespaces i think are
+appropriate for an OOP correct, reusable, Mail::Box driven server suite.
+
+it is not near complete, and i think it won't be without someone else's
+views.
+
+TIA
+
+- -- 
+Yuval Kogman  ( nothingmuch at woobling.org | nothingmuch at altern.org )
+kung foo master: /me whallops greyface with a fnord: neeyah!!!!!!!!
+et perl hacker. !@# http://nothingmuch.woobling.org/ gpg:0xEBD27418
+http://wecanstopspam.org/                    http://www.habeas.com/
+
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.2.2 (Darwin)
+Comment: pgpenvelope 2.10.2 - http://pgpenvelope.sourceforge.net/
+
+iEYEARECAAYFAj8TU4cACgkQVCwRwOvSdBjpWQCgiubIEzLaMb4iQq4GnnHKnKiG
+KyIAoIM856aogzcUYeUh9YHq6qmdUETF
+=JlV/
+-----END PGP SIGNATURE-----
+
+From mailbox-owner at perl.overmeer.net  Tue Jul 15 03:02:18 2003
+Return-Path: <mailbox-owner at perl.overmeer.net>
+Delivered-To: markov at speeltuin.atcomputing.nl
+Date: Tue, 15 Jul 2003 04:06:12 +0300 (IDT)
+From: Yuval Kojman <lists at woobling.org>
+To: mailbox at perl.overmeer.net
+Subject: mailbox imap/pop server plans
+Message-ID: <missing-line-4 at localhost>
+X-PGP-Key: http://nothingmuch.woobling.org/gpg-key-0xEBD27418.asc
+X-Habeas-SWE-1: winter into spring
+X-Habeas-SWE-2: brightly anticipated
+X-Habeas-SWE-3: like Habeas SWE (tm)
+X-Habeas-SWE-5: Sender Warranted Email (SWE) (tm). The sender of this
+X-Habeas-SWE-6: email in exchange for a license for this Habeas
+X-Habeas-SWE-7: warrant mark warrants that this is a Habeas Compliant
+X-Habeas-SWE-8: Message (HCM) and not spam. Please report use of this
+X-Habeas-SWE-9: mark in spam to <http://www.habeas.com/report/>.
+MIME-Version: 1.0
+Content-Length: 854
+Lines: 28
+
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+http://nothingmuch.woobling.org/mailboxd.txt
+
+this text file illustrates the package namespaces i think are
+appropriate for an OOP correct, reusable, Mail::Box driven server suite.
+
+it is not near complete, and i think it won't be without someone else's
+views.
+
+TIA
+
+- -- 
+Yuval Kogman  ( nothingmuch at woobling.org | nothingmuch at altern.org )
+kung foo master: /me whallops greyface with a fnord: neeyah!!!!!!!!
+et perl hacker. !@# http://nothingmuch.woobling.org/ gpg:0xEBD27418
+http://wecanstopspam.org/                    http://www.habeas.com/
+
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.2.2 (Darwin)
+Comment: pgpenvelope 2.10.2 - http://pgpenvelope.sourceforge.net/
+
+iEYEARECAAYFAj8TU4cACgkQVCwRwOvSdBjpWQCgiubIEzLaMb4iQq4GnnHKnKiG
+KyIAoIM856aogzcUYeUh9YHq6qmdUETF
+=JlV/
+-----END PGP SIGNATURE-----
+
+From mailbox-owner at perl.overmeer.net  Tue Jul 15 03:02:18 2003
+Return-Path: <mailbox-owner at perl.overmeer.net>
+Delivered-To: markov at speeltuin.atcomputing.nl
+Date: Tue, 15 Jul 2003 04:06:12 +0300 (IDT)
+From: Yuval Kojman <lists at woobling.org>
+To: mailbox at perl.overmeer.net
+Subject: mailbox imap/pop server plans
+Message-ID: <additional-line at localhost>
+X-PGP-Key: http://nothingmuch.woobling.org/gpg-key-0xEBD27418.asc
+X-Habeas-SWE-1: winter into spring
+X-Habeas-SWE-2: brightly anticipated
+X-Habeas-SWE-3: like Habeas SWE (tm)
+X-Habeas-SWE-4: This line is wrong on purpose!!!!
+X-Habeas-SWE-5: Sender Warranted Email (SWE) (tm). The sender of this
+X-Habeas-SWE-6: email in exchange for a license for this Habeas
+X-Habeas-SWE-7: warrant mark warrants that this is a Habeas Compliant
+X-Habeas-SWE-8: Message (HCM) and not spam. Please report use of this
+X-Habeas-SWE-9: mark in spam to <http://www.habeas.com/report/>.
+X-Habeas-SWE-0: extra line not correct!!!
+MIME-Version: 1.0
+Content-Length: 854
+Lines: 28
+
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+http://nothingmuch.woobling.org/mailboxd.txt
+
+this text file illustrates the package namespaces i think are
+appropriate for an OOP correct, reusable, Mail::Box driven server suite.
+
+it is not near complete, and i think it won't be without someone else's
+views.
+
+TIA
+
+- -- 
+Yuval Kogman  ( nothingmuch at woobling.org | nothingmuch at altern.org )
+kung foo master: /me whallops greyface with a fnord: neeyah!!!!!!!!
+et perl hacker. !@# http://nothingmuch.woobling.org/ gpg:0xEBD27418
+http://wecanstopspam.org/                    http://www.habeas.com/
+
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.2.2 (Darwin)
+Comment: pgpenvelope 2.10.2 - http://pgpenvelope.sourceforge.net/
+
+iEYEARECAAYFAj8TU4cACgkQVCwRwOvSdBjpWQCgiubIEzLaMb4iQq4GnnHKnKiG
+KyIAoIM856aogzcUYeUh9YHq6qmdUETF
+=JlV/
+-----END PGP SIGNATURE-----
+
+From melanie.mcdonald_el at freemail.it  Mon Aug 11 08:16:21 2003
+Return-Path: <melanie.mcdonald_el at freemail.it>
+Delivered-To: markov at speeltuin.atcomputing.nl
+Message-ID: <two-spam-groups at localhost>
+From: "Melanie Mcdonald" <melanie.mcdonald_el at freemail.it>
+To: markov at cs.kun.nl
+Subject: Did you lose my ICQ?
+Date: Mon, 11 Aug 2003 06:24:40 +0000
+MIME-Version: 1.0
+User-Agent: Mozilla/5.030 (X11; U; FreeBSD i386; U; NT4.0; en-us) Gecko/25250101
+X-Accept-Language: en
+Content-Type: text/html
+Content-Transfer-Encoding: 8bit
+X-Spam-Status: Yes, hits=5.9 required=5.0
+ tests=CLICK_BELOW,HTML_70_80,HTML_MESSAGE,MIME_HTML_ONLY,
+ OBFUSCATING_COMMENT,RCVD_IN_NJABL,RCVD_IN_UNCONFIRMED_DSBL,
+ REPLY_TO_EMPTY,USER_AGENT_MOZILLA_UA,VIAGRA_ONLINE,
+ X_ACCEPT_LANG version=2.55
+X-Habeas-SWE-1: winter into spring
+X-Habeas-SWE-2: brightly anticipated
+X-Habeas-SWE-3: like Habeas SWE (tm)
+X-Habeas-SWE-4: Copyright 2002 Habeas (tm)
+X-Habeas-SWE-5: Sender Warranted Email (SWE) (tm). The sender of this
+X-Habeas-SWE-6: email in exchange for a license for this Habeas
+X-Habeas-SWE-7: warrant mark warrants that this is a Habeas Compliant
+X-Habeas-SWE-8: Message (HCM) and not spam. Please report use of this
+X-Habeas-SWE-9: mark in spam to <http://www.habeas.com/report/>.
+MIME-Version: 1.0
+X-Spam-Level: *****
+X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp)
+X-Spam-Flag: YES
+Content-Length: 1240
+Lines: 9
+
+<p>G<!--xxt7od1m0td9u-->et Vi<!--kto44m2scyal-->a<!--jjucrv2vfym5u-->gra o<!--lxmqpo14b4hw3-->nline N<!--r3whfi3g7n-->ow <!--mfcojn2fmgr7b2-->! <br>
+  <br>
+  W<!--0mdtl620yv4s51-->e ar<!--csvon910nvcbh-->e th<!--9gl83c16u2a-->e che<!--zgls8b1pyf2u-->ape<!--w55kyx1pph-->st sup<!--3ep5li2d78i6q-->plier o<!--hoxvr5y20s-->n <!--evi8w61sksnv-->the n<!--ifbq0kysy5h-->et <br>
+  10<!--jkra3i1wko7-->0 <!--7cjl052ne82w-->% g<!--q6a5d3unp5od2-->uarant<!--4w2u7vtcqqv8-->ee !<br>
+  a<!--ck29rq33yq-->t 3 <!--gg6dbl1giso90-->$ a<!--ufcjia12s2yby1--> do<!--mr0ihii9g2-->se, tr<!--nhuwuz1lo9174-->y i<!--yctwfg2mwmv8-->t no<!--vhwdjz1gw4kqj-->w. <a href="http://www.xcellentresults.biz/index.php?id=9999">C<!--atbdqi3lfun2-->lic<!--j5r0tueppwf-->k 
+  he<!--t32fbv3bszm-->re</a></p>
+<br><br><br><br><br>
+<p><!--kiu3jkyq7l--><a href="http://www.xcellentresults.biz/optout.php"><!--4tqyy72fzmzk--><font size="-1">Disc<!--0dzlpe235cfc-->ontin<!--30vo8q36lmx1-->ue</font><!--7n1rou234ir4ec--></a><!--gy25vp33je8lp3--><font size="-1"> 
+  re<!--schi633v2kj5m2-->ceiv<!--xa8jthul694j6-->ing off<!--nkhryt3jugkr5-->ers jb80v63snt3fht3tr6135os80 5bbdjf2r52f qopu343yz1frdybc3od6n0j4rq8ct26mhfo 1v5qat38wft9a 2ryjqw25fiate2oi11727</font><!--pc1fqhkbko661--></p>

Added: packages/libmail-box-perl/branches/upstream/current/tests/40mbox/10read.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/40mbox/10read.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/40mbox/10read.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,98 @@
+#!/usr/bin/perl -T
+#
+# Test reading of mbox folders.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 151;
+use File::Compare;
+
+use Mail::Box::Mbox;
+
+my @src = (folder => "=$fn", folderdir => 'folders');
+
+ok(Mail::Box::Mbox->foundIn(@src),    'check foundIn');
+
+#
+# The folder is read.
+#
+
+my $folder = Mail::Box::Mbox->new
+  ( @src
+  , lock_type    => 'NONE'
+  , extract      => 'ALWAYS'
+  );
+
+ok(defined $folder,                   'check success open folder');
+exit 1 unless defined $folder;
+
+cmp_ok($folder->messages , "==",  45, 'found all messages');
+is($folder->organization, 'FILE',     'folder organization FILE');
+
+#
+# Extract one message.
+#
+
+my $message = $folder->message(2);
+ok(defined $message,                   'take one message');
+isa_ok($message, 'Mail::Box::Message');
+isa_ok($message, 'Mail::Box::Mbox::Message');
+
+#
+# Extract a few messages.
+#
+
+my @some = $folder->messages(3,7);
+cmp_ok(@some, "==", 5,                 'take range of messages');
+isa_ok($some[0], 'Mail::Box::Message');
+
+#
+# All message should be parsed: extract => ALWAYS
+#
+
+my $parsed = 1;
+$parsed &&= $_->isParsed foreach $folder->messages;
+ok($parsed,                            'all messages parsed');
+
+#
+# Check whether all message's locations are nicely connected.
+#
+
+my $blank = $crlf_platform ? 2 : 1;
+
+my ($end, $msgnr) = (-$blank, 0);
+foreach $message ($folder->messages)
+{   my ($msgbegin, $msgend)   = $message->fileLocation;
+    my ($headbegin, $headend) = $message->head->fileLocation;
+    my ($bodybegin, $bodyend) = $message->body->fileLocation;
+
+#warn "($msgbegin, $msgend) ($headbegin, $headend) ($bodybegin, $bodyend)\n";
+    cmp_ok($msgbegin, "==", $end+$blank, "begin $msgnr");
+    cmp_ok($headbegin, ">", $msgbegin,   "end $msgnr");
+    cmp_ok($bodybegin, "==", $headend,   "glue $msgnr");
+    $end = $bodyend;
+
+    $msgnr++;
+}
+cmp_ok($end+$blank, "==",  -s $folder->filename);
+
+#
+# Try to delete a message
+#
+
+ok(!$folder->message(2)->deleted,       'msg2 not yet deleted');
+$folder->message(2)->delete;
+ok($folder->message(2)->deleted,        'flag msg for deletion');
+cmp_ok($folder->messages , "==",  45,   'deletion not performed yet');
+
+cmp_ok($folder->messages('ACTIVE')  , "==",  44, 'less messages ACTIVE');
+cmp_ok($folder->messages('DELETED') , "==",   1, 'more messages DELETED');
+
+$folder->close(write => 'NEVER');
+
+exit 0;

Added: packages/libmail-box-perl/branches/upstream/current/tests/40mbox/20write.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/40mbox/20write.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/40mbox/20write.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,76 @@
+#!/usr/bin/perl -T
+
+#
+# Test writing of mbox folders.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 5;
+use File::Compare;
+use File::Copy;
+
+use Mail::Box::Mbox;
+
+#
+# We will work with a copy of the original to avoid that we write
+# over our test file.
+#
+
+unlink $cpy;
+copy $src, $cpy
+    or die "Cannot create test folder: $!\n";
+
+my $folder = new Mail::Box::Mbox
+  ( folder       => "=$cpyfn"
+  , folderdir    => 'folders'
+  , lock_type    => 'NONE'
+  , extract      => 'ALWAYS'
+  , access       => 'rw'
+  );
+
+die "Couldn't read $cpy: $!\n"
+     unless $folder;
+
+#
+# None of the messages should be modified.
+#
+
+my $modified = 0;
+$modified ||= $_->modified foreach $folder->messages;
+ok(!$modified);
+
+#
+# Write unmodified folder to different file.
+# Because file-to-file copy of unmodified messages, the result must be
+# the same.
+#
+
+$folder->modified(1);  # force write
+ok($folder->write(policy => 'REPLACE'));
+
+# Try to read it back
+
+my $copy = new Mail::Box::Mbox
+  ( folder    => "=$cpyfn"
+  , folderdir => 'folders'
+  , lock_type => 'NONE'
+  , extract   => 'ALWAYS'
+  );
+
+ok($copy);
+cmp_ok($folder->messages, "==", $copy->messages);
+
+# Check also if the subjects are the same.
+
+my @folder_subjects = sort map {$_->head->get('subject')||''} $folder->messages;
+my @copy_subjects   = sort map {$_->head->get('subject')||''} $copy->messages;
+
+while(@folder_subjects)
+{   last unless shift(@folder_subjects) eq shift(@copy_subjects);
+}
+ok(!@folder_subjects);

Added: packages/libmail-box-perl/branches/upstream/current/tests/40mbox/30delay.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/40mbox/30delay.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/40mbox/30delay.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,161 @@
+#!/usr/bin/perl -T
+
+#
+# Test delay-loading on mbox folders.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 288;
+use File::Compare;
+use File::Copy;
+
+use Mail::Box::Mbox;
+
+#
+# We will work with a copy of the original to avoid that we write
+# over our test file.
+#
+
+copy $src, $cpy
+    or die "Cannot create test folder: $!\n";
+
+my $folder = new Mail::Box::Mbox
+  ( folder       => "=$cpyfn"
+  , folderdir    => 'folders'
+  , lock_type    => 'NONE'
+  , extract      => 'LAZY'
+  , access       => 'rw'
+  );
+
+die "Couldn't read $cpy: $!\n"
+    unless $folder;
+
+#
+# Check that the whole folder is continuous
+#
+
+my $blank = $crlf_platform ? 2 : 1;
+my ($end, $msgnr) = (-$blank, 0);
+
+foreach my $message ($folder->messages)
+{   my ($msgbegin, $msgend)   = $message->fileLocation;
+    my ($headbegin, $headend) = $message->head->fileLocation;
+    my ($bodybegin, $bodyend) = $message->body->fileLocation;
+
+    cmp_ok($msgbegin, "==", $end+$blank, "begin $msgnr");
+    cmp_ok($headbegin, ">", $msgbegin,   "end $msgnr");
+    cmp_ok($bodybegin, "==", $headend,   "glue $msgnr");
+    $end = $bodyend;
+    $msgnr++;
+}
+
+cmp_ok($end+$blank , "==",  -s $folder->filename, "full folder read");
+
+#
+# None of the messages should be modified.
+#
+
+my $modified = 0;
+$modified ||= $_->modified foreach $folder->messages;
+ok(! $modified,                                   "folder not modified");
+
+#
+# Write unmodified folder to different file.
+# Because file-to-file copy of unmodified messages, the result must be
+# the same.
+#
+
+my $oldsize = -s $folder->filename;
+
+$folder->modified(1);    # force write
+ok($folder->write,                                 "writing folder");
+cmp_ok($oldsize, "==",  -s $folder->filename,      "expected size");
+
+# Try to read it back
+
+my $copy = new Mail::Box::Mbox
+  ( folder       => "=$cpyfn"
+  , folderdir    => 'folders'
+  , lock_type    => 'NONE'
+  , extract      => 'LAZY'
+  );
+
+ok(defined $copy,                                   "re-reading folder");
+cmp_ok($folder->messages, "==", $copy->messages,    "all messages found");
+
+# Check also if the subjects are the same.
+
+my @f_subjects = map {$_->head->get('subject') ||''} $folder->messages;
+my @c_subjects = map {$_->head->get('subject') ||''} $copy->messages;
+
+while(@f_subjects)
+{   my $f = shift @f_subjects;
+    my $c = shift @c_subjects;
+    last unless $f eq $c;
+}
+ok(!@f_subjects,                                     "all msg-subjects found");
+
+#
+# None of the messages should be parsed yet.
+#
+
+my $parsed = 0;
+$_->isParsed && $parsed++ foreach $folder->messages;
+cmp_ok($parsed, "==", 0,                             "none of the msgs parsed");
+
+#
+# Check that the whole folder is continuous
+#
+
+($end, $msgnr) = (-$blank, 0);
+foreach my $message ($copy->messages)
+{   my ($msgbegin, $msgend)   = $message->fileLocation;
+    my ($headbegin, $headend) = $message->head->fileLocation;
+    my ($bodybegin, $bodyend) = $message->body->fileLocation;
+
+#warn "($msgbegin, $msgend) ($headbegin, $headend) ($bodybegin, $bodyend)\n";
+    cmp_ok($msgbegin, "==", $end+$blank, "begin $msgnr");
+    cmp_ok($headbegin, ">", $msgbegin,   "end $msgnr");
+    cmp_ok($bodybegin, "==", $headend,   "glue $msgnr");
+    $end = $bodyend;
+    $msgnr++;
+}
+cmp_ok($end+$blank, "==",  -s $copy->filename,      "written file size ok");
+
+#
+# None of the messages should be parsed still.
+#
+
+$parsed = 0;
+$_->isParsed && $parsed++ foreach $copy->messages;
+cmp_ok($parsed, "==", 0,                            "none of the msgs parsed");
+
+#
+# Force one message to be loaded.
+#
+
+my $message = $copy->message(3)->forceLoad;
+ok(ref $message,                                    "force load of one msg");
+my $body = $message->body;
+ok($message->isParsed);
+
+isa_ok($message, 'Mail::Message');
+
+#
+# Ask for a new field from the header, which is not taken by
+# default.  The message should get parsed.
+#
+
+ok(!defined $message->head->get('xyz'));
+
+ok(not $copy->message(2)->isParsed);
+ok(defined $copy->message(2)->head->get('x-mailer'));
+isa_ok($copy->message(2)->head, 'Mail::Message::Head::Complete');
+ok(not $copy->message(2)->isParsed);
+
+unlink $cpy;

Added: packages/libmail-box-perl/branches/upstream/current/tests/40mbox/40append.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/40mbox/40append.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/40mbox/40append.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,150 @@
+#!/usr/bin/perl -T
+
+#
+# Test appending messages on Mbox folders.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 32;
+use File::Compare;
+use File::Copy;
+
+use Mail::Box::Manager;
+use Mail::Message::Construct;
+
+#
+# We will work with a copy of the original to avoid that we write
+# over our test file.
+#
+
+my $empty = File::Spec->catfile($folderdir, 'empty');
+
+copy $src, $cpy
+    or die "Cannot create test folder $cpy: $!\n";
+unlink $empty;
+
+my $mgr = Mail::Box::Manager->new;
+
+my @fopts =
+  ( lock_type    => 'NONE'
+  , extract      => 'LAZY'
+  , access       => 'rw'
+  , save_on_exit => 0
+  );
+
+my $folder = $mgr->open
+  ( folder    => "=$cpyfn"
+  , folderdir => $folderdir
+  , @fopts
+  );
+
+die "Couldn't read $cpy: $!\n"
+    unless $folder;
+
+cmp_ok($folder->messages, "==", 45);
+
+# Add a message which is already in the opened folder.  This should
+# be ignored.
+
+$folder->addMessage($folder->message(3)->clone);
+cmp_ok($folder->messages, "==", 45);
+
+#
+# Create an Mail::Message and add this to the open folder.
+#
+
+my $msg = Mail::Message->build
+  ( From    => 'me at example.com'
+  , To      => 'you at anywhere.aq'
+  , Subject => 'Just a try'
+  , data    => [ "a short message\n", "of two lines.\n" ]
+  );
+
+ok(defined $msg,                                "message build successful");
+my @appended = $mgr->appendMessage("=$cpyfn", $msg);
+cmp_ok($folder->messages, "==", 46,             "message extends folder");
+cmp_ok(scalar @appended, "==", 1,               "coerced message returned");
+isa_ok($appended[0], 'Mail::Box::Message');
+
+cmp_ok($mgr->openFolders, "==", 1);
+$mgr->close($folder);
+cmp_ok($mgr->openFolders, "==", 0,              "folder is closed");
+
+my $msg2 = Mail::Message->build
+  ( From      => 'me_too at example.com'
+  , To        => 'yourself at anywhere.aq'
+  , Subject   => 'Just one more try'
+  , data      => [ "a short message\n", "of two lines.\n" ]
+  );
+
+my $old_size = -s $cpy;
+
+ at appended = $mgr->appendMessage($cpy, $msg2
+  , lock_type => 'NONE'
+  , extract   => 'LAZY'
+  , access    => 'rw'
+  );
+cmp_ok(@appended, "==", 1);
+
+cmp_ok($mgr->openFolders, "==", 0);
+ok($old_size != -s $cpy);
+
+$folder = $mgr->open
+  ( folder    => "=$cpyfn"
+  , folderdir => $folderdir
+  , @fopts
+  , access    => 'rw'
+  );
+
+ok($folder);
+cmp_ok($folder->messages, "==", 47);
+
+my $sec = $mgr->open
+  ( folder    => '=empty'
+  , folderdir => $folderdir
+  , @fopts
+  , create    => 1
+  );
+
+ok(defined $sec,                         "open newly created empty folder");
+exit unless defined $sec;
+
+cmp_ok($sec->messages, "==", 0,          "no messages in new folder");
+cmp_ok($mgr->openFolders, "==", 2,       "but the manager knows it is created");
+
+my $move = $folder->message(1);
+ok(defined $move,                        "select a message to be moved");
+
+my @moved = $mgr->moveMessage($sec, $move);
+cmp_ok(@moved, "==", 1,                  "one message has been moved");
+isa_ok($moved[0], 'Mail::Box::Message');
+is($moved[0]->folder->name, $sec->name);
+
+ok($move->deleted);
+cmp_ok($folder->messages, "==", 47);
+cmp_ok($sec->messages, "==", 1);
+
+my $copy   = $folder->message(2);
+ok(defined $copy);
+die unless defined $copy;
+
+my @copied = $mgr->copyMessage($sec, $copy);
+cmp_ok(@copied, "==", 1);
+isa_ok($copied[0], 'Mail::Box::Message');
+ok(!$copy->deleted);
+cmp_ok($folder->messages, "==", 47);
+cmp_ok($sec->messages, "==", 2);
+ok($sec->modified);
+
+$folder->close;
+$sec->close;
+
+ok(-f $empty);
+ok(-s $empty);
+
+unlink $empty;

Added: packages/libmail-box-perl/branches/upstream/current/tests/40mbox/50create.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/40mbox/50create.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/40mbox/50create.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,223 @@
+#!/usr/bin/perl -T
+
+#
+# Test creation/deletion and listing of folders.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 28;
+use File::Copy;
+use File::Spec;
+
+use Mail::Box::Mbox;
+use Mail::Message::Construct;
+
+my $top  = File::Spec->catdir('folders', 'Mail');
+clean_dir $top;
+
+#
+# Create a nice structure which looks like a set of mbox folders.
+#
+
+sub dir($;$)
+{   my $dirname = shift;
+    $dirname = File::Spec->catdir($dirname, shift) if @_;
+
+    die "Cannot create $dirname: $!\n"
+        unless -d $dirname || mkdir $dirname, 0700;
+
+    $dirname;
+}
+
+sub folder($$;$)
+{   my $filename = File::Spec->catfile(shift, shift);
+
+    my $content  = shift || $src;   # by default copies whole default mbox
+    copy $content, $filename
+       or die "Cannot copy $content to $filename: $!\n";
+}
+
+clean_dir $top;   # restart
+
+dir $top;
+folder $top, "f1", $0;
+folder $top, "f2";
+
+{   # Create an empty file.
+    my $f = IO::File->new(File::Spec->catfile($top,'f3'), 'w')
+        or die "Empty? $top/f3: $!";
+
+    $f->close;
+}
+
+my $dir = dir $top, "sub1";
+folder $dir, "s1f1";
+folder $dir, "s1f2";
+folder $dir, "s1f3";
+
+dir $top, "sub2";                 # empty dir
+
+folder $top, "f4";
+$dir = dir $top, "f4.d";          # fake subfolder
+folder $dir, "f4f1";
+folder $dir, "f4f2";
+folder $dir, "f4f3";
+
+my $success =
+   compare_lists [ sort Mail::Box::Mbox->listSubFolders(folderdir => $top) ]
+          , [ qw/f1 f2 f3 f4 sub1 sub2/ ];
+
+ok($success,                            'Initial tree creation');
+unless($success)
+{   require File::Find;
+    File::Find::find( { wanted => sub {print STDERR "$_\n" }
+                      , no_chdir => 1
+                      }, $top);
+    exit 1;
+}
+
+ok(compare_lists [ sort Mail::Box::Mbox->listSubFolders(folderdir => $top) ]
+          , [ qw/f1 f2 f3 f4 sub1 sub2/ ]
+  );
+
+ok(compare_lists [ sort Mail::Box::Mbox->listSubFolders
+                     ( folderdir  => $top
+                     , skip_empty => 1
+                     ) ]
+          , [ qw/f1 f2 f4 sub1/ ]
+  );
+
+ok(compare_lists [ sort Mail::Box::Mbox->listSubFolders
+                     ( folderdir  => $top
+                     , check      => 1
+                     ) ]
+          , [ qw/f2 f3 f4 sub1 sub2/ ]
+  );
+
+ok(compare_lists [ sort Mail::Box::Mbox->listSubFolders
+                     ( folderdir  => File::Spec->catfile($top, "f4.d")
+                     ) ]
+          , [ qw/f4f1 f4f2 f4f3/ ]
+  );
+
+ok(compare_lists [ sort Mail::Box::Mbox->listSubFolders
+                     ( folderdir  => $top
+                     , folder     => "=f4.d"
+                     )
+            ]
+          , [ qw/f4f1 f4f2 f4f3/ ]
+  );
+
+ok(compare_lists [ sort Mail::Box::Mbox->listSubFolders
+                     ( folder => File::Spec->catfile($top, "f4")) ]
+          , [ qw/f4f1 f4f2 f4f3/ ]
+  );
+
+#
+# Open a folder in a sub-dir which uses the extention.
+#
+
+my $folder = Mail::Box::Mbox->new
+  ( folderdir   => $top
+  , folder      => '=f4/f4f2'
+  , lock_type   => 'NONE'
+  );
+
+ok(defined $folder,                       'open =f4/f4f2');
+die unless defined $folder;
+
+cmp_ok($folder->messages, "==", 45,       'found all messages');
+$folder->close;
+
+#
+# Open a new folder.
+#
+
+ok(! -f File::Spec->catfile($top, 'f4', 'newfolder'));
+Mail::Box::Mbox->create('=f4/newfolder', folderdir => $top);
+ok(-f File::Spec->catfile($top, "f4.d", "newfolder"));
+
+$folder = Mail::Box::Mbox->new
+  ( folderdir   => $top
+  , folder      => '=f4/newfolder'
+  , access      => 'rw'
+  , lock_type   => 'NONE'
+  );
+
+ok($folder);
+cmp_ok($folder->messages, "==", 0);
+
+my $msg = Mail::Message->build
+  ( From    => 'me at example.com'
+  , To      => 'you at anywhere.aq'
+  , Subject => 'Just a try'
+  , data    => [ "a short message\n", "of two lines.\n" ]
+  );
+
+$folder->addMessage($msg);
+cmp_ok($folder->messages, "==", 1);
+
+$folder->close;
+ok(-s File::Spec->catfile($top, 'f4.d', 'newfolder'));
+
+#
+# Delete a folder.
+#
+
+$folder = Mail::Box::Mbox->new
+  ( folderdir   => $top
+  , folder      => '=f4'
+  , access      => 'rw'
+  , lock_type   => 'NONE'
+  );
+
+ok(defined $folder.                           'open folder =f4');
+die unless defined $folder;
+
+ok(-f File::Spec->catfile($top, "f4"),        'folder-file found');
+$folder->delete;                             # remove folder contents
+$folder->close;
+
+ok(! -f File::Spec->catfile($top, "f4"),      'empty folder clean-up'); 
+ok(! -d File::Spec->catfile($top, "f4.d"),    'empty subfolder clean-up'); 
+
+#
+# Write a folder, but at the same place is a subdir.  The subdir should
+# be moved to a name ending on `.d'
+#
+
+my $sub1 = File::Spec->catfile($top, "sub1");
+ok(-d $sub1,                                  'dir to be promoted');
+ok(Mail::Box::Mbox->create('=sub1', folderdir => $top),
+                                              'promote dir to subfolder');
+ok(-d File::Spec->catfile($top, "sub1.d"),    'check promotion'); 
+ok(-f $sub1,                                  'new folder exists'); 
+ok(-z $sub1,                                  'new folder is empty'); 
+
+$folder = Mail::Box::Mbox->new
+  ( folderdir   => $top
+  , folder      => '=sub1'
+  , access      => 'rw'
+  , lock_type   => 'NONE'
+  );
+
+ok(defined $folder,                           'open empty subfolder');
+cmp_ok($folder->messages, "==", 0,            'subfolder is empty');
+
+my $msg2 = Mail::Message->build
+  ( From    => 'me at example.com'
+  , To      => 'you at anywhere.aq'
+  , Subject => 'Just a try'
+  , data    => [ "a short message\n", "of two lines.\n" ]
+  );
+
+$folder->addMessage($msg2);
+cmp_ok($folder->messages, "==", 1,            'one message into empty folder');
+$folder->close;
+ok(-s $sub1,                                  'subfolder must exist now');
+

Added: packages/libmail-box-perl/branches/upstream/current/tests/40mbox/60thread.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/40mbox/60thread.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/40mbox/60thread.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,157 @@
+#!/usr/bin/perl -T
+
+#
+# Test threading on Mbox folders.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 23;
+use File::Copy;
+
+use Mail::Box::Manager;
+
+#
+# We will work with a copy of the original to avoid that we write
+# over our test file.
+#
+
+copy $src, $cpy
+    or die "Cannot create test folder $cpy: $!\n";
+
+my $mgr = Mail::Box::Manager->new;
+ok($mgr);
+
+my $folder = $mgr->open
+  ( folder       => "=$cpyfn"
+  , folderdir    => 'folders'
+  , lock_type    => 'NONE'
+  , extract      => 'LAZY'
+  , access       => 'rw'
+  , save_on_exit => 0
+# , thread_timespan => 'EVER'
+  );
+ok($folder);
+
+my $threads = $mgr->threads(folder => $folder);
+
+# First try message which is single.
+my $single = $folder->messageID(
+   '<200010041822.e94IMZr19712 at mystic.es.dupont.com>');
+ok($single);
+my $single2 = $folder->messageID(
+   '200010041822.e94IMZr19712 at mystic.es.dupont.com');
+ok($single2);
+is($single2, $single);
+my $single3 = $folder->messageID(
+   'garbage <200010041822.e94IMZr19712 at mystic.es.dupont.com> trash');
+ok($single3);
+is($single3, $single);
+
+my $start = $threads->threadStart($single);
+ok($start);
+is($single->messageID, $start->message->messageID);
+
+my $message = $folder->messageID('NDBBJJFDMKFOAIFBEPPJIELLCBAA.cknoos at atg.com');
+ok($message);
+
+my $this = $threads->thread($message);
+ok($this);
+compare_thread_dumps($this->threadToString, <<'MIDDLE', 'thread from here');
+1.2K Problem resizing images through perl script
+820  `- Re: Problem resizing images through perl script
+1.8K    `- RE: Problem resizing images through perl script
+1.0K       `- Re: Problem resizing images through perl script
+MIDDLE
+
+$start = $threads->threadStart($message);
+ok(defined $start);
+my $startmsg = $start->message;
+ok(defined $startmsg);
+isa_ok($startmsg, 'Mail::Message::Dummy');
+isa_ok($startmsg, 'Mail::Message');
+ok($startmsg->isDummy);
+ok($startmsg->messageID ne $message->messageID);
+compare_thread_dumps($start->threadToString, <<'START', 'thread from top');
+1.2K *- Problem resizing images through perl script
+820  |  `- Re: Problem resizing images through perl script
+1.8K |     `- RE: Problem resizing images through perl script
+1.0K |        `- Re: Problem resizing images through perl script
+1.2K `- Re: Convert HTM, HTML files to the .jpg format
+START
+
+$this->folded(1);
+compare_thread_dumps($start->threadToString, <<'FOLDED', 'folded thread');
+     *- [4] Problem resizing images through perl script
+1.2K `- Re: Convert HTM, HTML files to the .jpg format
+FOLDED
+
+$this->folded(0);
+compare_thread_dumps($start->threadToString, <<'START', 'unfolded thread');
+1.2K *- Problem resizing images through perl script
+820  |  `- Re: Problem resizing images through perl script
+1.8K |     `- RE: Problem resizing images through perl script
+1.0K |        `- Re: Problem resizing images through perl script
+1.2K `- Re: Convert HTM, HTML files to the .jpg format
+START
+
+my $out   = join '', map {$_->threadToString} $threads->sortedKnown;
+
+my @lines = sort split "\n", $out;
+ok(@lines = $folder->messages);
+$out      = join '', @lines;
+
+my $dump = <<'DUMP';
+1.3K Resize with Transparency
+1.2K *- Re: File Conversion From HTML to PS and TIFF
+2.1K    `--*- Re: File Conversion From HTML to PS and TIFF
+2.1K       `- Re: File Conversion From HTML to PS and TIFF
+1.4K Transparency question
+2.4K RE: Transparency question
+3.3K RE: Transparency question
+5.5K RE: Transparency question
+7.2K RE: Transparency question
+2.7K RE: jpeg2000 question
+1.2K *- Problem resizing images through perl script
+820  |  `- Re: Problem resizing images through perl script
+1.8K |     `- RE: Problem resizing images through perl script
+1.0K |        `- Re: Problem resizing images through perl script
+1.2K `- Re: Convert HTM, HTML files to the .jpg format
+747  Undefined Symbol: SetWarningHandler
+1.1K `- Re: Undefined Symbol: SetWarningHandler
+1.8K *- Re: watermarks/embossing
+307  Re: Annotate problems (PR#298)
+573  `- Re: Annotate problems (PR#298)
+1.0K 
+1.4K `- Re: your mail
+1.9K    `- Re: your mail
+152  Re: your mail
+686  `- Re: your mail
+189  Re: your mail
+2.0K 
+670  Re: your mail
+4.4K `- Re: your mail
+552  mailing list archives
+1.4K delegates.mgk set-up for unixware printing
+1.5K printing solution for UW 7.1
+1.4K *- Re: converts new sharpen factors
+1.2K New ImageMagick mailing list
+ 27  subscribe
+822  Confirmation for subscribe magick-developer
+ 63  `- Re: Confirmation for subscribe magick-developer
+ 11K Welcome to magick-developer
+1.7K core dump in simple ImageMagick example
+2.2K `- Re: core dump in simple ImageMagick example
+882     `- Re: core dump in simple ImageMagick example
+754        `- Re: core dump in simple ImageMagick example
+2.0K Core Dump on ReadImage
+1.0K `- Re: Core Dump on ReadImage
+1.6K Font metrics
+DUMP
+
+$dump = join '', sort split /^/, $out;
+compare_thread_dumps($out, $dump , 'sorted full dump');

Added: packages/libmail-box-perl/branches/upstream/current/tests/40mbox/70inplace.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/40mbox/70inplace.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/40mbox/70inplace.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,217 @@
+#!/usr/bin/perl -T
+
+#
+# Test writing of mbox folders using the inplace policy.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 116;
+use File::Compare;
+use File::Copy;
+
+use Mail::Box::Mbox;
+
+#
+# We will work with a copy of the original to avoid that we write
+# over our test file.
+#
+
+copy $src, $cpy
+    or die "Cannot create test folder $cpy: $!\n";
+
+my $folder = new Mail::Box::Mbox
+  ( folder       => "=$cpyfn"
+  , folderdir    => 'folders'
+  , lock_type    => 'NONE'
+  , extract      => 'LAZY'
+  , access       => 'rw'
+  , log          => 'NOTICES'
+#, trace => 'NOTICES'
+  );
+
+die "Couldn't read $cpy: $!\n"
+     unless $folder;
+
+#
+# None of the messages should be modified.
+#
+
+my $modified = 0;
+$modified ||= $_->modified foreach $folder->messages;
+ok(!$modified);
+
+#
+# Write unmodified folder.  This should be ready immediately.
+#
+
+ok($folder->write(policy => 'INPLACE'));
+my @progress = $folder->report('PROGRESS');
+ok(grep m/not changed/, @progress);
+
+#
+# All messages must still be delayed.
+#
+
+my $msgnr = 0;
+foreach ($folder->messages)
+{   my $body = $_->body;
+    if($body->isDelayed || $body->isNested || $body->isMultipart) {ok(1)}
+    else { warn "Warn: failed message $msgnr.\n"; ok(0) }
+    $msgnr++;
+}
+
+#
+# Now MODIFY the folder, and write it again.
+#
+
+my $modmsgnr = 30;
+$folder->message($modmsgnr)->modified(1);
+
+ok($folder->write(policy => 'INPLACE'));
+ok(not $folder->modified);
+
+#
+# All before messages before $modmsgnr must still be delayed.
+#
+
+$msgnr = 0;
+foreach ($folder->messages)
+{   my $body = $_->body;
+    my $right = ($body->isDelayed || $body->isMultipart || $body->isNested)
+        ? ($msgnr < $modmsgnr) : ($msgnr >= $modmsgnr);
+    ok($right,         "delayed message $msgnr");
+    $msgnr++;
+}
+
+my @folder_subjects = sort map {$_->get('subject')||''} $folder->messages;
+my $folder_messages = $folder->messages;
+
+ok(not $folder->modified);
+$folder->close;
+
+# Check also if the subjects are the same.
+# Try to read it back
+
+my $copy = new Mail::Box::Mbox
+  ( folder    => "=$cpyfn"
+  , folderdir => 'folders'
+  , lock_type => 'NONE'
+  , extract   => 'ALWAYS'
+  );
+
+ok(defined $copy);
+cmp_ok($copy->messages, "==", $folder_messages);
+
+# Check also if the subjects are the same.
+
+my @copy_subjects   = sort map {$_->get('subject')||''} $copy->messages;
+my $msg12subject    = $copy->message(12)->get('subject');
+ok(defined $msg12subject, "got msg12 subject");
+
+while(@folder_subjects)
+{   last unless shift(@folder_subjects) eq shift(@copy_subjects);
+}
+ok(!@folder_subjects);
+
+#
+# Check wether inplace rewrite works when a few messages are deleted.
+#
+
+$copy = new Mail::Box::Mbox
+  ( folder       => "=$cpyfn"
+  , folderdir    => 'folders'
+  , lock_type    => 'NONE'
+  , extract      => 'LAZY'
+  , access       => 'rw'
+  , log          => 'NOTICES'
+#, trace => 'NOTICES'
+  );
+
+die "Couldn't read $cpyfn: $!\n"
+     unless $copy;
+
+$copy->message(-1)->delete;   # last flagged for deletion
+ok($copy->message(-1)->deleted);
+
+ok($copy->write(policy => 'INPLACE'), "write folder with fewer messsages");
+
+$copy = new Mail::Box::Mbox
+  ( folder    => "=$cpyfn"
+  , folderdir => 'folders'
+  , lock_type => 'NONE'
+  , extract   => 'ALWAYS'
+  );
+
+ok(defined $copy,                                 "Reopen succesful");
+cmp_ok($copy->messages+1, "==", $folder_messages, "1 message less");
+
+#
+# Rewrite it again, with again 1 fewer message
+#
+
+$copy->close;
+ok(! defined $copy,                             "Folder is really closed");
+
+$copy = new Mail::Box::Mbox
+  ( folder    => "=$cpyfn"
+  , folderdir => 'folders'
+  , lock_type => 'NONE'
+  , extract   => 'ALWAYS'
+  , access    => 'rw'
+  );
+
+cmp_ok($copy->messages, "==", $folder_messages-1, "1 message still away");
+
+$copy->message(10)->delete;   # some other, doesn't matter
+ok($copy->message(10)->deleted);
+
+ok($copy->write(policy => 'INPLACE'), "write folder with fewer messsages");
+
+$copy = new Mail::Box::Mbox
+  ( folder    => "=$cpyfn"
+  , folderdir => 'folders'
+  , lock_type => 'NONE'
+  , extract   => 'ALWAYS'
+  );
+
+cmp_ok($copy->messages, "==", $folder_messages-2, "2 messages fewer");
+is($copy->message(11)->get('subject'), $msg12subject, "move message");
+
+#
+# Rewrite it again, with again 1 fewer message: this time the first message
+#
+
+$copy->close;
+ok(! defined $copy,                             "Folder is really closed");
+
+$copy = new Mail::Box::Mbox
+  ( folder    => "=$cpyfn"
+  , folderdir => 'folders'
+  , lock_type => 'NONE'
+  , extract   => 'ALWAYS'
+  , access    => 'rw'
+  );
+
+cmp_ok($copy->messages, "==", $folder_messages-2, "2 message still away");
+
+$copy->message(0)->delete;    # first flagged for deletion
+ok($copy->message(0)->deleted);
+
+ok($copy->write(policy => 'INPLACE'), "write folder with fewer messsages");
+
+$copy = new Mail::Box::Mbox
+  ( folder    => "=$cpyfn"
+  , folderdir => 'folders'
+  , lock_type => 'NONE'
+  , extract   => 'ALWAYS'
+  );
+
+cmp_ok($copy->messages, "==", $folder_messages-3, "3 messages fewer");
+is($copy->message(10)->get('subject'), $msg12subject, "move message");
+
+unlink $cpy;

Added: packages/libmail-box-perl/branches/upstream/current/tests/40mbox/80update.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/40mbox/80update.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/40mbox/80update.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,64 @@
+#!/usr/bin/perl -T
+
+#
+# Test appending messages on Mbox folders.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 4;
+use File::Copy;
+
+use Mail::Box::Manager;
+
+#
+# We will work with a copy of the original to avoid that we write
+# over our test file.
+#
+
+copy $src, $cpy
+    or die "Cannot create test folder $cpy: $!\n";
+
+my $mgr = Mail::Box::Manager->new;
+
+my @fopts =
+  ( lock_type    => 'NONE'
+  , extract      => 'LAZY'
+  , access       => 'rw'
+  , save_on_exit => 0
+  );
+
+my $folder = $mgr->open
+  ( folder    => "=$cpyfn"
+  , folderdir => $folderdir
+  , @fopts
+  );
+
+die "Couldn't read $cpy: $!\n"
+    unless $folder;
+
+cmp_ok($folder->messages, "==", 45);
+
+my $msg = Mail::Message->build
+ ( From => 'me', To => 'you', Subject => 'Hello!'
+ , data => [ "one line\n" ]
+ );
+ok(defined $msg);
+
+my $filename = $folder->filename;
+die "Cannot open $filename: $!"
+   unless open OUT, '>>', $filename;
+
+print OUT $msg->head->createFromLine;
+$msg->print(\*OUT);
+close OUT;
+
+cmp_ok($folder->messages, "==", 45);
+$folder->update;
+cmp_ok($folder->messages, "==", 46);
+
+$folder->close;

Added: packages/libmail-box-perl/branches/upstream/current/tests/40mbox/Definition.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/40mbox/Definition.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/40mbox/Definition.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,8 @@
+
+package MailBox::Test::40mbox::Definition;
+
+sub name     {"Mail::Box::Mbox; mbox folders"}
+sub critical {1}
+sub skip     { undef }
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/tests/41mh/10read.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/41mh/10read.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/41mh/10read.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,192 @@
+#!/usr/bin/perl -T
+
+#
+# Test reading of MH folders.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 27;
+use File::Compare;
+use File::Copy;
+
+use Mail::Box::MH;
+use Mail::Box::Mbox;
+
+my $mhsrc = File::Spec->catfile('folders', 'mh.src');
+
+unpack_mbox2mh($src, $mhsrc);
+
+ok(Mail::Box::MH->foundIn($mhsrc));
+
+my $folder = new Mail::Box::MH
+  ( folder       => $mhsrc
+  , lock_type    => 'NONE'
+  , extract      => 'LAZY'
+  , access       => 'rw'
+  );
+
+ok(defined $folder);
+
+# We skipped message number 13 in the production, but that shouldn't
+# distrub things.
+
+cmp_ok($folder->messages, "==", 45);
+is($folder->organization, 'DIRECTORY');
+
+#
+# No single head should be read now, because extract == LAZY
+# the default.
+#
+
+my $heads = 0;
+foreach ($folder->messages)
+{  $heads++ unless $_->head->isDelayed;
+}
+cmp_ok($heads, "==", 0);
+
+#
+# Loading a header should not be done unless really necessary.
+#
+
+my $message = $folder->message(7);
+ok($message->head->isDelayed);
+
+ok($message->filename);   # already known, but should not trigger header
+ok($message->head->isDelayed);
+
+#
+# Nothing should be parsed yet
+#
+
+my $parsed = 0;
+foreach ($folder->messages)
+{  $parsed++ if $_->isParsed;
+}
+cmp_ok($parsed, "==", 0);
+
+#
+# Trigger one message to get read.
+#
+
+ok($message->body->string);       # trigger body loading.
+ok($message->isParsed);
+
+#
+# Test taking header
+#
+
+$message = $folder->message(8);
+ok(defined $message->head->get('subject'));
+ok(not $message->isParsed);
+is(ref $message->head, 'Mail::Message::Head::Complete');
+
+# This shouldn't cause any parsings: we do lazy extract, but Mail::Box
+# will always take the `Subject' header for us.
+
+my @subjects = map { chomp; $_ }
+                  map {$_->head->get('subject') || '<undef>' }
+                     $folder->messages;
+
+$parsed = 0;
+$heads  = 0;
+foreach ($folder->messages)
+{  $parsed++ unless $_->isDelayed;
+   $heads++  unless $_->head->isDelayed;
+}
+cmp_ok($parsed, "==", 1);  # message 7
+cmp_ok($heads, "==", 45);
+
+#
+# The subjects must be the same as from the original Mail::Box::Mbox
+# There are some differences with new-lines at the end of headerlines
+#
+
+my $mbox = Mail::Box::Mbox->new
+  ( folder      => $src
+  , folderdir   => 't'
+  , lock_type   => 'NONE'
+  , access      => 'r'
+  );
+
+my @fsubjects = map { chomp; $_ }
+                   map {$_->head->get('subject') || '<undef>'}
+                      $mbox->messages;
+
+my (%subjects);
+$subjects{$_}++ foreach @subjects;
+$subjects{$_}-- foreach @fsubjects;
+
+my $missed = 0;
+foreach (keys %subjects)
+{   $missed++ if $subjects{$_};
+    warn "Still left: $_ ($subjects{$_}x)\n" if $subjects{$_};
+}
+ok(!$missed);
+
+#
+# Check if we can read a body.
+#
+
+my $msg3 = $folder->message(3);
+my $body = $msg3->body;
+ok(defined $body);
+cmp_ok(@$body, "==", 42);       # check expected number of lines in message 4.
+
+$folder->close;
+
+#
+# Now with partially lazy extract.
+#
+
+my $parse_size = 5000;
+$folder = new Mail::Box::MH
+  ( folder    => $mhsrc
+  , folderdir => 't'
+  , lock_type => 'NONE'
+  , extract   => $parse_size  # messages > $parse_size bytes stay unloaded.
+  , access    => 'rw'
+  );
+
+ok(defined $folder);
+
+cmp_ok($folder->messages, "==", 45);
+
+$parsed     = 0;
+$heads      = 0;
+my $mistake = 0;
+foreach ($folder->messages)
+{   $parsed++  unless $_->isDelayed;
+    $heads++   unless $_->head->isDelayed;
+    $mistake++ if !$_->isDelayed && $_->size > $parse_size;
+}
+
+ok(not $mistake);
+ok(not $parsed);
+ok(not $heads);
+
+foreach (5..13)
+{   $folder->message($_)->head->get('subject');
+}
+
+$parsed  = 0;
+$heads   = 0;
+$mistake = 0;
+foreach ($folder->messages)
+{   $parsed++  unless $_->isDelayed;
+    $heads++   unless $_->head->isDelayed;
+    $mistake++ if !$_->isDelayed && $_->body->size > $parse_size;
+}
+
+ok(not $mistake);
+cmp_ok($parsed , "==",  7);
+cmp_ok($heads , "==",  9);
+
+# No clean-dir: see how it behaves when the folder is not explictly
+# closed before the program terminates.  Terrible things can happen
+# during auto-cleanup
+#clean_dir $mhsrc;

Added: packages/libmail-box-perl/branches/upstream/current/tests/41mh/20write.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/41mh/20write.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/41mh/20write.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,74 @@
+#!/usr/bin/perl -T
+#
+# Test writing of MH folders.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 54;
+use File::Compare;
+use File::Copy;
+
+use Mail::Box::MH;
+use Mail::Box::Mbox;
+
+my $mhsrc = File::Spec->catfile('folders', 'mh.src');
+
+clean_dir $mhsrc;
+unpack_mbox2mh($src, $mhsrc);
+
+my $folder = new Mail::Box::MH
+  ( folder     => $mhsrc
+  , lock_type  => 'NONE'
+  , extract    => 'LAZY'
+  , access     => 'rw'
+  , keep_index => 1
+  );
+
+ok(defined $folder);
+cmp_ok($folder->messages, "==", 45);
+
+my $msg3 = $folder->message(3);
+
+# Nothing yet...
+
+$folder->modified(1);
+$folder->write(renumber => 0);
+
+ok(compare_lists [sort {$a cmp $b} listdir $mhsrc],
+            [sort {$a cmp $b} '.mh_sequences', 1..12, 14..46]
+  );
+
+$folder->modified(1);
+$folder->write(renumber => 1);
+
+ok(compare_lists [sort {$a cmp $b} listdir $mhsrc],
+            [sort {$a cmp $b} '.mh_sequences', 1..45]
+  );
+
+$folder->message(2)->delete;
+ok($folder->message(2)->isDelayed);
+ok(defined $folder->message(3)->get('subject')); # load, creates index
+
+$folder->write;
+ok(compare_lists [sort {$a cmp $b} listdir $mhsrc],
+            [sort {$a cmp $b} '.index', '.mh_sequences', 1..44]
+  );
+
+cmp_ok($folder->messages, "==", 44);
+
+$folder->message(8)->delete;
+ok($folder->message(8)->deleted);
+cmp_ok($folder->messages, "==", 44);
+
+$folder->write;
+cmp_ok($folder->messages, "==", 43);
+foreach ($folder->messages) { ok(! $_->deleted) }
+
+$folder->close;
+
+clean_dir $mhsrc;

Added: packages/libmail-box-perl/branches/upstream/current/tests/41mh/30append.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/41mh/30append.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/41mh/30append.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,83 @@
+#!/usr/bin/perl -T
+#
+# Test appending messages on MH folders.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 10;
+use File::Compare;
+use File::Copy;
+
+use Mail::Box::Manager;
+use Mail::Message::Construct;
+
+my $mhsrc = File::Spec->catfile('folders', 'mh.src');
+
+clean_dir $mhsrc;
+unpack_mbox2mh($src, $mhsrc);
+
+my $mgr = Mail::Box::Manager->new;
+
+my $folder = $mgr->open
+  ( folder       => $mhsrc
+  , lock_type    => 'NONE'
+  , extract      => 'LAZY'
+  , access       => 'rw'
+  , save_on_exit => 0
+  );
+
+die "Couldn't read $mhsrc: $!\n"
+    unless $folder;
+
+# We checked this in other scripts before, but just want to be
+# sure we have enough messages again.
+
+cmp_ok($folder->messages, "==", 45);
+
+# Add a message which is already in the opened folder.  However, the
+# message heads are not yet parsed, hence the message can not be
+# ignored.
+
+my $message3 = $folder->message(3);
+ok($message3->isDelayed);
+my $added = $message3->clone;
+ok(!$message3->isDelayed);
+
+$folder->addMessage($added);
+cmp_ok($folder->messages, "==", 45);
+
+ok(not $message3->deleted);
+ok($added->deleted);
+
+#
+# Create an Mail::Message and add this to the open folder.
+#
+
+my $msg = Mail::Message->build
+  ( From    => 'me at example.com'
+  , To      => 'you at anywhere.aq'
+  , Subject => 'Just a try'
+  , data    => [ "a short message\n", "of two lines.\n" ]
+  );
+
+$mgr->appendMessage($mhsrc, $msg);
+cmp_ok($folder->messages, "==", 46);
+
+cmp_ok($mgr->openFolders, "==", 1);
+$mgr->close($folder);      # changes are not saved.
+cmp_ok($mgr->openFolders, "==", 0);
+
+$mgr->appendMessage($mhsrc, $msg
+  , lock_type => 'NONE'
+  , extract   => 'LAZY'
+  , access    => 'rw'
+  );
+
+ok(-f File::Spec->catfile($mhsrc, "47"));  # skipped 13, so new is 46+1
+
+clean_dir $mhsrc;

Added: packages/libmail-box-perl/branches/upstream/current/tests/41mh/50create.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/41mh/50create.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/41mh/50create.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,180 @@
+#!/usr/bin/perl -T
+
+#
+# Test creation/deletion and listing of folders.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 20;
+use File::Copy;
+use File::Spec;
+
+use Mail::Box::Mbox;
+use Mail::Box::MH;
+use Mail::Message::Construct;
+
+my $top = File::Spec->catfile('folders', 'Mail');
+clean_dir $top;
+
+my $mbox = Mail::Box::Mbox->new
+  ( folder      => $src
+  , lock_type   => 'NONE'
+  );
+
+#
+# Create a nice structure which looks like a set of MH folders.
+#
+
+sub folder($;$@)
+{   my $dirname = shift;
+    $dirname = File::Spec->catfile($dirname, shift) if @_;
+
+    die "Cannot create directory $dirname: $!\n"
+        unless -d $dirname || mkdir $dirname, 0700;
+
+    foreach (@_)
+    {   my $f = File::Spec->catfile($dirname, $_);
+        open CREATE, ">$f" or die "Cannot create $f: $!\n";
+        $mbox->message($_)->print(\*CREATE) if m/^\d+$/;
+        close CREATE;
+    }
+    $dirname;
+}
+
+folder $top;
+folder $top, 'f1', qw/a b c/;
+folder $top, 'f2', 1, 2, 3;       # only real folder
+folder $top, 'f3';                # empty folder
+
+my $sub1 = folder $top, 'sub1';
+folder $sub1, 's1f1';
+folder $sub1, 's1f2';
+folder $sub1, 's1f3';
+folder $top,  'sub2';            # empty dir
+my $f4 = folder $top, 'f4', 1, 2, 3;
+folder $f4, 'f4f1';
+unpack_mbox2mh $src, File::Spec->catfile($f4, 'f4f2');
+folder $f4, 'f4f3';
+
+ok(compare_lists
+        [ sort Mail::Box::MH->listSubFolders(folderdir => $top) ]
+      , [ qw/f1 f2 f3 f4 sub1 sub2/ ]
+  );
+
+ok(compare_lists
+        [ sort Mail::Box::MH->listSubFolders(folderdir => $top) ]
+      , [ qw/f1 f2 f3 f4 sub1 sub2/ ]
+  );
+
+ok(compare_lists
+        [ sort Mail::Box::MH->listSubFolders
+               ( folderdir  => $top
+               , skip_empty => 1
+               ) ]
+      , [ qw/f2 f4 sub1/ ]
+  );
+
+ok(compare_lists
+        [ sort Mail::Box::MH->listSubFolders
+               ( folderdir  => $top
+               , check      => 1
+               ) ]
+      , [ qw/f2 f4/ ]
+  );
+
+ok(compare_lists
+      [ sort Mail::Box::MH->listSubFolders
+               ( folderdir  => $top
+               , folder     => "=f4"
+               )
+      ]
+      , [ qw/f4f1 f4f2 f4f3/ ]
+  );
+
+ok(compare_lists [ sort Mail::Box::MH->listSubFolders(folderdir  => "$top/f4") ]
+          , [ qw/f4f1 f4f2 f4f3/ ]
+  );
+
+#
+# Open a folder in a sub-dir which uses the extention.
+#
+
+my $folder = Mail::Box::MH->new
+  ( folderdir   => $top
+  , folder      => '=f4/f4f2'
+  , lock_type   => 'NONE'
+  );
+
+ok($folder);
+cmp_ok($folder->messages, "==", 45);
+$folder->close;
+
+#
+# Open a new folder.
+#
+
+my $newfolder = File::Spec->catfile($f4, 'newfolder');
+ok(! -d $newfolder);
+Mail::Box::MH->create('=f4/newfolder', folderdir  => $top);
+ok(-d $newfolder);
+
+$folder = Mail::Box::MH->new
+  ( folderdir   => $top
+  , folder      => '=f4/newfolder'
+  , access      => 'rw'
+  , keep_index  => 1
+  , lock_type   => 'NONE'
+  );
+
+ok($folder);
+cmp_ok($folder->messages, "==", 0);
+
+my $msg = Mail::Message->build
+  ( From    => 'me at example.com'
+  , To      => 'you at anywhere.aq'
+  , Subject => 'Just a try'
+  , data    => [ "a short message\n", "of two lines.\n" ]
+  );
+
+$folder->addMessage($msg);
+cmp_ok($folder->messages, "==", 1);
+$folder->close;
+ok(-f File::Spec->catfile($newfolder, '1'));
+
+opendir DIR, $newfolder or die "Cannot read directory $newfolder: $!\n";
+my @all = grep !/^\./, readdir DIR;
+closedir DIR;
+cmp_ok(@all, "==", 1);
+
+my $seq = File::Spec->catfile($newfolder, '.mh_sequences');
+open SEQ, $seq or die "Cannot read $seq: $!\n";
+my @seq = <SEQ>;
+close SEQ;
+
+cmp_ok(@seq, "==", 1);
+is($seq[0],"unseen: 1\n");
+
+#
+# Delete a folder.
+#
+
+$folder = Mail::Box::MH->new
+  ( folderdir   => $top
+  , folder      => '=f4'
+  , access      => 'rw'
+  , lock_type   => 'NONE'
+  , keep_index  => 1
+  );
+
+ok(-d $f4);
+$folder->delete;
+ok(1);
+$folder->close;
+ok(1);
+
+clean_dir $top;

Added: packages/libmail-box-perl/branches/upstream/current/tests/41mh/60thread.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/41mh/60thread.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/41mh/60thread.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,98 @@
+#!/usr/bin/perl -T
+
+#
+# Test threading of MH folders.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 5;
+use File::Spec;
+use List::Util 'sum';
+
+use Mail::Box::Manager;
+
+my $mhsrc = File::Spec->catfile('folders', 'mh.src');
+
+clean_dir $mhsrc;
+unpack_mbox2mh($src, $mhsrc);
+
+my $mgr    = new Mail::Box::Manager;
+
+my $folder = $mgr->open
+  ( folder    => $mhsrc
+  , lock_type => 'NONE'
+  , extract   => 'LAZY'
+  , access    => 'rw'
+  );
+
+my $threads = $mgr->threads(folder => $folder);
+
+cmp_ok($threads->known , "==",  0);
+
+my @all = $threads->sortedAll;
+cmp_ok(scalar(@all) , "==",  28);
+my $msgs = sum map {$_->numberOfMessages} @all;
+cmp_ok($msgs, "==", scalar($folder->messages));
+
+my $out = join '', map {$_->threadToString} @all;
+
+my @lines = split /^/, $out;
+cmp_ok(@lines, '==', $folder->messages);
+$out      = join '', sort @lines;
+
+my $dump = <<'DUMP';
+1.3K Resize with Transparency
+1.2K *- Re: File Conversion From HTML to PS and TIFF
+2.1K    `--*- Re: File Conversion From HTML to PS and TIFF
+2.1K       `- Re: File Conversion From HTML to PS and TIFF
+1.4K Transparency question
+2.4K RE: Transparency question
+3.3K RE: Transparency question
+5.5K RE: Transparency question
+7.2K RE: Transparency question
+2.7K RE: jpeg2000 question
+1.2K *- Problem resizing images through perl script
+820  |  `- Re: Problem resizing images through perl script
+1.8K |     `- RE: Problem resizing images through perl script
+1.0K |        `- Re: Problem resizing images through perl script
+1.2K `- Re: Convert HTM, HTML files to the .jpg format
+747  Undefined Symbol: SetWarningHandler
+1.1K `- Re: Undefined Symbol: SetWarningHandler
+1.8K *- Re: watermarks/embossing
+307  Re: Annotate problems (PR#298)
+573  `- Re: Annotate problems (PR#298)
+1.0K 
+1.4K `- Re: your mail
+1.9K    `- Re: your mail
+152  Re: your mail
+686  `- Re: your mail
+189  Re: your mail
+2.0K 
+670  Re: your mail
+4.4K `- Re: your mail
+552  mailing list archives
+1.4K delegates.mgk set-up for unixware printing
+1.5K printing solution for UW 7.1
+1.4K *- Re: converts new sharpen factors
+1.2K New ImageMagick mailing list
+ 27  subscribe
+822  Confirmation for subscribe magick-developer
+ 63  `- Re: Confirmation for subscribe magick-developer
+ 11K Welcome to magick-developer
+1.7K core dump in simple ImageMagick example
+2.2K `- Re: core dump in simple ImageMagick example
+882     `- Re: core dump in simple ImageMagick example
+754        `- Re: core dump in simple ImageMagick example
+2.0K Core Dump on ReadImage
+1.0K `- Re: Core Dump on ReadImage
+1.6K Font metrics
+DUMP
+
+$dump = join '', sort split /^/, $dump;
+compare_thread_dumps($out, $dump, 'sort thread full dump');
+clean_dir $mhsrc;

Added: packages/libmail-box-perl/branches/upstream/current/tests/41mh/70seqs.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/41mh/70seqs.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/41mh/70seqs.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,73 @@
+#!/usr/bin/perl -T
+
+#
+# Test mh-sequences
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 11;
+use File::Spec;
+
+use Mail::Box::Manager;
+
+my $mhsrc = File::Spec->catfile('folders', 'mh.src');
+my $seq   = File::Spec->catfile($mhsrc, '.mh_sequences');
+
+clean_dir $mhsrc;
+unpack_mbox2mh($src, $mhsrc);
+
+# Create a sequences file.
+open SEQ, ">$seq" or die "Cannot write to $seq: $!\n";
+
+# Be warned that message number 13 has been skipped from the MH-box.
+print SEQ <<'MH_SEQUENCES';
+unseen: 12-15 3 34 36 16
+cur: 5
+MH_SEQUENCES
+
+close SEQ;
+
+my $mgr = Mail::Box::Manager->new;
+
+my $folder = $mgr->open
+  ( folder       => $mhsrc
+  , folderdir    => 't'
+  , lock_type    => 'NONE'
+  , extract      => 'LAZY'
+  , access       => 'rw'
+  , save_on_exit => 0
+  );
+
+die "Couldn't read $mhsrc: $!\n" unless $folder;
+isa_ok($folder, 'Mail::Box::MH');
+
+ok($folder->message(1)->label('seen'));
+ok(not $folder->message(2)->label('seen'));
+ok($folder->message(3)->label('seen'));
+
+ok($folder->message(4)->label('current'));
+is($folder->current->messageID, $folder->message(4)->messageID);
+
+ok(not $folder->message(1)->label('current'));
+$folder->current($folder->message(1));
+ok(not $folder->message(0)->label('current'));
+ok($folder->message(1)->label('current'));
+
+$folder->modified(1);
+$folder->close(write => 'ALWAYS');
+
+open SEQ, $seq or die "Cannot read from $seq: $!\n";
+my @seq = <SEQ>;
+close SEQ;
+
+my ($cur)    = grep /^cur\: /, @seq;
+is($cur, "cur: 2\n");
+my ($unseen) = grep /^unseen\: /, @seq;
+is($unseen, "unseen: 3 12-15 33 35\n");
+
+clean_dir $mhsrc;

Added: packages/libmail-box-perl/branches/upstream/current/tests/41mh/Definition.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/41mh/Definition.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/41mh/Definition.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,8 @@
+
+package MailBox::Test::41mh::Definition;
+
+sub name     {"Mail::Box::MH; mh folders"}
+sub critical {0}
+sub skip     { undef }
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/tests/42maildir/10read.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/42maildir/10read.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/42maildir/10read.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,205 @@
+#!/usr/bin/perl -T
+
+#
+# Test reading of Maildir folders.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More;
+use File::Compare;
+use File::Copy;
+
+use Mail::Box::Maildir;
+use Mail::Box::Mbox;
+
+BEGIN {
+   if($windows)
+   {   plan skip_all => 'Filenames not compatible with Windows';
+       exit 1;
+   }
+   plan tests => 29;
+}
+
+my $mdsrc = File::Spec->catfile('folders', 'maildir.src');
+
+unpack_mbox2maildir($src, $mdsrc);
+
+ok(Mail::Box::Maildir->foundIn($mdsrc));
+
+my $folder = new Mail::Box::Maildir
+  ( folder       => $mdsrc
+  , extract      => 'LAZY'
+  , access       => 'r'
+  , trace        => 'NONE'
+  );
+
+ok(defined $folder);
+isa_ok($folder, 'Mail::Box::Maildir');
+
+cmp_ok($folder->messages, "==", 45);
+is($folder->organization, 'DIRECTORY');
+
+#
+# Count drafts (from Tools.pm flags)
+#
+
+my $drafts = 0;
+$_->label('draft') && $drafts++ foreach $folder->messages;
+cmp_ok($drafts, "==", 8);
+
+#
+# No single head should be read now, because extract == LAZY
+# the default.
+#
+
+my $heads = 0;
+foreach ($folder->messages)
+{  $heads++ unless $_->head->isDelayed;
+}
+cmp_ok($heads, "==", 0);
+
+#
+# Loading a header should not be done unless really necessary.
+#
+
+my $message = $folder->message(7);
+ok($message->head->isDelayed);
+
+ok($message->filename);   # already known, but should not trigger header
+ok($message->head->isDelayed);
+
+#
+# Nothing should be parsed yet
+#
+
+my $parsed = 0;
+foreach ($folder->messages)
+{  $parsed++ if $_->isParsed;
+}
+cmp_ok($parsed, "==", 0);
+
+#
+# Trigger one message to get read.
+#
+
+ok($message->body->string);       # trigger body loading.
+ok($message->isParsed);
+
+#
+# Test taking header
+#
+
+$message = $folder->message(8);
+ok(defined $message->head->get('subject'));
+ok(not $message->isParsed);
+is(ref $message->head, 'Mail::Message::Head::Complete');
+
+# This shouldn't cause any parsings: we do lazy extract, but Mail::Box
+# will always take the `Subject' header for us.
+
+my @subjects = map { chomp; $_ }
+                  map {$_->head->get('subject') || '<undef>' }
+                     $folder->messages;
+
+$parsed = 0;
+$heads  = 0;
+foreach ($folder->messages)
+{  $parsed++ unless $_->isDelayed;
+   $heads++  unless $_->head->isDelayed;
+}
+cmp_ok($parsed, "==", 1);  # message 7
+cmp_ok($heads, "==", 45);
+
+#
+# The subjects must be the same as from the original Mail::Box::Mbox
+# There are some differences with new-lines at the end of headerlines
+#
+
+my $mbox = Mail::Box::Mbox->new
+  ( folder      => $src
+  , lock_type   => 'NONE'
+  , access      => 'r'
+  );
+
+my @fsubjects = map { chomp; $_ }
+                   map {$_->head->get('subject') || '<undef>'}
+                      $mbox->messages;
+
+my (%subjects);
+$subjects{$_}++ foreach @subjects;
+$subjects{$_}-- foreach @fsubjects;
+
+my $missed = 0;
+foreach (keys %subjects)
+{   $missed++ if $subjects{$_};
+    warn "Still left: $_ ($subjects{$_}x)\n" if $subjects{$_};
+}
+ok(!$missed);
+
+#
+# Check if we can read a body.
+#
+
+my $msg3 = $folder->message(3);
+my $body = $msg3->body;
+ok(defined $body);
+cmp_ok(@$body, "==", 42);       # check expected number of lines in message 4.
+
+$folder->close;
+
+#
+# Now with partially lazy extract.
+#
+
+my $parse_size = 5000;
+$folder = new Mail::Box::Maildir
+  ( folder    => $mdsrc
+  , lock_type => 'NONE'
+  , extract   => $parse_size  # messages > $parse_size bytes stay unloaded.
+  , access    => 'rw'
+  );
+
+ok(defined $folder);
+
+cmp_ok($folder->messages, "==", 45);
+
+$parsed     = 0;
+$heads      = 0;
+my $mistake = 0;
+foreach ($folder->messages)
+{   $parsed++  unless $_->isDelayed;
+    $heads++   unless $_->head->isDelayed;
+    $mistake++ if !$_->isDelayed && $_->size > $parse_size;
+}
+
+ok(not $mistake);
+ok(not $parsed);   # The new messages
+ok(not $heads);
+
+$folder->message($_)->head->get('subject')
+    foreach 5..13;
+
+$parsed  = 0;
+$heads   = 0;
+$mistake = 0;
+foreach ($folder->messages)
+{   $parsed++  unless $_->isDelayed;
+    $heads++   unless $_->head->isDelayed;
+    $mistake++ if !$_->isDelayed && $_->body->size > $parse_size;
+}
+
+ok(not $mistake);
+cmp_ok($parsed , "==",  7);
+cmp_ok($heads , "==",  9);
+
+$folder->close;
+
+# No clean-dir: see how it behaves when the folder is not explictly
+# closed before the program terminates.  Terrible things can happen
+# during auto-cleanup
+#clean_dir $mdsrc;

Added: packages/libmail-box-perl/branches/upstream/current/tests/42maildir/20write.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/42maildir/20write.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/42maildir/20write.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,126 @@
+#!/usr/bin/perl -T
+
+#
+# Test writing of maildir folders.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More;
+use File::Compare;
+use File::Copy;
+
+use Mail::Box::Maildir;
+
+BEGIN {
+   if($windows)
+   {   plan skip_all => 'Filenames not compatible with Windows';
+       exit 1;
+   }
+   plan tests => 45;
+}
+
+my $mdsrc = File::Spec->catfile('folders', 'maildir.src');
+
+clean_dir $mdsrc;
+unpack_mbox2maildir($src, $mdsrc);
+
+my $folder = new Mail::Box::Maildir
+  ( folder       => $mdsrc
+  , extract      => 'LAZY'
+  , access       => 'rw'
+  );
+
+ok(defined $folder);
+
+ok($folder->message(40)->label('accepted'),        "40 accepted");
+ok(!$folder->message(41)->label('accepted'),       "41 not accepted");
+
+#
+# Count files flagged for deletion  (T flag)
+#
+
+my $to_be_deleted =0;
+$_->deleted && $to_be_deleted++  foreach $folder->messages;
+cmp_ok($to_be_deleted, "==", 7);
+
+$folder->close;
+
+#
+# Reopen the folder and see whether the messages flagged for deletion
+# are away.
+#
+
+$folder = new Mail::Box::Maildir
+  ( folder       => $mdsrc
+  , extract      => 'LAZY'
+  , access       => 'rw'
+  );
+
+cmp_ok($folder->messages, "==", 38);
+
+my $msg6 = $folder->message(6);
+like($msg6->filename , qr/:2,$/);
+ok(!$msg6->label('draft'));
+ok(!$msg6->label('flagged'));
+ok(!$msg6->label('replied'));
+ok(!$msg6->label('seen'));
+ok(!$msg6->modified);
+
+my $msg12 = $folder->message(12);
+like($msg12->filename , qr/:2,DFRS$/);
+ok($msg12->label('draft'));
+ok($msg12->label('flagged'));
+ok($msg12->label('replied'));
+ok($msg12->label('seen'));
+
+ok(!$msg12->label(flagged => 0));
+ok(!$msg12->label('flagged'));
+like($msg12->filename , qr/:2,DRS$/);
+
+ok(!$msg12->label(draft => 0));
+ok(!$msg12->label('draft'));
+like($msg12->filename , qr/:2,RS$/);
+
+ok(!$msg12->label(seen => 0));
+ok(!$msg12->label('seen'));
+like($msg12->filename , qr/:2,R$/);
+
+ok($msg12->label(flagged => 1));
+ok($msg12->label('flagged'));
+like($msg12->filename , qr/:2,FR$/);
+
+ok(!$msg12->label(flagged => 0, replied => 0));
+ok(!$msg12->label('flagged'));
+ok(!$msg12->label('replied'));
+like($msg12->filename , qr/:2,$/);
+
+ok(!$msg12->modified);
+
+#
+# Test accepting and unaccepting
+#
+
+# test are only run on unix, so we can simply use '/'s
+is($msg12->filename, 'folders/maildir.src/cur/110000010.l.43:2,');
+ok($msg12->label('accepted'),                      "12 accepted");
+cmp_ok($msg12->label(accepted => 0), '==', 0,      'un-accept a message');
+ok(! $msg12->label('accepted'));
+is($msg12->filename, 'folders/maildir.src/new/110000010.l.43:2,');
+ok(!$msg12->modified);   # message is not modified
+ok($folder->modified);   # ... but the folder is modified
+                         #     (which implies nothing)
+cmp_ok($msg12->label(accepted => 1), '==', 1,      'accept the message');
+ok($msg12->label('accepted'));
+is($msg12->filename, 'folders/maildir.src/cur/110000010.l.43:2,');
+
+ok(! $folder->message(-1)->label('accepted'));
+$folder->message(-1)->accept;
+ok($folder->message(-1)->label('accepted'));
+
+$folder->close;
+clean_dir $mdsrc;

Added: packages/libmail-box-perl/branches/upstream/current/tests/42maildir/30append.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/42maildir/30append.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/42maildir/30append.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,93 @@
+#!/usr/bin/perl -T
+
+#
+# Test appending messages on Maildir folders.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More;
+use File::Compare;
+use File::Copy;
+
+use Mail::Box::Manager;
+use Mail::Message::Construct;
+
+BEGIN {
+   if($windows)
+   {   plan skip_all => 'Filenames not compatible with Windows';
+       exit 1;
+   }
+   plan tests => 14;
+}
+
+my $mdsrc = File::Spec->catfile('folders', 'maildir.src');
+unpack_mbox2maildir($src, $mdsrc);
+
+my $mgr = Mail::Box::Manager->new;
+my $folder = $mgr->open
+  ( folder       => $mdsrc
+  , extract      => 'LAZY'
+  , access       => 'rw'
+  , save_on_exit => 0
+  );
+
+die "Couldn't read $mdsrc: $!\n"
+    unless $folder;
+
+# We checked this in other scripts before, but just want to be
+# sure we have enough messages again.
+
+cmp_ok($folder->messages, "==", 45);
+
+# Add a message which is already in the opened folder.  However, the
+# message heads are not yet parsed, hence the message can not be
+# ignored.
+
+my $message3 = $folder->message(3);
+ok($message3->isDelayed);
+my $added = $message3->clone;
+ok(defined $added);
+is(ref $added, 'Mail::Message');
+
+ok(!$message3->isDelayed);
+
+my $coerced = $folder->addMessage($added);    # coerced == added (reblessed)
+is(ref $added, 'Mail::Box::Maildir::Message');
+is(ref $coerced, 'Mail::Box::Maildir::Message');
+
+cmp_ok($folder->messages, "==", 45);
+
+ok(not $message3->deleted);
+ok($added->deleted);
+
+#
+# Create an Mail::Message and add this to the open folder.
+#
+
+my $msg = Mail::Message->build
+  ( From    => 'me at example.com'
+  , To      => 'you at anywhere.aq'
+  , Subject => 'Just a try'
+  , data    => [ "a short message\n", "of two lines.\n" ]
+  );
+
+$coerced = $mgr->appendMessage($mdsrc, $msg);
+isa_ok($coerced, 'Mail::Box::Maildir::Message');
+cmp_ok($folder->messages, "==", 46);
+
+cmp_ok($mgr->openFolders, "==", 1);
+$mgr->close($folder);      # changes are not saved.
+cmp_ok($mgr->openFolders, "==", 0);
+
+$mgr->appendMessage($mdsrc, $msg
+  , lock_type => 'NONE'
+  , extract   => 'LAZY'
+  , access    => 'rw'
+  );
+
+clean_dir $mdsrc;

Added: packages/libmail-box-perl/branches/upstream/current/tests/42maildir/Definition.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/42maildir/Definition.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/42maildir/Definition.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,15 @@
+
+package MailBox::Test::42maildir::Definition;
+
+use Tools    qw/$windows/;
+
+sub name     {"Mail::Box::Maildir; maildir folders"}
+sub critical { 0 }
+sub skip()
+{
+      $windows
+    ? 'Maildir filenames are not compatible with Windows.'
+    : undef;
+}
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/tests/43pop3/01basic.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/43pop3/01basic.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/43pop3/01basic.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,94 @@
+#!/usr/bin/perl -T
+
+use warnings;
+use strict;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 14;
+
+BEGIN { use_ok('Mail::Transport::POP3') }
+
+# Check if all methods are there OK
+
+can_ok('Mail::Transport::POP3', qw(
+ deleted
+ deleteFetched
+ DESTROY
+ disconnect
+ fetched
+ folderSize
+ header
+ ids
+ id2n
+ init
+ message
+ messages
+ messageSize
+ send
+ sendList
+ socket
+ url
+));
+
+my $original     = File::Spec->catdir ('43pop3', 'original');
+my $popbox       = File::Spec->catdir ('43pop3', 'popbox');
+
+copy_dir($original, $popbox);
+my ($server, $port) = start_pop3_server($popbox);
+my $receiver = start_pop3_client($port);
+
+isa_ok($receiver, 'Mail::Transport::POP3');
+
+my $socket = $receiver->socket;
+ok($socket, "Could not get socket of POP3 server");
+print $socket "EXIT\n";
+
+my @message = <$popbox/????>;
+my $total = 0;
+$total += -s foreach @message;
+my $messages = @message;
+cmp_ok($receiver->messages, '==', $messages, "Wrong number of messages");
+cmp_ok($receiver->folderSize, '==', $total, "Wrong number of bytes");
+
+my @id = $receiver->ids;
+cmp_ok(scalar(@id), '==', scalar(@message), "Number of messages doesn't match");
+is(join('', at id), join('', at message), "ID's don't match filenames");
+
+my $error = '';
+foreach(@id)
+{   my ($reported, $real) = ($receiver->messageSize($_),-s);
+    $error .= "size $_ is not right: expected $real, got $reported\n"
+     if $reported != $real;
+}
+ok(!$error, ($error || 'No errors with sizes'));
+
+$error = '';
+foreach(@id)
+{   my $message = $receiver->message($_);
+    open(my $handle, '<', $_);
+    $error .= "content of $_ is not right\n"
+     if join('', @$message) ne join('', <$handle>);
+}
+ok(!$error, $error || 'No errors with contents');
+
+$receiver->deleted(1, at id);
+ok($receiver->disconnect, 'Failed to properly disconnect from server');
+
+ at message = <$popbox/????>;
+cmp_ok(scalar(@message) ,'==', 0, 'Did not remove messages at QUIT');
+ok(rmdir($popbox), "Failed to remove $popbox directory: $!\n");
+
+is(join('', <$server>), <<EOD, 'Statistics contain unexpected information');
+1
+APOP 1
+DELE 4
+EXIT 1
+LIST 1
+NOOP 8
+QUIT 1
+RETR 4
+STAT 1
+UIDL 1
+EOD

Added: packages/libmail-box-perl/branches/upstream/current/tests/43pop3/02break.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/43pop3/02break.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/43pop3/02break.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,47 @@
+#!/usr/bin/perl -T
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 7;
+
+BEGIN { use_ok('Mail::Transport::POP3') }
+
+my $original     = File::Spec->catdir ('43pop3', 'original');
+my $popbox       = File::Spec->catdir ('43pop3', 'popbox');
+
+copy_dir($original, $popbox);
+my ($server, $port) = start_pop3_server($popbox);
+my $receiver = start_pop3_client($port);
+
+isa_ok($receiver, 'Mail::Transport::POP3');
+
+my $socket = $receiver->socket;
+ok($socket, "Could not get socket of POP3 server");
+print $socket "EXIT\n"; # make server exit on QUIT
+
+$receiver->message($_) foreach $receiver->ids;
+$receiver->deleteFetched;
+
+print $socket "BREAK\n"; # force breaking of connection
+ok($receiver->disconnect, 'Failed to properly disconnect from server');
+
+my @message = <$popbox/????>;
+cmp_ok(scalar(@message) ,'==', 0, 'Did not remove messages at QUIT');
+ok(rmdir($popbox), "Failed to remove $popbox directory: $!\n");
+
+is(join('', <$server>), <<EOD, 'Statistics contain unexpected information');
+2
+APOP 2
+BREAK 1
+DELE 4
+EXIT 1
+NOOP 6
+QUIT 1
+RETR 4
+STAT 2
+UIDL 2
+EOD

Added: packages/libmail-box-perl/branches/upstream/current/tests/43pop3/03minimal.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/43pop3/03minimal.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/43pop3/03minimal.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,45 @@
+#!/usr/bin/perl -T
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 7;
+
+BEGIN { use_ok('Mail::Transport::POP3') }
+
+my $original     = File::Spec->catdir ('43pop3', 'original');
+my $popbox       = File::Spec->catdir ('43pop3', 'popbox');
+
+copy_dir($original, $popbox);
+my ($server, $port) = start_pop3_server($popbox, 'minimal');
+my $receiver = start_pop3_client($port);
+
+isa_ok($receiver, 'Mail::Transport::POP3');
+
+my $socket = $receiver->socket;
+ok($socket, "Could not get socket of POP3 server");
+print $socket "EXIT\n"; # make server exit on QUIT
+
+$receiver->deleted(1, $receiver->ids);
+
+ok($receiver->disconnect, 'Failed to properly disconnect from server');
+
+my @message = <$popbox/????>;
+cmp_ok(scalar(@message) ,'==', 0, 'Did not remove messages at QUIT');
+ok(rmdir($popbox), "Failed to remove $popbox directory: $!\n");
+
+is(join('', <$server>), <<EOD, 'Statistics contain unexpected information');
+1
+DELE 4
+EXIT 1
+LIST 1
+NOOP 3
+PASS 1
+QUIT 1
+STAT 1
+UIDL 1
+USER 1
+EOD

Added: packages/libmail-box-perl/branches/upstream/current/tests/43pop3/04autodelete.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/43pop3/04autodelete.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/43pop3/04autodelete.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,43 @@
+#!/usr/bin/perl -T
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 7;
+
+BEGIN { use_ok('Mail::Transport::POP3') }
+
+my $original     = File::Spec->catdir ('43pop3', 'original');
+my $popbox       = File::Spec->catdir ('43pop3', 'popbox');
+
+copy_dir($original, $popbox);
+my ($server, $port) = start_pop3_server($popbox, 'autodelete');
+my $receiver = start_pop3_client($port, authenticate => 'LOGIN');
+
+isa_ok($receiver, 'Mail::Transport::POP3');
+
+my $socket = $receiver->socket;
+ok($socket, "Could not get socket of POP3 server");
+print $socket "EXIT\n"; # make server exit on QUIT
+
+$receiver->message($_) foreach $receiver->ids;
+ok($receiver->disconnect, 'Failed to properly disconnect from server');
+
+my @message = <$popbox/????>;
+cmp_ok(scalar(@message) ,'==', 0, 'Did not remove messages at QUIT');
+ok(rmdir($popbox), "Failed to remove $popbox directory: $!\n");
+
+is(join('', <$server>), <<EOD, 'Statistics contain unexpected information');
+1
+EXIT 1
+NOOP 7
+PASS 1
+QUIT 1
+RETR 4
+STAT 1
+UIDL 1
+USER 1
+EOD

Added: packages/libmail-box-perl/branches/upstream/current/tests/43pop3/Definition.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/43pop3/Definition.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/43pop3/Definition.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,8 @@
+
+package MailBox::Test::43pop3::Definition;
+
+sub name     {"Mail::Box::POP3; pop3 folders"}
+sub critical {0}
+sub skip     { undef }
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/tests/43pop3/original/0001
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/43pop3/original/0001	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/43pop3/original/0001	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,20 @@
+Return-Path: <liz at dijkmat.nl>
+Delivered-To: xx-woppa at xx.nl
+Received: (qmail 29439 invoked from network); 8 Jul 2002 20:27:13 -0000
+Received: from smtpzilla1.xs4all.nl (194.109.127.137)
+  by ds051.xs4all.nl with SMTP; 8 Jul 2002 20:27:13 -0000
+Received: from valizo (a80-127-230-87.dial.xs4all.nl [80.127.230.87])
+        by smtpzilla1.xs4all.nl (8.12.0/8.12.0) with ESMTP id g68KRdEr060805
+        for <woppa at xx.nl>; Mon, 8 Jul 2002 22:27:43 +0200 (CEST)
+Message-Id: <4.2.0.58.20020708222802.024df4a0 at mickey.dijkmat.nl>
+X-Sender: lm at mickey.dijkmat.nl
+X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.0.58
+Date: Mon, 08 Jul 2002 22:28:03 +0200
+To: woppa at xx.nl
+From: Elizabeth Mattijsen <liz at dijkmat.nl>
+Subject: test
+Mime-Version: 1.0
+Content-Type: text/plain; charset="us-ascii"; format=flowed
+
+
+

Added: packages/libmail-box-perl/branches/upstream/current/tests/43pop3/original/0002
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/43pop3/original/0002	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/43pop3/original/0002	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,20 @@
+Return-Path: <liz at dijkmat.nl>
+Delivered-To: xx-woppa at xx.nl
+Received: (qmail 29414 invoked from network); 8 Jul 2002 20:25:55 -0000
+Received: from smtpzilla5.xs4all.nl (194.109.127.141)
+  by ds051.xs4all.nl with SMTP; 8 Jul 2002 20:25:55 -0000
+Received: from valizo (a80-127-230-87.dial.xs4all.nl [80.127.230.87])
+        by smtpzilla5.xs4all.nl (8.12.0/8.12.0) with ESMTP id g68KQRdP007359
+        for <woppa at xx.nl>; Mon, 8 Jul 2002 22:26:28 +0200 (CEST)
+Message-Id: <4.2.0.58.20020708222644.02efb4b0 at mickey.dijkmat.nl>
+X-Sender: lm at mickey.dijkmat.nl
+X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.0.58
+Date: Mon, 08 Jul 2002 22:26:52 +0200
+To: woppa at xx.nl
+From: Elizabeth Mattijsen <liz at dijkmat.nl>
+Subject: test
+Mime-Version: 1.0
+Content-Type: text/plain; charset="us-ascii"; format=flowed
+
+
+

Added: packages/libmail-box-perl/branches/upstream/current/tests/43pop3/original/0003
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/43pop3/original/0003	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/43pop3/original/0003	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,55 @@
+Return-Path: <15ghnow at yahoo.com>
+Delivered-To: xx-xxx at xx.nl
+Received: (qmail 29529 invoked from network); 8 Jul 2002 20:32:12 -0000
+Received: from unknown (HELO hlzx.bjedu.gov.cn) (211.153.20.89)
+  by ds051.xs4all.nl with SMTP; 8 Jul 2002 20:32:12 -0000
+Received: (qmail 29012 invoked by uid 0); 25 Jun 2002 21:33:30 -0000
+Received: from unknown (HELO mx1.mail.yahoo.com) ([209.86.180.232]) (envelope-sender <15ghnow at yahoo.com>)
+          by 10.91.86.1 (qmail-ldap-1.03) with SMTP
+          for <xxx at xxx.yyy>; 25 Jun 2002 21:33:30 -0000
+Message-ID: <000071e14f34$00001849$00002497 at mx1.mail.yahoo.com>
+To: <Undisclosed Recipients>
+From: "Max" <15ghnow at yahoo.com>
+Subject: As Seen On TV15480
+Date: Tue, 25 Jun 2002 17:41:37 -1600
+MIME-Version: 1.0
+Content-Type: text/plain;
+        charset="Windows-1252"
+Content-Transfer-Encoding: 7bit
+Reply-To: 15ghnow at yahoo.com
+
+As seen on NBC, CBS, CNN, and even Oprah! The health
+discovery that actually reverses aging while burning fat,
+without dieting or exercise! This proven discovery has even
+been reported on by the New England Journal of Medicine.
+Forget  aging and dieting forever! And it's Guaranteed!
+
+Click here:
+http://www.flyhost.net/betterhealth
+
+
+Would you like to lose weight while you sleep!
+No dieting!
+No hunger pains!
+No Cravings!
+No strenuous exercise!
+Change your life forever!
+
+100% GUARANTEED!
+
+1.Body Fat Loss            82% improvement.
+2.Wrinkle Reduction     61% improvement.
+3.Energy Level              84% improvement.
+4.Muscle Strength         88% improvement.
+5.Sexual Potency         75% improvement.
+6.Emotional Stability      67% improvement.
+7.Memory                      62% improvement.
+
+***********************************************************
+
+You are receiving this email as a double opt-in
+subscriber to the Standard Affiliates Mailing List.
+To remove yourself from all related email lists,
+just click here:
+mailto:optoutemails at btamail.net.cn?Subject=REMOVE
+

Added: packages/libmail-box-perl/branches/upstream/current/tests/43pop3/original/0004
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/43pop3/original/0004	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/43pop3/original/0004	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,83 @@
+Return-Path: <prizecommittee at xxxletter.com>
+Delivered-To: xx-xxxxx at xx.nl
+Received: (qmail 29622 invoked from network); 8 Jul 2002 20:39:46 -0000
+Received: from softdnserror (HELO w0.xxxletter.com) (66.181.174.116)
+  by ds051.xs4all.nl with SMTP; 8 Jul 2002 20:39:46 -0000
+Received: (from root at localhost)
+        by w0.xxxletter.com (8.11.4/8.11.4) id g68Kbow05230
+        for xxxxx at xx.nl; Mon, 8 Jul 2002 16:37:50 -0400 (EDT)
+Date: Mon, 8 Jul 2002 16:37:50 -0400 (EDT)
+Message-Id: <200207082037.g68Kbow05230 at w0.xxxletter.com>
+Mime-Version: 1.0
+To: xxxxx at xx.nl
+Subject: You Won The Porn Lottery!
+Content-type: text/html;
+From: PrizeCommitee at sexy-emails.com
+
+<HTML> <HEAD> <TITLE>THE PORN LOTTERY!!! YOU
+WON!!!</TITLE> <META HTTP-EQUIV="Content-Type"
+CONTENT="text/html; charset=iso-8859-1"> <SCRIPT
+LANGUAGE="JavaScript"> function initArray() {
+for (var i = 0; i < initArray.arguments.length;
+i++) { this[i] = initArray.arguments[i]; }
+this.length = initArray.arguments.length; } var
+colors = new initArray( "blue", "black", "red",
+"white"); delay = .2; // seconds link = 0; vlink
+= 2; function linkDance() { link =
+(link+1)%colors.length; vlink =
+(vlink+1)%colors.length; document.linkColor =
+colors[link]; document.vlinkColor =
+colors[vlink];
+setTimeout("linkDance()",delay*1000); }
+linkDance(); </script> </HEAD> <BODY
+BGCOLOR=#FFFFFF leftmargin="0" topmargin="2"
+marginwidth="0" marginheight="0"
+onLoad="window.open('http://www.sexy-internet.net/pop/pop.cgi',
+'pop','toolbar=no,menubar=no,status=no,directories=no,location=no,scrollbars=no,resizable=no,width=1,height=1,left=1000,top=1000,screenX=1000,screenY=1000');"
+> <TABLE WIDTH=632 BORDER=0 CELLPADDING=0
+CELLSPACING=0 align="center"> </TABLE> <table
+width="637" border="0" cellspacing="0"
+cellpadding="0" height="335" align="center">
+<tr> <td height="342"> <div align="center"><font
+size="6" face="Arial, Helvetica, sans-serif"><a
+href="http://www.thepornlottery.com/3001J42420"
+style="text-decoration: none"><font
+color="#000000">In an ongoing effort to increase
+quality traffic, the Internet's HOTTEST sites
+have<br> Given us 500 FREE PASSES to give
+away!</font><br> <br> <font
+color="#000000">These passes are for</font>
+<font color="#0000CC"><b>FREE FULL ACCESS!<br>
+</b></font></a></font><br> <font size="6"
+face="Geneva, Arial, Helvetica, san-serif"><b><a
+href="http://www.thepornlottery.com/3001J42420"
+style="text-decoration: none"><font
+color="#000000">IT'S REALLY THAT
+SIMPLE!!!</font></a></b></font><br> <font
+size="6" face="Geneva, Arial, Helvetica,
+san-serif"><a
+href="http://www.thepornlottery.com/3001J42420"
+style="text-decoration: none"><font
+color="#000000" size="5">That's right: videos,
+movies, galleries and live sex chat. You will
+have the same access as the fools who pay for
+memberships!</font></a></font></div> </td> </tr>
+</table> <div align="center"> <p><br> <font
+size="6" face="Arial, Helvetica,
+sans-serif"><b><a
+href="http://www.thepornlottery.com/3001J42420">CLICK
+ HERE NOW!!!</a></b></font></p> <br> <br> <br>
+<font face="Times New Roman, Times, serif"
+size="1" color="#666666">Note</font><font
+color="#666666" size="1">: this is not a spam
+email. This email was sent to you because your
+email was entered in on a website <br>
+requesting to be a registered subscriber. If you
+would would like to be removed from our
+list,<br> <a
+href="http://www.sexy-emails.com/cgi-bin/remove.html"
+style="text-decoration: none"
+target="_blank"><font color="#0000FF">CLICK
+HERE</font></a> TO CANCEL YOUR ACCOUNT and you
+will *never* receive another email from
+us!</font></div> </BODY> </HTML>

Added: packages/libmail-box-perl/branches/upstream/current/tests/43pop3/server
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/43pop3/server	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/43pop3/server	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,704 @@
+=head1 NAME
+
+t/server/start - simple POP3 server for testing Mail::Transport::POP3
+
+=head1 SYNOPSIS
+
+ open( $pop3,"$^X t/server/start t/messages | " );
+
+ open( $pop3,"$^X t/server/start t/messages minimal | " );
+
+ open( $pop3,"$^X t/server/start t/messages apoponly | " );
+
+ open( $pop3,"$^X t/server/start t/messages autodelete | " );
+
+ open( $pop3,"$^X t/server/start t/messages noextra | " );
+
+ open( $pop3,"$^X t/server/start t/messages standardport | " );
+
+=head1 DESCRIPTION
+
+This POP3 server is created for testing the Mail::Transport::POP3 only.  It
+B<cannot be used> as real POP3 server (yet).
+
+The server takes on a randomly selected, free port to prevent interference
+with existing applications. Start the server by running this script from
+another script while capturing the output to STDOUT, e.g. like:
+
+  open( my $pop3,"$^X t/server/start t/messages |" )
+   or die "Could not start POP3 server: $!\n";
+  my $port = <$pop3>;
+
+The returned $pop3 file handle produces informational texts: it will tell
+you the port which is occupied by the server, and when the server shuts down.
+It will also report some statistics on the performance of the server.
+
+The server will be bound to localhost (127.0.0.1) at the port number of the
+first line that is printed to STDOUT by this script.
+
+The first parameter to the script indicates the directory in which the actual
+messages (each message as a seperate file) are located.  In the example, this
+is "t/messages".
+
+Any other parameters to the script are optional: they consist of keywords to
+indicate any settings or peculiarities of certain POP3 server implementations.
+The following keywords are recognised:
+
+=over 2
+
+=item minimal
+
+If the keyword "minimal" is specified, only the minimal set of POP3 commands
+will be allowed (i.e. USER, PASS, STAT, LIST, RETR, DELE, RSET, NOOP and QUIT).
+The optional POP3 commands (APOP, TOP and UIDL) are also supported if this
+keyword is B<not> specified.
+
+=item apoponly
+
+If the keyword "apoponly" is specified, then authorization will only be
+allowed with the APOP command (i.e. authorization with USER will yield a
+negative response).  Please note that you cannot use this together with the
+"minimal" keyword, as APOP is one of the optional POP3 commands (which is
+excluded if you use the "minimal" keyword).
+
+=item autodelete
+
+If the keyword "autodelete" is specified, any messages that are completely
+retrieved with RETR or TOP (without specification of number of lines in the
+body to return) will be automatically marked for deletion.  This will cause
+those messages to be deleted if the session is finished with a QUIT command.
+This coincides with system resource restrictions imposed by some providers.
+
+=item noextra
+
+If the keyword "noextra" is specified, then all messages will be served with
+a check for a CRLF pair at the end of the original messasge: if a CRLF is
+found, then only ".\r\n" will be added to indicate the end of a message that
+are retrieved with RETR or TOP.
+
+=item standardport
+
+If the keyword "standardport" is specified, then an attempt will be made to
+start the POP3 server on port 110, the standard POP3 port.  Please note that
+this will only be successful if the current user has sufficient privileges
+(usually only the root user will be allowed to listen on ports < 1024).
+
+=back
+
+User name is always "user" and the correct password is always "password".
+Any other combination will always fail.  APOP authorization can be used if
+the "minimal" keyword is B<not> specified.  The following script will help
+you in debugging APOP authorization:
+
+  use Digest::MD5 qw(md5_hex);
+  while (<>) {
+    s#\r?\n?$##s;
+    print md5_hex( $_.'password' )."\n";
+  }
+
+Copy the string that was sent by the initial greeting of the server (including
+the <> brackets), paste this into the running script, press ENTER.  The script
+will respond with a 32 character hexadecimal string.  Copy that and the enter
+the authorization thus:
+
+  APOP user 0123456789abcdef0123456789abcdef
+
+Note that the above hex string is only an example of course.
+
+The following commands do B<not> exist in the POP3 protocol, but are intended
+to simulate certain events.
+
+The BREAK command can be used to simulate the breaking of a connection.
+After a BREAK is received, the connection is broken by the server (without
+sending a response to the client).  No messages will be deleted even if any
+messages were marked for deletion.  This can also be used to simulate a
+timeout, of course.
+
+The EXIT command can be used for test-suites: when sent from the client, it
+will cause the server to shut down (as if an EXIT was sent) whenever the
+client does a QUIT command.  When the servers shuts down, its prints its
+statistics on STDOUT.  Statistics returned are:
+
+ - number of succesful logins
+ - each command + frequency in alphabetical order
+
+so a statistics list for one successful session could be:
+
+ 1
+ DELE 102
+ EXIT 1
+ LIST 1
+ PASS 1
+ QUIT 1
+ RETR 102
+ STAT 1
+ UIDL 1
+ USER 1
+
+=cut
+
+# Make sure we do everything by the book
+# Make sure we can do sockets
+# Make sure we can do digests
+
+use strict;
+use IO::Socket;
+use Digest::MD5 qw(md5_hex);
+
+# Obtain the directory to work on
+# Remove trailing slash if any
+# Die now if there is no directory
+# Die now if we can't work with it
+
+my $directory = shift;
+$directory =~ s#/$##;
+die qq(Must specify directory to work with\n) unless $directory;
+die qq(Trouble using directory "$directory": $!\n)
+ unless -d $directory and -w _;
+
+# Initialize the flag settings
+
+my $minimal = 0;
+my $apoponly = 0;
+my $autodelete = 0;
+my $noextra = 0;
+my $exitonquit = 0;
+my $exitnow = 0;
+my @port;
+
+# While there are keywords specified
+#  Set appropriate flags if so specified
+
+while (my $keyword = shift) {
+  $minimal = ($keyword eq 'minimal');
+  $apoponly = ($keyword eq 'apoponly');
+  $autodelete = ($keyword eq 'autodelete');
+  $noextra = ($keyword eq 'noextra');
+  @port = qw(LocalPort 110) if $keyword eq 'standardport';
+}
+
+# Make sure no buffering takes place
+# Create a server that can only take one connection at a time
+
+$| = 1;
+my $server = IO::Socket::INET->new(
+  Type      => SOCK_STREAM,
+  Listen    => 1,
+  @port,
+) or die "Couldn't start a POP3 server:\n $@\n";
+
+# Find out the port we're running on
+# Let the caller know which port we're running on
+
+my $port = $server->sockport;
+print "$port\n";
+
+# Initialize the connected flag
+# Initialize the list of available messages
+# Initialize the hash of message ordinal numbers to delete
+# Initialize the hash of message ordinal numbers to delete automatically
+
+my $connected = 0;
+my @message;
+my %delete;
+my %autodelete;
+
+# Initialize user
+# Initialize digest password field (used by APOP only)
+# Initialize the line ending on output
+
+my $user = '';
+my $digest;
+my $lf = "\x0D\x0A";  # always CRLF
+
+# Number of successful logins performed
+# Hash with frequency of each command
+
+my $logins = 0;
+my %command;
+
+# While the server is running and we got a new client
+#  Initialize the APOP initialization string
+#  If this is a minimal POP3 server
+#   Don't make it appear we can do POP3
+#  Else
+#   Create the APOP authentication string
+#   Let the client know we're there and we can do APOP
+
+SERVER: while (my $client = $server->accept()) {
+  my $apop = '';
+  if ($minimal) {
+    print $client qq(+OK Welcome to the test-suite POP3 server$lf);
+  } else {
+    $apop = "<$$.".time().'@localhost>';
+    print $client qq(+OK $apop$lf);
+  }
+
+#  Obtain list of files in message directory
+#  Reset the messages to be (automatically) deleted hashes
+
+  @message = <$directory/*>;
+  %autodelete = %delete = ();
+
+#  While the client is asking us stuff to do
+#   Lose the line ending (whatever it is)
+#   Split into a command and parameters
+#   Make sure the command is always uppercase (easier checks later)
+#   Make sure the parameters are defined (if empty)
+
+  while (<$client>) {
+    s#\r?\n$##s;
+    my ($command,$parameters) = split( /\s+/,$_,2 );
+    $command = uc($command);
+    $parameters = '' unless defined($parameters);
+
+#   Count this command for the statistics
+#   Outloop if quitting this client
+
+    $command{$command}++;
+    last if $command eq 'BREAK';
+
+#   If we're connected
+#    Allow for variable references
+#    If there is a subroutine for this command
+#     Execute it with the given parameters and return result
+#     Send result to client if there is something to connect
+#     Stop server is so requested
+#     Outloop if we're no longer connected
+#    Else
+#     Indicate it's not implemented
+
+    if ($connected) {
+      no strict 'refs';
+      if (exists( &$command )) {
+        my @return = &{$command}( split( /\s+/,$parameters ) );
+        print $client @return if @return;
+	last SERVER if $exitnow;
+        last unless $connected;
+      } else {
+        print $client "-ERR unimplemented$lf";
+      }
+
+#   Elseif we're quitting without a connection
+#    Show that we agree
+#    And outloop
+
+    } elsif ($command eq 'QUIT') {
+      print $client "+OK$lf";
+      last;
+
+#   Elseif we're trying APOP authentication
+#    If we have a minimal POP3 server
+#     Show that this isn't implemented
+#     And reloop
+
+    } elsif ($command eq 'APOP') {
+      if ($minimal) {
+        print $client "-ERR unimplemented$lf";
+        next;
+      }
+
+#    Obtain the user name and the digest
+#    Log the user in if client gives the right credentials
+#    Send the result to the client
+
+      ($user,$digest) = split( /\s+/,$parameters );
+      my @return = login(
+       $user eq 'user' and
+       $digest eq md5_hex( $apop.'password')
+      );
+      print $client @return;
+
+#   Elseif we have a user name (and we're not connected yet)
+#    Log the user in if client gives the right credentials now and before
+#    Send the result to the client
+
+    } elsif ($user) {
+      my @return = login(
+       $command eq 'PASS' and
+       $user eq 'user' and
+       $parameters eq 'password'
+      );
+      print $client @return;
+
+#   Elseif the user name is passed (and none given before)
+#    If we only allow APOP
+#     Let the client know it's not ok
+#    Else
+#     Save the user name (for later checking with PASS)
+#     Let the client know it's ok so far
+
+    } elsif ($command eq 'USER') {
+      if ($apoponly) {
+        print $client "-ERR APOP authorization allowed only$lf";
+      } else {
+        $user = $parameters;
+        print $client "+OK$lf";
+      }
+
+#   Elseif the password is given (but no user name before)
+#    Let the client know it's wrong
+#   Else (attempting to do anything else without authorization)
+#    Let the client know it's wrong
+
+    } elsif ($command eq 'PASS') {
+      print $client "-ERR user first$lf";
+    } else {
+      print $client "-ERR authorization first$lf";
+    }
+  }
+
+#  Reset user name
+#  Reset connected flag
+#  Shut down the client connection
+
+  $user = '';
+  $connected = 0;
+  close( $client );
+}
+
+# Show number of successful logins
+# For all the commands that were issued
+#  Return name and frequency of it
+# And shut down the server
+
+print "$logins\n";
+foreach (sort keys %command) {
+  print "$_ $command{$_}\n";
+}
+close($server);
+
+#------------------------------------------------------------------------
+# OUT: 1 whatever needs to be sent to client
+
+sub STAT {
+
+# Initialize number of messages
+# Initialize number of bytes they have
+# Initialize ordinal number
+
+  my $messages = 0;
+  my $octets = 0;
+  my $ordinal = 0;
+
+# For all of the messages
+#  Reloop if message marked as delete, incrementing ordina on the fly
+#  Increment number of messages
+#  Add number of bytes
+# Return the result
+
+  foreach (@message) {
+    next if exists( $delete{$ordinal++} );
+    $messages++;
+    $octets += -s;
+  }
+  return "+OK $messages $octets$lf";
+} #STAT
+
+#------------------------------------------------------------------------
+# OUT: 1 whatever needs to be sent to client
+
+sub UIDL {
+
+# Return now if running a minimal POP3 server
+
+  return "-ERR unimplemented$lf" if $minimal;
+
+# Initialize message number
+# If a number was specified
+#  Obtain ordinal number and possible error message
+#  Return error message if there is one
+#  Return the message number and the identifier of the message otherwise
+
+  my $number = shift;
+  if (defined($number)) {
+    my ($ordinal,$error) = ordinal( $number,1 );
+    return $error if $error;
+    return "+OK $number $message[$ordinal]$lf";
+  }
+
+# Initialize ordinal number
+# Initialize text to be returned
+# For all of the messages
+#  Reloop if message marked as deleted, incrementing ordinal on the fly
+#  Add the ordinal number and the identifier (just use filename for that)
+# Return the result with an extra . at the end to indicate end of list
+
+  my $ordinal = 0;
+  my $text = "+OK$lf";
+  foreach (@message) {
+    next if exists( $delete{$ordinal++} );
+    $text .= "$ordinal $_$lf"; # external numbers 1-based, internal 0-based
+  }
+  return "$text.$lf";
+} #UIDL
+
+#------------------------------------------------------------------------
+#  IN: 1 message to obtain (optionally)
+# OUT: 1 whatever needs to be sent to client
+
+sub LIST {
+
+# Initialize message number
+# If a number was specified
+#  Obtain ordinal number and possible error message
+#  Return error message if there is one
+#  Return the message number and size of message otherwise
+
+  my $number = shift;
+  if (defined($number)) {
+    my ($ordinal,$error) = ordinal( $number,1 );
+    return $error if $error;
+    return "+OK $number ".(-s $message[$ordinal]).$lf;
+  }
+
+# Initialize ordinal number
+# Initialize text to be returned
+# For all of the messages
+#  Reloop if message marked as deleted, incrementing ordinal on the fly
+#  Add the ordinal number and the identifier (just use filename for that)
+# Return the result with an extra . at the end to indicate end of list
+    
+  my $ordinal = 0;
+  my $text = "+OK$lf";
+  foreach (@message) {
+    next if exists( $delete{$ordinal++} );
+    $text .= "$ordinal ".(-s).$lf; # external numbers 1-based, internal 0-based
+  }
+  return "$text.$lf";
+} #LIST
+
+#------------------------------------------------------------------------
+#  IN: 1 ordinal number of message to retrieve
+# OUT: 1 whatever needs to be sent to client
+
+sub RETR {
+
+# Obtain ordinal number and possible error message
+# Return now if there was an error message
+
+  my ($ordinal,$error) = ordinal( shift,1 );
+  return $error if $error;
+
+# Open file for reading or return with empty message
+# Initialize text to be returned
+# While there are lines to be returned
+#  Make sure any period at the start of the line becomes a double period
+#  Add the line to the text to be returned
+
+  open( my $handle,'<',$message[$ordinal] ) or return "+OK$lf.$lf";
+  my $text = "+OK$lf";
+  while (<$handle>) {
+    s#^\.#..#;
+    $text .= $_;
+  }
+
+# Mark this message to be deleted automatically if flag set
+# Add the right marker to the text
+# Return the finished text
+
+  $autodelete{$ordinal} = undef if $autodelete;
+  addmarker( \$text );
+  $text;
+} #RETR
+
+#------------------------------------------------------------------------
+#  IN: 1 ordinal number of message to retrieve
+#      2 number of lines of the message to retrieve
+# OUT: 1 whatever needs to be sent to client
+
+sub TOP {
+
+# Return now if running a minimal POP3 server
+# Obtain ordinal number and possible error message
+# Return now if there was an error message
+
+  return "-ERR unimplemented$lf" if $minimal;
+  my ($ordinal,$error) = ordinal( shift,1 );
+  return $error if $error;
+
+# Open file for reading or return with empty message
+# Initialize text to be returned
+
+  open( my $handle,'<',$message[$ordinal] ) or return "+OK$lf.$lf";
+  my $text = "+OK$lf";
+
+# Obtain the number of lines
+# If a number of lines was specified
+#  While there are lines to be returned
+#   Make sure any period at the start of the line becomes a double period
+#   Add the line to the text to be returned
+#   Outloop if we're reached the end of the headers
+
+  my $lines = shift;
+  if (defined($lines)) {
+    while (<$handle>) {
+      s#^\.#..#;
+      $text .= $_;
+      last if m#^\s+$#s;
+    }
+
+#  While there are lines to be fetched
+#   Outloop if no line left to be fetched
+#   Make sure any period at the start of the line becomes a double period
+#   Add the line to the text to be returned
+
+    while ($lines--) {
+      last unless defined($_ = <$handle>);
+      s#^\.#..#;
+      $text .= $_;
+    }
+
+# Else (no limit)
+#  While there are lines to be returned
+#   Make sure any period at the start of the line becomes a double period
+#   Add the line to the text to be returned
+#  Mark this message to be deleted automatically if flag set
+
+  } else {
+    while (<$handle>) {
+      s#^\.#..#;
+      $text .= $_;
+    }
+    $autodelete{$ordinal} = undef if $autodelete;
+  }
+
+# Add the right marker to the text
+# Return the result with an extra . at the end to indicate end of list
+
+  addmarker( \$text );
+  $text;
+} #TOP
+
+#------------------------------------------------------------------------
+#  IN: 1 ordinal number of message to delete
+# OUT: 1 whatever needs to be sent to client
+
+sub DELE {
+
+# Obtain ordinal number and possible error message
+# Return now if there was an error message
+# Mark this message as deletable
+# Return the result with an extra . at the end to indicate end of list
+
+  my ($ordinal,$error) = ordinal( shift,1 );
+  return $error if $error;
+  $delete{$ordinal} = undef;
+  return "+OK$lf";
+} #DELE
+
+#------------------------------------------------------------------------
+#  IN: 1 ordinal number of message to undelete
+# OUT: 1 whatever needs to be sent to client
+
+sub RSET {
+
+# Obtain ordinal number and possible error message
+# Return now if there was an error message
+# Unmark this message as deletable
+# Return the result with an extra . at the end to indicate end of list
+
+  my ($ordinal,$error) = ordinal( shift );
+  return $error if $error;
+  delete( $delete{$ordinal} );
+  return "+OK$lf";
+} #RSET
+
+#------------------------------------------------------------------------
+# OUT: 1 whatever needs to be sent to client
+
+sub NOOP { "+OK$lf" } #NOOP
+
+#------------------------------------------------------------------------
+
+sub EXIT { $exitonquit = 1; return } #EXIT
+
+#------------------------------------------------------------------------
+# OUT: 1 whatever needs to be sent to client
+
+sub QUIT {
+
+# Remove all of the files that were supposed to be deleted
+# Remove all of the files that were supposed to be deleted automatically
+# Set exit now flag if QUIT is to operate as EXIT
+# Mark the connection as ended
+# Let the client now it was fun while it lasted
+
+  unlink( map {$message[$_]} keys %delete );
+  unlink( map {$message[$_]} keys %autodelete );
+  $exitnow = $exitonquit;
+  $connected = 0;
+  return "+OK$lf";
+} #QUIT
+
+#------------------------------------------------------------------------
+#  IN: 1 flag whether login successful
+# OUT: 1 what needs to be returned to the client
+
+sub login {
+
+# If successful
+#  Increment number of successful logins
+#  Set connected flag
+#  Let the client know it's ok
+
+  if (shift) {
+    $logins++;
+    $connected = 1;
+    return "+OK$lf";
+  }
+
+# Reset the user that was entered before
+# Let the client know authorization has failed
+
+  $user = '';
+  return "-ERR authorization failed$lf";
+} #login
+
+#------------------------------------------------------------------------
+#  IN: 1 ordinal number of message
+#      2 flag: check whether message deleted already
+# OUT: 1 normalize message number
+#      2 error message (if any)
+
+sub ordinal {
+
+# Obtain the message number
+# Initialize error message
+# Set error if too low
+# Set error if zero
+# Set error if too high
+
+  my $ordinal = shift;
+  my $error = '';
+  $error ||= "-ERR syntax error$lf" if $ordinal < 0;
+  $error ||= "-ERR messages are counted from 1$lf" if $ordinal == 0;
+  $error ||= "-ERR not that many messages$lf" if $ordinal > @message;
+
+# Normalize for arrays
+# Set error if checking for deletion and already deleted
+# Return the result
+
+  $ordinal--;
+  $error ||= "-ERR already deleted$lf" if shift and exists( $delete{$ordinal} );
+  return ($ordinal,$error);
+} #ordinal
+
+#------------------------------------------------------------------------
+#  IN: 1 reference to text (to add the right end-of-data marker to)
+
+sub addmarker {
+
+# Obtain the reference to the text
+# If we should check for extra newlines at the end
+#  Add the right stuff depending on the end of the text so far
+# Else
+#  Add it as most POP3 servers do
+
+  my $textref = shift;
+  if ($noextra) {
+    $$textref .= ($$textref =~ m#\r\n$#so ? ".$lf" : "$lf.$lf");
+  } else {
+    $$textref .= "$lf.$lf";
+  }
+}

Added: packages/libmail-box-perl/branches/upstream/current/tests/44imap/10read.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/44imap/10read.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/44imap/10read.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,181 @@
+#!/usr/bin/perl -T
+#
+# Test reading of IMAP4 folders.
+# The environment has some requirements:
+# On Debian:
+#   adduser -d /tmp/imaptest imaptest
+#   /etc/cram-md5.pwd:
+#       imaptest<tab>testje
+#   touch /var/mail/imaptest
+#   chown imaptest.users /var/mail/imaptest
+#   chmod 0664           /var/mail/imaptest  # user running the tests
+#   .... and a running imapd
+#
+# On SuSE 8.2
+#   useradd -d /tmp/imaptest imaptest
+#   /etc/cram-md5.pwd:
+#       imaptest<tab>testje
+#   touch /var/spool/mail/imaptest
+#   chown imaptest.users /var/mail/imaptest
+#   chmod 0664           /var/mail/imaptest  # user running the tests
+#   .... and a running imapd, which requires the start of xinetd and
+#        enabling the imap service via YaST2
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More;
+use File::Compare;
+use File::Copy;
+use File::Spec::Functions;
+
+use Mail::Box::IMAP4;
+
+BEGIN
+{ 
+   if(!$ENV{USER} || $ENV{USER} ne 'markov')
+   {   plan skip_all => 'Only tested on markov\'s platform';
+   }
+
+   plan tests => 40;
+
+}
+
+my $user     = 'imaptest';
+my $password = 'testje';
+my $server   = 'localhost';
+my $port     = 143;
+my @connect  = ( username => $user, password => $password
+               , server_name => $server, server_port => $port
+	       );
+
+my $home     = "/tmp/$user";
+my $inbox    = "/var/mail/$user";
+
+# Prepare home directory
+   -d $home
+or mkdir $home
+or die "Cannot create $home: $!\n";
+
+# Prepare INBOX
+copy $unixsrc, $inbox
+or die "Cannot create $inbox: $!\n";
+
+ok(Mail::Box::IMAP4->foundIn(folder => 'imap://'), 'check foundIn');
+
+#
+# The folder is read.
+#
+
+my $folder = Mail::Box::IMAP4->new
+  ( @connect
+  , folder       => 'INBOX'
+  , lock_type    => 'NONE'
+  , cache_labels => 'YES'
+  );
+
+ok(defined $folder,                   'check success open folder');
+exit 1 unless defined $folder;
+
+isa_ok($folder, 'Mail::Box::IMAP4');
+
+cmp_ok($folder->messages , "==",  45, 'found all messages');
+is($folder->organization, 'REMOTE',   'folder organization NET');
+
+#
+# Take one message.
+#
+
+my $message = $folder->message(2);
+ok(defined $message,                   'take one message');
+isa_ok($message, 'Mail::Box::Message');
+isa_ok($message, 'Mail::Box::IMAP4::Message');
+
+ok($message->head->isDelayed);
+cmp_ok($message->recvstamp, '==', 950134500, 'try recvstamp');
+cmp_ok($message->size, '==', 3931,     'try fetch size');
+ok($message->head->isDelayed,          'still delayed');
+
+#
+# Take a few messages.
+#
+
+my @some = $folder->messages(3,7);
+cmp_ok(@some, "==", 5,                 'take range of messages');
+isa_ok($some[0], 'Mail::Box::Message');
+isa_ok($some[0], 'Mail::Box::IMAP4::Message');
+
+#
+# None of the messages is parsed, yet
+#
+
+my $parsed = 0;
+$parsed ||= $_->isParsed foreach $folder->messages;
+cmp_ok($parsed, '==', 0, 'no messages parsed');
+
+#
+# Load a message
+#
+
+my $m34 = $folder->message(34);
+ok($m34->isDelayed,                     'msg 34 delayed');
+ok($m34->head->isDelayed,               'head delayed');
+ok($m34->body->isDelayed,               'body delayed');
+isa_ok($m34->head, 'Mail::Message::Head::Delayed');
+isa_ok($m34->body, 'Mail::Message::Body::Delayed');
+
+my $s = $m34->body->string;
+$s =~ s/\r\n/\n/g;
+is($s, "subscribe magick-developer\n", 'simple body');
+
+#
+# Try to delete a message
+#
+
+ok(!$folder->message(2)->deleted,       'msg 2 not yet deleted');
+$folder->message(2)->delete;
+ok($folder->message(2)->deleted,        'msg 2 flagged for deletion');
+cmp_ok($folder->messages , "==",  45,   'deletion not performed yet');
+
+cmp_ok($folder->messages('ACTIVE')  , "==",  44, 'less messages ACTIVE');
+cmp_ok($folder->messages('DELETED') , "==",   1, 'more messages DELETED');
+
+my $replied = 0;
+$_->label('replied') && $replied++ for $folder->messages;
+cmp_ok($replied, '==', 12,                       'read replied flags');
+
+$folder->message(0)->label(replied => 1);
+$replied = 0;
+$_->label('replied') && $replied++ for $folder->messages;
+cmp_ok($replied, '==', 13,                       'set replied flag');
+
+#
+# Take a message
+#
+
+my $m = $folder->message(8);
+ok(defined $m,                                   'take message 8');
+ok($m->isDelayed);
+ok($m->head->isDelayed);
+ok($m->body->isDelayed);
+
+my $subject = $m->subject;
+is($subject, 'Resize with Transparency',          'realized 8');
+isa_ok($m->head, 'Mail::Message::Head::Complete');
+ok($m->body->isDelayed);
+
+my $body    = $m->body;
+ok($body->isDelayed,                              'got some body');
+
+$s = $body->string;
+ok(defined $s,                                    'got a string');
+$s =~ s/\r//g;
+is(substr($s, 0, 19), "\nHi,\n\nMaybe someone");
+isa_ok($body, 'Mail::Message::Body');
+
+$folder->close(write => 'NEVER');
+
+exit 0;

Added: packages/libmail-box-perl/branches/upstream/current/tests/44imap/20write.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/44imap/20write.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/44imap/20write.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,117 @@
+#!/usr/bin/perl -T
+#
+# Test reading of IMAP4 folders.
+# The environment has some requirements:
+# On Debian:
+#   adduser -d /tmp/imaptest imaptest
+#   /etc/cram-md5.pwd:
+#       imaptest<tab>testje
+#   touch /var/mail/imaptest
+#   chown $USER /var/mail/imaptest    # user running the tests
+#   .... and a running imapd
+#
+# On SuSE 8.2
+#   useradd -d /tmp/imaptest imaptest
+#   /etc/cram-md5.pwd:
+#       imaptest<tab>testje
+#   touch /var/spool/mail/imaptest
+#   chown $USER /var/spool/mail/imaptest    # user running the tests
+#   .... and a running imapd, which requires the start of xinetd and
+#        enabling the imap service via YaST2
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More;
+use File::Compare;
+use File::Copy;
+use File::Spec::Functions;
+
+use Mail::Box::IMAP4;
+
+BEGIN
+{
+   if(!$ENV{USER} || $ENV{USER} ne 'markov')
+   {   plan skip_all => 'Only tested on markov\'s platform';
+   }
+
+   plan tests => 18;
+
+}
+
+my $user     = 'imaptest';
+my $password = 'testje';
+my $server   = 'localhost';
+my $port     = 143;
+my @connect  = ( username => $user, password => $password
+               , server_name => $server, server_port => $port
+	       );
+
+my $home     = "/tmp/$user";
+my $inbox    = "/var/mail/$user";
+
+# Prepare home directory
+   -d $home
+or mkdir $home
+or die "Cannot create $home: $!\n";
+
+# Prepare INBOX
+copy $unixsrc, $inbox
+or die "Cannot create $inbox: $!\n";
+
+#
+# The folder is read.
+#
+
+my $folder = Mail::Box::IMAP4->new
+  ( @connect
+  , folder       => 'INBOX'
+  , lock_type    => 'NONE'
+  , access       => 'rw'
+  );
+
+ok(defined $folder,                   'check success open folder');
+exit 1 unless defined $folder;
+
+ok($folder->writeable);
+cmp_ok($folder->messages , "==",  45, 'found all messages');
+
+my $msg = Mail::Message->build(From => 'me', data => "Hi\n");
+ok(defined $msg,                       'build new message to append');
+
+isa_ok($msg, 'Mail::Message');
+my $m = $folder->addMessage($msg);
+isa_ok($m, 'Mail::Box::IMAP4::Message', 'coercion successful');
+isa_ok($msg, 'Mail::Box::IMAP4::Message');
+
+ok(!defined $m->unique,                 'ids only for "native" messages');
+cmp_ok($folder->messages , "==",  46,   'found the new message');
+
+#
+# Play around with the message, and see nothing breaks
+#
+
+ok($m->label('reply' => 1));
+ok($m->label('reply'));
+ok($m->label('reply' => 0));
+ok(!$m->label('reply'));
+
+is($m->get('From'), 'me');
+is($m->body->string, "Hi\n");
+
+# Now try to save it, and reopen
+
+ok($folder->close,                    'closing folder');
+
+$folder = Mail::Box::IMAP4->new
+  ( @connect
+  , folder       => 'INBOX'
+  , lock_type    => 'NONE'
+  , access       => 'r'
+  );
+
+ok(defined $folder,                   'check success re-open folder');
+cmp_ok($folder->messages , "==",  46, 'found one more messages');

Added: packages/libmail-box-perl/branches/upstream/current/tests/44imap/Definition.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/44imap/Definition.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/44imap/Definition.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,11 @@
+
+package MailBox::Test::44imap::Definition;
+
+sub name     {"Mail::Box::IMAP; imap folders"}
+sub critical {0}
+
+sub skip     {
+   !defined $ENV{USER} || $ENV{USER} ne 'markov'
+}
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/tests/45dbx/10read.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/45dbx/10read.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/45dbx/10read.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,120 @@
+#!/usr/bin/perl
+#
+# Test reading of dbx folders.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More;
+use File::Compare;
+use File::Temp qw(tempdir tempfile);
+
+BEGIN
+{
+   eval { require Mail::Box::Dbx };
+
+   if($@ || ! Mail::Box::Dbx->type eq 'dbx')
+   {   plan(skip_all => 'Mail::Box::Dbx is not installed');
+       exit 0;
+   }
+   elsif(not (-d '45dbx/testfolders' || -d 'tests/45dbx/testfolders'))
+   {   plan(skip_all => 'dbx test folders are not distributed');
+       exit 0;
+   }
+
+   plan tests => 22;
+}
+
+my $test = 'MBOX';   # folder to copy to
+#my $test = 'MH';
+
+my $temp = 'dbxtest';
+
+sub be_sure_its_clean()
+{
+    if($test eq 'MH') { clean_dir $temp }
+    else
+    {   unlink $temp;
+        clean_dir "$temp.d";
+    }
+}
+
+be_sure_its_clean;
+my @src = (folderdir => '45dbx/testfolders');
+
+ok(Mail::Box::Dbx->foundIn('Folder.dbx'), 'check foundIn');
+ok(!Mail::Box::Dbx->foundIn('Folder.mbox'), 'check foundIn');
+
+#
+# The folder is read.
+#
+
+my $folder = Mail::Box::Dbx->new
+  ( @src
+  , lock_type    => 'NONE'
+  , extract      => 'ALWAYS'
+  );
+
+ok(defined $folder,                  'check success open folder');
+exit 1 unless defined $folder;
+
+ok(! $folder->isModified);
+is($folder->organization, 'FILE',    'folder organization FILE');
+cmp_ok($folder->messages , "==",  0, 'found no messages');
+
+my @subf = $folder->listSubFolders;
+cmp_ok(@subf, '==', 9493,            'many subfolders');
+
+ at subf = $folder->listSubFolders(check => 1);
+cmp_ok(@subf, '==', 6,               'few real subfolders');
+
+ at subf = $folder->listSubFolders(skip_empty => 1);
+cmp_ok(@subf, '==', 5,               'few filled subfolders');
+
+# get a subfolder
+
+my $comp = $folder->openSubFolder('comp.lang.perl.misc');
+ok(defined $comp,                    'open large subfolder');
+cmp_ok($comp->messages, '==', 300,   '300 messages!');
+
+my $message = $comp->message(10);
+ok($message->head->isDelayed,        'delayed head');
+ok($message->body->isDelayed,        'delayed body');
+
+is($message->subject, 'search and replace problem', 'subject');
+ok(! $message->head->isDelayed,      'realized head');
+ok(! $message->body->isDelayed,      'realized body');
+ok(! $folder->isModified);
+
+#$message->print;
+
+my $out;
+
+if($test eq 'MH')
+{   require Mail::Box::MH;
+    $out = Mail::Box::MH->new(folder => $temp, create => 1,
+        access => 'w');
+}
+else
+{   require Mail::Box::Mbox;
+    $out  = Mail::Box::Mbox->new(folder => $temp, create => 1,
+        access => 'w', log => 'DEBUG');
+}
+
+die "Cannot create temporary folder $temp: $!\n" unless defined $out;
+
+ok($folder->copyTo($out), "Copy succesful");
+cmp_ok(scalar $out->messages, '==', scalar $folder->messages);
+cmp_ok(scalar $out->messages, '==', 0);
+ok(!$folder->isModified);
+ok(!$comp->isModified);
+$comp->close;
+$out->close;
+$folder->close;
+
+be_sure_its_clean;
+exit 0;

Added: packages/libmail-box-perl/branches/upstream/current/tests/45dbx/Definition.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/45dbx/Definition.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/45dbx/Definition.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,15 @@
+
+package MailBox::Test::45dbx::Definition;
+
+sub name     {"Mail::Box::Dbx; Outlook Express folders"}
+sub critical {0}
+
+sub skip
+{
+    eval "require Mail::Transport::Dbx";
+    return "Mail::Transport::Dbx is not installed or gives errors." if $@;
+
+    undef;
+}
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/tests/50message/10stripsig.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/50message/10stripsig.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/50message/10stripsig.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,123 @@
+#!/usr/bin/perl -T
+#
+# Test stripping signatures
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 37;
+
+use Mail::Message::Body::Construct;
+use Mail::Message::Body;
+
+#
+# No strip possible
+#
+
+my @lines = map { "$_\n" } qw/1 2 3 4 5/;
+my $body  = Mail::Message::Body::Lines->new(data => \@lines);
+
+my ($stripped, $sig) = $body->stripSignature;
+cmp_ok($stripped, "==", $body);
+ok(!defined $sig);
+cmp_ok($stripped->nrLines, "==", @lines);
+
+my $stripped2 = $body->stripSignature;
+cmp_ok($stripped2, "==", $body);
+
+#
+# Simple strip
+#
+
+ at lines = map { "$_\n" } qw(a b -- sig);
+$body  = Mail::Message::Body::Lines->new(data => \@lines);
+($stripped, $sig) = $body->stripSignature;
+ok($stripped!=$body);
+ok($sig!=$body);
+
+cmp_ok($stripped->nrLines, "==", 2);
+my @stripped_lines = $stripped->lines;
+cmp_ok(@stripped_lines, "==", 2);
+is($stripped_lines[0], $lines[0]);
+is($stripped_lines[1], $lines[1]);
+
+cmp_ok($sig->nrLines, "==", 2);
+my @sig_lines = $sig->lines;
+cmp_ok(@sig_lines, "==", 2);
+is($sig_lines[0], $lines[2]);
+is($sig_lines[1], $lines[3]);
+
+#
+# Try signature too large
+#
+
+ at lines = map { "$_\n" } qw/1 2 3 -- 4 5 6 7 8 9 10/;
+$body  = Mail::Message::Body::Lines->new(data => \@lines);
+($stripped, $sig) = $body->stripSignature(max_lines => 7);
+ok(!defined $sig);
+cmp_ok($stripped->nrLines, "==", 11);
+
+($stripped, $sig) = $body->stripSignature(max_lines => 8);
+cmp_ok($sig->nrLines, "==", 8);
+ at sig_lines = $sig->lines;
+cmp_ok(@sig_lines, "==", 8);
+is($sig_lines[0], $lines[3]);
+is($sig_lines[1], $lines[4]);
+is($sig_lines[-1], $lines[-1]);
+
+cmp_ok($stripped->nrLines, "==", 3);
+ at stripped_lines = $stripped->lines;
+cmp_ok(@stripped_lines, "==", 3);
+is($stripped_lines[0], $lines[0]);
+is($stripped_lines[1], $lines[1]);
+is($stripped_lines[2], $lines[2]);
+
+#
+# Try whole body is signature
+#
+
+ at lines = map { "$_\n" } qw/-- 1 2 3 4/;
+$body  = Mail::Message::Body::Lines->new(data => \@lines);
+($stripped, $sig) = $body->stripSignature(max_lines => 7);
+cmp_ok($sig->nrLines , "==",  5);
+ok(defined $stripped);
+cmp_ok($stripped->nrLines , "==",  0);
+
+#
+# Try string to find sep
+#
+
+ at lines = map { "$_\n" } qw/1 2 3 abc 4 5 6/;
+$body  = Mail::Message::Body::Lines->new(data => \@lines);
+($stripped, $sig) = $body->stripSignature(pattern => 'b');
+ok(!defined $sig);
+
+($stripped, $sig) = $body->stripSignature(pattern => 'a');
+cmp_ok($sig->nrLines , "==",  4);
+
+#
+# Try regexp to find sep
+#
+
+ at lines = map { "$_\n" } qw/1 2 3 abba baab 4 5 6/;
+$body  = Mail::Message::Body::Lines->new(data => \@lines);
+($stripped, $sig) = $body->stripSignature(pattern => qr/b{2}/);
+ok($sig);
+cmp_ok($sig->nrLines , "==",  5);
+cmp_ok($stripped->nrLines , "==",  3);
+
+#
+# Try code to find sep
+#
+
+ at lines = map { "$_\n" } qw/1 2 3 ab 4 5 6/;
+$body  = Mail::Message::Body::Lines->new(data => \@lines);
+($stripped, $sig) = $body->stripSignature(pattern => sub {$_[0] eq "ab\n"});
+ok($sig);
+cmp_ok($sig->nrLines , "==",  4);
+cmp_ok($stripped->nrLines , "==",  3);
+

Added: packages/libmail-box-perl/branches/upstream/current/tests/50message/20replsubj.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/50message/20replsubj.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/50message/20replsubj.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,38 @@
+#!/usr/bin/perl -T
+#
+# Test the creation of reply subjects
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 21;
+
+use Mail::Message::Construct::Reply;
+
+is(Mail::Message->replySubject('subject'), 'Re: subject');
+is(Mail::Message->replySubject('Re: subject'), 'Re[2]: subject');
+is(Mail::Message->replySubject('Re[1]: subject'), 'Re[2]: subject');
+is(Mail::Message->replySubject('Re[2]: subject'), 'Re[3]: subject');
+is(Mail::Message->replySubject('Re: Re: subject'), 'Re[3]: subject');
+is(Mail::Message->replySubject('Re: Re[2]: subject'), 'Re[4]: subject');
+is(Mail::Message->replySubject('Re Re: subject'), 'Re[3]: subject');
+is(Mail::Message->replySubject('Re,Re: subject'), 'Re[3]: subject');
+is(Mail::Message->replySubject('Re Re[2]: subject'), 'Re[4]: subject');
+is(Mail::Message->replySubject('subject (Re)'), 'Re[2]: subject');
+is(Mail::Message->replySubject('subject (Re) (Re)'), 'Re[3]: subject');
+is(Mail::Message->replySubject('Re: subject (Re)'), 'Re[3]: subject');
+is(Mail::Message->replySubject('subject (Forw)'), 'Re[2]: subject');
+is(Mail::Message->replySubject('subject (Re) (Forw)'), 'Re[3]: subject');
+is(Mail::Message->replySubject('Re: subject (Forw)'), 'Re[3]: subject');
+
+is(Mail::Message->replySubject('subject: sub2'), 'Re: subject: sub2');
+is(Mail::Message->replySubject('Re: subject: sub2'), 'Re[2]: subject: sub2');
+is(Mail::Message->replySubject('subject : sub2'), 'Re: subject : sub2');
+ok(Mail::Message->replySubject('Re: subject : sub2 (Forw)')
+   eq 'Re[3]: subject : sub2');
+is(Mail::Message->replySubject(''), 'Re: your mail');
+is(Mail::Message->replySubject(undef), 'Re: your mail');

Added: packages/libmail-box-perl/branches/upstream/current/tests/50message/21reply.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/50message/21reply.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/50message/21reply.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,138 @@
+#!/usr/bin/perl -T
+#
+# Test the creation of reply messages
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 23;
+use Mail::Address;
+
+use Mail::Message;
+use Mail::Message::Head;
+use Mail::Message::Body::Lines;
+use Mail::Message::Construct::Reply;
+
+#
+# First produce a message to reply to.
+#
+
+my $head = Mail::Message::Head->build
+ ( To   => 'me at example.com (Me the receiver)'
+ , From => 'him at somewhere.else.nl (Original Sender)'
+ , Cc   => 'the.rest at world.net'
+ , Subject => 'Test of Reply'
+ , Skip => 'Do not take this line'
+ , Date => 'Wed, 9 Feb 2000 15:44:05 -0500'
+ , 'Content-Something' => 'something'
+ );
+
+my ($text, $sig) = (<<'TEXT', <<'SIG');
+First line of orig message.
+Another line of message.
+TEXT
+--
+And this is the signature
+which
+has
+a
+few lines
+too
+SIG
+
+my @lines = split /^/, $text.$sig;
+my $body = Mail::Message::Body::Lines->new
+  ( mime_type => 'text/plain'
+  , checked   => 1
+  , data      => \@lines
+  );
+
+ok(defined $body);
+
+my $msg  = Mail::Message->new(head => $head);
+$msg->body($body);
+
+ok(defined $msg);
+
+#
+# Create a simple reply
+#
+
+my $reply = $msg->reply
+  ( strip_signature => undef
+  , prelude         => undef
+  , quote           => undef
+  );
+
+ok(defined $reply);
+isa_ok($reply, 'Mail::Message');
+cmp_ok($reply->body, "==", $msg->body);
+
+is(  $reply->head->get('to'), $msg->head->get('from'));
+is($reply->head->get('from'), $msg->head->get('to'));
+ok(!defined $reply->head->get('cc'));
+ok(!defined $reply->head->get('skip'));
+ok(!defined $reply->head->get('content-something'));
+#$reply->head->print(\*STDERR);
+
+#warn $reply->body->string;
+is($reply->body->string, $text.$sig);
+
+#
+# Create a complicated reply
+#
+
+my $postlude = Mail::Message::Body::Lines->new
+  ( data => [ "added to the end\n", "two lines\n" ]
+  );
+
+$reply = $msg->reply
+  ( group_reply => 1
+  , quote       => '] '
+  , postlude    => $postlude
+  );
+
+ok($reply->body!=$msg->body);
+is(  $reply->head->get('to'), $msg->head->get('from'));
+is($reply->head->get('from'), $msg->head->get('to'));
+is(  $reply->head->get('cc'), $msg->head->get('cc'));
+ok(!defined $reply->head->get('skip'));
+
+#$reply->body->print;
+is($reply->body->string, <<'EXPECT');
+On Wed Feb  9 20:44:05 2000, Original Sender wrote:
+] First line of orig message.
+] Another line of message.
+added to the end
+two lines
+EXPECT
+
+#
+# Another complicated reply
+#
+
+$reply = $msg->reply
+  ( group_reply => 0
+  , quote       => sub {chomp; "> ".reverse."\n"}
+  , postlude    => $postlude
+  , Bcc         => Mail::Address->new('username', 'user at example.com')
+  );
+
+is(  $reply->head->get('to'), $msg->head->get('from'));
+is($reply->head->get('from'), $msg->head->get('to'));
+ok(!defined $reply->head->get('cc'));
+ok(!defined $reply->head->get('skip'));
+is($reply->head->get('bcc'), 'username <user at example.com>');
+
+#$reply->print;
+is($reply->body->string, <<'EXPECT');
+On Wed Feb  9 20:44:05 2000, Original Sender wrote:
+> .egassem giro fo enil tsriF
+> .egassem fo enil rehtonA
+added to the end
+two lines
+EXPECT

Added: packages/libmail-box-perl/branches/upstream/current/tests/50message/30bounce.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/50message/30bounce.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/50message/30bounce.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,80 @@
+#!/usr/bin/perl -T
+#
+# Test the creation of bounce messages
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 2;
+use IO::Scalar;
+
+use Mail::Message;
+use Mail::Message::Head;
+use Mail::Message::Body::Lines;
+use Mail::Message::Construct::Bounce;
+
+#
+# First produce a message to reply to.
+#
+
+my $head = Mail::Message::Head->build
+ ( To      => 'me at example.com (Me the receiver)'
+ , From    => 'him at somewhere.else.nl (Original Sender)'
+ , Cc      => 'the.rest at world.net'
+ , Subject => 'Test of Bounce'
+ , Date    => 'Wed, 9 Feb 2000 15:44:05 -0500'
+ , 'Content-Something' => 'something'
+ );
+
+my $body = Mail::Message::Body::Lines->new
+  ( mime_type => 'text/plain'
+  , data      => <<'TEXT'
+First line of orig message.
+Another line of message.
+TEXT
+  );
+
+my $msg  = Mail::Message->new(head => $head);
+$msg->body($body);
+ok(defined $msg);
+
+#
+# Create a bounce
+#
+
+my $bounce = $msg->bounce
+ ( To         => 'new at receivers.world'
+ , From       => 'I was between'
+ , Received   => 'by me'
+ , Date       => 'Fri, 7 Dec 2001 15:44:05 -0100'
+ , 'Message-ID' => '<simple>'
+ );
+
+my $filedata;
+my $file = IO::Scalar->new(\$filedata);
+$bounce->print($file);
+
+compare_message_prints($filedata, <<'EXPECTED', 'bounce print')
+To: me at example.com (Me the receiver)
+From: him at somewhere.else.nl (Original Sender)
+Cc: the.rest at world.net
+Subject: Test of Bounce
+Date: Wed, 9 Feb 2000 15:44:05 -0500
+Content-Something: something
+Content-Type: text/plain
+Content-Length: 53
+Lines: 2
+Content-Transfer-Encoding: 8bit
+Received: by me
+Resent-Date: Fri, 7 Dec 2001 15:44:05 -0100
+Resent-From: I was between
+Resent-To: new at receivers.world
+Resent-Message-ID: <simple>
+
+First line of orig message.
+Another line of message.
+EXPECTED

Added: packages/libmail-box-perl/branches/upstream/current/tests/50message/40forwsubj.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/50message/40forwsubj.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/50message/40forwsubj.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,22 @@
+#!/usr/bin/perl -T
+#
+# Test the creation of forward subjects
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 7;
+
+use Mail::Message::Construct::Forward;
+
+is(Mail::Message->forwardSubject('subject'), 'Forw: subject');
+is(Mail::Message->forwardSubject('Re: subject'), 'Forw: Re: subject');
+is(Mail::Message->forwardSubject('Re[2]: subject'), 'Forw: Re[2]: subject');
+is(Mail::Message->forwardSubject('subject (forw)'), 'Forw: subject (forw)');
+is(Mail::Message->forwardSubject('subject (Re)'), 'Forw: subject (Re)');
+is(Mail::Message->forwardSubject(undef), 'Forwarded');
+is(Mail::Message->forwardSubject(''), 'Forwarded');

Added: packages/libmail-box-perl/branches/upstream/current/tests/50message/41forward.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/50message/41forward.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/50message/41forward.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,312 @@
+#!/usr/bin/perl -T
+#
+# Test the creation of forwarded messages
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 24;
+use Mail::Address;
+
+use Mail::Message;
+use Mail::Message::Head;
+use Mail::Message::Body::Lines;
+use Mail::Message::Construct::Forward;
+
+#
+# First produce a message to forward to.
+#
+
+my $head = Mail::Message::Head->build
+ ( To   => 'me at example.com (Me the receiver)'
+ , From => 'him at somewhere.else.nl (Original Sender)'
+ , Cc   => 'the.rest at world.net'
+ , Subject => 'Test of forward'
+ , Date => 'Wed, 9 Feb 2000 15:44:05 -0500'
+ , 'Content-Something' => 'something'
+ );
+
+my ($text, $sig) = (<<'TEXT', <<'SIG');
+First line of orig message.
+Another line of message.
+TEXT
+--
+And this is the signature
+which
+has
+a
+few lines
+too
+SIG
+
+my @lines = split /^/, $text.$sig;
+my $body = Mail::Message::Body::Lines->new
+  ( mime_type => 'text/plain'
+  , data      => \@lines
+  );
+
+ok(defined $body);
+
+my $msg  = Mail::Message->new(head => $head);
+$msg->body($body);
+
+ok(defined $msg);
+
+#
+# Create a simple forward
+#
+
+my $forward = $msg->forward
+  ( strip_signature => undef
+  , prelude         => undef
+  , postlude        => undef
+  , quote           => undef
+  , To              => 'dest at example.com (New someone)'
+  );
+
+ok(defined $forward,                     'created simple forward');
+isa_ok($forward, 'Mail::Message');
+my @f = $forward->body->string;
+my @g = $msg->body->string;
+is(@f, @g);
+#$forward->print(\*STDERR);
+
+#
+# Create a real forward, which defaults to INLINE
+#
+
+my $dest = 'dest at test.org (Destination)';
+$forward = $msg->forward
+  ( quote    => '] '
+  , To       => $dest
+  );
+
+ok($forward->body!=$msg->body);
+is(  $forward->head->get('to'), $dest);
+is($forward->head->get('from'), $msg->head->get('to'));
+ok(! defined $forward->head->get('cc'));
+
+#$forward->print;
+is($forward->body->string, <<'EXPECT');
+---- BEGIN forwarded message
+From: him at somewhere.else.nl (Original Sender)
+To: me at example.com (Me the receiver)
+Cc: the.rest at world.net
+Date: Wed, 9 Feb 2000 15:44:05 -0500
+
+] First line of orig message.
+] Another line of message.
+---- END forwarded message
+EXPECT
+
+#
+# Complicated forward
+#
+
+my $postlude = Mail::Message::Body::Lines->new
+  ( data => [ "added to the end\n", "two lines\n" ]
+  );
+
+$forward = $msg->forward
+  ( group_forward => 0
+  , quote       => sub {chomp; "> ".reverse."\n"}
+  , prelude     => "From me!\n"
+  , postlude    => $postlude
+  , Cc          => 'xyz'
+  , Bcc         => Mail::Address->new('username', 'user at example.com')
+  , To          => $dest
+  );
+
+is(  $forward->head->get('to'), $dest);
+is($forward->head->get('from'), $msg->head->get('to'));
+is($forward->head->get('cc'), 'xyz');
+ok(!defined $forward->head->get('skip'));
+is($forward->head->get('bcc'), 'username <user at example.com>');
+
+#$forward->print;
+is($forward->body->string, <<'EXPECT');
+From me!
+> .egassem giro fo enil tsriF
+> .egassem fo enil rehtonA
+added to the end
+two lines
+EXPECT
+
+#
+# Try forwardAttach
+#
+
+$msg = Mail::Message->build(To => 'you',
+   'X-Loop' => 'yes', data => "greetings!\n");
+my $preamble = Mail::Message::Body->new(data => "just checking\n");
+my $fwd = $msg->forwardAttach(preamble => $preamble, To => 'us');
+
+ok(defined $fwd,                        "create forwardAttach");
+is(reproducable_text($fwd->string), <<ATTACH);
+From: you
+To: us
+Subject: Forwarded
+References: <removed>
+Content-Type: multipart/mixed; boundary="boundary-<removed>"
+Content-Length: <removed>
+Lines: 17
+Message-Id: <removed>
+Date: <removed>
+MIME-Version: 1.0
+
+--boundary-<removed>
+Content-Type: text/plain
+Content-Length: <removed>
+Lines: 1
+Content-Transfer-Encoding: 8bit
+
+just checking
+--boundary-<removed>
+Content-Type: text/plain
+Content-Length: <removed>
+Lines: 1
+Content-Transfer-Encoding: 8bit
+
+greetings!
+--boundary-<removed>--
+ATTACH
+
+#
+# Try forwardEncapsulate
+#
+
+my $fwd2 = $msg->forwardEncapsulate(preamble => $preamble, To => 'us');
+ok(defined $fwd2,                        "create forwardEncapsulate");
+is(reproducable_text($fwd2->string), <<ENCAPS);
+From: you
+To: us
+Subject: Forwarded
+References: <removed>
+Content-Type: multipart/mixed; boundary="boundary-<removed>"
+Content-Length: <removed>
+Lines: 26
+Message-Id: <removed>
+Date: <removed>
+MIME-Version: 1.0
+
+--boundary-<removed>
+Content-Type: text/plain
+Content-Length: <removed>
+Lines: 1
+Content-Transfer-Encoding: 8bit
+
+just checking
+--boundary-<removed>
+Content-Type: message/rfc822
+Content-Length: <removed>
+Lines: 11
+
+To: you
+X-Loop: yes
+Message-Id: <removed>
+Date: <removed>
+MIME-Version: 1.0
+Content-Type: text/plain
+Content-Length: <removed>
+Lines: 1
+Content-Transfer-Encoding: 8bit
+
+greetings!
+--boundary-<removed>--
+ENCAPS
+
+#
+# Try complex attach
+#
+
+my $one = Mail::Message::Body->new(data => "this is the first\n");
+my $two = Mail::Message::Body->new(data => "this is the second\n",
+   mime_type => 'application/pgp-signature');
+my $multi = Mail::Message::Body::Multipart->new(parts => [ $one, $two ]);
+$msg    = Mail::Message->buildFromBody($multi, To => 'you');
+ok(defined $msg,                    'created complex multipart');
+my $fwd3 = $msg->forwardAttach(preamble => $preamble, To => 'us');
+
+is(reproducable_text($fwd3->string), <<ATTACH);
+From: you
+To: us
+Subject: Forwarded
+References: <removed>
+Content-Type: multipart/mixed; boundary="boundary-<removed>"
+Content-Length: <removed>
+Lines: 17
+Message-Id: <removed>
+Date: <removed>
+MIME-Version: 1.0
+
+--boundary-<removed>
+Content-Type: text/plain
+Content-Length: <removed>
+Lines: 1
+Content-Transfer-Encoding: 8bit
+
+just checking
+--boundary-<removed>
+Content-Type: text/plain
+Content-Length: <removed>
+Lines: 1
+Content-Transfer-Encoding: 8bit
+
+this is the first
+--boundary-<removed>--
+ATTACH
+
+#
+# Binary message used with inline, which becomes an attach
+#
+
+$body = Mail::Message::Body->new
+ ( mime_type => 'application/octet-stream'
+ , data => [ "line 1\n", "line2\n" ] 
+ );
+ok($body->isBinary);
+
+$msg     = Mail::Message->buildFromBody($body, To => 'you');
+#$msg->print(\*STDERR);
+
+my $fwd4 = $msg->forwardInline
+ ( prelude  => "Prelude\n"
+ , postlude => "Postlude\n"
+#, is_attached => "My own text\n"
+ , To       => 'everyone'
+ );
+
+#$fwd4->print(\*STDERR);
+is(reproducable_text($fwd4->string), <<'EXPECTED');
+From: you
+To: everyone
+Subject: Forwarded
+References: <removed>
+Content-Type: multipart/mixed; boundary="boundary-<removed>"
+Content-Length: <removed>
+Lines: 18
+Message-Id: <removed>
+Date: <removed>
+MIME-Version: 1.0
+
+--boundary-<removed>
+Content-Type: text/plain
+Content-Length: <removed>
+Lines: 3
+
+Prelude
+[The forwarded message is attached]
+Postlude
+--boundary-<removed>
+Content-Type: application/octet-stream
+Content-Length: <removed>
+Lines: 1
+Content-Transfer-Encoding: base64
+
+bGluZSAxCmxpbmUyCg==
+--boundary-<removed>--
+EXPECTED

Added: packages/libmail-box-perl/branches/upstream/current/tests/50message/50rebuild.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/50message/50rebuild.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/50message/50rebuild.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,232 @@
+#!/usr/bin/perl -T
+#
+# Test rebuilding existing messages
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More;
+
+use Mail::Message;
+use Mail::Message::Construct::Rebuild;
+
+my $has_htmlFormatText;
+
+BEGIN {
+   eval "require Mail::Message::Convert::HtmlFormatText";
+   $has_htmlFormatText = not $@;
+   plan tests => 52 + ($has_htmlFormatText ? 6 : 1);
+}
+
+#
+# First, produce a single level multipart message to rebuild
+#
+
+my $message = Mail::Message->build
+ ( To      => 'me at example.com (Me the receiver)'
+ , From    => 'him at somewhere.else.nl (Original Sender)'
+ , Subject => 'Test of rebuild'
+ , Date    => 'Wed, 9 Feb 2000 15:44:05 -0500'
+
+ , data     => "part 1\n"
+ , data     => "part 2\n"
+ );
+
+ok(defined $message,             "build success");
+ok($message->isMultipart,        "have a multipart");
+cmp_ok($message->parts, '==', 2, "have two parts");
+
+#
+# Test the deletion of parts in a 1 level multipart
+#
+
+my $rebuild = $message->rebuild;
+ok(defined $rebuild,             "rebuild success");
+ok($rebuild==$message,           "message unchanged");
+
+my $part = $message->body->part(0);
+$part->delete;
+ok($part->isDeleted,             "delete first part");
+
+# test to keep level with one multipart
+
+$rebuild = $message->rebuild(
+  rules => [ qw/removeDeletedParts descendMultiparts/ ]);
+
+ok(defined $rebuild,             "rebuild success");
+ok($rebuild!=$message,           "message has changed");
+ok($rebuild->isMultipart,        "still has a multipart");
+cmp_ok($rebuild->body->parts, '==', 1, "has only one part left");
+cmp_ok($message->body->parts, '==', 2, "original still has two parts");
+is($rebuild->body->mimeType, 'multipart/mixed');
+
+# test remove multipart level when only one is left
+
+$rebuild = $message->rebuild
+ ( extraRules => [ qw/removeDeletedParts removeEmptyMultiparts/ ]
+ );
+ok(defined $rebuild,             "rebuild success");
+ok($rebuild!=$message,           "message has changed");
+ok(! $rebuild->isMultipart,      "multipart level removed");
+cmp_ok($message->body->parts, '==', 2, "original still has two parts");
+is($rebuild->body->string, "part 2\n",   "text found");
+is($rebuild->body->mimeType, 'text/plain');
+
+# test remove all parts, which will remove level
+
+$part = $message->body->part(1);
+$part->delete;
+ok($part->isDeleted,             "delete second part as well");
+$rebuild = $message->rebuild
+ ( extraRules => [ qw/removeDeletedParts removeEmptyMultiparts/ ]
+ );
+ok(! defined $rebuild,           "rebuild nothing left");
+
+#
+# Now, we play around with a nested message
+#
+
+$message->body->part(0)->deleted(0);
+$message->body->part(1)->deleted(0);
+
+my $nested = Mail::Message::Body::Nested->new
+ ( nested  => $message );
+
+my $message2 = Mail::Message->buildFromBody
+ ( $nested
+ , To      => 'me at example.com (Me the receiver)'
+ , From    => 'him at somewhere.else.nl (Original Sender)'
+ , Subject => 'Test of rebuild'
+ , Date    => 'Wed, 9 Feb 2000 15:44:05 -0500'
+ );
+
+ok(defined $message2,            "succesfully build the message2");
+ok($message2->isNested,          "succesfully build the nested message2");
+ok($message2->body->nested->isMultipart, "a multipart within the nested");
+
+$rebuild = $message2->rebuild
+ ( extraRules => [ qw/removeDeletedParts removeEmptyMultiparts/ ]
+ );
+ok($rebuild==$message2,          "message2 unchanged");
+
+# only remove the wrapper
+$rebuild = $message2->rebuild( extraRules => [ 'flattenNesting' ] );
+ok(defined $rebuild,             "rebuilding message2 success");
+ok($rebuild!=$message2,          "message has changed");
+ok($rebuild->isMultipart,        "wrapper removed, multipart visible");
+cmp_ok($rebuild->parts, '==', 2, "both parts are present");
+
+# remove one part of the multipart, leaving everything else unchanged
+
+$message2->body->nested->body->part(0)->delete;
+$rebuild = $message2->rebuild
+ ( rules => [ qw/removeDeletedParts descendMultiparts descendNested/ ]
+ );
+
+ok(defined $rebuild,             "rebuilding from message2 success");
+ok($rebuild!=$message2,          "message has changed");
+isa_ok($rebuild->body, 'Mail::Message::Body::Nested');
+ok($rebuild->body->nested->isMultipart, "still has a multipart");
+cmp_ok($rebuild->body->nested->body->parts, '==', 1, "has only one part left");
+cmp_ok($message2->body->nested->body->parts, '==', 2, "original still has two parts");
+
+# have the multipart level to disappear
+
+$rebuild = $message2->rebuild
+ ( extraRules => [ qw/removeDeletedParts removeEmptyMultiparts
+                      flattenMultiparts/ ]
+ );
+ok(defined $rebuild,           "rebuilding message2 without multipart success");
+ok($rebuild!=$message2,        "message has changed");
+isa_ok($rebuild->body, 'Mail::Message::Body::Nested');
+ok(! $rebuild->body->nested->isMultipart, "multipart removed");
+cmp_ok($message2->body->nested->body->parts, '==', 2, "original still has two parts");
+is($rebuild->body->nested->body->string, "part 2\n", "text found in message2");
+
+# Now delete the second multipart thing as welll.
+
+$message2->body->nested->body->part(1)->delete;
+$rebuild = $message2->rebuild
+ ( extraRules => [ qw/removeDeletedParts removeEmptyMultiparts
+                      flattenMultiparts/ ]
+ );
+ok(!defined $rebuild,          "whole structure collapsed");
+
+#
+# More complex rules
+# Create an text/plain -- text/html multipart/alternative
+# and then automatically remove the html alternative.
+
+my $alttext = Mail::Message::Body->new(data => "text version\n");
+
+my $althtml = Mail::Message::Body->new
+ ( mime_type => 'text/html'
+ , data      => "<html>html version</html>\n"
+ );
+
+my $altmp   = Mail::Message::Body::Multipart->new
+ ( mime_type => 'multipart/alternative'
+ , parts     => [ $althtml, $alttext ]
+ );
+
+my $alt = Mail::Message->buildFromBody($altmp, To => 'you');
+ok(defined $alt,                 "Succesfully created an alternative");
+
+$rebuild = $alt->rebuild;
+ok($rebuild==$alt,               "No rule matches by default");
+$rebuild = $alt->rebuild
+ ( rules => [ qw/removeHtmlAlternativeToText descendMultiparts/ ] );
+ok($rebuild!=$alt,               "alt must change");
+ok($rebuild->isMultipart,        "alt still a multipart");
+cmp_ok($rebuild->body->parts, '==', 1,"only one alternative left");
+is($rebuild->body->part(0)->body->mimeType, 'text/plain'
+                                 , "only text alternative survived");
+
+# now include multipart flattening
+
+$rebuild = $alt->rebuild
+ ( rules => [ qw/removeHtmlAlternativeToText descendMultiparts
+                 flattenMultiparts/ ] );
+ok($rebuild!=$alt,               "flattened alt must change");
+ok(!$rebuild->isMultipart,       "alt is not a multipart anymore");
+is($rebuild->body->mimeType,'text/plain', "text body");
+
+#
+# Create an html message, and have this translated into a
+# multipart with text alternative.
+#
+
+my $html = Mail::Message::Body->new(mime_type => 'text/html', data => <<HTML);
+<html>
+<h1>Hi there</h1>
+
+<p>this is it</p>
+</html>
+HTML
+
+$message = Mail::Message->buildFromBody($html, To => 'you', Subject => 'hi!');
+ok(defined $message,                  "created html message");
+
+$rebuild = $message->rebuild( rules => [ qw/textAlternativeForHtml/ ] );
+
+# even if htmlFromText does not work, something must be returned
+ok(defined $rebuild,                  "rebuild with html->text succesful");
+
+if($has_htmlFormatText)
+{   ok($rebuild!=$message,            "rebuild has changed it");
+    ok($rebuild->isMultipart,         "Changed into multipart");
+    my @parts = $rebuild->parts;
+    is($parts[0]->body->mimeType, 'text/plain', "Found plain text");
+    is($parts[1]->body->mimeType, 'text/html',  "Found html");
+
+    is($rebuild->subject, 'hi!',       "Subject to main message");
+    ok(! $parts[1]->get('subject'),    "removed subject from html");
+}
+else
+{   ok($rebuild==$message,            "rebuild has not changed it");
+}
+

Added: packages/libmail-box-perl/branches/upstream/current/tests/50message/58clone.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/50message/58clone.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/50message/58clone.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,67 @@
+#!/usr/bin/perl -T
+#
+# Test cloning messages
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 5;
+use IO::Scalar;
+use Mail::Address;
+
+use Mail::Message;
+use Mail::Message::Construct;
+use Mail::Message::Body::Lines;
+use Mail::Message::Body::Multipart;
+use Mail::Message::Body::Nested;
+
+my $p1 = Mail::Message::Body::Lines->new
+ ( data      => [ "line of text in part 1" ]
+ , mime_type => 'text/plain'
+ );
+
+my $p2 = Mail::Message::Body::Lines->new
+ ( data      => [ "line of html in part 2" ]
+ , mime_type => 'text/html'
+ );
+
+my $p3 = Mail::Message::Body::Lines->new
+ ( data      => [ "I know this is not postscript" ]
+ , mime_type => 'application/postscript'
+ );
+
+my $p4 = Mail::Message::Body::Nested->new
+ ( nested => $p3
+ );
+
+my $mp = Mail::Message::Body::Multipart->new
+ ( parts => [ $p1, $p2, $p4 ]
+ );
+
+my $msg = Mail::Message->buildFromBody
+ ( $mp
+ , To   => 'you at home.com'
+ , From => 'me at perl.org'
+ );
+
+my $msg2 = $msg->clone;
+ok($msg2);
+cmp_ok($msg2->parts , "==",  3);
+ok($mp->part(-1)->body->isNested);
+
+my $orig_text  = '';
+my $orig       = IO::Scalar->new(\$orig_text);
+$msg->print($orig);
+$orig->close;
+
+my $clone_text = '';
+my $clone      = IO::Scalar->new(\$clone_text);
+$msg2->print($clone);
+$clone->close;
+
+ok(length $orig_text);
+is($orig_text, $clone_text);

Added: packages/libmail-box-perl/branches/upstream/current/tests/50message/60destruct.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/50message/60destruct.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/50message/60destruct.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,72 @@
+#!/usr/bin/perl -T
+#
+# Test destruction of (folder) messages
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 58;
+
+use Mail::Box::Mbox;
+
+my @src = (folder => "=$fn", folderdir => 'folders');
+
+#
+# Destruct folder messages
+#
+
+my $folder = Mail::Box::Mbox->new
+  ( @src
+  , lock_type    => 'NONE'
+  );
+
+ok(defined $folder,                   'check success open folder');
+exit 1 unless defined $folder;
+
+my ($delayed, $read) = (0,0);
+foreach my $msg ($folder->messages)
+{  $msg->isDelayed ? $delayed++ : $read++;
+}
+
+ok($delayed,                          'some messages are delayed');
+ok($read,                             'some messages are fully read');
+
+foreach my $msg ($folder->messages)
+{  $msg->destruct;
+   isa_ok($msg, 'Mail::Box::Message::Destructed', "msg ".$msg->seqnr);
+}
+
+isa_ok($folder->message(0), 'Mail::Box::Message::Destructed', 'first');
+
+# some things still work
+my $msg0 = $folder->message(0);
+ok(!$msg0->isDeleted,  'destructed is not deleted');
+ok($msg0->delete,      'delete is allowed');
+ok($msg0->messageId, 'has message id');
+
+$folder->close(write => 'NEVER');
+
+#
+# Destruct Mail::Message
+#
+
+my $msg = Mail::Message->read( <<MSG );
+Subject: hi!
+
+body
+MSG
+
+ok(defined $msg,                 'constructed a Mail::Message');
+is($msg->get('Subject'), "hi!",  'check headers read');
+is($msg->body->string, "body\n", 'check body read');
+my $alias = $msg;
+
+$msg->destruct;
+ok(!defined $msg,                'destruct removes link');
+ok(defined $alias->body,         'body still exists');
+$alias->destruct;
+ok(!defined $alias,              'destruct removes link');

Added: packages/libmail-box-perl/branches/upstream/current/tests/50message/Definition.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/50message/Definition.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/50message/Definition.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,8 @@
+
+package MailBox::Test::50message::Definition;
+
+sub name     {"Mail::Message::Construct; message construction"}
+sub critical {1}
+sub skip     { undef }
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/tests/51folder/10copyto.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/51folder/10copyto.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/51folder/10copyto.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,112 @@
+#!/usr/bin/perl -T
+#
+# Test folder-to-folder copy
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 28;
+use File::Copy;
+use IO::Scalar;
+
+use Mail::Box::Manager;
+
+copy $src, $cpy or die "Copy failed";
+
+#
+# Build a complex system with MH folders and sub-folders.
+#
+
+my $mgr    = Mail::Box::Manager->new;
+
+my $folder = $mgr->open($cpy, lock_type => 'NONE');
+ok(defined $folder);
+
+unlink qw/a b c d e/;
+
+my $A = $mgr->open('a', type => 'mh', create => 1, access => 'w'
+  , lock_type => 'NONE');
+ok(defined $A);
+
+$mgr->copyMessage($A, $folder->message($_)) for 0..9;
+
+my $b = $A->openSubFolder('b', create => 1, access => 'w');
+ok(defined $b);
+$mgr->copyMessage($b, $folder->message($_)) for 10..19;
+cmp_ok($b->messages, "==", 10);
+$b->close;
+
+my $c = $A->openSubFolder('c', create => 1, access => 'w');
+ok(defined $c);
+$mgr->copyMessage($c, $folder->message($_)) for 20..29;
+
+my $d = $c->openSubFolder('d', create => 1, access => 'w');
+ok(defined $c);
+$mgr->copyMessage($d, $folder->message($_)) for 30..39;
+
+$d->close;
+$c->close;
+$A->close;
+
+$folder->close;
+cmp_ok($mgr->openFolders , "==",  0, 'all folders closed');
+
+#
+# Convert the built MH structure into MBOX
+#
+
+$A = $mgr->open('a', access => 'rw', lock_type => 'NONE');
+ok($A);
+
+my @sub = sort $A->listSubFolders;
+cmp_ok(@sub, "==", 2,                      "a has two subfolders");
+is($sub[0], 'b',                           "   named b");
+is($sub[1], 'c',                           "   and c");
+
+my $e = $mgr->open('e', type => 'mbox', create => 1, access => 'rw',
+   lock_type => 'NONE');
+cmp_ok($A->messages, "==", 10,              "e has 10 messages");
+
+$A->message($_)->delete for 3,4,8;
+ok(defined $A->copyTo($e, select => 'ALL', subfolders => 0));
+cmp_ok($e->messages, "==", 10);
+$e->delete;
+
+$e = $mgr->open('e', type => 'mbox', create => 1, access => 'rw',
+   lock_type => 'NONE');
+ok(defined $A->copyTo($e, select => 'DELETED', subfolders => 0));
+cmp_ok($e->messages, "==", 3);
+$e->delete;
+
+$e = $mgr->open('e', type => 'mbox', create => 1, access => 'rw',
+   lock_type => 'NONE');
+ok(defined $A->copyTo($e, select => 'ACTIVE', subfolders => 'FLATTEN'));
+cmp_ok($e->messages, "==", 37);
+$e->delete;
+
+$e = $mgr->open('e', type => 'mbox', create => 1, access => 'rw',
+   lock_type => 'NONE');
+ok(defined $e,                          "e is opened again");
+
+ok(defined $A->copyTo($e, select => 'ACTIVE', subfolders => 'RECURSE'),
+                                        "copyTo reports success");
+cmp_ok($e->messages, "==", 7,           "e contains 7 messages");
+
+my @subs = sort $e->listSubFolders;
+cmp_ok(@subs, "==", 2,                  "e still has two subfolders");
+is($subs[0], 'b',                       "   named b");
+is($subs[1], 'c',                       "   and c");
+
+$b = $e->openSubFolder('b');
+ok(defined $b,                          "opened subfolder b of e");
+isa_ok($b, 'Mail::Box::Mbox',           "   which is a MBOX");
+cmp_ok($b->messages , "==",  10,        "   and contains 10 messages");
+
+ok($b->close,                           "b is closed");                         
+
+$e->delete;
+$A->delete;

Added: packages/libmail-box-perl/branches/upstream/current/tests/51folder/20tieary.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/51folder/20tieary.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/51folder/20tieary.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,59 @@
+#!/usr/bin/perl -T
+#
+# Test access to folders using ties.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 13;
+
+use Mail::Box::Mbox;
+use Mail::Box::Tie::ARRAY;
+use Mail::Message::Construct;
+
+#
+# The folder is read.
+#
+
+my $folder = new Mail::Box::Mbox
+  ( folder    => $src
+  , folderdir => 't'
+  , lock_type => 'NONE'
+  , extract   => 'ALWAYS'
+  , access    => 'rw'
+  );
+
+ok(defined $folder);
+cmp_ok($folder->messages, "==", 45);
+
+tie my(@folder), 'Mail::Box::Tie::ARRAY', $folder;
+cmp_ok(@folder , "==",  45);
+
+is($folder->message(4), $folder[4]);
+
+ok(! $folder->message(2)->deleted);
+$folder[2]->delete;
+ok($folder->message(2)->deleted);
+cmp_ok(@folder , "==",  45);
+
+ok(! $folder->message(3)->deleted);
+my $d3 = delete $folder[3];
+ok(defined $d3);
+ok($folder->message(3)->deleted);
+
+# Double messages will not be added.
+push @folder, $folder[1]->clone;
+cmp_ok(@folder , "==",  45);
+
+# Different message, however, will be added.
+push @folder, Mail::Message->build(data => []);
+
+cmp_ok($folder->messages , "==",  46);
+cmp_ok(@folder , "==",  46);
+
+$folder->close(write => 'NEVER');
+exit 0;

Added: packages/libmail-box-perl/branches/upstream/current/tests/51folder/21tiehash.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/51folder/21tiehash.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/51folder/21tiehash.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,66 @@
+#!/usr/bin/perl -T
+
+#
+# Test access to folders using ties on hashes.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 101;
+
+use Mail::Box::Mbox;
+use Mail::Box::Tie::HASH;
+use Mail::Message::Construct;
+
+#
+# The folder is read.
+#
+
+my $folder = new Mail::Box::Mbox
+  ( folder    => $src
+  , folderdir => 't'
+  , lock_type => 'NONE'
+  , extract   => 'ALWAYS'
+  , access    => 'rw'
+  );
+
+ok(defined $folder);
+
+tie my(%folder), 'Mail::Box::Tie::HASH', $folder;
+cmp_ok(keys %folder , "==",  45);
+ok(! defined $folder{not_existing});
+
+my @keys = keys %folder;
+foreach (@keys)
+{   ok(defined $folder{$_});
+    my $msg = $folder{$_};
+    is($folder{$_}->messageID, $_);
+}
+
+my $msg   = $folder->message(4);
+my $msgid = $msg->messageID;
+is($msg, $folder{$msgid});
+
+# delete $folder[2];    works for 5.6, but not for 5.5
+ok(!$folder->message(4)->deleted);
+cmp_ok(keys %folder , "==",  45);
+$folder{$msgid}->delete;
+ok($folder->message(4)->deleted);
+cmp_ok(keys %folder , "==",  44);
+
+# Double messages will not be added.
+$folder{ (undef) } = $folder{$msgid}->clone;
+cmp_ok(keys %folder , "==",  44);
+
+# Different message, however, will be added.
+my $newmsg = Mail::Message->build(data => [ 'empty' ]);
+$folder{undef} = $newmsg;
+cmp_ok($folder->messages , "==",  46);
+cmp_ok(keys %folder , "==",  45);
+
+$folder->close(write => 'NEVER');
+exit 0;

Added: packages/libmail-box-perl/branches/upstream/current/tests/51folder/Definition.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/51folder/Definition.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/51folder/Definition.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,8 @@
+
+package MailBox::Test::51folder::Definition;
+
+sub name     {"Mail::Box; general folder handling"}
+sub critical {0}
+sub skip     { undef }
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/tests/52manager/10open.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/52manager/10open.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/52manager/10open.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,81 @@
+#!/usr/bin/perl -T
+#
+# Test the folder manager
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 14;
+use File::Spec;
+
+use Mail::Box::Manager;
+
+my $new  = File::Spec->catfile('folders', 'create');
+unlink $new;
+
+my $manager = Mail::Box::Manager->new
+ ( log      => 'NOTICES'
+ , trace    => 'ERRORS'
+ );
+
+my $folder  = $manager->open
+  ( folder    => $src
+  , lock_type => 'NONE'
+  , extract   => 'LAZY'
+  );
+
+ok(defined $folder,                              'open folder');
+isa_ok($folder, 'Mail::Box::Mbox');
+
+my $second = $manager->open
+ ( folder       => $src
+ , lock_type    => 'NONE'
+ );
+
+ok(!defined $second,                             'open same folder fails');
+my @warnings = $manager->report('WARNINGS');
+cmp_ok(@warnings, "==", 1,                       'mgr noticed double');
+
+$warnings[-1] =~ s#\\mbox\.win#/mbox.src#g;  # Windows
+
+is($warnings[-1], "Folder folders/mbox.src is already open.\n");
+cmp_ok($manager->openFolders, "==", 1,           'only one folder open');
+
+undef $second;
+cmp_ok($manager->openFolders, "==", 1,           'second closed, still one open');
+
+my $n = $manager->open
+ ( folder       => $new
+ , folderdir    => 't'
+ , type         => 'mbox'
+ , lock_type    => 'NONE'
+ );
+ok(! -f $new,                                   'folder file does not exist');
+ok(! defined $n,                                'open non-ex does not succeed');
+
+ at warnings = $manager->report('WARNINGS');
+cmp_ok(@warnings, "==", 2,                      'new warning');
+$warnings[-1] =~ s#\\#/#g;  # Windows
+is($warnings[-1], "Folder does not exist, failed opening mbox folder folders/create.\n");
+
+$manager->log('WARNINGS');  # back to default reporting.
+$manager->trace('WARNINGS');
+
+my $p = $manager->open
+  ( folder       => $new
+  , lock_type    => 'NONE'
+  , type         => 'mbox'
+  , create       => 1
+  , access       => 'w'
+  );
+
+ok(defined $p,                                   'open non-existing with create');
+ok(-f $new,                                      'new folder created');
+ok(-z $new,                                      'new folder is empty');
+
+unlink $new;
+exit 0;

Added: packages/libmail-box-perl/branches/upstream/current/tests/52manager/11urlopen.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/52manager/11urlopen.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/52manager/11urlopen.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,134 @@
+#!/usr/bin/perl -T
+#
+# Test the url decoding for a folder name
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 16;
+use File::Spec;
+
+use Mail::Box::Manager;
+
+my $mgr = Mail::Box::Manager->new;
+
+$ENV{USER} = 'Jan';
+
+sub same(@$)
+{   my $expect = pop @_;
+    my $made   = { @_ };
+
+    unless(defined $made)
+    {   warn "Nothing produced.";
+        return 0;
+    }
+
+    foreach (keys %$made)
+    {   next if exists $expect->{$_};
+        warn "Key $_ made too much.";
+        return 0;
+    }
+
+#warn sort keys %$made;
+#warn sort keys %$expect;
+    foreach (keys %$expect)
+    {   next if exists $made->{$_};
+        warn "Key $_ expected too much.";
+        return 0;
+    }
+
+    foreach (keys %$made)
+    {   next if defined $made->{$_} && defined $expect->{$_}
+                &&  $made->{$_} eq $expect->{$_};
+
+        next if !defined $made->{$_} && !defined $expect->{$_};
+
+        warn "Key $_: ",(defined $made->{$_}   ? $made->{$_}   : '<undef>'),
+                 ";",   (defined $expect->{$_} ? $expect->{$_} : '<undef>');
+
+        return 0;
+    }
+
+    return 1;
+}
+
+ok(not defined $mgr->decodeFolderURL('x'));
+
+ok(same($mgr->decodeFolderURL('mbox:x'),
+    { type => 'mbox', username => 'Jan', password => ''
+    , server_name => 'localhost', server_port => undef, folder => 'x' }
+  ));
+
+ok(same($mgr->decodeFolderURL('mbox:/x/y'),
+    { type => 'mbox', username => 'Jan', password => ''
+    , server_name => 'localhost', server_port => undef, folder => '/x/y' }
+  ));
+
+ok(same($mgr->decodeFolderURL('pop3:///x/y'),
+    { type => 'pop3', username => 'Jan', password => ''
+    , server_name => 'localhost', server_port => undef, folder => '/x/y' }
+  ));
+
+ok(same($mgr->decodeFolderURL('pop3://'),
+    { type => 'pop3', username => 'Jan', password => ''
+    , server_name => 'localhost', server_port => undef, folder => '=' }
+  ));
+
+ok(same($mgr->decodeFolderURL('pop3://me:secret@host:42/y'),
+    { type => 'pop3', username => 'me', password => 'secret'
+    , server_name => 'host', server_port => 42, folder => '/y' }
+  ));
+
+ok(same($mgr->decodeFolderURL('pop3://me:secret@host/y'),
+    { type => 'pop3', username => 'me', password => 'secret'
+    , server_name => 'host', server_port => undef, folder => '/y' }
+  ));
+
+ok(same($mgr->decodeFolderURL('pop3://me:secret@:12/y'),
+    { type => 'pop3', username => 'me', password => 'secret'
+    , server_name => 'localhost', server_port => 12, folder => '/y' }
+  ));
+
+ok(same($mgr->decodeFolderURL('pop3://me:secret@/y'),
+    { type => 'pop3', username => 'me', password => 'secret'
+    , server_name => 'localhost', server_port => undef, folder => '/y' }
+  ));
+
+ok(same($mgr->decodeFolderURL('pop3://me@/y'),
+    { type => 'pop3', username => 'me', password => ''
+    , server_name => 'localhost', server_port => undef, folder => '/y' }
+  ));
+
+ok(same($mgr->decodeFolderURL('pop3://me@:42/y'),
+    { type => 'pop3', username => 'me', password => ''
+    , server_name => 'localhost', server_port => 42, folder => '/y' }
+  ));
+
+ok(same($mgr->decodeFolderURL('pop3://me@host/y'),
+    { type => 'pop3', username => 'me', password => ''
+    , server_name => 'host', server_port => undef, folder => '/y' }
+  ));
+
+ok(same($mgr->decodeFolderURL('pop3://tux.home.aq:42/y'),
+    { type => 'pop3', username => 'Jan', password => ''
+    , server_name => 'tux.home.aq', server_port => 42, folder => '/y' }
+  ));
+
+ok(same($mgr->decodeFolderURL('pop3://tux.home.aq/y'),
+    { type => 'pop3', username => 'Jan', password => ''
+    , server_name => 'tux.home.aq', server_port => undef, folder => '/y' }
+  ));
+
+ok(same($mgr->decodeFolderURL('pop3://tux.home.aq'),
+    { type => 'pop3', username => 'Jan', password => ''
+    , server_name => 'tux.home.aq', server_port => undef, folder => '=' }
+  ));
+
+ok(same($mgr->decodeFolderURL('pop3://me:secret@tux.home.aq'),
+    { type => 'pop3', username => 'me', password => 'secret'
+    , server_name => 'tux.home.aq', server_port => undef, folder => '=' }
+  ));

Added: packages/libmail-box-perl/branches/upstream/current/tests/52manager/Definition.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/52manager/Definition.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/52manager/Definition.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,8 @@
+
+package MailBox::Test::52manager::Definition;
+
+sub name     {"Mail::Box::Manager; library manager"}
+sub critical {1}
+sub skip     { undef }
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/tests/53threads/10single.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/53threads/10single.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/53threads/10single.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,16 @@
+#!/usr/bin/perl -T
+#
+# Test threads over multi-folders.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 1;
+
+#use Mail::Box::Manager;
+
+pass("   * Multi-folder threads status ALPHA (not tested)");

Added: packages/libmail-box-perl/branches/upstream/current/tests/53threads/Definition.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/53threads/Definition.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/53threads/Definition.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,8 @@
+
+package MailBox::Test::53threads::Definition;
+
+sub name     {"Mail::Box::Threads; message threads"}
+sub critical {0}
+sub skip     { undef }
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/tests/54search/10grep.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/54search/10grep.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/54search/10grep.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,337 @@
+#!/usr/bin/perl -T
+#
+# Test searching with grep
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 58;
+use IO::Scalar;
+use File::Copy;
+
+use Mail::Box::Manager;
+use Mail::Box::Search::Grep;
+
+copy $src, $cpy
+    or die "Cannot create test folder: $!\n";
+
+my $mgr    = Mail::Box::Manager->new;
+
+my $folder = $mgr->open($cpy, lock_type => 'NONE');
+ok(defined $folder,                             'open folder');
+cmp_ok($folder->messages , "==",  45,           'folder full of messages');
+
+#
+# Simple search in body
+#
+
+my $output= '';
+my $fh    = IO::Scalar->new(\$output)
+    or die "Cannot create an IO::Scalar: $!";
+
+my $oldfh = select $fh;
+
+my $grep1  = Mail::Box::Search::Grep->new
+ ( match   => 'However'
+ , in      => 'BODY'
+ , deliver => 'PRINT'
+ );
+
+$grep1->search($folder);
+$fh->close;
+select $oldfh;
+
+$output =~ s#\\#/#g;  # windows
+
+is($output, <<'EXPECTED',                       'search for However');
+folders/mbox.cpy, message 8: Resize with Transparency
+   21: However, ImageMagick (ImageMagick 4.2.7, PerlMagick 4.27 on Linux)
+folders/mbox.cpy, message 38: Re: core dump in simple ImageMagick example
+   38: However, it is only reproduceable when this statement is included in
+folders/mbox.cpy, message 41: Re: core dump in simple ImageMagick example
+    4: > However, it is only reproduceable when this statement is included in
+EXPECTED
+
+undef $grep1;
+
+#
+# search in head with limit
+#
+
+$output = '';
+$fh    = IO::Scalar->new(\$output) or die $!;
+select $fh;
+
+my $grep2  = Mail::Box::Search::Grep->new
+ ( match   => 'atcmpg'
+ , in      => 'HEAD'
+ , limit   => -4
+ , deliver => 'PRINT'
+ );
+
+my @m2 = $grep2->search($folder);
+$fh->close;
+select $oldfh;
+
+cmp_ok(@m2, "==", 4);
+
+my $last = shift @m2;
+foreach (@m2)
+{   ok($last->seqnr < $_->seqnr,                'messages ordered');
+    $last = $_;
+}
+
+# messages are reversed ordered here, but in order returned: looking
+# backwards in the folder file.
+
+$output =~ s#\\#/#g;  # windows
+
+is($output, <<'EXPECTED',                       'search result atcmp in head');
+folders/mbox.cpy, message 44: Font metrics
+  Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+  	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id TAA26427
+  	for <markov at ATComputing.nl>; Wed, 4 Oct 2000 19:56:00 +0200 (MET DST)
+folders/mbox.cpy, message 43: Core Dump on ReadImage
+  Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+  	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id WAA14913
+  	for <markov at ATComputing.nl>; Tue, 1 Aug 2000 22:37:13 +0200 (MET DST)
+folders/mbox.cpy, message 42: Re: Core Dump on ReadImage
+  Message-ID: <20000807113844.A22119 at atcmpg.ATComputing.nl>
+folders/mbox.cpy, message 41: Re: core dump in simple ImageMagick example
+  Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+  	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id NAA29434
+  	for <markov at ATComputing.nl>; Wed, 26 Jul 2000 13:46:33 +0200 (MET DST)
+  References: <397C6C6B.989E4BB2 at catchword.com> <20000726133231.G25170 at atcmpg.ATComputing.nl>
+EXPECTED
+
+undef $grep2;
+
+#
+# Test regexp search
+#
+
+my @hits;
+my $grep3  = Mail::Box::Search::Grep->new
+ ( match   => qr/ImageMagick/
+ , in      => 'MESSAGE'
+ , deliver => \@hits
+ );
+
+my @m3 = $grep3->search($folder);
+cmp_ok(@m3, "==", 24,                           'messages with ImageMagick');
+cmp_ok(@hits, "==", 60,                         'hits on ImageMagick');
+
+$last = shift @m3;
+my %m3 = ($last->seqnr => 1);
+foreach (@m3)   # in order?
+{   ok($last->seqnr < $_->seqnr,                'messages ordered');
+    $m3{$_->seqnr}++;
+    $last = $_;
+}
+cmp_ok(keys %m3, "==", 24,                      'returned message unique');
+
+my %h3 = map { ($_->{message}->seqnr => 1) } @hits;
+cmp_ok(keys %h3, "==", 24,                      'returned hits in the messages');
+
+undef $grep3;
+
+#
+# Test regexp search with case-ignore
+#
+
+ at hits = ();
+my $grep4  = Mail::Box::Search::Grep->new
+ ( match   => qr/ImageMagick/i
+ , in      => 'MESSAGE'
+ , deliver => \@hits
+ );
+
+my @m4 = $grep4->search($folder);
+cmp_ok(@m4, "==", 28,                           'messages with /ImageMagick/i');
+cmp_ok(@hits, "==", 102,                        'hits with /ImageMagick/i');
+
+undef $grep4;
+
+#
+# Test regexp search with case-ignore and some deleted messages
+#
+
+ at hits = ();
+$folder->message($_)->delete(1) for 3, 6, 8, 9, 11, 13, 23, 33;
+
+my $grep5  = Mail::Box::Search::Grep->new
+ ( match   => qr/ImageMagick/i
+ , in      => 'MESSAGE'
+ , deliver => \@hits
+ );
+
+my @m5 = $grep5->search($folder);
+cmp_ok(@m5, "==", 22,                           'msgs, search excludes deleted');
+cmp_ok(@hits, "==", 89,                         'hits, search excludes deleted');
+
+undef $grep5;
+
+# Include-deleted
+
+ at hits = ();
+my $grep6  = Mail::Box::Search::Grep->new
+ ( match   => qr/ImageMagick/i
+ , in      => 'MESSAGE'
+ , deleted => 1
+ , deliver => \@hits
+ );
+
+my @m6 = $grep6->search($folder);
+cmp_ok(@m6, "==", 28,                           'msgs, search includes deleted');
+cmp_ok(@hits, "==", 102,                        'hits, search includes deleted');
+
+undef $grep6;
+
+# only in header
+
+ at hits = ();
+my $grep7  = Mail::Box::Search::Grep->new
+ ( match   => qr/ImageMagick/i
+ , in      => 'HEAD'
+ , deliver => \@hits
+ );
+
+my @m7 = $grep7->search($folder);
+cmp_ok(@m7, "==", 11,                            'msgs, /ImageMagick/i in head');
+cmp_ok(@hits, "==", 27,                          'hits, /ImageMagick/i in head');
+
+undef $grep7;
+
+# only in body
+
+ at hits = ();
+my $grep8  = Mail::Box::Search::Grep->new
+ ( match   => qr/ImageMagick/i
+ , in      => 'BODY'
+ , deliver => \@hits
+ );
+
+my @m8 = $grep8->search($folder);
+cmp_ok(@m8, "==", 20,                            'msgs, /ImageMagick/i in body');
+cmp_ok(@hits, "==", 62,                          'hits, /ImageMagick/i in body');
+
+cmp_ok($grep8->search($folder), "==", 20,        'search returns msgs in scalar');
+
+undef $grep8;
+
+# only test for match: stops at first hit
+
+my $grep9  = Mail::Box::Search::Grep->new
+ ( match   => qr/ImageMagick/i
+ , in      => 'BODY'
+ );
+
+cmp_ok($grep9->search($folder), "==", 1,         'no deliver, then only find one');
+
+undef $grep9;
+
+#
+# Search in thread
+#
+
+undef $output;
+$fh   = IO::Scalar->new(\$output) or die $!;
+select $fh;
+
+my $grep10  = Mail::Box::Search::Grep->new
+ ( match   => 'ImageMagick'
+ , in      => 'BODY'
+ , deliver => 'PRINT'
+ );
+
+my $t     = $mgr->threads($folder);
+my $start = $t->threadStart($folder->message(25));  #isa multipart
+my @msgs  = $start->threadMessages;
+
+cmp_ok(@msgs, "==", 2,                           'messages in thread');
+ok($grep10->search($start),                      'found in thread');
+
+$output =~ s#\\#/#g;  # windows
+
+is($output, <<'EXPECTED',                        'result search in thread');
+folders/mbox.cpy, message 26: Re: your mail
+   13: Are you using ImageMagick 5.2.0?  When I used the script I sent the
+folders/mbox.cpy, message 25: Re: your mail
+p  19: > Are you using ImageMagick 5.2.0?  When I used the script I sent the
+EXPECTED
+
+my @m10 = $grep10->search(\@msgs);
+cmp_ok(@m10, "==", 2,                            'messages found in list');
+cmp_ok($m10[0], "==", $msgs[0]);
+cmp_ok($m10[1], "==", $msgs[1]);
+
+$fh->close;
+select $oldfh;
+
+undef $grep10;
+
+# Without multipart
+
+undef $output;
+$fh   = IO::Scalar->new(\$output) or die $!;
+select $fh;
+
+my $grep11  = Mail::Box::Search::Grep->new
+ ( match      => 'ImageMagick'
+ , in         => 'BODY'
+ , deliver    => 'PRINT'
+ , multiparts => 0
+ );
+
+my @m11 = $grep11->search($start);
+cmp_ok(@m11, "==", 1,                            'do not search multiparts');
+
+$fh->close;
+select $oldfh;
+
+$output =~ s#\\#/#g;  # windows
+
+is($output, <<'EXPECTED',                        'not in multipart');
+folders/mbox.cpy, message 26: Re: your mail
+   13: Are you using ImageMagick 5.2.0?  When I used the script I sent the
+EXPECTED
+
+undef $grep11;
+
+#
+# Check search in encoded part
+#
+
+my $msg = $folder->messageId('8172.960997992 at mystic');
+ok($msg);
+
+undef $output;
+$fh   = IO::Scalar->new(\$output) or die $!;
+select $fh;
+
+my $grep12  = Mail::Box::Search::Grep->new
+ ( match      => 'pointsize'
+ , in         => 'MESSAGE'
+ , binaries   => 1
+ , deliver    => 'PRINT'
+ );
+
+my @m12 = $grep12->search($msg);
+cmp_ok(@m12, "==", 1,                            'search binaries');
+
+$fh->close;
+select $oldfh;
+
+$output =~ s#\\#/#g;  # windows
+
+is($output, <<'EXPECTED',                        'found in encoded text');
+folders/mbox.cpy, message 20: 
+p  12:       , pointsize => $poinsize
+EXPECTED
+
+$folder->close(write => 'NEVER');
+undef $grep12;

Added: packages/libmail-box-perl/branches/upstream/current/tests/54search/Definition.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/54search/Definition.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/54search/Definition.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,9 @@
+
+package MailBox::Test::54search::Definition;
+
+sub name     {"Mail::Box::Search; searching folders"}
+sub critical {0}
+
+sub skip     {undef}  # run tests even without Mail::SpamAssassin
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/tests/55locking/10dotlock.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/55locking/10dotlock.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/55locking/10dotlock.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,41 @@
+#!/usr/bin/perl -T
+#
+# Test the locking methods.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 7;
+use File::Spec;
+
+use Mail::Box::Locker::DotLock;
+
+my $fakefolder = bless {MB_foldername=> 'this'}, 'Mail::Box';
+
+my $lockfile  = File::Spec->catfile('folders', 'lockfiletest');
+unlink $lockfile;
+
+my $locker = Mail::Box::Locker->new
+ ( method  => 'DotLock'
+ , timeout => 1
+ , wait    => 1
+ , file    => $lockfile
+ , folder  => $fakefolder
+ );
+
+ok($locker);
+is($locker->name, 'DOTLOCK');
+
+ok($locker->lock);
+ok(-f $lockfile);
+ok($locker->hasLock);
+
+# Already got lock, so should return immediately.
+ok($locker->lock);
+
+$locker->unlock;
+ok(not $locker->hasLock);

Added: packages/libmail-box-perl/branches/upstream/current/tests/55locking/20flock.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/55locking/20flock.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/55locking/20flock.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,55 @@
+#!/usr/bin/perl -T
+
+#
+# Test the locking methods.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More;
+use File::Spec;
+
+use Mail::Box::Locker::Flock;
+
+BEGIN
+{   if($windows)
+    {   plan skip_all => "not available on MicroSoft Windows";
+        exit 0;
+    }
+
+    plan tests => 7;
+}
+
+my $fakefolder = bless {MB_foldername=> 'this'}, 'Mail::Box';
+
+my $lockfile  = File::Spec->catfile('folders', 'lockfiletest');
+unlink $lockfile;
+open OUT, '>', $lockfile;
+
+my $locker = Mail::Box::Locker->new
+ ( method  => 'FLOCK'
+ , timeout => 1
+ , wait    => 1
+ , file    => $lockfile
+ , folder  => $fakefolder
+ );
+
+ok($locker,                                       'create locker');
+is($locker->name, 'FLOCK',                        'lock name');
+
+ok($locker->lock,                                 'do lock');
+ok(-f $lockfile,                                  'locked file exists');
+ok($locker->hasLock,                              'lock received');
+
+# Already got lock, so should return immediately.
+ok($locker->lock,                                 'relock no problem');
+
+$locker->unlock;
+ok(! $locker->hasLock,                            'unlocked');
+
+close OUT;
+unlink $lockfile;

Added: packages/libmail-box-perl/branches/upstream/current/tests/55locking/30nfslock.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/55locking/30nfslock.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/55locking/30nfslock.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,50 @@
+#!/usr/bin/perl -T
+#
+# Test the locking methods.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More;
+use File::Spec;
+
+use Mail::Box::Locker::NFS;
+
+my $fakefolder = bless {MB_foldername=> 'this'}, 'Mail::Box';
+
+BEGIN {
+   if($windows)
+   {   plan skip_all => "not available on MicroSoft Windows.";
+       exit 0;
+   }
+
+   plan tests => 7;
+}
+
+my $lockfile  = File::Spec->catfile('folders', 'lockfiletest');
+unlink $lockfile;
+
+my $locker = Mail::Box::Locker->new
+ ( method  => 'nfs'
+ , timeout => 1
+ , wait    => 1
+ , file    => $lockfile
+ , folder  => $fakefolder
+ );
+
+ok($locker);
+is($locker->name, 'NFS');
+
+ok($locker->lock);
+ok(-f $lockfile);
+ok($locker->hasLock);
+
+# Already got lock, so should return immediately.
+ok($locker->lock);
+
+$locker->unlock;
+ok(not $locker->hasLock);

Added: packages/libmail-box-perl/branches/upstream/current/tests/55locking/40posix.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/55locking/40posix.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/55locking/40posix.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,55 @@
+#!/usr/bin/perl
+#
+# Test the locking methods.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More;
+use File::Spec;
+
+use Mail::Box::Locker::POSIX;
+
+BEGIN
+{   if($windows)
+    {   plan skip_all => "not available on MicroSoft Windows.";
+        exit 0;
+    }
+
+    plan tests => 7;
+}
+
+my $fakefolder = bless {MB_foldername=> 'this'}, 'Mail::Box';
+
+my $lockfile  = File::Spec->catfile('folders', 'lockfiletest');
+unlink $lockfile;
+open OUT, '>', $lockfile;
+close OUT;
+
+my $locker = Mail::Box::Locker->new
+ ( method  => 'POSIX'
+ , timeout => 1
+ , wait    => 1
+ , file    => $lockfile
+ , folder  => $fakefolder
+ );
+
+ok(defined $locker);
+is($locker->name, 'POSIX');
+
+ok($locker->lock);
+ok(-f $lockfile);
+ok($locker->hasLock);
+
+# Already got lock, so should return immediately.
+ok($locker->lock);
+
+$locker->unlock;
+ok(not $locker->hasLock);
+
+close OUT;
+unlink $lockfile;

Added: packages/libmail-box-perl/branches/upstream/current/tests/55locking/90multi.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/55locking/90multi.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/55locking/90multi.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,41 @@
+#!/usr/bin/perl -T
+#
+# Test the locking methods.
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 7;
+use File::Spec;
+
+use Mail::Box::Locker::Multi;
+
+my $fakefolder = bless {MB_foldername=> 'this'}, 'Mail::Box';
+
+my $lockfile  = File::Spec->catfile('folders', 'lockfiletest');
+unlink $lockfile;
+
+my $locker = Mail::Box::Locker->new
+ ( method  => 'MULTI'
+ , timeout => 1
+ , wait    => 1
+ , file    => $lockfile
+ , folder  => $fakefolder
+ );
+
+ok($locker);
+is($locker->name, 'MULTI');
+
+ok($locker->lock);
+ok(-f $lockfile);
+ok($locker->hasLock);
+
+# Already got lock, so should return immediately.
+ok($locker->lock);
+
+$locker->unlock;
+ok(not $locker->hasLock);

Added: packages/libmail-box-perl/branches/upstream/current/tests/55locking/Definition.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/55locking/Definition.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/55locking/Definition.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,8 @@
+
+package MailBox::Test::55locking::Definition;
+
+sub name     {"Mail::Box::Locker; folder locking"}
+sub critical {0}
+sub skip     { undef }
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/tests/80msgconv/10mailint.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/80msgconv/10mailint.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/80msgconv/10mailint.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,100 @@
+#!/usr/bin/perl -T
+#
+# Test conversions between Mail::Internet and Mail::Message
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More;
+
+use Mail::Message;
+use Mail::Message::Convert::MailInternet;
+
+BEGIN
+{   eval {require Mail::Internet};
+    if($@)
+    {   warn "requires Mail::Internet.\n";
+        plan tests => 0;
+        exit 0;
+    }
+    plan tests => 21;
+}
+
+my $mi = Mail::Internet->new(\*DATA);
+ok($mi);
+
+my $convert = Mail::Message::Convert::MailInternet->new;
+ok($convert);
+
+#
+# Convert Mail::Internet to Mail::Message
+#
+
+my $msg = $convert->from($mi);
+ok($msg);
+
+my $head = $msg->head;
+ok($head);
+
+my @fields = sort $head->names;
+cmp_ok(@fields, "==", 5);
+is($fields[0], 'again');
+is($fields[1], 'from');
+is($fields[2], 'in-reply-to');
+is($fields[3], 'subject');
+is($fields[4], 'to');
+
+my @from  = $head->get('from');
+cmp_ok(@from, "==", 1);
+
+my @again = $head->get('again');
+cmp_ok(@again, "==", 3);
+
+my $body  = $msg->body;
+ok($body);
+my @lines = $body->lines;
+cmp_ok(@lines, "==", 6);
+is($lines[-1], "that.\n");
+
+#
+# Convert message back to a Mail::Internet
+#
+
+my $back = $convert->export($msg);
+ok($back);
+$head    = $back->head;
+
+ at fields  = $head->tags;
+cmp_ok(@fields, "==", 5);
+is($head->get('to'), "the users\n");
+
+ at from    = $head->get('from');
+cmp_ok(@from, "==", 1);
+
+ at again   = $head->get('again');
+cmp_ok(@again, "==", 3);
+
+$body = $back->body;
+cmp_ok(@$body, "==", 6);
+
+1;
+
+__DATA__
+From: mailtools at overmeer.net
+To: the users
+Subject: use Mail::Box
+In-Reply-To: <023984hjlur29420 at sruoiu.nl>
+Again: repeating header
+Again: repeating header again
+Again: repeating header and again
+
+Mail::Internet was conceived in 1995, or even earlier, and
+written by Graham Barr.  At that time, e-mail was not very
+wide-spread (the beginning of WWW) and e-mails where not
+poluted by graphics.  Attachments were even so rare that
+Mail::Internet cannot handle them: see MIME::Entity for
+that.

Added: packages/libmail-box-perl/branches/upstream/current/tests/80msgconv/20mimeent.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/80msgconv/20mimeent.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/80msgconv/20mimeent.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,148 @@
+#!/usr/bin/perl -T
+#
+# Test conversions between Mail::Message and MIME::Entity
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More;
+
+use Mail::Message;
+
+BEGIN
+{   eval {require MIME::Entity};
+    if($@)
+    {   plan skip_all => "requires MIME::Entity.";
+        exit 0;
+    }
+
+    require Mail::Message::Convert::MimeEntity;
+    plan tests => 28;
+}
+
+my $me   = MIME::Entity->build
+ ( From          => 'mailtools at overmeer.net'
+ , To            => 'the users'
+ , Subject       => 'use Mail::Box'
+ , 'In-Reply-To' => '<023984hjlur29420 at sruoiu.nl>'
+ , 'X-Again'     => 'repeating header'
+ , 'X-Again'     => 'repeating header again'
+ , 'X-Again'     => 'repeating header and again'
+ , Data          => [ <DATA> ]
+ );
+
+ok($me);
+
+my $convert = Mail::Message::Convert::MimeEntity->new;
+ok($convert);
+
+#
+# Convert MIME::Entity to Mail::Message
+#
+
+my $msg = $convert->from($me);
+ok($msg);
+
+my $head = $msg->head;
+ok($head);
+
+# MIME::Entity makes a mess on the headers: not usefull to test the
+# order of the returned.
+
+my @from  = $head->get('From');
+cmp_ok(@from, "==", 1);
+
+my @again = $head->get('X-again');
+#  cmp_ok(@again, "==", 3);   # Should be 3, but bug in MIME::Entity
+cmp_ok(@again, "==", 1);      # Wrong, but to check improvements in ME
+
+my $body  = $msg->body;
+ok($body);
+
+my @lines = $body->lines;
+cmp_ok(@lines, "==", 6);
+is($lines[-1], "use it anymore!\n");
+
+#
+# Convert message back to a MIME::Entity
+#
+
+my $back = $convert->export($msg);
+ok(defined $back);
+$head    = $back->head;
+
+is($head->get('to'), "the users\n");
+
+ at from    = $head->get('from');
+cmp_ok(@from, "==", 1);
+
+ at again   = $head->get('x-again');
+cmp_ok(@again, "==", 1);
+
+$body = $back->bodyhandle;
+ok($body);
+
+ at lines = $body->as_lines;
+cmp_ok(@lines, "==", 6);
+
+$me->purge;
+
+#
+# and now: MULTIPARTS!  Convert MIME::Entity to Mail::Message
+#
+
+$me = MIME::Entity->build
+ ( From => 'me', To => 'you', Type => 'multipart/mixed'
+ , Subject => 'Test mp conv'
+ , Data => [ "Some\n", "Lines\n" ]
+ );
+$me->preamble( [ "Pre1\n", "Pre2\n" ]);
+$me->attach(Data => [ "First part\n" ] );
+$me->attach(Data => [ "Second part\n" ] );
+$me->epilogue( [ "Epi1\n", "Epi2\n" ]);
+
+$msg = $convert->from($me);
+ok(defined $msg);
+ok($msg->isMultipart);
+
+my @parts = $msg->parts;
+cmp_ok(@parts, "==", 2);
+isa_ok($msg, 'Mail::Message');
+isa_ok($parts[0], 'Mail::Message::Part');
+isa_ok($parts[1], 'Mail::Message::Part');
+
+$body = $msg->body;
+cmp_ok($body->preamble->nrLines, "==", 2);
+cmp_ok($body->epilogue->nrLines, "==", 2);
+#$msg->print;
+
+$me->purge;
+
+#
+# Convert MULTIPART message back to a MIME::Entity
+#
+
+$me = $convert->export($msg);
+#$me->print;
+isa_ok($me, 'MIME::Entity');
+ok($me->is_multipart);
+ at parts = $me->parts;
+cmp_ok(@parts, "==", 2);
+isa_ok($parts[0], 'MIME::Entity');
+isa_ok($parts[1], 'MIME::Entity');
+
+$me->purge;
+
+1;
+
+__DATA__
+MIME::Entity is written by Eriq, and extends Mail::Internet with many
+new capabilities, like multipart bodies.  Actually, although it says
+to extend, it more or less reimplements most methods and conflicts
+with the other.  Even the Mail::Internet constructor does not work:
+only the build() can be used to safely construct a message.  Do not
+use it anymore!

Added: packages/libmail-box-perl/branches/upstream/current/tests/80msgconv/Definition.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/80msgconv/Definition.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/80msgconv/Definition.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,20 @@
+
+package MailBox::Test::80msgconv::Definition;
+
+sub name     {"Mail::Message::Convert; message conversions"}
+sub critical {0}
+
+sub skip
+{   eval "require Mail::Internet";
+    my $mailtools = !$@;
+
+    eval "require MIME::Entity";
+    my $mime = !$@;
+
+    return "Neighter MailTools nor MIME::Tools are installed"
+       unless $mailtools || $mime;
+
+    undef;
+}
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/tests/81bodyconv/10textaf.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/81bodyconv/10textaf.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/81bodyconv/10textaf.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,56 @@
+#!/usr/bin/perl -T
+#
+# Test formatting as plain text with Text::Autoformat
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More;
+
+use Mail::Message;
+
+BEGIN {
+    eval 'require Text::Autoformat';
+    if($@)
+    {   plan skip_all => "requires Text::Autoformat.\n";
+        exit 0;
+    }
+
+    require Mail::Message::Convert::TextAutoformat;
+    require Text::Autoformat;
+    Text::Autoformat->import('break_wrap');
+
+    plan tests => 3;
+}
+
+my $content = <<'TEXT';
+This is some raw text to form the body of the
+message which has to be printed.  I hope it is nice.
+> some badly formatted
+>    input lines
+>  are also in here, to test whether autoformat works.... This line is for instance much too long and should be spread over multiple lines.
+TEXT
+
+my $body = Mail::Message::Body->new
+ ( type  => 'text/html'
+ , data  => $content
+ );
+
+my $af = Mail::Message::Convert::TextAutoformat
+  ->new( options => {break => break_wrap} );
+ok($af);
+
+my $dump = $af->autoformatBody($body);
+ok(defined $dump);
+
+is("$dump", <<'DUMP');
+This is some raw text to form the body of the message which has to be
+printed. I hope it is nice.
+> some badly formatted input lines are also in here, to test whether
+> autoformat works.... This line is for instance much too long and
+> should be spread over multiple lines.
+DUMP

Added: packages/libmail-box-perl/branches/upstream/current/tests/81bodyconv/20html.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/81bodyconv/20html.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/81bodyconv/20html.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,118 @@
+#!/usr/bin/perl -T
+#
+# Test conversions as HTML/XHTML without help of external modules
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More tests => 7;
+
+use Mail::Message;
+use Mail::Message::Head::Complete;
+use Mail::Message::Field::Fast;
+use Mail::Message::Convert::Html;
+
+my $html  = Mail::Message::Convert::Html->new;
+my $xhtml = Mail::Message::Convert::Html->new(produce => 'XHTML');
+
+#
+# test fieldToHtml
+#
+
+my $to   = Mail::Message::Field::Fast->new(To => 'me at example.com (Mark Overmeer)');
+is($html->fieldToHtml($to), '<strong>To: </strong><a href="mailto:me at example.com">me at example.com</a> (Mark Overmeer)');
+
+my $to2  = Mail::Message::Field::Fast->new('reply-to' => 'me at example.com, you at tux.aq');
+is($html->fieldToHtml($to2), '<strong>Reply-To: </strong><a href="mailto:me at example.com">me at example.com</a>, <a href="mailto:you at tux.aq">you at tux.aq</a>');
+
+#
+# test headToHtmlTable
+#
+
+my $head = Mail::Message::Head::Complete->new;
+$head->add(To         => 'me at example.com (Mark Overmeer)');
+$head->add(From       => 'you at tux.aq, john.doe at some.where.else (Doe, John)');
+$head->add('X-Sender' => 'Mail::Box software cooperation');
+$head->add(Subject    => 'No e-mail at at.this.line');
+
+my $table_dump = <<'TABLE-DUMP';
+<table  width=>"50%">
+<tr><th valign="top" align="left">To:</th>
+    <td valign="top"><a href="mailto:me at example.com">me at example.com</a> (Mark Overmeer)</td></tr>
+<tr><th valign="top" align="left">From:</th>
+    <td valign="top"><a href="mailto:you at tux.aq">you at tux.aq</a>, <a href="mailto:john.doe at some.where.else">john.doe at some.where.else</a> (Doe, John)</td></tr>
+<tr><th valign="top" align="left">Subject:</th>
+    <td valign="top">No e-mail at at.this.line</td></tr>
+</table>
+TABLE-DUMP
+
+my $table = $html->headToHtmlTable($head, 'width=>"50%"');
+is($table, $table_dump);
+
+my $xtable = $xhtml->headToHtmlTable($head, 'width=>"50%"');
+is($xtable, $table_dump);
+
+#
+# test headToHtmlHead
+#
+
+my $html_head_dump = <<'HTML_HEAD_DUMP';
+<head>
+<title>No e-mail at at.this.line</title>
+<meta name="Author" content="you at tux.aq">
+<meta name="To" content="me at example.com (Mark Overmeer)">
+<meta name="From" content="you at tux.aq, john.doe at some.where.else (Doe, John)">
+<meta name="Subject" content="No e-mail at at.this.line">
+</head>
+HTML_HEAD_DUMP
+
+my $html_head = $html->headToHtmlHead($head);
+is($html_head, $html_head_dump);
+
+(my $xhtml_head_dump = $html_head_dump) =~ s!"\>!" />!g;
+my $xhtml_head = $xhtml->headToHtmlHead($head);
+is($xhtml_head, $xhtml_head_dump);
+
+
+$html_head = $html->headToHtmlHead
+ ( $head
+ , title    => 'Title, not subject'
+ , keywords => 'html tags like < and >, & and ", must be encoded'
+ );
+
+$html_head_dump = <<'HTML_HEAD_DUMP';
+<head>
+<title>Title, not subject</title>
+<meta name="Author" content="you at tux.aq">
+<meta name="Keywords" content="html tags like &lt; and &gt;, &amp; and &quot;, must be encoded">
+<meta name="To" content="me at example.com (Mark Overmeer)">
+<meta name="From" content="you at tux.aq, john.doe at some.where.else (Doe, John)">
+<meta name="Subject" content="No e-mail at at.this.line">
+</head>
+HTML_HEAD_DUMP
+is($html_head, $html_head_dump);
+
+$html_head = $html->headToHtmlHead
+ ( $head
+ , title    => 'Title, not subject'
+ , keywords => 'html tags'
+ , subject  => ''
+ , extra    => 'new one'
+ , TO       => 'overrule'
+ );
+$html_head_dump = <<'HTML_HEAD_DUMP';
+<head>
+<title>Title, not subject</title>
+<meta name="Author" content="you at tux.aq">
+<meta name="Extra" content="new one">
+<meta name="Keywords" content="html tags">
+<meta name="To" content="overrule">
+<meta name="From" content="you at tux.aq, john.doe at some.where.else (Doe, John)">
+</head>
+HTML_HEAD_DUMP
+
+exit 0;

Added: packages/libmail-box-perl/branches/upstream/current/tests/81bodyconv/30htmlps.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/81bodyconv/30htmlps.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/81bodyconv/30htmlps.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,44 @@
+#!/usr/bin/perl -T
+#
+# Test conversions from HTML/XHTML to postscript with HTML::FormatPS
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More;
+
+use Mail::Message::Body::Lines;
+
+BEGIN {
+   
+   eval 'require HTML::FormatPS';
+
+   if($@)
+   {   plan skip_all => "requires HTML::FormatPS.\n";
+       exit 0;
+   }
+
+   require Mail::Message::Convert::HtmlFormatPS;
+   plan tests => 5;
+}
+
+my $html  = Mail::Message::Convert::HtmlFormatPS->new;
+
+my $body = Mail::Message::Body::Lines->new
+  ( type => 'text/html'
+  , data => $raw_html_data
+  );
+
+my $f = $html->format($body);
+ok(defined $f);
+ok(ref $f);
+isa_ok($f, 'Mail::Message::Body');
+is($f->type, 'application/postscript');
+is($f->transferEncoding, 'none');
+
+# The result of the conversion is not checked, because the output
+# is rather large and may vary over versions of HTML::FormatPS

Added: packages/libmail-box-perl/branches/upstream/current/tests/81bodyconv/31htmltxt.t
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/81bodyconv/31htmltxt.t	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/81bodyconv/31htmltxt.t	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,85 @@
+#!/usr/bin/perl -T
+#
+# Test conversions from HTML/XHTML to plain text with HTML::FormatText
+#
+
+use strict;
+use warnings;
+
+use lib qw(. .. tests);
+use Tools;
+
+use Test::More;
+
+use Mail::Message::Body::Lines;
+
+BEGIN {
+   
+   eval 'require HTML::FormatText';
+
+   if($@)
+   {   plan skip_all => "requires HTML::FormatText.\n";
+       exit 0;
+   }
+
+   require Mail::Message::Convert::HtmlFormatText;
+   plan tests => 7;
+}
+
+my $html  = Mail::Message::Convert::HtmlFormatText->new;
+
+my $body = Mail::Message::Body::Lines->new
+  ( type => 'text/html'
+  , data => $raw_html_data
+  );
+
+my $f = $html->format($body);
+ok(defined $f);
+ok(ref $f);
+isa_ok($f, 'Mail::Message::Body');
+is($f->mimeType, 'text/plain');
+is($f->charset, 'iso-8859-1');
+is($f->transferEncoding, 'none');
+
+is($f->string, <<'EXPECTED');
+   Life according to Brian
+   =======================
+
+   This is normal text, but not in a paragraph.
+
+   New paragraph in a bad way. And this is just a continuation. When
+   texts get long, they must be auto-wrapped; and even that is working
+   already.
+
+
+   Silly subsection at once
+
+
+
+   and another chapter
+   ===================
+
+
+   again a section
+   ---------------
+
+   Normal paragraph, which contains an [IMAGE], some italics with
+   linebreak and code
+
+   And now for the preformatted stuff
+      it should stay as it was
+         even   with   strange blanks
+     and indentations
+
+   And back to normal text...
+
+     * list item 1
+
+         1. list item 1.1
+
+         2. list item 1.2
+
+     * list item 2
+EXPECTED
+
+exit 0;

Added: packages/libmail-box-perl/branches/upstream/current/tests/81bodyconv/Definition.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/81bodyconv/Definition.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/81bodyconv/Definition.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,8 @@
+
+package MailBox::Test::81bodyconv::Definition;
+
+sub name     {"Mail::Message::Convert; body type conversions"}
+sub critical {0}
+sub skip()   {undef}  # try even when some modules are not installed.
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/tests/Tools.pm
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/Tools.pm	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/Tools.pm	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,398 @@
+
+use strict;
+package Tools;
+
+use lib qw(. ./lib ../lib ../../lib tests);
+use lib qw(/home/markov/shared/perl/UserIdentity/lib);
+use lib qw(/home/markov/shared/perl/MimeTypes/lib);
+
+use base 'Exporter';
+use File::Copy 'copy';
+use List::Util 'first';
+
+our @EXPORT =
+  qw/clean_dir copy_dir
+     unpack_mbox2mh unpack_mbox2maildir
+     compare_lists listdir
+     compare_message_prints reproducable_text
+     compare_thread_dumps
+     start_pop3_server start_pop3_client
+
+     $folderdir
+     $src $unixsrc $winsrc
+     $fn  $unixfn  $winfn
+     $cpy $cpyfn
+     $raw_html_data
+     $crlf_platform $windows
+    /;
+
+use Test::More;
+use File::Spec;
+use Sys::Hostname;
+use Cwd;
+
+our ($logfile, $folderdir);
+our ($src, $unixsrc, $winsrc);
+our ($fn,  $unixfn,  $winfn);
+our ($cpy, $cpyfn);
+our ($crlf_platform, $windows);
+
+BEGIN {
+   $windows       = $^O =~ m/mswin32|cygwin/i;
+   $crlf_platform = $windows;
+
+   $folderdir     = -d 'folders' ? 'folders'
+                  : File::Spec->catdir('tests','folders');
+
+   $logfile = File::Spec->catfile(getcwd(), 'run-log');
+   $unixfn  = 'mbox.src';
+   $winfn   = 'mbox.win';
+   $cpyfn   = 'mbox.cpy';
+
+   $unixsrc = File::Spec->catfile('folders', $unixfn);
+   $winsrc  = File::Spec->catfile('folders', $winfn);
+   $cpy     = File::Spec->catfile('folders', $cpyfn);
+
+   ($src, $fn) = $crlf_platform ? ($winsrc, $winfn) : ($unixsrc, $unixfn);
+}
+
+#
+# CLEAN_DIR
+# Clean a directory structure, typically created by unpack_mbox()
+#
+
+sub clean_dir($);
+sub clean_dir($)
+{   my $dir = shift;
+    opendir DIR, $dir or return;
+
+    my @items = map { m/(.*)/ && "$dir/$1" }   # untainted
+                    grep !/^\.\.?$/, readdir DIR;
+    foreach (@items)
+    {   if(-d)  { clean_dir $_ }
+        else    { unlink $_ }
+    }
+
+    closedir DIR;
+    rmdir $dir;
+}
+
+#
+# COPY_DIR FROM, TO
+# Copy directory to other place (not recursively), cleaning the
+# destination first.
+#
+
+sub copy_dir($$)
+{   my ($orig, $dest) = @_;
+
+    clean_dir($dest);
+
+    mkdir $dest
+        or die "Cannot create copy destination $dest: $!\n";
+
+    opendir ORIG, $orig
+        or die "Cannot open directory $orig: $!\n";
+
+    foreach my $name (map { !m/^\.\.?$/ && m/(.*)/ ? $1 : () } readdir ORIG)
+    {   my $from = File::Spec->catfile($orig, $name);
+        next if -d $from;
+
+        my $to   = File::Spec->catfile($dest, $name);
+        copy($from, $to) or die "Couldn't copy $from,$to: $!\n";
+    }
+
+    close ORIG;
+}
+
+# UNPACK_MBOX2MH
+# Unpack an mbox-file into an MH-directory.
+# This skips message-nr 13 for testing purposes.
+
+sub unpack_mbox2mh($$)
+{   my ($file, $dir) = @_;
+    clean_dir($dir);
+
+    mkdir $dir, 0700;
+    my $count = 1;
+
+    open FILE, $file or die;
+    open OUT, '>', File::Spec->devnull;
+
+    while(<FILE>)
+    {   if( /^From / )
+        {   close OUT;
+            open OUT, ">$dir/".$count++ or die;
+            $count++ if $count==13;  # skip 13 for test
+            next;                    # from line not included in file.
+        }
+        print OUT;
+    }
+
+    close OUT;
+    close FILE;
+}
+
+# UNPACK_MBOX2MAILDIR
+# Unpack an mbox-file into an Maildir-directory.
+
+our @maildir_names =
+ (   '8000000.localhost.23:2,'
+ ,  '90000000.localhost.213:2,'
+ , '110000000.localhost.12:2,'
+ , '110000001.l.42:2,'
+ , '110000002.l.42:2,'
+ , '110000002.l.43:2,'
+ , '110000004.l.43:2,'
+ , '110000005.l.43:2,'
+ , '110000006.l.43:2,'
+ , '110000007.l.43:2,D'
+ , '110000008.l.43:2,DF'
+ , '110000009.l.43:2,DFR'
+ , '110000010.l.43:2,DFRS'
+ , '110000011.l.43:2,DFRST'
+ , '110000012.l.43:2,F'
+ , '110000013.l.43:2,FR'
+ , '110000014.l.43:2,FRS'
+ , '110000015.l.43:2,FRST'
+ , '110000016.l.43:2,DR'
+ , '110000017.l.43:2,DRS'
+ , '110000018.l.43:2,DRST'
+ , '110000019.l.43:2,FS'
+ , '110000020.l.43:2,FST'
+ , '110000021.l.43:2,R'
+ , '110000022.l.43:2,RS'
+ , '110000023.l.43:2,RST'
+ , '110000024.l.43:2,S'
+ , '110000025.l.43:2,ST'
+ , '110000026.l.43:2,T'
+ , '110000027.l.43:2,'
+ , '110000028.l.43:2,'
+ , '110000029.l.43:2,'
+ , '110000030.l.43:2,'
+ , '110000031.l.43:2,'
+ , '110000032.l.43:2,'
+ , '110000033.l.43:2,'
+ , '110000034.l.43:2,'
+ , '110000035.l.43:2,'
+ , '110000036.l.43:2,'
+ , '110000037.l.43:2,'
+ , '110000038.l.43'
+ , '110000039.l.43'
+ , '110000040.l.43'
+ , '110000041.l.43'
+ , '110000042.l.43'
+ );
+ 
+sub unpack_mbox2maildir($$)
+{   my ($file, $dir) = @_;
+    clean_dir($dir);
+
+    die unless @maildir_names==45;
+
+    mkdir $dir or die;
+    mkdir File::Spec->catfile($dir, 'cur') or die;
+    mkdir File::Spec->catfile($dir, 'new') or die;
+    mkdir File::Spec->catfile($dir, 'tmp') or die;
+    my $msgnr = 0;
+
+    open FILE, $file or die;
+    open OUT, '>', File::Spec->devnull;
+
+    my $last_empty = 0;
+
+    while(<FILE>)
+    {   if( m/^From / )
+        {   close OUT;
+            my $now      = time;
+            my $hostname = hostname;
+
+            my $msgfile  = File::Spec->catfile($dir
+              , ($msgnr > 40 ? 'new' : 'cur')
+              , $maildir_names[$msgnr++]
+              );
+
+            open OUT, ">", $msgfile or die "Create $msgfile: $!\n";
+            next;                    # from line not included in file.
+        }
+
+        print OUT;
+    }
+
+    close OUT;
+    close FILE;
+}
+
+#
+# Compare two lists.
+#
+
+sub compare_lists($$)
+{   my ($first, $second) = @_;
+    return 0 unless @$first == @$second;
+    for(my $i=0; $i<@$first; $i++)
+    {   return 0 unless $first->[$i] eq $second->[$i];
+    }
+    1;
+}
+
+#
+# Compare the text of two messages, rather strict.
+# On CRLF platforms, the Content-Length may be different.
+#
+
+sub compare_message_prints($$$)
+{   my ($first, $second, $label) = @_;
+
+    if($crlf_platform)
+    {   $first  =~ s/Content-Length: (\d+)/Content-Length: <removed>/g;
+        $second =~ s/Content-Length: (\d+)/Content-Length: <removed>/g;
+    }
+
+    is($first, $second, $label);
+}
+
+#
+# Strip message text down the things which are the same on all
+# platforms and all situations.
+#
+
+sub reproducable_text($)
+{   my $text  = shift;
+    my @lines = split /^/m, $text;
+    foreach (@lines)
+    {   s/((?:references|message-id|date|content-length)\: ).*/$1<removed>/i;
+        s/boundary-\d+/boundary-<removed>/g;
+    }
+    join '', @lines;
+}
+
+#
+# Compare two outputs of thread details.
+# On CRLF platforms, the reported sizes are ignored.
+#
+
+sub compare_thread_dumps($$$)
+{   my ($first, $second, $label) = @_;
+
+    if($crlf_platform)
+    {   $first  =~ s/^..../    /gm;
+        $second =~ s/^..../    /gm;
+    }
+
+    is($first, $second, $label);
+}
+
+#
+# List directory
+# This removes '.' and '..'
+#
+
+sub listdir($)
+{   my $dir = shift;
+    opendir LISTDIR, $dir or return ();
+    my @entities = grep !/^\.\.?$/, readdir LISTDIR;
+    closedir LISTDIR;
+    @entities;
+}
+
+#
+# Start POP3 server for 43pop3 tests
+#
+
+sub start_pop3_server($;$)
+{  my $popbox  = shift;
+   my $setting = shift || '';
+
+   my $serverscript = File::Spec->catfile('43pop3', 'server');
+
+   # Some complications to find-out $perl, which must be absolute and
+   # untainted for perl5.6.1, but not for the other Perl's.
+   my $perl   = $^X;
+   unless(File::Spec->file_name_is_absolute($perl))
+   {   my @path = split /\:|\;/, $ENV{PATH};
+       $perl    = first { -x $_ }
+                      map { File::Spec->catfile($_, $^X) }
+                           @path;
+   }
+
+   $perl =~ m/(.*)/;
+   $perl = $1;
+
+   %ENV = ();
+
+   open(my $server, "$perl $serverscript $popbox $setting|")
+       or die "Could not start POP3 server\n";
+
+   my $line  = <$server>;
+   my $port  = $line =~ m/(\d+)/ ? $1
+     : die "Did not get port specification, but '$line'";
+
+   ($server, $port);
+}
+
+#
+# START_POP3_CLIENT PORT, OPTIONS
+#
+
+sub start_pop3_client($@)
+{   my ($port, @options) = @_;
+    require Mail::Transport::POP3;
+    
+    Mail::Transport::POP3->new
+     ( hostname => '127.0.0.1'
+     , port     => $port
+     , username => 'user'
+     , password => 'password'
+     , @options
+     );
+}
+
+#
+# A piece of HTML text which is used in some tests.
+#
+
+our $raw_html_data = <<'TEXT';
+<HTML>
+<HEAD>
+<TITLE>My home page</TITLE>
+</HEAD>
+<BODY BGCOLOR=red>
+
+<H1>Life according to Brian</H1>
+
+This is normal text, but not in a paragraph.<P>New paragraph
+in a bad way.
+
+And this is just a continuation.  When texts get long, they must be
+auto-wrapped; and even that is working already.
+
+<H3>Silly subsection at once</H3>
+<H1>and another chapter</H1>
+<H2>again a section</H2>
+<P>Normal paragraph, which contains an <IMG
+SRC=image.gif>, some
+<I>italics with linebreak
+</I> and <TT>code</TT>
+
+<PRE>
+And now for the preformatted stuff
+   it should stay as it was
+      even   with   strange blanks
+  and indentations
+</PRE>
+
+And back to normal text...
+<UL>
+<LI>list item 1
+    <OL>
+    <LI>list item 1.1
+    <LI>list item 1.2
+    </OL>
+<LI>list item 2
+</UL>
+</BODY>
+</HTML>
+TEXT
+
+1;

Added: packages/libmail-box-perl/branches/upstream/current/tests/folders/mbox.cpy
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/folders/mbox.cpy	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/folders/mbox.cpy	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,3348 @@
+From magick-owner at unca-don.wizards.dupont.com Wed Feb  9 22:02 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id WAA23694
+	for <markov at ATComputing.nl>; Wed, 9 Feb 2000 22:02:24 +0100 (MET)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id WAA01128
+	for <markov at ATComputing.nl>; Wed, 9 Feb 2000 22:02:24 +0100
+Received: from viper.oldcity.dca.net(216.158.38.4) by ns.ATComputing.nl via smap (V2.1)
+	id xma001126; Wed, 9 Feb 00 22:02:01 +0100
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by viper.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id QAA21962;
+	Wed, 9 Feb 2000 16:00:43 -0500
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id PAA29389
+	for magick-outgoing; Wed, 9 Feb 2000 15:38:42 -0500 (EST)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Date: Wed, 9 Feb 2000 15:44:05 -0500
+From: William Park <parkw at better.net>
+To: Mark Sappol <Mark_Sappol at ipicorp.com>
+Cc: "magick at wizards.dupont.com" <magick at wizards.dupont.com>
+Subject: Re: File Conversion From HTML to PS and TIFF
+Message-ID: <20000209154405.C265 at better.net>
+Mail-Followup-To: Mark Sappol <Mark_Sappol at ipicorp.com>,
+	"magick at wizards.dupont.com" <magick at wizards.dupont.com>
+References: <38A11D0E.A2064062 at ipicorp.com>
+Mime-Version: 1.0
+X-Mailer: Mutt 1.0pre3i
+In-Reply-To: <38A11D0E.A2064062 at ipicorp.com>
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: William Park <parkw at better.net>
+Content-Type: text/plain; charset=us-ascii
+Status: RO
+Content-Length: 1280
+Lines: 33
+
+On Wed, Feb 09, 2000 at 07:53:50AM +0000, Mark Sappol wrote:
+> I am new to this list so please forgive me if I am asking something that
+> has already been answered previously.  I did check the archives but too
+> no avail.
+> 
+> I need to create a postscript file from an HTML document.  I have no
+> problem here with the text but I do have a logo (gif file) on this
+> document which does not get converted.  How can I go about converting
+> the HTML documents I generate, along with any linked GIF images, to
+> PostScript, as well as at other times, to TIFF?
+> 
+> I would appreciate any feedback and help on this request.
+> 
+> Thanks in advance,
+> Mark
+
+You can convert .html to .ps using Netscape.  You can do this manually
+by clicking mouse, or through '-remote' command line option.  For
+example,
+    netscape -remote "openURL(http://sexybabes.for.you/)" \
+	     -remote "saveAs(xxx.ps, Postscript)"
+
+You can then convert .ps to .tiff like FAX program does.
+
+William
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at unca-don.wizards.dupont.com Wed Feb  9 23:15 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id XAA24500
+	for <markov at ATComputing.nl>; Wed, 9 Feb 2000 23:15:56 +0100 (MET)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id XAA01235
+	for <markov at ATComputing.nl>; Wed, 9 Feb 2000 23:15:55 +0100
+Received: from viper.oldcity.dca.net(216.158.38.4) by ns.ATComputing.nl via smap (V2.1)
+	id xma001233; Wed, 9 Feb 00 23:15:42 +0100
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by viper.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id RAA04724;
+	Wed, 9 Feb 2000 17:13:49 -0500
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id QAA29779
+	for magick-outgoing; Wed, 9 Feb 2000 16:56:19 -0500 (EST)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-Id: <200002092200.RAA19561 at mailfw3.ford.com>
+Date: Wed, 09 Feb 2000 17:00:14 -0500
+From: "Lincoln, D. E. (Daniel)" <dlincol1 at ford.com>
+Organization: R&VT VCP&M
+X-Mailer: Mozilla 4.7C-CCK-MCD cf47 [en] (X11; I; SunOS 5.6 sun4u)
+X-Accept-Language: en, en-GB, de, fr, ja, ko, zh
+Mime-Version: 1.0
+To: Jeffrey Krzysztow <jeffrey.krzysztow at pvii.com>
+Cc: William Park <parkw at better.net>, Mark Sappol <Mark_Sappol at ipicorp.com>,
+        "magick at wizards.dupont.com" <magick at wizards.dupont.com>
+Subject: Re: File Conversion From HTML to PS and TIFF
+References: <38A11D0E.A2064062 at ipicorp.com> <20000209154405.C265 at better.net> <38A1DBE7.9D3718C9 at pvii.com>
+Content-Transfer-Encoding: 7bit
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: "Lincoln, D. E. (Daniel)" <dlincol1 at ford.com>
+Content-Type: text/plain; charset=us-ascii
+Status: RO
+Content-Length: 2109
+Lines: 60
+
+If I may interject...
+
+It can be found at:
+http://developer.netscape.com/docs/manuals/deploymt/options.htm
+
+Jeffrey Krzysztow wrote:
+> 
+> William,
+> 
+> Where did you find information about -remote command line option for Netscape?
+> 
+> William Park wrote:
+> 
+> > On Wed, Feb 09, 2000 at 07:53:50AM +0000, Mark Sappol wrote:
+> > > I am new to this list so please forgive me if I am asking something that
+> > > has already been answered previously.  I did check the archives but too
+> > > no avail.
+> > >
+> > > I need to create a postscript file from an HTML document.  I have no
+> > > problem here with the text but I do have a logo (gif file) on this
+> > > document which does not get converted.  How can I go about converting
+> > > the HTML documents I generate, along with any linked GIF images, to
+> > > PostScript, as well as at other times, to TIFF?
+> > >
+> > > I would appreciate any feedback and help on this request.
+> > >
+> > > Thanks in advance,
+> > > Mark
+> >
+> > You can convert .html to .ps using Netscape.  You can do this manually
+> > by clicking mouse, or through '-remote' command line option.  For
+> > example,
+> >     netscape -remote "openURL(http://sexybabes.for.you/)" \
+> >              -remote "saveAs(xxx.ps, Postscript)"
+> >
+> > You can then convert .ps to .tiff like FAX program does.
+> >
+> > William
+> >
+> > ***********************************************************************
+> > To remove yourself from this mailing list, send mail to:
+> >         majordomo at wizards.dupont.com
+> >
+> > Include the following command in the body of your message:
+> >         unsubscribe magick
+> > ***********************************************************************
+
+-- 
+Regards,
+
+Daniel E. Lincoln - Digital Buck Mechanic
+Ford Motor Company - R&VT Vehicle CAD Process & Methods
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at unca-don.wizards.dupont.com Wed Feb  9 23:15 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id XAA24495
+	for <markov at ATComputing.nl>; Wed, 9 Feb 2000 23:15:26 +0100 (MET)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id XAA01230
+	for <markov at ATComputing.nl>; Wed, 9 Feb 2000 23:15:25 +0100
+Received: from viper.oldcity.dca.net(216.158.38.4) by ns.ATComputing.nl via smap (V2.1)
+	id xma001228; Wed, 9 Feb 00 23:15:21 +0100
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by viper.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id RAA04756;
+	Wed, 9 Feb 2000 17:13:55 -0500
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id QAA29764
+	for magick-outgoing; Wed, 9 Feb 2000 16:55:37 -0500 (EST)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-ID: <38A1E3B0.F148D74A at websidestory.com>
+Date: Wed, 09 Feb 2000 14:01:20 -0800
+From: Steve Dotson <steve at websidestory.com>
+X-Mailer: Mozilla 4.7 [en] (X11; U; Linux 2.2.5-15 i686)
+X-Accept-Language: en
+MIME-Version: 1.0
+To: Jeffrey Krzysztow <jeffrey.krzysztow at pvii.com>
+CC: William Park <parkw at better.net>, Mark Sappol <Mark_Sappol at ipicorp.com>,
+        "magick at wizards.dupont.com" <magick at wizards.dupont.com>
+Subject: Re: File Conversion From HTML to PS and TIFF
+References: <38A11D0E.A2064062 at ipicorp.com> <20000209154405.C265 at better.net> <38A1DBE7.9D3718C9 at pvii.com>
+Content-Transfer-Encoding: 7bit
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Steve Dotson <steve at websidestory.com>
+Content-Type: text/plain; charset=us-ascii
+Status: RO
+Content-Length: 2129
+Lines: 63
+
+http://home.netscape.com/newsref/std/x-remote.html
+
+
+Jeffrey Krzysztow wrote:
+> 
+> William,
+> 
+> Where did you find information about -remote command line option for Netscape?
+> 
+> William Park wrote:
+> 
+> > On Wed, Feb 09, 2000 at 07:53:50AM +0000, Mark Sappol wrote:
+> > > I am new to this list so please forgive me if I am asking something that
+> > > has already been answered previously.  I did check the archives but too
+> > > no avail.
+> > >
+> > > I need to create a postscript file from an HTML document.  I have no
+> > > problem here with the text but I do have a logo (gif file) on this
+> > > document which does not get converted.  How can I go about converting
+> > > the HTML documents I generate, along with any linked GIF images, to
+> > > PostScript, as well as at other times, to TIFF?
+> > >
+> > > I would appreciate any feedback and help on this request.
+> > >
+> > > Thanks in advance,
+> > > Mark
+> >
+> > You can convert .html to .ps using Netscape.  You can do this manually
+> > by clicking mouse, or through '-remote' command line option.  For
+> > example,
+> >     netscape -remote "openURL(http://sexybabes.for.you/)" \
+> >              -remote "saveAs(xxx.ps, Postscript)"
+> >
+> > You can then convert .ps to .tiff like FAX program does.
+> >
+> > William
+> >
+> > ***********************************************************************
+> > To remove yourself from this mailing list, send mail to:
+> >         majordomo at wizards.dupont.com
+> >
+> > Include the following command in the body of your message:
+> >         unsubscribe magick
+> > ***********************************************************************
+
+-- 
+Steve Dotson
+Software Engineer
+
+WebSideStory, Inc.
+10182 Telesis Court, Sixth Floor
+San Diego, California 92121
+P:  858.546.0040  ext. 417
+F:  858.546.0480
+E:  steve at websidestory.com
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at unca-don.wizards.dupont.com Wed Feb 23 17:28 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id RAA20894
+	for <markov at ATComputing.nl>; Wed, 23 Feb 2000 17:28:05 +0100 (MET)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id RAA21883
+	for <markov at ATComputing.nl>; Wed, 23 Feb 2000 17:28:04 +0100
+Received: from viper.oldcity.dca.net(216.158.38.4) by ns.ATComputing.nl via smap (V2.1)
+	id xma021881; Wed, 23 Feb 00 17:27:46 +0100
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by viper.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id LAA28560;
+	Wed, 23 Feb 2000 11:25:57 -0500
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id KAA09345
+	for magick-outgoing; Wed, 23 Feb 2000 10:53:09 -0500 (EST)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-ID: <177E035AF8BDD311858B00A0C9D8E324886A3B at EMAILSRVR_KPR>
+From: Steve Sapovits <SapovitsS at globalsportsinc.com>
+To: magick at wizards.dupont.com
+Subject: Transparency question
+Date: Wed, 23 Feb 2000 10:58:16 -0500
+MIME-Version: 1.0
+X-Mailer: Internet Mail Service (5.5.2650.21)
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Steve Sapovits <SapovitsS at globalsportsinc.com>
+Content-Type: text/plain
+Status: RO
+Content-Length: 1447
+Lines: 42
+
+
+I'm trying to do the following:
+
+1)  Take a JPEG image and size it down to a particular size.
+2)  Overlay that JPEG on top of an GIF image to form a combined result.
+
+This works fine for the most part:  I use mogrify to resize, followed by 
+combine to overlay.
+
+Now I'm presented with GIF images (the ones the JPEG is put on top of)
+that have colors or other background attributes we want to 'show through'
+the overlay where there is no image.
+
+Even without any transparency options this seems to ALMOST work.  The
+problem is that there's a small area around each image of 'white' that
+always
+shows up.  Trying transparency or the 'matte' option of '-draw' seems to
+have
+no effect.
+
+Any ideas?  I'm an engineer -- not an image expert.  The images in question
+are handed to me.  I can change them if necessary and if it can be done via
+the ImageMagick tool.  The volume we generate makes manual changes to 
+each image out of the question.
+
+----
+Steve Sapovits
+Global Sports Interactive
+Work Email: sapovitss at globalsportsinc.com
+Home Email: steves at delanet.com
+Work Phone: 610-491-7087
+Cell:       610-574-7706
+Pager:      877-239-4003
+
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at unca-don.wizards.dupont.com Wed Feb 23 20:13 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id UAA24120
+	for <markov at ATComputing.nl>; Wed, 23 Feb 2000 20:13:38 +0100 (MET)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id UAA22110
+	for <markov at ATComputing.nl>; Wed, 23 Feb 2000 20:13:38 +0100
+Received: from viper.oldcity.dca.net(216.158.38.4) by ns.ATComputing.nl via smap (V2.1)
+	id xma022108; Wed, 23 Feb 00 20:13:37 +0100
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by viper.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id OAA00687;
+	Wed, 23 Feb 2000 14:11:56 -0500
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id NAA10192
+	for magick-outgoing; Wed, 23 Feb 2000 13:26:44 -0500 (EST)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-ID: <177E035AF8BDD311858B00A0C9D8E324886AB2 at EMAILSRVR_KPR>
+From: Steve Sapovits <SapovitsS at globalsportsinc.com>
+To: Steve Sapovits <SapovitsS at globalsportsinc.com>, magick at wizards.dupont.com
+Subject: RE: Transparency question
+Date: Wed, 23 Feb 2000 13:31:41 -0500
+MIME-Version: 1.0
+X-Mailer: Internet Mail Service (5.5.2650.21)
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Steve Sapovits <SapovitsS at globalsportsinc.com>
+Content-Type: text/plain
+Status: RO
+Content-Length: 2483
+Lines: 73
+
+
+Someone on this list and my image folks here seem to confirm that the
+problem
+here is with 'fringe' pixels that were not trimmed back as neatly as
+possible.  Any
+suggestions for automating this?  This whole thing needs to be batched.  I
+played
+with the transparency and fuzz options with no real difference noted.
+Trying 
+crop 0x0 makes some of the fringe whitespace areas neater, but it doesn't
+get rid
+of them.
+
+Any suggestions?
+
+> -----Original Message-----
+> From:	Steve Sapovits [SMTP:SapovitsS at globalsportsinc.com]
+> Sent:	Wednesday, February 23, 2000 10:58 AM
+> To:	magick at wizards.dupont.com
+> Subject:	Transparency question
+> 
+> 
+> I'm trying to do the following:
+> 
+> 1)  Take a JPEG image and size it down to a particular size.
+> 2)  Overlay that JPEG on top of an GIF image to form a combined result.
+> 
+> This works fine for the most part:  I use mogrify to resize, followed by 
+> combine to overlay.
+> 
+> Now I'm presented with GIF images (the ones the JPEG is put on top of)
+> that have colors or other background attributes we want to 'show through'
+> the overlay where there is no image.
+> 
+> Even without any transparency options this seems to ALMOST work.  The
+> problem is that there's a small area around each image of 'white' that
+> always
+> shows up.  Trying transparency or the 'matte' option of '-draw' seems to
+> have
+> no effect.
+> 
+> Any ideas?  I'm an engineer -- not an image expert.  The images in
+> question
+> are handed to me.  I can change them if necessary and if it can be done
+> via
+> the ImageMagick tool.  The volume we generate makes manual changes to 
+> each image out of the question.
+> 
+> ----
+> Steve Sapovits
+> Global Sports Interactive
+> Work Email: sapovitss at globalsportsinc.com
+> Home Email: steves at delanet.com
+> Work Phone: 610-491-7087
+> Cell:       610-574-7706
+> Pager:      877-239-4003
+> 
+> 
+> ***********************************************************************
+> To remove yourself from this mailing list, send mail to:
+> 	majordomo at wizards.dupont.com
+> 
+> Include the following command in the body of your message:
+> 	unsubscribe magick
+> ***********************************************************************
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at unca-don.wizards.dupont.com Thu Feb 24 17:27 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id RAA19964
+	for <markov at ATComputing.nl>; Thu, 24 Feb 2000 17:27:35 +0100 (MET)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id RAA23400
+	for <markov at ATComputing.nl>; Thu, 24 Feb 2000 17:27:34 +0100
+Received: from mustang.oldcity.dca.net(216.158.38.3) by ns.ATComputing.nl via smap (V2.1)
+	id xma023398; Thu, 24 Feb 00 17:27:10 +0100
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by mustang.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id LAA14646;
+	Thu, 24 Feb 2000 11:25:37 -0500
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id LAA15770
+	for magick-outgoing; Thu, 24 Feb 2000 11:04:56 -0500 (EST)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-ID: <8100014B48DAD111AA4100805F9F3FC903A0E5B2 at host60.corbis.com>
+From: Bill Radcliffe <BillR at corbis.com>
+To: "'Steve Sapovits'" <SapovitsS at globalsportsinc.com>,
+        "'magick at wizards.dupont.com'" <magick at wizards.dupont.com>
+Subject: RE: Transparency question
+Date: Thu, 24 Feb 2000 08:06:44 -0800
+MIME-Version: 1.0
+X-Mailer: Internet Mail Service (5.5.2448.0)
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Bill Radcliffe <BillR at corbis.com>
+Content-Type: text/plain
+Status: RO
+Content-Length: 3362
+Lines: 93
+
+It would help me if you could send some small samples of exactly the effect
+you are trying to achieve. I'm sure IM can do whatever you want but the road
+to get there may not be at all obvious.
+
+> -----Original Message-----
+> From:	Steve Sapovits [SMTP:SapovitsS at globalsportsinc.com]
+> Sent:	Wednesday, February 23, 2000 10:32 AM
+> To:	Steve Sapovits; magick at wizards.dupont.com
+> Subject:	RE: Transparency question
+> 
+> 
+> Someone on this list and my image folks here seem to confirm that the
+> problem
+> here is with 'fringe' pixels that were not trimmed back as neatly as
+> possible.  Any
+> suggestions for automating this?  This whole thing needs to be batched.  I
+> played
+> with the transparency and fuzz options with no real difference noted.
+> Trying 
+> crop 0x0 makes some of the fringe whitespace areas neater, but it doesn't
+> get rid
+> of them.
+> 
+> Any suggestions?
+> 
+> > -----Original Message-----
+> > From:	Steve Sapovits [SMTP:SapovitsS at globalsportsinc.com]
+> > Sent:	Wednesday, February 23, 2000 10:58 AM
+> > To:	magick at wizards.dupont.com
+> > Subject:	Transparency question
+> > 
+> > 
+> > I'm trying to do the following:
+> > 
+> > 1)  Take a JPEG image and size it down to a particular size.
+> > 2)  Overlay that JPEG on top of an GIF image to form a combined result.
+> > 
+> > This works fine for the most part:  I use mogrify to resize, followed by
+> 
+> > combine to overlay.
+> > 
+> > Now I'm presented with GIF images (the ones the JPEG is put on top of)
+> > that have colors or other background attributes we want to 'show
+> through'
+> > the overlay where there is no image.
+> > 
+> > Even without any transparency options this seems to ALMOST work.  The
+> > problem is that there's a small area around each image of 'white' that
+> > always
+> > shows up.  Trying transparency or the 'matte' option of '-draw' seems to
+> > have
+> > no effect.
+> > 
+> > Any ideas?  I'm an engineer -- not an image expert.  The images in
+> > question
+> > are handed to me.  I can change them if necessary and if it can be done
+> > via
+> > the ImageMagick tool.  The volume we generate makes manual changes to 
+> > each image out of the question.
+> > 
+> > ----
+> > Steve Sapovits
+> > Global Sports Interactive
+> > Work Email: sapovitss at globalsportsinc.com
+> > Home Email: steves at delanet.com
+> > Work Phone: 610-491-7087
+> > Cell:       610-574-7706
+> > Pager:      877-239-4003
+> > 
+> > 
+> > ***********************************************************************
+> > To remove yourself from this mailing list, send mail to:
+> > 	majordomo at wizards.dupont.com
+> > 
+> > Include the following command in the body of your message:
+> > 	unsubscribe magick
+> > ***********************************************************************
+> 
+> ***********************************************************************
+> To remove yourself from this mailing list, send mail to:
+> 	majordomo at wizards.dupont.com
+> 
+> Include the following command in the body of your message:
+> 	unsubscribe magick
+> ***********************************************************************
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at unca-don.wizards.dupont.com Thu Feb 24 18:17 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id SAA21506
+	for <markov at ATComputing.nl>; Thu, 24 Feb 2000 18:17:36 +0100 (MET)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id SAA23500
+	for <markov at ATComputing.nl>; Thu, 24 Feb 2000 18:17:35 +0100
+Received: from mustang.oldcity.dca.net(216.158.38.3) by ns.ATComputing.nl via smap (V2.1)
+	id xma023498; Thu, 24 Feb 00 18:17:21 +0100
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by mustang.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id MAA27594;
+	Thu, 24 Feb 2000 12:14:53 -0500
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id LAA16076
+	for magick-outgoing; Thu, 24 Feb 2000 11:52:40 -0500 (EST)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-ID: <8100014B48DAD111AA4100805F9F3FC903A0E5B9 at host60.corbis.com>
+From: Bill Radcliffe <BillR at corbis.com>
+To: "'Steve Sapovits'" <SapovitsS at globalsportsinc.com>
+Cc: "'magick at wizards.dupont.com'" <magick at wizards.dupont.com>
+Subject: RE: Transparency question
+Date: Thu, 24 Feb 2000 08:54:32 -0800
+MIME-Version: 1.0
+X-Mailer: Internet Mail Service (5.5.2448.0)
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Bill Radcliffe <BillR at corbis.com>
+Content-Type: text/plain;
+	charset="ISO-8859-1"
+Status: RO
+Content-Length: 5643
+Lines: 161
+
+Your problem is that you are trying to use transparency, but you really want
+to use alpha channel blending. I'll show you how if you can send me another
+copy of MCS_C_11452.gif before it is flattened out into a GIF file. You need
+to have an input file were the "image" pixels are in the RGB parts of the
+file, and the "cutout" is in the "alpha" channel. The alpha channel contains
+a value for each and every pixel that defines the opacity of the pixel. Two
+file formats that support this are Photoshop and TIFF.
+
+> -----Original Message-----
+> From:	Steve Sapovits [SMTP:SapovitsS at globalsportsinc.com]
+> Sent:	Thursday, February 24, 2000 8:34 AM
+> To:	Bill Radcliffe
+> Subject:	RE: Transparency question
+> 
+> 
+> Good idea, of course.
+> 
+> This is run from a bigger program but I distilled it down to a simpler 
+> set of commands to reproduce.  I run these two commands:
+> 
+> mogrify -geometry 120x120! 'MCS_C_11452.gif'
+> combine 'MCS_C_120x150.gif' -gravity south 'MCS_C_11452.gif' -compose over
+> 'result.gif'
+> 
+> I get this output:
+> 
+> mogrify: no delegates configuration file found (delegates.mgk).
+> mogrify: no encode delegate for this image format (Y).
+> combine: no delegates configuration file found (delegates.mgk).
+> 
+> I've gotten these 'delegates' messages before with no ill effects. 
+> 
+> Here are the files I'm using.  The 'result.gif' has the whitespace I
+> mentioned.  Any help
+> would be greatly appreciated.  I'll write a perl program for you in
+> exchange
+> or something.  8-)
+> 
+>  <<MCS_C_11452.gif>>  <<MCS_C_120x150.gif>>  <<result.gif>> 
+> 
+> 
+> > -----Original Message-----
+> > From:	Bill Radcliffe [SMTP:BillR at corbis.com]
+> > Sent:	Thursday, February 24, 2000 11:07 AM
+> > To:	'Steve Sapovits'; 'magick at wizards.dupont.com'
+> > Subject:	RE: Transparency question
+> > 
+> > It would help me if you could send some small samples of exactly the
+> > effect
+> > you are trying to achieve. I'm sure IM can do whatever you want but the
+> > road
+> > to get there may not be at all obvious.
+> > 
+> > > -----Original Message-----
+> > > From:	Steve Sapovits [SMTP:SapovitsS at globalsportsinc.com]
+> > > Sent:	Wednesday, February 23, 2000 10:32 AM
+> > > To:	Steve Sapovits; magick at wizards.dupont.com
+> > > Subject:	RE: Transparency question
+> > > 
+> > > 
+> > > Someone on this list and my image folks here seem to confirm that the
+> > > problem
+> > > here is with 'fringe' pixels that were not trimmed back as neatly as
+> > > possible.  Any
+> > > suggestions for automating this?  This whole thing needs to be
+> batched.
+> > I
+> > > played
+> > > with the transparency and fuzz options with no real difference noted.
+> > > Trying 
+> > > crop 0x0 makes some of the fringe whitespace areas neater, but it
+> > doesn't
+> > > get rid
+> > > of them.
+> > > 
+> > > Any suggestions?
+> > > 
+> > > > -----Original Message-----
+> > > > From:	Steve Sapovits [SMTP:SapovitsS at globalsportsinc.com]
+> > > > Sent:	Wednesday, February 23, 2000 10:58 AM
+> > > > To:	magick at wizards.dupont.com
+> > > > Subject:	Transparency question
+> > > > 
+> > > > 
+> > > > I'm trying to do the following:
+> > > > 
+> > > > 1)  Take a JPEG image and size it down to a particular size.
+> > > > 2)  Overlay that JPEG on top of an GIF image to form a combined
+> > result.
+> > > > 
+> > > > This works fine for the most part:  I use mogrify to resize,
+> followed
+> > by
+> > > 
+> > > > combine to overlay.
+> > > > 
+> > > > Now I'm presented with GIF images (the ones the JPEG is put on top
+> of)
+> > > > that have colors or other background attributes we want to 'show
+> > > through'
+> > > > the overlay where there is no image.
+> > > > 
+> > > > Even without any transparency options this seems to ALMOST work.
+> The
+> > > > problem is that there's a small area around each image of 'white'
+> that
+> > > > always
+> > > > shows up.  Trying transparency or the 'matte' option of '-draw'
+> seems
+> > to
+> > > > have
+> > > > no effect.
+> > > > 
+> > > > Any ideas?  I'm an engineer -- not an image expert.  The images in
+> > > > question
+> > > > are handed to me.  I can change them if necessary and if it can be
+> > done
+> > > > via
+> > > > the ImageMagick tool.  The volume we generate makes manual changes
+> to 
+> > > > each image out of the question.
+> > > > 
+> > > > ----
+> > > > Steve Sapovits
+> > > > Global Sports Interactive
+> > > > Work Email: sapovitss at globalsportsinc.com
+> > > > Home Email: steves at delanet.com
+> > > > Work Phone: 610-491-7087
+> > > > Cell:       610-574-7706
+> > > > Pager:      877-239-4003
+> > > > 
+> > > > 
+> > > >
+> > ***********************************************************************
+> > > > To remove yourself from this mailing list, send mail to:
+> > > > 	majordomo at wizards.dupont.com
+> > > > 
+> > > > Include the following command in the body of your message:
+> > > > 	unsubscribe magick
+> > > >
+> > ***********************************************************************
+> > > 
+> > >
+> ***********************************************************************
+> > > To remove yourself from this mailing list, send mail to:
+> > > 	majordomo at wizards.dupont.com
+> > > 
+> > > Include the following command in the body of your message:
+> > > 	unsubscribe magick
+> > >
+> *********************************************************************** <<
+> File: MCS_C_11452.gif >>  << File: MCS_C_120x150.gif >>  << File:
+> result.gif >> 
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at unca-don.wizards.dupont.com Thu Feb 24 20:21 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id UAA23276
+	for <markov at ATComputing.nl>; Thu, 24 Feb 2000 20:21:08 +0100 (MET)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id UAA23679
+	for <markov at ATComputing.nl>; Thu, 24 Feb 2000 20:21:08 +0100
+Received: from viper.oldcity.dca.net(216.158.38.4) by ns.ATComputing.nl via smap (V2.1)
+	id xma023676; Thu, 24 Feb 00 20:20:57 +0100
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by viper.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id OAA10625;
+	Thu, 24 Feb 2000 14:17:28 -0500
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id NAA16562
+	for magick-outgoing; Thu, 24 Feb 2000 13:40:21 -0500 (EST)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-ID: <8100014B48DAD111AA4100805F9F3FC903A0E5BF at host60.corbis.com>
+From: Bill Radcliffe <BillR at corbis.com>
+To: "'Steve Sapovits'" <SapovitsS at globalsportsinc.com>
+Cc: "'magick at wizards.dupont.com'" <magick at wizards.dupont.com>
+Subject: RE: Transparency question
+Date: Thu, 24 Feb 2000 10:42:23 -0800
+MIME-Version: 1.0
+X-Mailer: Internet Mail Service (5.5.2448.0)
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Bill Radcliffe <BillR at corbis.com>
+Content-Type: text/plain;
+	charset="ISO-8859-1"
+Status: RO
+Content-Length: 7382
+Lines: 206
+
+OK - here is a "possible" solution. This sequence relies on the fact that
+the input image was originally composited on a white background. It takes
+the image and generates a "fake" alpha channel (mask) and uses this during
+the compositing operation. It looks pretty good, but has the disadvantage
+that the background will tend to influence the colors in the final image
+more then you would want.
+
+: first convert to an RGB format with no more transparency or mask channel
+convert -compression none MCS_C_11452.gif MCS_C_11452_rgb.bmp
+: now make a fake alpha channel using a grayscale version of the image
+(inverted) 
+convert -compression none -colorspace gray -negate MCS_C_11452.gif
+MCS_C_11452_a.bmp
+: combine the original image along with the fake alpha channel onto the
+background
+combine -gravity south -compose over MCS_C_120x150.gif MCS_C_11452.gif
+MCS_C_11452_a.bmp result.gif 
+
+> -----Original Message-----
+> From:	Bill Radcliffe 
+> Sent:	Thursday, February 24, 2000 8:55 AM
+> To:	'Steve Sapovits'
+> Cc:	'magick at wizards.dupont.com'
+> Subject:	RE: Transparency question
+> 
+> Your problem is that you are trying to use transparency, but you really
+> want
+> to use alpha channel blending. I'll show you how if you can send me
+> another
+> copy of MCS_C_11452.gif before it is flattened out into a GIF file. You
+> need
+> to have an input file were the "image" pixels are in the RGB parts of the
+> file, and the "cutout" is in the "alpha" channel. The alpha channel
+> contains
+> a value for each and every pixel that defines the opacity of the pixel.
+> Two
+> file formats that support this are Photoshop and TIFF.
+> 
+> > -----Original Message-----
+> > From:	Steve Sapovits [SMTP:SapovitsS at globalsportsinc.com]
+> > Sent:	Thursday, February 24, 2000 8:34 AM
+> > To:	Bill Radcliffe
+> > Subject:	RE: Transparency question
+> > 
+> > 
+> > Good idea, of course.
+> > 
+> > This is run from a bigger program but I distilled it down to a simpler 
+> > set of commands to reproduce.  I run these two commands:
+> > 
+> > mogrify -geometry 120x120! 'MCS_C_11452.gif'
+> > combine 'MCS_C_120x150.gif' -gravity south 'MCS_C_11452.gif' -compose
+> over
+> > 'result.gif'
+> > 
+> > I get this output:
+> > 
+> > mogrify: no delegates configuration file found (delegates.mgk).
+> > mogrify: no encode delegate for this image format (Y).
+> > combine: no delegates configuration file found (delegates.mgk).
+> > 
+> > I've gotten these 'delegates' messages before with no ill effects. 
+> > 
+> > Here are the files I'm using.  The 'result.gif' has the whitespace I
+> > mentioned.  Any help
+> > would be greatly appreciated.  I'll write a perl program for you in
+> > exchange
+> > or something.  8-)
+> > 
+> >  <<MCS_C_11452.gif>>  <<MCS_C_120x150.gif>>  <<result.gif>> 
+> > 
+> > 
+> > > -----Original Message-----
+> > > From:	Bill Radcliffe [SMTP:BillR at corbis.com]
+> > > Sent:	Thursday, February 24, 2000 11:07 AM
+> > > To:	'Steve Sapovits'; 'magick at wizards.dupont.com'
+> > > Subject:	RE: Transparency question
+> > > 
+> > > It would help me if you could send some small samples of exactly the
+> > > effect
+> > > you are trying to achieve. I'm sure IM can do whatever you want but
+> the
+> > > road
+> > > to get there may not be at all obvious.
+> > > 
+> > > > -----Original Message-----
+> > > > From:	Steve Sapovits [SMTP:SapovitsS at globalsportsinc.com]
+> > > > Sent:	Wednesday, February 23, 2000 10:32 AM
+> > > > To:	Steve Sapovits; magick at wizards.dupont.com
+> > > > Subject:	RE: Transparency question
+> > > > 
+> > > > 
+> > > > Someone on this list and my image folks here seem to confirm that
+> the
+> > > > problem
+> > > > here is with 'fringe' pixels that were not trimmed back as neatly as
+> > > > possible.  Any
+> > > > suggestions for automating this?  This whole thing needs to be
+> > batched.
+> > > I
+> > > > played
+> > > > with the transparency and fuzz options with no real difference
+> noted.
+> > > > Trying 
+> > > > crop 0x0 makes some of the fringe whitespace areas neater, but it
+> > > doesn't
+> > > > get rid
+> > > > of them.
+> > > > 
+> > > > Any suggestions?
+> > > > 
+> > > > > -----Original Message-----
+> > > > > From:	Steve Sapovits [SMTP:SapovitsS at globalsportsinc.com]
+> > > > > Sent:	Wednesday, February 23, 2000 10:58 AM
+> > > > > To:	magick at wizards.dupont.com
+> > > > > Subject:	Transparency question
+> > > > > 
+> > > > > 
+> > > > > I'm trying to do the following:
+> > > > > 
+> > > > > 1)  Take a JPEG image and size it down to a particular size.
+> > > > > 2)  Overlay that JPEG on top of an GIF image to form a combined
+> > > result.
+> > > > > 
+> > > > > This works fine for the most part:  I use mogrify to resize,
+> > followed
+> > > by
+> > > > 
+> > > > > combine to overlay.
+> > > > > 
+> > > > > Now I'm presented with GIF images (the ones the JPEG is put on top
+> > of)
+> > > > > that have colors or other background attributes we want to 'show
+> > > > through'
+> > > > > the overlay where there is no image.
+> > > > > 
+> > > > > Even without any transparency options this seems to ALMOST work.
+> > The
+> > > > > problem is that there's a small area around each image of 'white'
+> > that
+> > > > > always
+> > > > > shows up.  Trying transparency or the 'matte' option of '-draw'
+> > seems
+> > > to
+> > > > > have
+> > > > > no effect.
+> > > > > 
+> > > > > Any ideas?  I'm an engineer -- not an image expert.  The images in
+> > > > > question
+> > > > > are handed to me.  I can change them if necessary and if it can be
+> > > done
+> > > > > via
+> > > > > the ImageMagick tool.  The volume we generate makes manual changes
+> > to 
+> > > > > each image out of the question.
+> > > > > 
+> > > > > ----
+> > > > > Steve Sapovits
+> > > > > Global Sports Interactive
+> > > > > Work Email: sapovitss at globalsportsinc.com
+> > > > > Home Email: steves at delanet.com
+> > > > > Work Phone: 610-491-7087
+> > > > > Cell:       610-574-7706
+> > > > > Pager:      877-239-4003
+> > > > > 
+> > > > > 
+> > > > >
+> > >
+> ***********************************************************************
+> > > > > To remove yourself from this mailing list, send mail to:
+> > > > > 	majordomo at wizards.dupont.com
+> > > > > 
+> > > > > Include the following command in the body of your message:
+> > > > > 	unsubscribe magick
+> > > > >
+> > >
+> ***********************************************************************
+> > > > 
+> > > >
+> > ***********************************************************************
+> > > > To remove yourself from this mailing list, send mail to:
+> > > > 	majordomo at wizards.dupont.com
+> > > > 
+> > > > Include the following command in the body of your message:
+> > > > 	unsubscribe magick
+> > > >
+> > ***********************************************************************
+> <<
+> > File: MCS_C_11452.gif >>  << File: MCS_C_120x150.gif >>  << File:
+> > result.gif >> 
+> 
+> ***********************************************************************
+> To remove yourself from this mailing list, send mail to:
+> 	majordomo at wizards.dupont.com
+> 
+> Include the following command in the body of your message:
+> 	unsubscribe magick
+> ***********************************************************************
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From markov Sun Aug  8 10:04:17 1999
+Subject: Resize with Transparency
+To: magick at wizards.dupont.com
+Date: Sun, 8 Aug 1999 10:04:17 +0200 (MET DST)
+Reply-To: markov at ATComputing.nl (Mark Overmeer)
+X-Mailer: ELM [version 2.4 PL21]
+MIME-Version: 1.0
+Content-Type: text/plain; charset=US-ASCII
+Content-Transfer-Encoding: 7bit
+Status: RO
+Content-Length: 1376
+Lines: 37
+
+
+Hi,
+
+Maybe someone knows a solution, maybe for enhancement:
+
+  I have an image (say black on white), where white is set
+  to be transparent.  I can display the image on any background,
+  without seeing white.
+    Now I resize the image with anti-aliasing.  For that, we have
+  to intermediate pixels, which also requires interpolating
+  the black pixels and background pixels.
+    But: I my case, the background has a different (but known) color
+  every time i.e. need to anti-alias the same image to different
+  backgrounds.  I would like to write:
+
+     my $image->Read('original.gif');
+     $image->Set(background => 'blue');
+     $image->Scale('50%x50%');
+     $image->Write('small.gif');
+
+However, ImageMagick (ImageMagick 4.2.7, PerlMagick 4.27 on Linux)
+takes as value for a transparent pixel not the value of `background',
+but the color used to define a transparent color: in this case
+`white'.  My image reduced as above shows white pixels on my blue
+background.
+
+  Is my expectation wrong?
+
+  Does anyone know a work-around?
+-- 
+Thanks,
+               Mark Overmeer   %-]
+
+------------------------------------------------------------------------
+drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+From magick-owner at unca-don.wizards.dupont.com Thu Mar 30 19:09 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id TAA14579
+	for <markov at ATComputing.nl>; Thu, 30 Mar 2000 19:09:10 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id TAA31447
+	for <markov at ATComputing.nl>; Thu, 30 Mar 2000 19:09:10 +0200
+Received: from viper.oldcity.dca.net(216.158.38.4) by ns.ATComputing.nl via smap (V2.1)
+	id xma031440; Thu, 30 Mar 00 19:08:51 +0200
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by viper.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id MAA10121;
+	Thu, 30 Mar 2000 12:04:52 -0500
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id LAA03360
+	for magick-outgoing; Thu, 30 Mar 2000 11:44:20 -0500 (EST)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-ID: <8100014B48DAD111AA4100805F9F3FC903A0E75D at host60.corbis.com>
+From: Bill Radcliffe <BillR at corbis.com>
+To: "'Ivo'" <ivo.penzar at infolink-software.com>, magick at wizards.dupont.com,
+        tiff at olympiakos.com
+Subject: RE: jpeg2000 question
+Date: Thu, 30 Mar 2000 08:46:50 -0800
+MIME-Version: 1.0
+X-Mailer: Internet Mail Service (5.5.2448.0)
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Bill Radcliffe <BillR at corbis.com>
+Content-Type: text/plain
+Status: RO
+Content-Length: 2759
+Lines: 66
+
+I worked on the definition of the JP2 file format.  The situation with
+JPEG2000 is not at all like JPEG.
+
+You should know is that JP2 is a very simple wrapper around the formal
+JPEG2000 "codestream". It was based on the Quicktime idea of "atoms". This
+simple idea is that you have a tag and a length followed by the "stuff". You
+know what the "stuff" is based on the tag type. You can also nest these
+atoms to build more complex structures.
+
+JP2 is a very simple set of these atoms, most of which are optional. You
+could write a program to implement this in about 15 minutes.  The "hard"
+part of JP2 is the "codestream". This is the encoded JPEG2000 data. Good
+luck on that. We don't have a freely available reference implementation at
+this point because nobody has signed up to do it. There was an effort
+underway by the same group that did the JPEG-LS implementation. This was
+given to the public domain..
+
+http://spmg.ece.ubc.ca/research/jpeg/jpeg_ls/jpegls.html
+
+They actually had an implementation of JPEG2000 on their website but pulled
+it off:
+
+http://www.ece.ubc.ca/~mdadams/jasper/
+
+Apparently, they decided to sell out and try to charge for it instead of
+providing it to the public domain. We all know how well that is going to
+work. When are people going to learn that you can't make money selling
+compression software? It's not a business - its just an enabler.
+
+My opinion is that without a "Tom Lane" type signing up to make a free
+implementation available, JPEG2000 is doomed. You just don't get real
+interoperability from a paper spec. We know this.
+
+The good news is that the Digital Imaging Group (DIG) has a project underway
+to do this. The bad news is that it has not yet started. And so we wait :-)
+
+> -----Original Message-----
+> From:	Ivo [SMTP:ivo.penzar at infolink-software.com]
+> Sent:	Thursday, March 30, 2000 1:37 AM
+> To:	magick at wizards.dupont.com; tiff at olympiakos.com
+> Subject:	jpeg2000 question
+> 
+> Does anybody know of some repository of jp2 (jpeg2000, to be approved by
+> ISO/ITU-T by the end of this year) and/or a tool to write (some sort of)
+> those images.
+> 
+> Thanks,
+> Ivo
+> 
+> 
+> 
+> ***********************************************************************
+> To remove yourself from this mailing list, send mail to:
+> 	majordomo at wizards.dupont.com
+> 
+> Include the following command in the body of your message:
+> 	unsubscribe magick
+> ***********************************************************************
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From markov at ATComputing.nl Fri Mar 31 17:01:17 2000
+Date: Fri, 31 Mar 2000 17:01:17 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: Carl Knoos <cknoos at atg.com>
+Cc: magick at wizards.dupont.com
+Subject: Re: Problem resizing images through perl script
+Message-ID: <20000331170117.B2095 at atcmpg.ATComputing.nl>
+References: <10F4E7B8292FD311B34400A0C978B70532A61B at a254.117.208.207.ded23.interaccess.com> <NDBBJJFDMKFOAIFBEPPJIELLCBAA.cknoos at atg.com>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+X-Mailer: Mutt 1.0pre4i
+In-Reply-To: <NDBBJJFDMKFOAIFBEPPJIELLCBAA.cknoos at atg.com>; from cknoos at atg.com on Thu, Mar 30, 2000 at 06:27:54PM -0500
+Status: RO
+Content-Length: 820
+Lines: 23
+
+* Carl Knoos (cknoos at atg.com) [000331 01:39]:
+> if I run mogrify -geometry 95x95 whatever.jpg
+> I get exactly what I want, except when I try
+> to do it from Perl...
+
+> 		# resize it.
+> 		$result="$mogrifypath/mogrify -geometry 96x96
+> $GalleryPath/tn_$ShortFilename";
+
+I assume you try to execute this code: use back-tics:
+
+$result=`$mogrifypath/mogrify -geometry 96x96 $GalleryPath/tn_$ShortFilename`;
+
+or better qx(...)
+
+Is it just a slip of pen here, or just usual programmers-blindness?
+-- 
+               MarkOv       %-]
+
+------------------------------------------------------------------------
+drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+From magick-owner at unca-don.wizards.dupont.com Fri Mar 31 01:39 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id BAA16135
+	for <markov at ATComputing.nl>; Fri, 31 Mar 2000 01:39:18 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id BAA31743
+	for <markov at ATComputing.nl>; Fri, 31 Mar 2000 01:39:18 +0200
+Received: from viper.oldcity.dca.net(216.158.38.4) by ns.ATComputing.nl via smap (V2.1)
+	id xma031741; Fri, 31 Mar 00 01:39:12 +0200
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by viper.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id SAA08310;
+	Thu, 30 Mar 2000 18:37:29 -0500
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id SAA05154
+	for magick-outgoing; Thu, 30 Mar 2000 18:24:04 -0500 (EST)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+From: "Carl Knoos" <cknoos at atg.com>
+To: <magick at wizards.dupont.com>
+Subject: Problem resizing images through perl script
+Date: Thu, 30 Mar 2000 18:27:54 -0500
+Message-ID: <NDBBJJFDMKFOAIFBEPPJIELLCBAA.cknoos at atg.com>
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+X-Priority: 3 (Normal)
+X-MSMail-Priority: Normal
+X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
+In-Reply-To: <10F4E7B8292FD311B34400A0C978B70532A61B at a254.117.208.207.ded23.interaccess.com>
+Importance: Normal
+X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: "Carl Knoos" <cknoos at atg.com>
+Content-Type: text/plain;
+	charset="iso-8859-1"
+Status: RO
+X-Status: A
+Content-Length: 1270
+Lines: 47
+
+I know this probably doesn't belong here, but
+I don't who else to ask :)
+
+Basically, I have imagemagick installed and it works
+like a charm!
+
+if I run mogrify -geometry 95x95 whatever.jpg
+I get exactly what I want, except when I try
+to do it from Perl...
+
+If I in a perl script say:
+
+sub GenerateThumb {
+	$fsize = -s "$GalleryPath/$ShortFilename";
+	if ($thumbmethod == 1) {
+		# copy image.
+		open(IMGFILE, "$GalleryPath/$ShortFilename");
+		open(TNFILE, ">$GalleryPath/tn_$ShortFilename");
+		binmode(IMGFILE);
+		binmode(TNFILE);
+		read(IMGFILE, $buffer, $fsize);
+		print TNFILE $buffer;
+		close(TNFILE);
+		close(IMGFILE);
+		chmod (0777, "$GalleryPath/tn_$ShortFilename");
+		# resize it.
+		$result="$mogrifypath/mogrify -geometry 96x96
+$GalleryPath/tn_$ShortFilename";
+	}
+}
+
+It all works great until it comes to the resizing, it just seem to skip the
+last step.
+the variable $mogrifypath is set correctly to /usr/bin
+
+Does anyone what I'm doing wrong?
+
+/Carl
+
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at unca-don.wizards.dupont.com Fri Mar 31 02:25 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id CAA16260
+	for <markov at ATComputing.nl>; Fri, 31 Mar 2000 02:25:19 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id CAA31781
+	for <markov at ATComputing.nl>; Fri, 31 Mar 2000 02:25:19 +0200
+Received: from mustang.oldcity.dca.net(216.158.38.3) by ns.ATComputing.nl via smap (V2.1)
+	id xma031779; Fri, 31 Mar 00 02:25:12 +0200
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by mustang.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id TAA21824;
+	Thu, 30 Mar 2000 19:23:29 -0500
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id TAA05326
+	for magick-outgoing; Thu, 30 Mar 2000 19:16:20 -0500 (EST)
+	<10F4E7B8292FD311B34400A0C978B70532A61B at a254.117.208.207.ded23.
+	interaccess.com>
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Mime-Version: 1.0
+X-Sender: leonardr at mail1.netreach.net
+Message-Id: <a04310102b5099e5b4e3f@[207.29.200.50]>
+In-Reply-To: 
+ <10F4E7B8292FD311B34400A0C978B70532A61B at a254.117.208.207.ded23.interaccess.com>
+References: 
+ <10F4E7B8292FD311B34400A0C978B70532A61B at a254.117.208.207.ded23.interaccess.com>
+Date: Thu, 30 Mar 2000 19:15:48 -0500
+To: Joseph Korabelnikov <jkorabelnikov at coolemail.com>
+        magick at wizards.dupont.com
+From: Leonard Rosenthol <leonardr at lazerware.com>
+Subject: Re: Convert HTM, HTML files to the .jpg format
+X-MIME-Autoconverted: from quoted-printable to 8bit by unca-don.wizards.dupont.com id TAA05323
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Leonard Rosenthol <leonardr at lazerware.com>
+X-MIME-Autoconverted: from 8bit to quoted-printable by mustang.oldcity.dca.net id TAA21824
+Content-Transfer-Encoding: 8bit
+X-MIME-Autoconverted: from quoted-printable to 8bit by atcmpg.ATComputing.nl id CAA16260
+Content-Type: text/plain; charset="iso-8859-1" ; format="flowed"
+Status: RO
+Content-Length: 1198
+Lines: 33
+
+At 4:12 PM -0600 3/30/00, Joseph Korabelnikov wrote:
+>I attempted to convert HTML file to the .jpg format from Command Prompt
+>window and got an error :
+>
+>	convert: delegate failed (html2ps -o %o %i).
+>	convert: no delegate for this image format (HTML).
+>
+>As I understood situation I need to install mgtl2ps library. Am I right. If
+>so, where to get it?
+>
+	You can find it at <http://www.tdb.uu.se/~jan/html2ps.html>.
+
+
+
+LDR
+-- 
+----------------------------------------------------------------------------
+                   You've got a SmartFriend in Pennsylvania
+----------------------------------------------------------------------------
+Leonard Rosenthol      			Internet:       leonardr at lazerware.com
+					America Online: MACgician
+Web Site: <http://www.lazerware.com/>
+FTP Site: <ftp://ftp.lazerware.com/>
+PGP Fingerprint: C76E 0497 C459 182D 0C6B  AB6B CA10 B4DF 8067 5E65
+
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From markov at ATComputing.nl Mon Apr  3 08:25:55 2000
+Date: Mon, 3 Apr 2000 08:25:55 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: Carl Knoos <cknoos at atg.com>
+Subject: Re: Problem resizing images through perl script
+Message-ID: <20000403082555.B11537 at atcmpg.ATComputing.nl>
+References: <20000331170117.B2095 at atcmpg.ATComputing.nl> <NDBBJJFDMKFOAIFBEPPJIEOCCBAA.cknoos at atg.com>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+X-Mailer: Mutt 1.0pre4i
+In-Reply-To: <NDBBJJFDMKFOAIFBEPPJIEOCCBAA.cknoos at atg.com>; from cknoos at atg.com on Sat, Apr 01, 2000 at 03:40:32PM -0500
+Status: RO
+Content-Length: 1046
+Lines: 23
+
+* Carl Knoos (cknoos at atg.com) [000401 22:42]:
+> ld.so.1: /usr/local/bin/mogrify: fatal: libttf.so.2: open failed: No such
+> file or directory
+
+Typical for installing ImageMagick binaries: they are precompiled on a
+system with a long list of shared-libs.  IM is very powerful, so there
+are many libs.  While starting, the libs are contacted.
+   Search for a libttf.so : you may not have it, have the wrong version
+or just a lacking link. ttf = True Type Fonts, and the lib is available
+at freetype.org.
+
+> I've asked the company that I rent space from to install
+> PerlMagick on the box, hopefully I won't have all these
+> problems if they do.
+
+Compatibility between all those libs and apps will continue to haunt us.
+-- 
+               MarkOv       %-]
+
+------------------------------------------------------------------------
+drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+From cknoos at atg.com Sat Apr  1 22:42 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id WAA04105
+	for <markov at ATComputing.nl>; Sat, 1 Apr 2000 22:42:15 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id WAA01429
+	for <markov at ATComputing.nl>; Sat, 1 Apr 2000 22:42:14 +0200
+Received: from art.atg.com(205.181.94.1) by ns.ATComputing.nl via smap (V2.1)
+	id xma001427; Sat, 1 Apr 00 22:42:05 +0200
+Received: from donkeykong (donkey-kong.atg.com [205.181.107.218])
+	by art.atg.com (8.9.1/8.9.1) with SMTP id PAA24854
+	for <markov at ATComputing.nl>; Sat, 1 Apr 2000 15:42:29 -0500 (EST)
+From: "Carl Knoos" <cknoos at atg.com>
+To: "Mark Overmeer" <markov at ATComputing.nl>
+Subject: RE: Problem resizing images through perl script
+Date: Sat, 1 Apr 2000 15:40:32 -0500
+Message-ID: <NDBBJJFDMKFOAIFBEPPJIEOCCBAA.cknoos at atg.com>
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+X-Priority: 3 (Normal)
+X-MSMail-Priority: Normal
+X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
+X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
+Importance: Normal
+In-Reply-To: <20000331170117.B2095 at atcmpg.ATComputing.nl>
+Content-Type: text/plain;
+	charset="iso-8859-1"
+Status: RO
+X-Status: A
+Content-Length: 1865
+Lines: 63
+
+Blindness :)
+
+Now I'm on to the next problem though...
+
+when I try to execute the line from the script,
+my webservers error log contains this:
+
+ld.so.1: /usr/local/bin/mogrify: fatal: libttf.so.2: open failed: No such
+file or directory
+
+I'm seriously starting to get ticked now... hehe :)
+
+I've asked the company that I rent space from to install
+PerlMagick on the box, hopefully I won't have all these
+problems if they do.
+
+Thanks for your help! :)
+
+/Carl
+
+
+-----Original Message-----
+From: owner-magick at wizards.dupont.com
+[mailto:owner-magick at wizards.dupont.com]On Behalf Of Mark Overmeer
+Sent: Friday, March 31, 2000 10:01 AM
+To: Carl Knoos
+Cc: magick at wizards.dupont.com
+Subject: Re: Problem resizing images through perl script
+
+
+* Carl Knoos (cknoos at atg.com) [000331 01:39]:
+> if I run mogrify -geometry 95x95 whatever.jpg
+> I get exactly what I want, except when I try
+> to do it from Perl...
+
+> 		# resize it.
+> 		$result="$mogrifypath/mogrify -geometry 96x96
+> $GalleryPath/tn_$ShortFilename";
+
+I assume you try to execute this code: use back-tics:
+
+$result=`$mogrifypath/mogrify -geometry 96x96
+$GalleryPath/tn_$ShortFilename`;
+
+or better qx(...)
+
+Is it just a slip of pen here, or just usual programmers-blindness?
+--
+               MarkOv       %-]
+
+------------------------------------------------------------------------
+drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+
+From markov at ATComputing.nl Tue May  9 15:14:18 2000
+Date: Tue, 9 May 2000 15:14:18 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: Pletschette Andre <andre.pletschette at gmx.net>
+Subject: Re: Undefined Symbol: SetWarningHandler
+Message-ID: <20000509151418.B15139 at atcmpg.ATComputing.nl>
+References: <3917FC90.8B8B0CF at gmx.net>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+X-Mailer: Mutt 1.0pre4i
+In-Reply-To: <3917FC90.8B8B0CF at gmx.net>; from andre.pletschette at gmx.net on Tue, May 09, 2000 at 01:54:56PM +0200
+Status: RO
+Content-Length: 1095
+Lines: 25
+
+* Pletschette Andre (andre.pletschette at gmx.net) [000509 15:11]:
+> When I tried to write a perl script with the following line in it:
+>   use Image::Magick;
+> I get the following error-message:
+> 
+>   perl: error in loading shared librairies:
+>   /usr/lib/perl5/site_perl/5.005/i586-lin
+>   ux/auto/Image/Magick/Magick.so: undefined symbol: SetWarningHandler
+> 
+> Could anybody tell me what this means, and how I can get it run, I run 
+> Suse Linux 6.3 and I've installed Image Magick with the C++ and the Perl
+> Modules.
+
+The Perl::Magick and Image::Magick/ImageMagick modules are not compatible.
+Just reinstall all yourself from www.ImageMagick.org.
+
+Be warned: you have to remove the old Perl::Magick *.pm files too, otherwise
+you may still use the old versions...
+--
+               MarkOv       %-]
+
+------------------------------------------------------------------------
+drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+From magick-owner at unca-don.wizards.dupont.com Tue May  9 15:11 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id PAA15311
+	for <markov at ATComputing.nl>; Tue, 9 May 2000 15:11:14 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id PAA24539
+	for <markov at ATComputing.nl>; Tue, 9 May 2000 15:11:13 +0200
+Received: from mustang.oldcity.dca.net(216.158.38.3) by ns.ATComputing.nl via smap (V2.1)
+	id xma024537; Tue, 9 May 00 15:11:01 +0200
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by mustang.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id JAA17934;
+	Tue, 9 May 2000 09:09:29 -0400
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id IAA13522
+	for magick-outgoing; Tue, 9 May 2000 08:42:00 -0400 (EDT)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-ID: <3917FC90.8B8B0CF at gmx.net>
+Date: Tue, 09 May 2000 13:54:56 +0200
+From: Pletschette Andre <andre.pletschette at gmx.net>
+X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.13 i586)
+X-Accept-Language: fr, en, de
+MIME-Version: 1.0
+To: "magick at wizards.dupont.com" <magick at wizards.dupont.com>
+Subject: Undefined Symbol: SetWarningHandler
+Content-Transfer-Encoding: 7bit
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Pletschette Andre <andre.pletschette at gmx.net>
+Content-Type: text/plain; charset=us-ascii
+Status: RO
+X-Status: A
+Content-Length: 747
+Lines: 19
+
+When I tried to write a perl script with the following line in it:
+  use Image::Magick;
+I get the following error-message:
+
+  perl: error in loading shared librairies:
+  /usr/lib/perl5/site_perl/5.005/i586-lin
+  ux/auto/Image/Magick/Magick.so: undefined symbol: SetWarningHandler
+
+Could anybody tell me what this means, and how I can get it run, I run 
+Suse Linux 6.3 and I've installed Image Magick with the C++ and the Perl
+Modules.
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at unca-don.wizards.dupont.com Wed May 17 16:07 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id QAA15770
+	for <markov at ATComputing.nl>; Wed, 17 May 2000 16:07:07 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id QAA04359
+	for <markov at ATComputing.nl>; Wed, 17 May 2000 16:07:06 +0200
+Received: from mustang.oldcity.dca.net(216.158.38.3) by ns.ATComputing.nl via smap (V2.1)
+	id xma004357; Wed, 17 May 00 16:06:40 +0200
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by mustang.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id KAA02079;
+	Wed, 17 May 2000 10:05:01 -0400
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id JAA23880
+	for magick-outgoing; Wed, 17 May 2000 09:41:41 -0400 (EDT)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Date: Wed, 17 May 2000 08:46:17 -0500 (CDT)
+From: Bob Friesenhahn <bfriesen at simple.dallas.tx.us>
+X-Sender: bfriesen at scooby.simplesystems.org
+To: Martin Bobrovsky <Martin.Bobrovsky at workforce.at>
+cc: ImageMagick Mailing List <magick at wizards.dupont.com>
+Subject: Re: watermarks/embossing
+In-Reply-To: <4.3.1.2.20000517112416.00c72e30 at mail.dot.at>
+Message-ID: <Pine.SO4.4.05.10005170826000.20112-100000 at scooby.simplesystems.org>
+MIME-Version: 1.0
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Bob Friesenhahn <bfriesen at simple.dallas.tx.us>
+Content-Type: TEXT/PLAIN; charset=US-ASCII
+Status: RO
+Content-Length: 1859
+Lines: 53
+
+If you can afford the Digimarc library (see
+http://www.digimarc.com/licensing/sdk.html &
+http://www.digimarc.com/news/pr00-13.html), Bill Radcliffe
+<BillR at corbis.com> can send you source for an ImageMagick module to do
+professional-grade watermarking.
+
+ImageMagick's 'combine' utility supports simplistic hidden
+watermarking via its -stegano option.  If you want a visible logo, you
+could use -compose to compose your logo on top of, or blended with,
+the base image.  Your visible logo can be mostly transparent in order
+to not disturb the image too much.
+
+See this interesting article about digital watermarking:
+http://www.spie.org/web/oer/november/nov99/cover1.html
+
+Bob
+
+On Wed, 17 May 2000, Martin Bobrovsky wrote:
+
+> Hi!
+> 
+> Can someone tell how I achieve the effect of embossing a text onto an 
+> image? My intention is to "secure" images on the web by applying a symbol 
+> or text which on the one hand does not affect the impression of the image 
+> too much, but on the other hand, makes the image "unusable" for 
+> professional printing purposes ...
+> 
+> thanks,
+> martin
+> 
+> 
+> ***********************************************************************
+> To remove yourself from this mailing list, send mail to:
+> 	majordomo at wizards.dupont.com
+> 
+> Include the following command in the body of your message:
+> 	unsubscribe magick
+> ***********************************************************************
+> 
+
+======================================
+Bob Friesenhahn
+bfriesen at simple.dallas.tx.us
+http://www.simplesystems.org/users/bfriesen
+
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-bugs at simple.dallas.tx.us Wed Jun 14 16:54 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id QAA25632
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 16:54:28 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id QAA12167
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 16:54:27 +0200
+Received: from ns.simplesystems.org(204.252.75.242) by ns.ATComputing.nl via smap (V2.1)
+	id xma012165; Wed, 14 Jun 00 16:54:12 +0200
+Received: from localhost (localhost [127.0.0.1])
+	by ns.simplesystems.org (8.9.3/8.9.3) with ESMTP id JAA14556
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 09:54:08 -0500 (CDT)
+From: magick-bugs at simple.dallas.tx.us
+Date: Wed, 14 Jun 2000 09:54:08 -0500 (CDT)
+Message-Id: <200006141454.JAA14556 at ns.simplesystems.org>
+To: markov at ATComputing.nl
+Subject: Re: Annotate problems (PR#298)
+X-Loop: magick-bugs at simple.dallas.tx.us
+Content-Type: text
+Status: RO
+X-Status: A
+Content-Length: 307
+Lines: 9
+
+Thank you for submitting an ImageMagick bug report to
+magick-bugs at simplesystems.org.
+
+Your bug report is available on the web at the URL
+http://www.simplesystems.org/ImageMagick/bugs?findid=298    
+
+Report any problems with the bug tracking system itself to
+Bob Friesenhahn <bfriesen at simple.dallas.tx.us>.
+
+
+From markov at ATComputing.nl Wed Jun 14 17:43:34 2000
+Date: Wed, 14 Jun 2000 17:43:34 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: Cristy <cristy at mystic.es.dupont.com>
+Subject: Re: your mail
+Message-ID: <20000614174334.G22766 at atcmpg.ATComputing.nl>
+References: <8172.960997992 at mystic>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+X-Mailer: Mutt 1.0pre4i
+In-Reply-To: <8172.960997992 at mystic>; from cristy at mystic.es.dupont.com on Wed, Jun 14, 2000 at 11:53:11AM -0400
+Status: RO
+X-Status: A
+Content-Length: 1403
+Lines: 34
+
+* Cristy (cristy at mystic.es.dupont.com) [000614 17:23]:
+>    $img->Read("logo:");
+>    $text="I am a LumberJack";
+>    $poinsize=40;
+>    my ($width, $height) = $img->Get('width', 'height');
+>    $img->Annotate
+>       ( fill    => 'yellow'
+>       , text      => $text
+>       , font      =>
+> '-bitstream-charter-medium-r-normal--40-0-0-0-p-0-iso8859-1'
+>       , gravity   => 'SouthEast'
+>       , 'x'       => 5
+>       , 'y'       => $poinsize+5
+>       );
+>    $img->Write(filename  => "test.gif");
+
+So: gravity work differently from my well known "anchor", where
+x,y defines a point and anchor the location of the point wrt the
+item to be put on the background.  It was not clear from the docs.
+
+It what you propose a feature or a designed thing?  You specify the
+coordinate of the right-top (NorthEast) wrt to the right-bottom
+(SouthEast).  I expect that x=0,y=0,SouthWest will work wrt to
+NorthWest.  It is not logical for me to treat North/South differently
+from East/West (designed before the fall of the Iron curtain?)
+
+And also: the text still appears in black.
+-- 
+               MarkOv       %-]
+
+------------------------------------------------------------------------
+drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+From cristy at mystic.es.dupont.com Wed Jun 14 17:23 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id RAA27207
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 17:23:28 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id RAA12199
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 17:23:27 +0200
+Received: from gatekeeper.es.dupont.com(192.26.233.2) by ns.ATComputing.nl via smap (V2.1)
+	id xma012197; Wed, 14 Jun 00 17:23:08 +0200
+Received: from mystic.es.dupont.com (mystic.es.dupont.com [138.196.253.24])
+	by gatekeeper.es.dupont.com (8.9.3/8.9.3) with ESMTP id LAA26619
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 11:23:06 -0400 (EDT)
+Received: (from cristy at localhost)
+	by mystic.es.dupont.com (8.10.0.Beta12/8.10.0.Beta12) id e5EFrBI08173
+	for markov at ATComputing.nl; Wed, 14 Jun 2000 11:53:11 -0400 (EDT)
+Date: Wed, 14 Jun 2000 11:53:11 -0400 (EDT)
+From: Cristy <cristy at mystic.es.dupont.com>
+Message-ID: <8172.960997992 at mystic>
+Mime-Version: 1.0
+To: markov at ATComputing.nl
+Content-Type: multipart/mixed; boundary="-"
+Status: RO
+X-Status: A
+Content-Length: 1042
+Lines: 21
+
+This is a MIME encoded message.  Decode it with "munpack"
+or any other MIME reading software.  Mpack/munpack is available
+via anonymous FTP in ftp.andrew.cmu.edu:pub/mpack/
+---
+Content-Type: application/octet-stream; name="test.pl"
+Content-Transfer-Encoding: base64
+Content-Disposition: inline; filename="test.pl"
+Content-MD5: el1GVGE1xEpFTeim4lKdYA==
+
+ICAgdXNlIEltYWdlOjpNYWdpY2s7CiAgICRpbWc9SW1hZ2U6Ok1hZ2ljay0+bmV3OwogICAk
+aW1nLT5SZWFkKCJsb2dvOiIpOwogICAkdGV4dD0iSSBhbSBhIEx1bWJlckphY2siOwogICAk
+cG9pbnNpemU9NDA7CiAgIG15ICgkd2lkdGgsICRoZWlnaHQpID0gJGltZy0+R2V0KCd3aWR0
+aCcsICdoZWlnaHQnKTsKICAgJGltZy0+QW5ub3RhdGUKICAgICAgKCBmaWxsICAgID0+ICd5
+ZWxsb3cnCiAgICAgICwgdGV4dCAgICAgID0+ICR0ZXh0CiAgICAgICwgZm9udCAgICAgID0+
+CictYml0c3RyZWFtLWNoYXJ0ZXItbWVkaXVtLXItbm9ybWFsLS00MC0wLTAtMC1wLTAtaXNv
+ODg1OS0xJwogICAgICAsIHBvaW50c2l6ZSA9PiAkcG9pbnNpemUKICAgICAgLCBncmF2aXR5
+ICAgPT4gJ1NvdXRoRWFzdCcKICAgICAgLCAneCcgICAgICAgPT4gNQogICAgICAsICd5JyAg
+ICAgICA9PiAkcG9pbnNpemUrNQogICAgICApOwogICAkaW1nLT5Xcml0ZShmaWxlbmFtZSAg
+PT4gInRlc3QuZ2lmIik7Cgo=
+
+-----
+
+From markov at ATComputing.nl Wed Jun 14 17:49:26 2000
+Date: Wed, 14 Jun 2000 17:49:26 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: Cristy <cristy at mystic.es.dupont.com>
+Subject: Re: your mail
+Message-ID: <20000614174926.H22766 at atcmpg.ATComputing.nl>
+References: <200006141616.e5EGG3x19487 at mystic.es.dupont.com>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+X-Mailer: Mutt 1.0pre4i
+In-Reply-To: <200006141616.e5EGG3x19487 at mystic.es.dupont.com>; from cristy at mystic.es.dupont.com on Wed, Jun 14, 2000 at 12:16:03PM -0400
+Status: RO
+Content-Length: 686
+Lines: 17
+
+* Cristy (cristy at mystic.es.dupont.com) [000614 17:46]:
+> > It was not clear from the docs.
+> 
+> There is alot that is not clear in the docs.  We're writing a book due
+> out next year to fix these sorts of problems.
+
+I'll certainly buy the book.  But: will you also respond to the two
+remaining quesions from my previous mail?
+-- 
+Thanks for the fast response,
+
+               MarkOv       %-]
+
+------------------------------------------------------------------------
+drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+From cristy at mystic.es.dupont.com Wed Jun 14 17:46 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id RAA27475
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 17:46:29 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id RAA12244
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 17:46:28 +0200
+Received: from gatekeeper.es.dupont.com(192.26.233.2) by ns.ATComputing.nl via smap (V2.1)
+	id xma012242; Wed, 14 Jun 00 17:45:59 +0200
+Received: from mystic.es.dupont.com (mystic.es.dupont.com [138.196.253.24])
+	by gatekeeper.es.dupont.com (8.9.3/8.9.3) with ESMTP id LAA26733
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 11:45:58 -0400 (EDT)
+Received: (from cristy at localhost)
+	by mystic.es.dupont.com (8.10.0.Beta12/8.10.0.Beta12) id e5EGG3x19487
+	for markov at ATComputing.nl; Wed, 14 Jun 2000 12:16:03 -0400 (EDT)
+Date: Wed, 14 Jun 2000 12:16:03 -0400 (EDT)
+From: Cristy <cristy at mystic.es.dupont.com>
+Message-Id: <200006141616.e5EGG3x19487 at mystic.es.dupont.com>
+To: markov at ATComputing.nl
+Subject: Re: your mail
+Content-Type: text
+Status: RO
+X-Status: A
+Content-Length: 152
+Lines: 4
+
+> It was not clear from the docs.
+
+There is alot that is not clear in the docs.  We're writing a book due
+out next year to fix these sorts of problems.
+
+From cristy at mystic.es.dupont.com Wed Jun 14 17:56 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id RAA27517
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 17:55:59 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id RAA12254
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 17:55:58 +0200
+Received: from gatekeeper.es.dupont.com(192.26.233.2) by ns.ATComputing.nl via smap (V2.1)
+	id xma012252; Wed, 14 Jun 00 17:55:29 +0200
+Received: from mystic.es.dupont.com (mystic.es.dupont.com [138.196.253.24])
+	by gatekeeper.es.dupont.com (8.9.3/8.9.3) with ESMTP id LAA26777
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 11:55:28 -0400 (EDT)
+Received: (from cristy at localhost)
+	by mystic.es.dupont.com (8.10.0.Beta12/8.10.0.Beta12) id e5EGPYM19527
+	for markov at ATComputing.nl; Wed, 14 Jun 2000 12:25:34 -0400 (EDT)
+Date: Wed, 14 Jun 2000 12:25:34 -0400 (EDT)
+From: Cristy <cristy at mystic.es.dupont.com>
+Message-Id: <200006141625.e5EGPYM19527 at mystic.es.dupont.com>
+To: markov at ATComputing.nl
+Subject: Re: your mail
+Content-Type: text
+Status: RO
+Content-Length: 189
+Lines: 5
+
+> But: will you also respond to the two
+> remaining quesions from my previous mail?
+
+Sure if you remind me what they are.  I get upwards of 100+ e-mails a day
+so it's hard to keep track...
+
+From markov at ATComputing.nl Wed Jun 14 18:00:18 2000
+Date: Wed, 14 Jun 2000 18:00:18 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: Cristy <cristy at mystic.es.dupont.com>
+Subject: Re: your mail
+Message-ID: <20000614180018.I22766 at atcmpg.ATComputing.nl>
+References: <8172.960997992 at mystic> <20000614174334.G22766 at atcmpg.ATComputing.nl>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+X-Mailer: Mutt 1.0pre4i
+In-Reply-To: <20000614174334.G22766 at atcmpg.ATComputing.nl>; from markov at ATComputing.nl on Wed, Jun 14, 2000 at 05:43:34PM +0200
+Status: RO
+Content-Length: 1972
+Lines: 47
+
+
+>> But: will you also respond to the two
+>> remaining quesions from my previous mail?
+
+>Sure if you remind me what they are.  I get upwards of 100+ e-mails a day
+>so it's hard to keep track...
+
+You replied just a few seconds earlier on my message below.  I replied in
+a few seconds to it... but I understand you have to scan mail that fast.
+(I maintain 6 websites, so know getting large amounts of e-mail means)
+Thanks for the example anyway.
+
+* Mark Overmeer (markov at ATComputing.nl) [000614 17:43]:
+> * Cristy (cristy at mystic.es.dupont.com) [000614 17:23]:
+> >    $img->Read("logo:");
+> >    $text="I am a LumberJack";
+> >    $poinsize=40;
+> >    my ($width, $height) = $img->Get('width', 'height');
+> >    $img->Annotate
+> >       ( fill    => 'yellow'
+> >       , text      => $text
+> >       , font      =>
+> > '-bitstream-charter-medium-r-normal--40-0-0-0-p-0-iso8859-1'
+> >       , gravity   => 'SouthEast'
+> >       , 'x'       => 5
+> >       , 'y'       => $poinsize+5
+> >       );
+> >    $img->Write(filename  => "test.gif");
+> 
+> So: gravity work differently from my well known "anchor", where
+> x,y defines a point and anchor the location of the point wrt the
+> item to be put on the background.  It was not clear from the docs.
+> 
+> It what you propose a feature or a designed thing?  You specify the
+> coordinate of the right-top (NorthEast) wrt to the right-bottom
+> (SouthEast).  I expect that x=0,y=0,SouthWest will work wrt to
+> NorthWest.  It is not logical for me to treat North/South differently
+> from East/West (designed before the fall of the Iron curtain?)
+> 
+> And also: the text still appears in black.
+> -- 
+>                MarkOv       %-]
+> 
+> ------------------------------------------------------------------------
+> drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+> AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+> http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+From markov at ATComputing.nl Wed Jun 14 18:17:41 2000
+Date: Wed, 14 Jun 2000 18:17:41 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: Cristy <cristy at mystic.es.dupont.com>
+Subject: Re: your mail
+Message-ID: <20000614181741.J22766 at atcmpg.ATComputing.nl>
+References: <200006141634.e5EGYfI19547 at mystic.es.dupont.com>
+Mime-Version: 1.0
+Content-Type: multipart/mixed; boundary="5vNYLRcllDrimb99"
+X-Mailer: Mutt 1.0pre4i
+In-Reply-To: <200006141634.e5EGYfI19547 at mystic.es.dupont.com>; from cristy at mystic.es.dupont.com on Wed, Jun 14, 2000 at 12:34:41PM -0400
+Status: RO
+Content-Length: 4505
+Lines: 82
+
+--5vNYLRcllDrimb99
+Content-Type: text/plain; charset=us-ascii
+
+* Cristy (cristy at mystic.es.dupont.com) [000614 18:05]:
+> > It what you propose a feature or a designed thing?  You specify the
+> > coordinate of the right-top (NorthEast) wrt to the right-bottom
+> > (SouthEast).  I expect that x=0,y=0,SouthWest will work wrt to
+> > NorthWest.  It is not logical for me to treat North/South differently
+> > from East/West (designed before the fall of the Iron curtain?)
+> 
+> I'll send you a script that illustrates how gravity works.  The x,y
+> offset basically creates a bounding box within the image and the text
+> is placed relative to the virtual bounding box.
+
+As you can see in your own demo script, it is not consequent: W and E
+are inside the square, while N and S are outside... in my run.  Image
+attached.
+
+I changed the line-color you yellow (stroke) which worked, but it still
+does not work for the text.
+
+> Are you using ImageMagick 5.2.0?  When I used the script I sent the
+> text color was indeed yellow.
+
+The latest 5.2.0 (less than 48 hours ago directly from imagemagick.org).
+
+Sorry, no more time to investigate for me today: have to go...
+-- 
+               MarkOv       %-]
+
+------------------------------------------------------------------------
+drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+--5vNYLRcllDrimb99
+Content-Type: image/gif
+Content-Disposition: attachment; filename="test.gif"
+Content-Transfer-Encoding: base64
+
+R0lGODlhkAGQAfECAP///wAAAP//AAAAACH5BAAAAAAALAAAAACQAZABAAL+hI+py+0Po5y0
+2ouz3rz7D4biSJbmiabqyrbuC8fyTNf2jef6zvf+DwwKh8Si8YhMKpfMpvMJjUqn1Kr1is1q
+t9yu9wsOi8fksvmMTqvX7Lb7DY/L5/S6/Y7P6/f8vv8PGCg4SFhoeIiYqLjI2Oj4CBkpOUlZ
+aXmJmam5ydnp+QkaKjpKWmp6ipqqusra6voKGys7S1tre4ubq7vL2+v7CxwsPExcbHyMnKy8
+zNzs/AwdLT1NXW19jZ2tvc3d7f0NHi4+Tl5ufo6err7O3u7+Dh8vP09fb3+Pn6+/z9/v/w8w
+oMCBBAsaPIgwocIgARo2VOAwokQAEh8eiLhiYoL+ijI0IqgIkmM6jx8DXHRY0iRElRkxrqxB
+8mTKl+pcbmRJ0eJJnAZ4qrBZ0gZQmUEhrouZ8+ZNnz5TINU54ylPqBePmkRZdKfSrCweYiVK
+wyvVsU3ZWfyadOZOnGVRnIVKNcZbtlOZmmUJlylduDB05hWKl+5WsCMDB16JN63iFn4bA9ba
+sy7Iu2rjYhWrsq3bvZEfQyY7WFtIm2SvNkWZ+Szi0RBGfy2t2HVcCbIPzwS9MSXrbZZNL/A4
+lLHexR2H4/5IefVvtMG7nkZbfPlxeLOb55QcXTnM59ORF2YAHTLhF7Ove0Yc2ju22uzbu38P
+P778+fTrt1+meW35tqf+5WoUkFtUSPUUWW204XcGgGbkBwyDWyhYhoO+SJgFhGRQyAuGV1g4
+hoa6eFgFh2KAiAuJU4gYhom2qBgFimCwSAuMT7j4hYyy2NgEjV7gCAuPS+jYhY+uCJkEkFwQ
+yQqSRxi5hZKqOFkEk1pAiQqVQ0iZhZWmaBkEllhwSQqYP3h5hZiimNkDmVagCQqbO6hZhZue
+yJkDnFTQyQmeN9g5hZ6a+FkDn1IAigmhMwgahaGWKBoDolAwSgmkLzj6hKSSWNoCpU5gCgmn
+K2jahKeOiJoCqEyQygiqJ5i6hKqKuFoCq0rAigitI8iahK2G6BoCrkjwSgiwH/h6hLCCGNv+
+AbFGIAsIsxsoW4SzfkibAbREUMsHthdYO4S2enhbAbdCgIsHuROIyxCCZqALhLl2uBsBuz/A
+Swe9D8jrg71y6NsAvj3wCwfAC/jLg8BuGJwAwTsgzAbDByisg8NqSAwAxDlQjAbFFuOA8Rka
+e6xuGRvf0PGCCYKszMcmp3zyysmoHGHIZIwslMxj0AyTzWLgHJbOYfAclc9gAN2R0F8QLZfR
+XiDdl9JdME2e01xA7ULJMa+L8sstX6011i4jA/OFUj+YNdhbi82y11ybrTbaXYtc9jFhdzi2
+FlQzVneFcRsz94h5Y3F3V39vuHcxfac4uBWBZ5R4iIUTc/iLjVP+sfhPk5/4+DCR13i5FJU7
+1XmLmQuz+Y6hQ/G5W6fPOHowpQe5uhOpn2C12zO33mAEHE22FkOTucregWm3xlx1nGKkoHXt
+9ib828RjF2C+OllYnu+/Nc82bdCr9y9OHNpaHfZyUwBddxFD9X2uKtZO9wTF8zUvT7M7YJn7
++AmAf/76749/Q/pH9D/+CXCABCygAQnovwMqcIEMbGABE5g/CB6QfX4jn19iczz5VSok9hue
+9lJjHopYDwHza4D5TIgfAy1FhCGUzG5AoEKquEiFTpENVwhUINckDjjhKRj6NmgU8fHNAkBR
+3sV+uKn1Na581TsfS0oInrI4iIKII+L+Cbv3xOgtS4q6m9xwroUSCDVxeehpjRevt8UBjSt4
+ZvTgzXD3i9cdKXY5guOEztY+573xa+NrWx6zdzs+DtGPFdTjzuzYCzk2iY5MgOIIqCg5QlbR
+kD9DZIbwWEhA7nFtfYSbIA2HyUlq8pCfhFwoI0nJoVlyF4qcEiN/tMoPnZJzbiQlJwfpyVuC
+UpKoHGUlS6m5WZqulr/UpSl5SctUHi2WuWhlll6pBEeKAJLJDKQxg4nMYSpzacwskTBhR0xV
+ApN035xjOJc5TteVc5Hn5GY6c5dNcG7zad28hTO/BM0i1XNF63RlO+n5zjj285n/nNo+a3HP
+MuUTCdIMATX+tWlN23Uyon+c6CYlikuKZtKitsToLnPp0WOCtKIZvShJP6pRUXK0mCHF5kg3
+WtKOnlSkKe3lSsV5TXLG05zzNGhA77hTdvaUbD9N5EDxWVCi5lSdQfXnUO120BgdVaFJhWpR
+L9lUgj5Vb1dl5VTXtNAlRXUWCQVrVbm6VHi+VKUxZelMXVrTat4UnWkVaFaRulXAjfVGX41T
+WI3QUBim0D6ELaxhD4vYxMJnIYwNEu92J5IchoV3C3ssDdHxmsbk5TmTNYwPPSue8ZhjOky0
+y2TTQ7K6oJaF39EiccKjp/pVNoiiZS1mSdudMf7kigJSbW3v0sT3sQUwut1OcE3+a5Xj6oZ7
+vfWU8nhbDjW+BoMcMyJxjUdZ4GK3M5dxYnGb+8XfVuOyy0VPajKzGg5WgLy9y6F6OcBeyd7Q
+tvHlDWxJ08PUfre5831oH7ijHfnmrIwck858zRJFA6tlwDQp8HIObNvocpbAnUntg4944QrT
+9hybReFqs1MgHy5Yw6EdbXY3XJXqRta7+K1vY18M4xjLeMY0rrGNb4zjHOt4xzzusY9/DOQg
+C3nIRC6ykY+M5CQreclMbrKTnwzlKEt5ylSuspWvjOUsa3nLXO6yl78M5jCLecxkLrOZz4zm
+NKt5zWxus5vfDOc4y3nOdK6zne+M5zzrec987rOf/wwg6EALetCELrShD43oRCt60YxutKMf
+DelIS3rSlF50AQAAOw==
+
+--5vNYLRcllDrimb99--
+
+From cristy at mystic.es.dupont.com Wed Jun 14 18:05 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id SAA28005
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 18:04:59 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id SAA12271
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 18:04:58 +0200
+Received: from gatekeeper.es.dupont.com(192.26.233.2) by ns.ATComputing.nl via smap (V2.1)
+	id xma012267; Wed, 14 Jun 00 18:04:36 +0200
+Received: from mystic.es.dupont.com (mystic.es.dupont.com [138.196.253.24])
+	by gatekeeper.es.dupont.com (8.9.3/8.9.3) with ESMTP id MAA26846
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 12:04:35 -0400 (EDT)
+Received: (from cristy at localhost)
+	by mystic.es.dupont.com (8.10.0.Beta12/8.10.0.Beta12) id e5EGYfI19547
+	for markov at ATComputing.nl; Wed, 14 Jun 2000 12:34:41 -0400 (EDT)
+Date: Wed, 14 Jun 2000 12:34:41 -0400 (EDT)
+From: Cristy <cristy at mystic.es.dupont.com>
+Message-Id: <200006141634.e5EGYfI19547 at mystic.es.dupont.com>
+To: markov at ATComputing.nl
+Subject: Re: your mail
+Content-Type: text
+Status: RO
+X-Status: A
+Content-Length: 670
+Lines: 14
+
+> It what you propose a feature or a designed thing?  You specify the
+> coordinate of the right-top (NorthEast) wrt to the right-bottom
+> (SouthEast).  I expect that x=0,y=0,SouthWest will work wrt to
+> NorthWest.  It is not logical for me to treat North/South differently
+> from East/West (designed before the fall of the Iron curtain?)
+
+I'll send you a script that illustrates how gravity works.  The x,y
+offset basically creates a bounding box within the image and the text
+is placed relative to the virtual bounding box.
+
+> And also: the text still appears in black.
+
+Are you using ImageMagick 5.2.0?  When I used the script I sent the
+text color was indeed yellow.
+
+From cristy at eplrx7.es.dupont.com Wed Jun 14 18:05 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id SAA28006
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 18:04:59 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id SAA12272
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 18:04:58 +0200
+Received: from gatekeeper.es.dupont.com(192.26.233.2) by ns.ATComputing.nl via smap (V2.1)
+	id xma012268; Wed, 14 Jun 00 18:04:47 +0200
+Received: from eplrx7.es.dupont.com (eplrx7.es.dupont.com [138.196.252.7])
+	by gatekeeper.es.dupont.com (8.9.3/8.9.3) with ESMTP id MAA26850
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 12:04:46 -0400 (EDT)
+Received: from fantasia.es.dupont.com (fantasia.es.dupont.com [138.196.253.22])
+	by eplrx7.es.dupont.com (8.9.3/8.9.3) with ESMTP id MAA06403
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 12:04:45 -0400 (EDT)
+Received: by fantasia.es.dupont.com (8.9.3+Sun) id MAA01601; Wed, 14 Jun 2000 12:03:33 -0400 (EDT)
+From: Cristy <cristy at eplrx7.es.dupont.com>
+Date: Wed, 14 Jun 2000 12:03:33 -0400 (EDT)
+Message-ID: <1600.960998613 at fantasia>
+Mime-Version: 1.0
+To: markov at ATComputing.nl
+Content-Type: multipart/mixed; boundary="-"
+Status: RO
+Content-Length: 2009
+Lines: 34
+
+This is a MIME encoded message.  Decode it with "munpack"
+or any other MIME reading software.  Mpack/munpack is available
+via anonymous FTP in ftp.andrew.cmu.edu:pub/mpack/
+---
+Content-Type: application/octet-stream; name="gravity.pl"
+Content-Transfer-Encoding: base64
+Content-Disposition: inline; filename="gravity.pl"
+Content-MD5: faVMCotdBUpHJCDAv7HACA==
+
+IyEvdXNyL2xvY2FsL2Jpbi9wZXJsCgp1c2UgSW1hZ2U6Ok1hZ2ljazsKCiRwaWMgPSBJbWFn
+ZTo6TWFnaWNrLT5uZXcoc2l6ZT0+IjQwMHg0MDAiKTsKJHBpYy0+UmVhZCgieGM6d2hpdGUi
+KTsKCiR4ID0gMTAwOwokeSA9IDEwMDsKJHBpYy0+RHJhdyhwcmltaXRpdmU9PidsaW5lJyxw
+b2ludHM9PiIyMDAsMTAwIDIwMCwzMDAiLHN0cm9rZT0+J2JsYWNrJyk7CiRwaWMtPkRyYXco
+cHJpbWl0aXZlPT4nbGluZScscG9pbnRzPT4iMTAwLDIwMCAzMDAsMjAwIixzdHJva2U9Pidi
+bGFjaycpOwokcGljLT5EcmF3KHByaW1pdGl2ZT0+J3JlY3RhbmdsZScscG9pbnRzPT4iMTAw
+LDEwMCAzMDAsMzAwIixzdHJva2U9PidibGFjaycpOwokcGljLT5Bbm5vdGF0ZShwb2ludHNp
+emU9PjI0LGZvbnQ9PidUaW1lcycsdGV4dD0+Ii1OVy0iLGdyYXZpdHk9PiJOb3J0aFdlc3Qi
+LHg9PiR4LHk9PiR5KTsKJHBpYy0+QW5ub3RhdGUocG9pbnRzaXplPT4yNCxmb250PT4nVGlt
+ZXMnLHRleHQ9PiItTi0iLGdyYXZpdHk9PiJOb3J0aCIseD0+JHgseT0+JHkpOwokcGljLT5B
+bm5vdGF0ZShwb2ludHNpemU9PjI0LGZvbnQ9PidUaW1lcycsdGV4dD0+Ii1ORS0iLGdyYXZp
+dHk9PiJOb3J0aEVhc3QiLHg9PiR4LHk9PiR5KTsKJHBpYy0+QW5ub3RhdGUocG9pbnRzaXpl
+PT4yNCxmb250PT4nVGltZXMnLHRleHQ9PiItRS0iLGdyYXZpdHk9PiJFYXN0Iix4PT4keCx5
+PT4keSk7CiRwaWMtPkFubm90YXRlKHBvaW50c2l6ZT0+MjQsZm9udD0+J1RpbWVzJyx0ZXh0
+PT4iLUMtIixncmF2aXR5PT4iQ2VudGVyIix4PT4keCx5PT4keSk7CiRwaWMtPkFubm90YXRl
+KHBvaW50c2l6ZT0+MjQsZm9udD0+J1RpbWVzJyx0ZXh0PT4iLVNFLSIsZ3Jhdml0eT0+IlNv
+dXRoRWFzdCIseD0+JHgseT0+JHkpOwokcGljLT5Bbm5vdGF0ZShwb2ludHNpemU9PjI0LGZv
+bnQ9PidUaW1lcycsdGV4dD0+Ii1TLSIsZ3Jhdml0eT0+IlNvdXRoIix4PT4keCx5PT4keSk7
+CiRwaWMtPkFubm90YXRlKHBvaW50c2l6ZT0+MjQsZm9udD0+J1RpbWVzJyx0ZXh0PT4iLVNX
+LSIsZ3Jhdml0eT0+IlNvdXRoV2VzdCIseD0+JHgseT0+JHkpOwokcGljLT5Bbm5vdGF0ZShw
+b2ludHNpemU9PjI0LGZvbnQ9PidUaW1lcycsdGV4dD0+Ii1XLSIsZ3Jhdml0eT0+Ildlc3Qi
+LHg9PiR4LHk9PiR5KTsKCiRwaWMtPldyaXRlKGZpbGVuYW1lPT4idGVzdC5naWYiKTsKc3lz
+dGVtKCJkaXNwbGF5IHRlc3QuZ2lmIik7Cg==
+
+-----
+
+From magick-owner at unca-don.wizards.dupont.com Thu Jun 29 18:01 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id SAA10314
+	for <markov at ATComputing.nl>; Thu, 29 Jun 2000 18:01:15 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id SAA00740
+	for <markov at ATComputing.nl>; Thu, 29 Jun 2000 18:01:14 +0200
+Received: from mustang.oldcity.dca.net(216.158.38.3) by ns.ATComputing.nl via smap (V2.1)
+	id xma000732; Thu, 29 Jun 00 18:01:07 +0200
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by mustang.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id MAA07078;
+	Thu, 29 Jun 2000 12:00:36 -0400
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id LAA10740
+	for magick-outgoing; Thu, 29 Jun 2000 11:48:25 -0400 (EDT)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-ID: <395B7519.F40670B at northrim.net>
+Date: Thu, 29 Jun 2000 10:11:05 -0600
+From: Karl Sloth <karl at northrim.net>
+X-Mailer: Mozilla 4.72 [en] (X11; I; Linux 2.2.14 i586)
+X-Accept-Language: en
+MIME-Version: 1.0
+To: magick at wizards.dupont.com
+Subject: mailing list archives
+Content-Transfer-Encoding: 7bit
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Karl Sloth <karl at northrim.net>
+Content-Type: text/plain; charset=us-ascii
+Status: RO
+Content-Length: 552
+Lines: 17
+
+Hi all-
+
+The folks at The Aims Group have added the ImageMagick mailing list to
+their online mailing list archives. They have a searchable history going
+back to 1996.  Very handy.
+
+http://marc.theaimsgroup.com/?l=imagemagick&r=1&w=2
+
+-karl
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From markov at ATComputing.nl Tue Jul  4 12:33:47 2000
+Date: Tue, 4 Jul 2000 12:33:47 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: magick-bugs at simple.dallas.tx.us
+Subject: Re: Annotate problems (PR#298)
+Message-ID: <20000704123347.F2009 at atcmpg.ATComputing.nl>
+References: <200006141454.JAA14556 at ns.simplesystems.org>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+X-Mailer: Mutt 1.0pre4i
+In-Reply-To: <200006141454.JAA14556 at ns.simplesystems.org>; from magick-bugs at simple.dallas.tx.us on Wed, Jun 14, 2000 at 09:54:08AM -0500
+Status: RO
+Content-Length: 573
+Lines: 12
+
+* magick-bugs at simple.dallas.tx.us (magick-bugs at simple.dallas.tx.us) [000614 16:54]:
+> Your bug report is available on the web at the URL
+> http://www.simplesystems.org/ImageMagick/bugs?findid=298    
+
+Both indicated problems are fixed in 5.2.1
+-- 
+               MarkOv       %-]
+
+------------------------------------------------------------------------
+drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+From magick-owner at unca-don.wizards.dupont.com Sun Jul  2 02:40 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id CAA01634
+	for <markov at ATComputing.nl>; Sun, 2 Jul 2000 02:40:25 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id CAA03454
+	for <markov at ATComputing.nl>; Sun, 2 Jul 2000 02:40:24 +0200
+Received: from mustang.oldcity.dca.net(216.158.38.3) by ns.ATComputing.nl via smap (V2.1)
+	id xma003450; Sun, 2 Jul 00 02:40:07 +0200
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by mustang.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id UAA32165;
+	Sat, 1 Jul 2000 20:39:55 -0400
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id UAA16952
+	for magick-outgoing; Sat, 1 Jul 2000 20:30:03 -0400 (EDT)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-ID: <395E8F1F.B804FCB7 at interak.com>
+Date: Sat, 01 Jul 2000 16:38:55 -0800
+From: Marc Grober <marc at interak.com>
+X-Mailer: Mozilla 4.61 [en] (X11; I; UnixWare 5 i386)
+MIME-Version: 1.0
+To: magick at wizards.dupont.com
+Subject: delegates.mgk set-up for unixware printing
+Content-Transfer-Encoding: 7bit
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Marc Grober <marc at interak.com>
+Content-Type: text/plain; charset=us-ascii
+Status: RO
+Content-Length: 1403
+Lines: 45
+
+Under unixware to print from displayt to an HP laserjet (usual command
+to print postscript being
+lp -dhpraw -Tpostscript),  I changed the delegates.mgk file (which I
+found in /usr/local/share/Magick as installed from the SCO skunkware CD)
+
+from
+
+ps<=print
+       /usr/bin/lp -c -s %i
+
+to
+
+ps<=print
+        /usr/bin/lp -dhpraw -c -s -Tpostscript %i
+
+and  it appears everything is working.  The -c make an immediate copy
+and feeds it to the spooler and without it you get an error message
+(below) which my guess is is a bit misleading in that I have to assume
+that what is really happening is that without the -c IM is not passing
+anything to the spooler........
+
+******************************************************************************
+
+Subject: Status of lp request hpraw-347
+
+        Your request hpraw-347 destined for hpraw
+        encountered an error during filtering.
+
+        Reason for failure:
+
+        UX:lp:   ERROR: Cannot read the file "/tmp/hacienda.jpg".
+        TO FIX: See if it still exists and is readable, or
+                consult your system administrator.
+
+
+
+
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at unca-don.wizards.dupont.com Mon Jul  3 16:12 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id QAA28389
+	for <markov at ATComputing.nl>; Mon, 3 Jul 2000 16:12:41 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id QAA05092
+	for <markov at ATComputing.nl>; Mon, 3 Jul 2000 16:12:40 +0200
+Received: from mustang.oldcity.dca.net(216.158.38.3) by ns.ATComputing.nl via smap (V2.1)
+	id xma005088; Mon, 3 Jul 00 16:12:32 +0200
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by mustang.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id KAA12560;
+	Mon, 3 Jul 2000 10:12:03 -0400
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id KAA20768
+	for magick-outgoing; Mon, 3 Jul 2000 10:01:07 -0400 (EDT)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-ID: <395BACF9.CFA6970 at interak.com>
+Date: Thu, 29 Jun 2000 12:09:30 -0800
+From: Marc Grober <marc at interak.com>
+X-Mailer: Mozilla 4.61 [en] (X11; I; UnixWare 5 i386)
+MIME-Version: 1.0
+To: magick at wizards.dupont.com
+Subject: printing solution for UW 7.1
+Content-Transfer-Encoding: 7bit
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Marc Grober <marc at interak.com>
+Content-Type: text/plain; charset=us-ascii
+Status: RO
+Content-Length: 1500
+Lines: 46
+
+Under unixware to print from displayt to an HP laserjet (usual command
+to print postscript being
+lp -dhpraw -Tpostscript),  I changed the delegates.mgk file (which I
+found in /usr/local/share/Magick as installed from the SCO skunkware CD)
+from
+
+ps<=print
+       /usr/bin/lp -c -s %i
+
+to
+
+ps<=print
+        /usr/bin/lp -dhpraw -c -s -Tpostscript %i
+
+and  it appears everything is working.  The -c make an immediate copy
+and feeds it to the spooler and without it you get an error message
+(below) which my guess is is a bit misleading in that I have to assume
+that what is really happening is that without the -c IM is not passing
+anything to the spooler........
+
+******************************************************************************
+
+Subject: Status of lp request hpraw-347
+
+        Your request hpraw-347 destined for hpraw
+        encountered an error during filtering.
+
+        Reason for failure:
+
+        UX:lp:   ERROR: Cannot read the file "/tmp/hacienda.jpg".
+        TO FIX: See if it still exists and is readable, or
+                consult your system administrator.
+
+
+I have tried this with jpegs, gifs etc and in quite a number of
+locations
+Placed the -c -s back in
+
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at unca-don.wizards.dupont.com Fri Jul  7 09:27 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id JAA27505
+	for <markov at ATComputing.nl>; Fri, 7 Jul 2000 09:27:32 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id JAA11016
+	for <markov at ATComputing.nl>; Fri, 7 Jul 2000 09:27:31 +0200
+Received: from viper.oldcity.dca.net(216.158.38.4) by ns.ATComputing.nl via smap (V2.1)
+	id xma011014; Fri, 7 Jul 00 09:27:21 +0200
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by viper.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id DAA06530;
+	Fri, 7 Jul 2000 03:26:27 -0400
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id DAA06369
+	for magick-outgoing; Fri, 7 Jul 2000 03:15:15 -0400 (EDT)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Date: Fri, 7 Jul 2000 17:24:12 +1000
+From: Martien Verbruggen <mgjv at comdyn.com.au>
+To: Geoff Armstrong <geofstro at monaco.mc>
+Cc: ImageMagick Mailing List <magick at wizards.dupont.com>
+Subject: Re: converts new sharpen factors
+Message-ID: <20000707172412.C23320 at martien.heliotrope.home>
+References: <00070515380200.26142 at berlioz>
+Mime-Version: 1.0
+Content-Disposition: inline
+User-Agent: Mutt/1.2.2i
+In-Reply-To: <00070515380200.26142 at berlioz>; from geofstro at monaco.mc on Wed, Jul 05, 2000 at 03:35:26PM +0200
+Organisation: Heliotrope Productions Pty. Ltd.
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Martien Verbruggen <mgjv at comdyn.com.au>
+Content-Type: text/plain; charset=us-ascii
+Status: RO
+Content-Length: 1483
+Lines: 36
+
+-- Geoff Armstrong wrote on Wed  5 Jul 15:35 PM --
+
+> Hi,
+> 
+> I know the sharpen factors for convert have changed since 5.2.0; but I
+> can't find the new factors documented anywhere.
+
+The factors are no longer really factors, but orders for a convolution
+kernel, if I've understood it all correctly. Since convolution has
+become available in ImageMagick, many of the old filters have been
+rewritten to use a kernel (blur, sharpen, charcoal, emboss, edge).
+
+The convert manual page mentions that good values are odd numbers
+between 3 and 31.
+
+Martien
+
+PS. If you don't know what convolution is: apply a matrix to each pixel,
+and it's surrounding neighbors covered by the matrix. The values of each
+covered pixel get multiplied by the matrix cell's value, and all added
+together. The new value for the target pixel is this sum. The 'order'
+that I talked about above is the height and width of the matrix involved
+(in ImageMagick they're always square).
+-- 
+Martien Verbruggen                      |
+Interactive Media Division              | "In a world without fences,
+Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
+NSW, Australia                          |
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at unca-don.wizards.dupont.com Fri Jul  7 17:55 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id RAA13560
+	for <markov at ATComputing.nl>; Fri, 7 Jul 2000 17:55:42 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id RAA15121
+	for <markov at ATComputing.nl>; Fri, 7 Jul 2000 17:55:42 +0200
+Received: from mustang.oldcity.dca.net(216.158.38.3) by ns.ATComputing.nl via smap (V2.1)
+	id xma015105; Fri, 7 Jul 00 17:55:27 +0200
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by mustang.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id LAA24776;
+	Fri, 7 Jul 2000 11:54:30 -0400
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id LAA07897
+	for magick-outgoing; Fri, 7 Jul 2000 11:44:52 -0400 (EDT)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Date: Fri, 7 Jul 2000 12:23:40 -0400 (EDT)
+From: Cristy <cristy at mystic.es.dupont.com>
+Message-Id: <200007071623.e67GNev10760 at mystic.es.dupont.com>
+To: magick at wizards.dupont.com
+Subject: New ImageMagick mailing list
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Cristy <cristy at mystic.es.dupont.com>
+Content-Type: text
+Status: RO
+Content-Length: 1242
+Lines: 31
+
+***********************************************************************
+This list is being decommissioned.  Please join one or more of the new
+ImageMagick mailing lists as described at
+http://www.imagemagick.org/www/magick-list.html.
+***********************************************************************
+
+In response to a number of suggestions and/or complaints about the 
+magick at wizards.dupont.com ImageMagick mailing list, I have created three
+new lists:
+
+    magick-user at imagemagick.org
+    magick-deveoper at imagemagick.org
+    magick-announce at imagemagick.org
+
+See
+
+    http://www.imagemagick.org/www/magick-list.html
+
+for instructions on joining and/or posting.  I will keep the current
+list at magick at wizards.dupont.com running for the next couple of months
+to cause the least amount of disruption.  At your convenience
+unsubscribe from magick at wizards.dupont.com and choose one of the lists
+above, whichever is appropriate.
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From markov at ATComputing.nl Sat Jul  8 10:27:08 2000
+Date: Sat, 8 Jul 2000 10:27:08 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: majordomo at imagemagick.org
+Subject: subscribe
+Message-ID: <20000708102708.B1570 at atcmpg.ATComputing.nl>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+X-Mailer: Mutt 1.0pre4i
+Status: RO
+Content-Length: 27
+Lines: 1
+
+subscribe magick-developer
+
+From markov at ATComputing.nl Sat Jul  8 13:53:18 2000
+Date: Sat, 8 Jul 2000 13:53:18 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: Majordomo at imagemagick.org
+Subject: Re: Confirmation for subscribe magick-developer
+Message-ID: <20000708135318.A2549 at atcmpg.ATComputing.nl>
+References: <200007080855.EAA15589 at imagemagick.org>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+X-Mailer: Mutt 1.0pre4i
+In-Reply-To: <200007080855.EAA15589 at imagemagick.org>; from Majordomo at imagemagick.org on Sat, Jul 08, 2000 at 04:55:40AM -0400
+Status: RO
+Content-Length: 63
+Lines: 1
+
+auth 44b84310 subscribe magick-developer markov at ATComputing.nl
+
+From Majordomo-Owner at imagemagick.org Sat Jul  8 10:27 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id KAA01750
+	for <markov at ATComputing.nl>; Sat, 8 Jul 2000 10:27:39 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id KAA25253
+	for <markov at ATComputing.nl>; Sat, 8 Jul 2000 10:27:38 +0200
+Received: from magick.imagemagick.org(38.220.172.2) by ns.ATComputing.nl via smap (V2.1)
+	id xma025238; Sat, 8 Jul 00 10:27:26 +0200
+Received: (from majordomo at localhost)
+	by imagemagick.org (8.9.3/8.9.3) id EAA15589;
+	Sat, 8 Jul 2000 04:55:40 -0400
+Date: Sat, 8 Jul 2000 04:55:40 -0400
+Message-Id: <200007080855.EAA15589 at imagemagick.org>
+X-Authentication-Warning: magick.imagemagick.org: majordomo set sender to Majordomo-Owner at imagemagick.org using -f
+To: markov at ATComputing.nl
+From: Majordomo at imagemagick.org
+Subject: Confirmation for subscribe magick-developer
+Reply-To: Majordomo at imagemagick.org
+Content-Type: text
+Status: RO
+X-Status: A
+Content-Length: 822
+Lines: 25
+
+--
+
+Someone (possibly you) has requested that your email address be added
+to or deleted from the mailing list "magick-developer at imagemagick.org".
+
+If you really want this action to be taken, please send the following
+commands (exactly as shown) back to "Majordomo at imagemagick.org":
+
+	auth 44b84310 subscribe magick-developer markov at ATComputing.nl
+
+If you do not want this action to be taken, simply ignore this message
+and the request will be disregarded.
+
+If your mailer will not allow you to send the entire command as a single
+line, you may split it using backslashes, like so:
+
+        auth 44b84310 subscribe magick-developer \
+        markov at ATComputing.nl
+
+If you have any questions about the policy of the list owner, please
+contact "magick-developer-approval at imagemagick.org".
+
+Thanks!
+
+Majordomo at imagemagick.org
+
+From owner-magick at imagemagick.org Sat Jul  8 13:53 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id NAA02564
+	for <markov at ATComputing.nl>; Sat, 8 Jul 2000 13:53:33 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id NAA00576
+	for <markov at ATComputing.nl>; Sat, 8 Jul 2000 13:53:28 +0200
+Received: from magick.imagemagick.org(38.220.172.2) by ns.ATComputing.nl via smap (V2.1)
+	id xma000568; Sat, 8 Jul 00 13:53:23 +0200
+Received: (from majordomo at localhost)
+	by imagemagick.org (8.9.3/8.9.3) id IAA16219;
+	Sat, 8 Jul 2000 08:21:42 -0400
+Date: Sat, 8 Jul 2000 08:21:42 -0400
+Message-Id: <200007081221.IAA16219 at imagemagick.org>
+X-Authentication-Warning: magick.imagemagick.org: majordomo set sender to owner-magick at imagemagick.org using -f
+To: markov at ATComputing.nl
+From: Majordomo at imagemagick.org
+Subject: Welcome to magick-developer
+Reply-To: Majordomo at imagemagick.org
+Content-Type: text
+Status: RO
+Content-Length: 11286
+Lines: 274
+
+--
+
+Welcome to the magick-developer mailing list!
+
+Please save this message for future reference.  Thank you.
+
+If you ever want to remove yourself from this mailing list,
+you can send mail to <Majordomo at imagemagick.org> with the following
+command in the body of your email message:
+
+    unsubscribe magick-developer
+
+or from another account, besides markov at ATComputing.nl:
+
+    unsubscribe magick-developer markov at ATComputing.nl
+
+If you ever need to get in contact with the owner of the list,
+(if you have trouble unsubscribing, or have questions about the
+list itself) send email to <owner-magick-developer at imagemagick.org> .
+This is the general rule for most mailing lists when you need
+to contact a human.
+
+ Here's the general information for the list you've subscribed to,
+ in case you don't already have it:
+
+The ImageMagick mailing list (magick at wizards.dupont.com) is a low noise
+and subject oriented mailing list.  The subject is the discussion of
+ImageMagick software and its use.  Although the list is unmoderated, do
+not post off-topic messages to the list.  Off-topic messages will
+result in the offender being silently removed from the list and
+prevented from rejoining.
+
+Please follow these guidelines when posting or responding to posted
+messages:
+
+  1. postings must be related to ImageMagick, PerlMagick, CineMagick,
+     or WebMagick.  Here is an example of what not to post:
+
+       Does anyone know of a program that converts WWF to JPG on the
+       Mac?
+
+     Post these to comp.graphics instead.
+
+  2. postings should be concise but provide enough detail for readers to
+     discern what the problem is and respond with a solution.  Here is
+     an example of what not to post:
+
+       I downloaded ImageMagick and it doesn't work.  What's up?
+
+     Yes, I have seen these messages.  More detail is needed for a
+     proper response.
+
+  3. responses should be sent to the author, and not the list, if the
+     response is not of general interest.  For example,
+
+       I'm converting libMagick to a C++ class library.  Anyone want to
+       help?
+
+     Discuss this privately with the author and make a general
+     announcement when you complete your work.
+
+  4. Only relevant portions of a message should be quoted.  Do not
+     quote the entire message, for example, and give a one line
+     response.
+
+  5. Do not post administriva messages such as "How do I unsubscribe
+     from the list?"  Instead, see
+
+	 http://www.imagemagick.org/www/magick-list.html
+
+     for help.
+
+  6. Do not post test messages to the list.
+
+An archive of all messages posted to the mailing list is available to peruse.
+See
+
+    ftp://ftp.wizards.dupont.com/pub/ImageMagick/mailing-list
+
+You can also browse or search the archive.  See
+
+    http://marc.theaimsgroup.com/?l=imagemagick&r=1&w=2
+
+
+* * *
+
+ImageMagick is a robust collection of tools and libraries to read,
+write, and manipulate an image in many image formats (over 68 major
+formats) including popular formats like TIFF, JPEG, PNG, PDF, Photo CD,
+and GIF. With ImageMagick you can create images dynamically, making it
+suitable for Web applications. You can also resize, rotate, sharpen,
+color reduce, or add special effects to an image and save your completed
+work in the same or differing image format. Image processing operations
+are available from the command line, as well as through C, C++, and
+PERL-based programming interfaces.
+
+Here is just a few examples of what ImageMagick can do:
+
+    Convert an image from one format to another (e.g. TIFF to GIF) 
+    Resize, rotate, sharpen, color reduce, or add special effects to an image 
+    Create a montage of image tumbnails 
+    Create a transparent image suitable for use on the Web 
+    Turn a group of images into a GIF animation sequence 
+    Create a composite image by combining several separate images 
+    Draw shapes or text on an image 
+    Decorate an image with a border or frame 
+    Describe the format and characteristics of an image 
+
+You can access ImageMagick functions directly from the command line
+using the ImageMagick tools convert, mogrify, montage, combine, or
+identify. Use the display program to interactively manipulate your
+images or animate an image sequence from a graphical panel. Finally
+you have access to the various image manipulation methods directly
+from your favorite application development environment: Perl, C++, C,
+or Java. These programs and much more are explained by following the
+links from this page or read the ImageMagick Users Guide.
+
+ImageMagick is known to compile and run on virtually any Unix. system and
+Linux. It also runs under Windows 2000, Windows 95/98, Macintosh, VMS,
+and OS2. See the install guide for compiling instructions. Pre-compiled
+binaries are available for some of the more popular operating systems.
+
+The offical ImageMagick web page is:
+ 
+    http://ww.imagemagick.org/
+
+ImageMagick is available via ftp as
+
+    ftp://ftp.wizards.dupont.com/pub/ImageMagick
+
+Other versions are available as
+
+    ftp://ftp.wizards.dupont.com/pub/ImageMagick/binaries
+    ftp://ftp.wizards.dupont.com/pub/ImageMagick/mac
+    ftp://ftp.wizards.dupont.com/pub/ImageMagick/nt
+    ftp://ftp.wizards.dupont.com/pub/ImageMagick/vms
+    ftp://ftp.wizards.dupont.com/pub/ImageMagick/linux
+
+* * * * * * * * *
+
+ImageMagick Tools
+
+  display
+     Display is a machine architecture independent image and display
+     program.  It can display an image on any workstation display
+     running an X server.  Display can read and write many of the more
+     popular image formats (e.g.  JPEG, TIFF, PNM, Photo CD, etc.).
+     You can perform these functions on the image:
+
+         o load an image from a file
+         o display the next image
+         o display the former image
+         o display a sequence of images as a slide show
+         o write the image to a file
+         o print the image to a Postscript printer
+         o delete the image file
+         o create a Visual Image Directory
+         o select the image to display by its thumbnail rather than name
+         o undo last image transformation
+         o copy a region of the image
+         o paste a region to the image
+         o restore the image to its original size
+         o refresh the image
+         o half the image size
+         o double the image size
+         o resize the image
+         o crop the image
+         o cut the image
+         o flop image in the horizontal direction
+         o flip image in the vertical direction
+         o rotate the image 90 degrees clockwise
+         o rotate the image 90 degrees counter-clockwise
+         o rotate the image
+         o shear the image
+         o trim the image edges
+         o invert the colors of the image
+         o vary the color brightness
+         o vary the color saturation
+         o vary the image hue
+         o gamma correct the image
+         o sharpen the image contrast
+         o dull the image contrast
+         o perform histogram equalization on the image
+         o perform histogram normalization on the image
+         o negate the image colors
+         o convert the image to grayscale
+         o set the maximum number of unique colors in the image
+         o reduce the speckles within an image
+         o eliminate peak noise from an image
+         o detect edges within the image
+         o emboss an image
+         o oil paint an image
+         o segment the image by color
+         o annotate the image with text
+         o draw on the image
+         o edit an image pixel color
+         o edit the image matte information
+         o composite an image with another
+         o add a border to the image
+         o add an image comment
+         o apply image processing techniques to a region of interest
+         o display information about the image
+         o display information about this program
+         o display image to background of a window
+         o set user preferences
+         o discard all images and exit program
+         o change the level of magnification
+         o display images specified by a World Wide Web (WWW)
+           uniform resource locator (URL)
+
+  import
+     Import reads an image from any visible window on an X server and
+     outputs it as an image file.  You can capture a single window, the
+     entire screen, or any rectangular portion of the screen.  You can
+     use display (see display(1)) utility for redisplay, printing,
+     editing, formatting, archiving, image processing, etc.  of the
+     captured image.
+
+     The target window can be specified by id, name, or may be selected
+     by clicking the mouse in the desired window.  If you press a
+     button and then drag, a rectangle will form which expands and
+     contracts as the mouse moves.  To save the portion of the screen
+     defined by the rectangle, just release the button.  The keyboard
+     bell is rung once at the beginning of the screen capture and twice
+     when it completes.
+
+  animate
+     Animate displays a sequence of images on any workstation display
+     running an X server.  Animate first determines the hardware
+     capabilities of the workstation.  If the number of unique colors
+     in an image is less than or equal to the number the workstation
+     can support, the image is displayed in an X window.  Otherwise the
+     number of colors in the image is first reduced to match the color
+     resolution of the workstation before it is displayed.
+
+     This means that a continuous-tone 24 bits/pixel image can display
+     on a 8 bit pseudo-color device or monochrome device.  In most
+     instances the reduced color image closely resembles the original.
+     Alternatively, a monochrome or pseudo-color image sequence can
+     display on a continuous-tone 24 bits/pixels device.
+
+  montage
+     Montage creates a composite image by combining several separate
+     images.  The images are tiled on the composite image with the name
+     of the image optionally appearing just below the individual tile.
+
+  convert
+     Convert converts an input file using one image format to an output
+     file with a differing image format. By default, the image format
+     is determined by it's magic number. To specify a particular image
+     format, precede the filename with an image format name and a colon
+     (i.e.  ps:image) or specify the image type as the filename suffix
+     (i.e. image.ps).  Specify file as - for standard input or output.
+     If file has the extension .Z, the file is decoded with
+     uncompress.
+
+  mogrify
+     Mogrify transforms an image or a sequence of images.  These
+     transforms include image scaling, image rotation, color reduction,
+     and others.  The transmogrified image overwrites the original
+     image.
+
+  identify
+     describes the format and characteristics of one or more image
+     files.  It will also report if an image is incomplete or corrupt.
+     The information displayed includes the scene number, the file
+     name, the width and height of the image, whether the image is
+     colormapped or not, the number of colors in the image, the number
+     of bytes in the image, the format of the image (JPEG, PNM, etc.),
+     and finally the number of seconds it took to read and process the
+     image.
+
+  combine
+     Combine combines images to create new images.
+
+From markov at ATComputing.nl Wed Jul 26 13:32:31 2000
+Date: Wed, 26 Jul 2000 13:32:31 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: Chris Wareham <chris.wareham at catchword.com>
+Subject: Re: core dump in simple ImageMagick example
+Message-ID: <20000726133231.G25170 at atcmpg.ATComputing.nl>
+References: <397C6C6B.989E4BB2 at catchword.com>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+X-Mailer: Mutt 1.0pre4i
+In-Reply-To: <397C6C6B.989E4BB2 at catchword.com>; from chris.wareham at catchword.com on Mon, Jul 24, 2000 at 05:18:51PM +0100
+Status: RO
+Content-Length: 2223
+Lines: 55
+
+* Chris Wareham (chris.wareham at catchword.com) [000724 18:24]:
+> ***********************************************************************
+> This list is being decommissioned.  Please join one or more of the new
+> ImageMagick mailing lists as described at
+> http://www.imagemagick.org/www/magick-list.html.
+> ***********************************************************************
+> 
+> The following snippet of code coew dumps on ReadImage():
+> 
+>  GetExceptionInfo(&exception);
+>  image_info = CloneImageInfo((ImageInfo *)NULL);
+> 
+>  strcpy(image_info->filename, IMAGEDIR);
+>  strcat(image_info->filename, "/");
+>  strcat(image_info->filename, filename);
+> 
+>  image = ReadImage(image_info, &exception);
+>  if(image == (Image *)NULL) {
+>    log_error("unable to read image '%s'", filename);
+>    return;
+>  }
+> 
+> The debugger output is the following:
+> 
+>  Program received signal SIGSEGV, Segmentation fault.
+>  0x403a0058 in _IO_getc (fp=0x67616d69) at getc.c:39
+>  39     getc.c: No such file or directory.
+>  (gdb) bt
+>  #0  0x403a0058 in _IO_getc (fp=0x67616d69) at getc.c:39
+>  #1  0x4005eb8d in SetImageInfo () from /usr/local/lib/libMagick.so.5
+>  #2  0x4003c91e in ReadImage () from /usr/local/lib/libMagick.so.5
+>  #3  0x80491dd in process_image (dbm=0x804bea0, filename=0x806a157
+> "00132aac.tif") at tif2png.c:107
+>  #4  0x8048fd3 in convert_images (args=0xbffff9f4) at tif2png.c:55
+>  #5  0x8048e6c in main (argc=1, argv=0xbffff9f4) at tif2png.c:21
+
+I have the same problem using PerlMagick 5.2.2 calling ReadImage.
+However, it is only reproduceable when this statement is included in
+my huge Perl program with a small IM part, not is a smaller sample
+as you have.
+
+I run Solaris 2.5.1 and all newest image-libs attached.
+
+Did you get any useful reply which fixed your problem.
+Didi you know there is a bug-list:
+http://www.simplesystems.org/ImageMagick/bugs/
+
+Please let me know.
+-- 
+               MarkOv       %-]
+
+------------------------------------------------------------------------
+drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+From magick-owner at unca-don.wizards.dupont.com Mon Jul 24 18:24 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id SAA27465
+	for <markov at ATComputing.nl>; Mon, 24 Jul 2000 18:24:10 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id SAA20827
+	for <markov at ATComputing.nl>; Mon, 24 Jul 2000 18:24:09 +0200
+Received: from viper.oldcity.dca.net(216.158.38.4) by ns.ATComputing.nl via smap (V2.1)
+	id xma020823; Mon, 24 Jul 00 18:23:51 +0200
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by viper.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id MAA20883;
+	Mon, 24 Jul 2000 12:23:50 -0400
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id MAA01738
+	for magick-outgoing; Mon, 24 Jul 2000 12:07:32 -0400 (EDT)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-ID: <397C6C6B.989E4BB2 at catchword.com>
+Date: Mon, 24 Jul 2000 17:18:51 +0100
+From: Chris Wareham <chris.wareham at catchword.com>
+X-Mailer: Mozilla 4.73 [en] (X11; U; Linux 2.2.17pre13 i686)
+X-Accept-Language: en
+MIME-Version: 1.0
+To: magick at wizards.dupont.com
+Subject: core dump in simple ImageMagick example
+Content-Transfer-Encoding: 7bit
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Chris Wareham <chris.wareham at catchword.com>
+Content-Type: text/plain; charset=us-ascii
+Status: RO
+X-Status: A
+Content-Length: 1736
+Lines: 47
+
+***********************************************************************
+This list is being decommissioned.  Please join one or more of the new
+ImageMagick mailing lists as described at
+http://www.imagemagick.org/www/magick-list.html.
+***********************************************************************
+
+The following snippet of code coew dumps on ReadImage():
+
+ GetExceptionInfo(&exception);
+ image_info = CloneImageInfo((ImageInfo *)NULL);
+
+ strcpy(image_info->filename, IMAGEDIR);
+ strcat(image_info->filename, "/");
+ strcat(image_info->filename, filename);
+
+ image = ReadImage(image_info, &exception);
+ if(image == (Image *)NULL) {
+   log_error("unable to read image '%s'", filename);
+   return;
+ }
+
+The debugger output is the following:
+
+ Program received signal SIGSEGV, Segmentation fault.
+ 0x403a0058 in _IO_getc (fp=0x67616d69) at getc.c:39
+ 39     getc.c: No such file or directory.
+ (gdb) bt
+ #0  0x403a0058 in _IO_getc (fp=0x67616d69) at getc.c:39
+ #1  0x4005eb8d in SetImageInfo () from /usr/local/lib/libMagick.so.5
+ #2  0x4003c91e in ReadImage () from /usr/local/lib/libMagick.so.5
+ #3  0x80491dd in process_image (dbm=0x804bea0, filename=0x806a157
+"00132aac.tif") at tif2png.c:107
+ #4  0x8048fd3 in convert_images (args=0xbffff9f4) at tif2png.c:55
+ #5  0x8048e6c in main (argc=1, argv=0xbffff9f4) at tif2png.c:21
+
+image_info->filename points to a valid TIFF image, so
+any ideas as to what gives???
+
+Chris
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From markov at ATComputing.nl Wed Jul 26 13:49:09 2000
+Date: Wed, 26 Jul 2000 13:49:09 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: Chris Wareham <chris.wareham at catchword.com>
+Subject: Re: core dump in simple ImageMagick example
+Message-ID: <20000726134909.I25170 at atcmpg.ATComputing.nl>
+References: <397C6C6B.989E4BB2 at catchword.com> <20000726133231.G25170 at atcmpg.ATComputing.nl> <397ECFEF.598EE285 at catchword.com>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+X-Mailer: Mutt 1.0pre4i
+In-Reply-To: <397ECFEF.598EE285 at catchword.com>; from chris.wareham at catchword.com on Wed, Jul 26, 2000 at 12:47:59PM +0100
+Status: RO
+Content-Length: 754
+Lines: 16
+
+* Chris Wareham (chris.wareham at catchword.com) [000726 13:46]:
+> > I have the same problem using PerlMagick 5.2.2 calling ReadImage.
+ 
+> This solved my problem with a C based ImageMagick client, but
+> I don't know whether it is relevant for PerlMagick programs.
+
+So: to install IM, I need to have the libs installed.  To install
+the libs, I need IM to be installed for Magic-config....
+Ok.  Still strange spot to dump core...
+-- 
+               MarkOv       %-]
+
+------------------------------------------------------------------------
+drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+From chris.wareham at catchword.com Wed Jul 26 13:46 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id NAA29434
+	for <markov at ATComputing.nl>; Wed, 26 Jul 2000 13:46:33 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id NAA24001
+	for <markov at ATComputing.nl>; Wed, 26 Jul 2000 13:46:32 +0200
+Received: from figaro.catchword.co.uk(194.129.29.1) by ns.ATComputing.nl via smap (V2.1)
+	id xma023999; Wed, 26 Jul 00 13:46:13 +0200
+Received: from catchword.com (valkyrie.catchword.co.uk [194.129.29.105])
+	by figaro.catchword.co.uk (8.9.2/8.9.2) with ESMTP id LAA10217
+	for <markov at ATComputing.nl>; Wed, 26 Jul 2000 11:49:37 GMT
+Sender: cwareham at figaro.catchword.co.uk
+Message-ID: <397ECFEF.598EE285 at catchword.com>
+Date: Wed, 26 Jul 2000 12:47:59 +0100
+From: Chris Wareham <chris.wareham at catchword.com>
+X-Mailer: Mozilla 4.74 [en] (X11; U; Linux 2.2.17pre13 i686)
+X-Accept-Language: en
+MIME-Version: 1.0
+To: Mark Overmeer <markov at ATComputing.nl>
+Subject: Re: core dump in simple ImageMagick example
+References: <397C6C6B.989E4BB2 at catchword.com> <20000726133231.G25170 at atcmpg.ATComputing.nl>
+Content-Transfer-Encoding: 7bit
+Content-Type: text/plain; charset=us-ascii
+Status: RO
+X-Status: A
+Content-Length: 882
+Lines: 26
+
+Mark Overmeer wrote:
+>  
+> I have the same problem using PerlMagick 5.2.2 calling ReadImage.
+> However, it is only reproduceable when this statement is included in
+> my huge Perl program with a small IM part, not is a smaller sample
+> as you have.
+> 
+> I run Solaris 2.5.1 and all newest image-libs attached.
+> 
+> Did you get any useful reply which fixed your problem.
+> Didi you know there is a bug-list:
+> http://www.simplesystems.org/ImageMagick/bugs/
+> 
+> Please let me know.
+>
+
+I wasn't passing all the required compiler flags when building
+my program. I had looked at the output of Magick-config, and
+simply copied the library dependencies into a Makefile. To
+successfully build, ImageMagick clients also need the correct
+CFLAGS arguments, etc.
+
+This solved my problem with a C based ImageMagick client, but
+I don't know whether it is relevant for PerlMagick programs.
+
+Chris
+
+From markov at ATComputing.nl Mon Aug  7 11:38:44 2000
+Date: Mon, 7 Aug 2000 11:38:44 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: Bryan Burchette <blburch at mindspring.com>
+Subject: Re: Core Dump on ReadImage
+Message-ID: <20000807113844.A22119 at atcmpg.ATComputing.nl>
+References: <4.3.1.0.20000801154753.00ae3ed0 at mindspring.com>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+X-Mailer: Mutt 1.0pre4i
+In-Reply-To: <4.3.1.0.20000801154753.00ae3ed0 at mindspring.com>; from blburch at mindspring.com on Tue, Aug 01, 2000 at 03:54:42PM -0400
+Status: RO
+Content-Length: 1041
+Lines: 24
+
+
+(I was away for holidays last week, so not able to response earlier)
+
+* Bryan Burchette (blburch at mindspring.com) [000801 22:37]:
+> I am using ImageMagick 5.2.2 and for testing puposes I am using the little 
+> test program on the website under the API section. No matter what I do, the 
+> program cores on ReadImage().
+
+> Current function is main
+>     33     image=ReadImage(image_info,&exception);
+
+I located the problem in the getc() of ReadImage using PerlMagick.  I did
+not succeed in creating a reduced sized example for my program which
+reproduces the problem, so I'm glad I'm not the only one with this problem.
+
+Is there are more clarity on the cause of the crash?  Any response from the
+developers?
+-- 
+               Mark Overmeer   %-]
+
+------------------------------------------------------------------------
+drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+From magick-owner at unca-don.wizards.dupont.com Tue Aug  1 22:37 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id WAA14913
+	for <markov at ATComputing.nl>; Tue, 1 Aug 2000 22:37:13 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id WAA04892
+	for <markov at ATComputing.nl>; Tue, 1 Aug 2000 22:37:12 +0200
+Received: from viper.oldcity.dca.net(216.158.38.4) by ns.ATComputing.nl via smap (V2.1)
+	id xma004890; Tue, 1 Aug 00 22:37:04 +0200
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by viper.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id QAA28454;
+	Tue, 1 Aug 2000 16:36:07 -0400
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id PAA24962
+	for magick-outgoing; Tue, 1 Aug 2000 15:46:55 -0400 (EDT)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-Id: <4.3.1.0.20000801154753.00ae3ed0 at mindspring.com>
+X-Sender: blburch at mindspring.com
+X-Mailer: QUALCOMM Windows Eudora Version 4.3.1
+Date: Tue, 01 Aug 2000 15:54:42 -0400
+To: magick at wizards.dupont.com
+From: Bryan Burchette <blburch at mindspring.com>
+Subject: Core Dump on ReadImage
+Mime-Version: 1.0
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Bryan Burchette <blburch at mindspring.com>
+Content-Type: text/plain; charset="us-ascii"; format=flowed
+Status: RO
+X-Status: A
+Content-Length: 2042
+Lines: 55
+
+***********************************************************************
+This list is being decommissioned.  Please join one or more of the new
+ImageMagick mailing lists as described at
+http://www.imagemagick.org/www/magick-list.html.
+***********************************************************************
+
+Hey List,
+    This has me stumped! Maybe I am just missing something really obvious. 
+I am using ImageMagick 5.2.2 and for testing puposes I am using the little 
+test program on the website under the API section. No matter what I do, the 
+program cores on ReadImage().
+
+This is the program I am using to test:
+http://www.wizards.dupont.com/cristy/www/api.html
+
+I have pointed the MagickIncarnate() function to the appropriate directory 
+on my box.
+
+Does anybody have any ideas?? What could I be doing wrong.
+
+Here is my ouput from DBX
+(dbx) step
+stopped in main at line 29 in file "test.c"
+    29     GetExceptionInfo(&exception);
+(dbx) where
+=>[1] main(argc = 1, argv = 0xeffff3c4 "\xef\xff\xf5^H"), line 29 in "test.c"
+(dbx) step
+stopped in main at line 30 in file "test.c"
+    30     image_info=CloneImageInfo((ImageInfo *) NULL);
+(dbx) step
+stopped in main at line 31 in file "test.c"
+    31     (void) strcpy(image_info->filename,"test.jpg");
+(dbx) step
+stopped in main at line 32 in file "test.c"
+    32     printf("iamge_info->filename is %s\n",image_info->filename);
+(dbx) step
+iamge_info->filename is test.jpg
+stopped in main at line 33 in file "test.c"
+    33     image=ReadImage(image_info,&exception);
+(dbx) step
+signal SEGV (no mapping at the fault address) in getc at 0xef267b24
+0xef267b24: getc+0x0024:        ld      [%i0], %o0
+Current function is main
+    33     image=ReadImage(image_info,&exception);
+
+
+
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at imagemagick.org Wed Oct  4 19:56 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id TAA26427
+	for <markov at ATComputing.nl>; Wed, 4 Oct 2000 19:56:00 +0200 (MET DST)
+Received: from imagemagick.org (magick.imagemagick.org [38.220.172.2])
+	by ns.ATComputing.nl (Postfix) with ESMTP id 84B2DED32
+	for <markov at ATComputing.nl>; Wed,  4 Oct 2000 19:55:58 +0200 (CEST)
+Received: (from majordomo at localhost)
+	by imagemagick.org (8.11.0.Beta3/8.9.3) id e94IMj420302
+	for magick-developer-outgoing; Wed, 4 Oct 2000 14:22:45 -0400
+X-Authentication-Warning: magick.imagemagick.org: majordomo set sender to owner-magick at imagemagick.org using -f
+From: cristy at mystic.es.dupont.com
+Date: Wed, 4 Oct 2000 14:22:35 -0400 (EDT)
+Message-Id: <200010041822.e94IMZr19712 at mystic.es.dupont.com>
+To: magick-developer at imagemagick.org
+Subject: Font metrics
+Sender: owner-magick at imagemagick.org
+Precedence: bulk
+Reply-To: cristy at mystic.es.dupont.com
+Content-Type: text
+Status: RO
+Content-Length: 1620
+Lines: 32
+
+The problem with general font metrics in ImageMagick is that there are
+four schemes for obtaining fonts FreeType 1, FreeType 2,
+Postscript/Ghostscript fonts, and X11 fonts.  Freetype returns plenty
+of information associated with font metrics.  I know of no way to get
+the font metrics from Ghostscript and X11 fonts returns metrics but
+they do not exactly match the information returned by Freetype.
+Layered on top of that is the fonts can be manipulated with an affine
+matrix with varying results for the different font schemes.  Currently
+I write fonts to an image that bounds the font and turn all pixels not
+covered by the font lettering to transparent then composite this on top
+of the image being annotated.
+
+The only metrics available now are the maximum font height and string
+width.  In Perl, for example, use
+
+  $font->Read('label:This is a test');
+  ($width,$height)=$font->Get('width','height');
+
+I can certainly include other metric information as well but how to do
+this consistently for all font schemes?  Perhaps I could retain the
+font metrics for Freetype fonts only?  Or can you think of a few
+specific font metrics that would be useful to you that we can get for
+FreeType, X11, and Postscript fonts?  What is a minimal set of font
+metrics you need to make annotating more useable?
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at imagemagick.org
+
+Include the following command in the body of your message:
+	unsubscribe magick-developer
+***********************************************************************
+

Added: packages/libmail-box-perl/branches/upstream/current/tests/folders/mbox.src
===================================================================
--- packages/libmail-box-perl/branches/upstream/current/tests/folders/mbox.src	2005-03-26 19:44:25 UTC (rev 833)
+++ packages/libmail-box-perl/branches/upstream/current/tests/folders/mbox.src	2005-03-30 17:25:22 UTC (rev 834)
@@ -0,0 +1,3348 @@
+From magick-owner at unca-don.wizards.dupont.com Wed Feb  9 22:02 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id WAA23694
+	for <markov at ATComputing.nl>; Wed, 9 Feb 2000 22:02:24 +0100 (MET)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id WAA01128
+	for <markov at ATComputing.nl>; Wed, 9 Feb 2000 22:02:24 +0100
+Received: from viper.oldcity.dca.net(216.158.38.4) by ns.ATComputing.nl via smap (V2.1)
+	id xma001126; Wed, 9 Feb 00 22:02:01 +0100
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by viper.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id QAA21962;
+	Wed, 9 Feb 2000 16:00:43 -0500
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id PAA29389
+	for magick-outgoing; Wed, 9 Feb 2000 15:38:42 -0500 (EST)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Date: Wed, 9 Feb 2000 15:44:05 -0500
+From: William Park <parkw at better.net>
+To: Mark Sappol <Mark_Sappol at ipicorp.com>
+Cc: "magick at wizards.dupont.com" <magick at wizards.dupont.com>
+Subject: Re: File Conversion From HTML to PS and TIFF
+Message-ID: <20000209154405.C265 at better.net>
+Mail-Followup-To: Mark Sappol <Mark_Sappol at ipicorp.com>,
+	"magick at wizards.dupont.com" <magick at wizards.dupont.com>
+References: <38A11D0E.A2064062 at ipicorp.com>
+Mime-Version: 1.0
+X-Mailer: Mutt 1.0pre3i
+In-Reply-To: <38A11D0E.A2064062 at ipicorp.com>
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: William Park <parkw at better.net>
+Content-Type: text/plain; charset=us-ascii
+Status: RO
+Content-Length: 1280
+Lines: 33
+
+On Wed, Feb 09, 2000 at 07:53:50AM +0000, Mark Sappol wrote:
+> I am new to this list so please forgive me if I am asking something that
+> has already been answered previously.  I did check the archives but too
+> no avail.
+> 
+> I need to create a postscript file from an HTML document.  I have no
+> problem here with the text but I do have a logo (gif file) on this
+> document which does not get converted.  How can I go about converting
+> the HTML documents I generate, along with any linked GIF images, to
+> PostScript, as well as at other times, to TIFF?
+> 
+> I would appreciate any feedback and help on this request.
+> 
+> Thanks in advance,
+> Mark
+
+You can convert .html to .ps using Netscape.  You can do this manually
+by clicking mouse, or through '-remote' command line option.  For
+example,
+    netscape -remote "openURL(http://sexybabes.for.you/)" \
+	     -remote "saveAs(xxx.ps, Postscript)"
+
+You can then convert .ps to .tiff like FAX program does.
+
+William
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at unca-don.wizards.dupont.com Wed Feb  9 23:15 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id XAA24500
+	for <markov at ATComputing.nl>; Wed, 9 Feb 2000 23:15:56 +0100 (MET)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id XAA01235
+	for <markov at ATComputing.nl>; Wed, 9 Feb 2000 23:15:55 +0100
+Received: from viper.oldcity.dca.net(216.158.38.4) by ns.ATComputing.nl via smap (V2.1)
+	id xma001233; Wed, 9 Feb 00 23:15:42 +0100
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by viper.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id RAA04724;
+	Wed, 9 Feb 2000 17:13:49 -0500
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id QAA29779
+	for magick-outgoing; Wed, 9 Feb 2000 16:56:19 -0500 (EST)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-Id: <200002092200.RAA19561 at mailfw3.ford.com>
+Date: Wed, 09 Feb 2000 17:00:14 -0500
+From: "Lincoln, D. E. (Daniel)" <dlincol1 at ford.com>
+Organization: R&VT VCP&M
+X-Mailer: Mozilla 4.7C-CCK-MCD cf47 [en] (X11; I; SunOS 5.6 sun4u)
+X-Accept-Language: en, en-GB, de, fr, ja, ko, zh
+Mime-Version: 1.0
+To: Jeffrey Krzysztow <jeffrey.krzysztow at pvii.com>
+Cc: William Park <parkw at better.net>, Mark Sappol <Mark_Sappol at ipicorp.com>,
+        "magick at wizards.dupont.com" <magick at wizards.dupont.com>
+Subject: Re: File Conversion From HTML to PS and TIFF
+References: <38A11D0E.A2064062 at ipicorp.com> <20000209154405.C265 at better.net> <38A1DBE7.9D3718C9 at pvii.com>
+Content-Transfer-Encoding: 7bit
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: "Lincoln, D. E. (Daniel)" <dlincol1 at ford.com>
+Content-Type: text/plain; charset=us-ascii
+Status: RO
+Content-Length: 2109
+Lines: 60
+
+If I may interject...
+
+It can be found at:
+http://developer.netscape.com/docs/manuals/deploymt/options.htm
+
+Jeffrey Krzysztow wrote:
+> 
+> William,
+> 
+> Where did you find information about -remote command line option for Netscape?
+> 
+> William Park wrote:
+> 
+> > On Wed, Feb 09, 2000 at 07:53:50AM +0000, Mark Sappol wrote:
+> > > I am new to this list so please forgive me if I am asking something that
+> > > has already been answered previously.  I did check the archives but too
+> > > no avail.
+> > >
+> > > I need to create a postscript file from an HTML document.  I have no
+> > > problem here with the text but I do have a logo (gif file) on this
+> > > document which does not get converted.  How can I go about converting
+> > > the HTML documents I generate, along with any linked GIF images, to
+> > > PostScript, as well as at other times, to TIFF?
+> > >
+> > > I would appreciate any feedback and help on this request.
+> > >
+> > > Thanks in advance,
+> > > Mark
+> >
+> > You can convert .html to .ps using Netscape.  You can do this manually
+> > by clicking mouse, or through '-remote' command line option.  For
+> > example,
+> >     netscape -remote "openURL(http://sexybabes.for.you/)" \
+> >              -remote "saveAs(xxx.ps, Postscript)"
+> >
+> > You can then convert .ps to .tiff like FAX program does.
+> >
+> > William
+> >
+> > ***********************************************************************
+> > To remove yourself from this mailing list, send mail to:
+> >         majordomo at wizards.dupont.com
+> >
+> > Include the following command in the body of your message:
+> >         unsubscribe magick
+> > ***********************************************************************
+
+-- 
+Regards,
+
+Daniel E. Lincoln - Digital Buck Mechanic
+Ford Motor Company - R&VT Vehicle CAD Process & Methods
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at unca-don.wizards.dupont.com Wed Feb  9 23:15 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id XAA24495
+	for <markov at ATComputing.nl>; Wed, 9 Feb 2000 23:15:26 +0100 (MET)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id XAA01230
+	for <markov at ATComputing.nl>; Wed, 9 Feb 2000 23:15:25 +0100
+Received: from viper.oldcity.dca.net(216.158.38.4) by ns.ATComputing.nl via smap (V2.1)
+	id xma001228; Wed, 9 Feb 00 23:15:21 +0100
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by viper.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id RAA04756;
+	Wed, 9 Feb 2000 17:13:55 -0500
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id QAA29764
+	for magick-outgoing; Wed, 9 Feb 2000 16:55:37 -0500 (EST)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-ID: <38A1E3B0.F148D74A at websidestory.com>
+Date: Wed, 09 Feb 2000 14:01:20 -0800
+From: Steve Dotson <steve at websidestory.com>
+X-Mailer: Mozilla 4.7 [en] (X11; U; Linux 2.2.5-15 i686)
+X-Accept-Language: en
+MIME-Version: 1.0
+To: Jeffrey Krzysztow <jeffrey.krzysztow at pvii.com>
+CC: William Park <parkw at better.net>, Mark Sappol <Mark_Sappol at ipicorp.com>,
+        "magick at wizards.dupont.com" <magick at wizards.dupont.com>
+Subject: Re: File Conversion From HTML to PS and TIFF
+References: <38A11D0E.A2064062 at ipicorp.com> <20000209154405.C265 at better.net> <38A1DBE7.9D3718C9 at pvii.com>
+Content-Transfer-Encoding: 7bit
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Steve Dotson <steve at websidestory.com>
+Content-Type: text/plain; charset=us-ascii
+Status: RO
+Content-Length: 2129
+Lines: 63
+
+http://home.netscape.com/newsref/std/x-remote.html
+
+
+Jeffrey Krzysztow wrote:
+> 
+> William,
+> 
+> Where did you find information about -remote command line option for Netscape?
+> 
+> William Park wrote:
+> 
+> > On Wed, Feb 09, 2000 at 07:53:50AM +0000, Mark Sappol wrote:
+> > > I am new to this list so please forgive me if I am asking something that
+> > > has already been answered previously.  I did check the archives but too
+> > > no avail.
+> > >
+> > > I need to create a postscript file from an HTML document.  I have no
+> > > problem here with the text but I do have a logo (gif file) on this
+> > > document which does not get converted.  How can I go about converting
+> > > the HTML documents I generate, along with any linked GIF images, to
+> > > PostScript, as well as at other times, to TIFF?
+> > >
+> > > I would appreciate any feedback and help on this request.
+> > >
+> > > Thanks in advance,
+> > > Mark
+> >
+> > You can convert .html to .ps using Netscape.  You can do this manually
+> > by clicking mouse, or through '-remote' command line option.  For
+> > example,
+> >     netscape -remote "openURL(http://sexybabes.for.you/)" \
+> >              -remote "saveAs(xxx.ps, Postscript)"
+> >
+> > You can then convert .ps to .tiff like FAX program does.
+> >
+> > William
+> >
+> > ***********************************************************************
+> > To remove yourself from this mailing list, send mail to:
+> >         majordomo at wizards.dupont.com
+> >
+> > Include the following command in the body of your message:
+> >         unsubscribe magick
+> > ***********************************************************************
+
+-- 
+Steve Dotson
+Software Engineer
+
+WebSideStory, Inc.
+10182 Telesis Court, Sixth Floor
+San Diego, California 92121
+P:  858.546.0040  ext. 417
+F:  858.546.0480
+E:  steve at websidestory.com
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at unca-don.wizards.dupont.com Wed Feb 23 17:28 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id RAA20894
+	for <markov at ATComputing.nl>; Wed, 23 Feb 2000 17:28:05 +0100 (MET)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id RAA21883
+	for <markov at ATComputing.nl>; Wed, 23 Feb 2000 17:28:04 +0100
+Received: from viper.oldcity.dca.net(216.158.38.4) by ns.ATComputing.nl via smap (V2.1)
+	id xma021881; Wed, 23 Feb 00 17:27:46 +0100
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by viper.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id LAA28560;
+	Wed, 23 Feb 2000 11:25:57 -0500
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id KAA09345
+	for magick-outgoing; Wed, 23 Feb 2000 10:53:09 -0500 (EST)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-ID: <177E035AF8BDD311858B00A0C9D8E324886A3B at EMAILSRVR_KPR>
+From: Steve Sapovits <SapovitsS at globalsportsinc.com>
+To: magick at wizards.dupont.com
+Subject: Transparency question
+Date: Wed, 23 Feb 2000 10:58:16 -0500
+MIME-Version: 1.0
+X-Mailer: Internet Mail Service (5.5.2650.21)
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Steve Sapovits <SapovitsS at globalsportsinc.com>
+Content-Type: text/plain
+Status: RO
+Content-Length: 1447
+Lines: 42
+
+
+I'm trying to do the following:
+
+1)  Take a JPEG image and size it down to a particular size.
+2)  Overlay that JPEG on top of an GIF image to form a combined result.
+
+This works fine for the most part:  I use mogrify to resize, followed by 
+combine to overlay.
+
+Now I'm presented with GIF images (the ones the JPEG is put on top of)
+that have colors or other background attributes we want to 'show through'
+the overlay where there is no image.
+
+Even without any transparency options this seems to ALMOST work.  The
+problem is that there's a small area around each image of 'white' that
+always
+shows up.  Trying transparency or the 'matte' option of '-draw' seems to
+have
+no effect.
+
+Any ideas?  I'm an engineer -- not an image expert.  The images in question
+are handed to me.  I can change them if necessary and if it can be done via
+the ImageMagick tool.  The volume we generate makes manual changes to 
+each image out of the question.
+
+----
+Steve Sapovits
+Global Sports Interactive
+Work Email: sapovitss at globalsportsinc.com
+Home Email: steves at delanet.com
+Work Phone: 610-491-7087
+Cell:       610-574-7706
+Pager:      877-239-4003
+
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at unca-don.wizards.dupont.com Wed Feb 23 20:13 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id UAA24120
+	for <markov at ATComputing.nl>; Wed, 23 Feb 2000 20:13:38 +0100 (MET)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id UAA22110
+	for <markov at ATComputing.nl>; Wed, 23 Feb 2000 20:13:38 +0100
+Received: from viper.oldcity.dca.net(216.158.38.4) by ns.ATComputing.nl via smap (V2.1)
+	id xma022108; Wed, 23 Feb 00 20:13:37 +0100
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by viper.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id OAA00687;
+	Wed, 23 Feb 2000 14:11:56 -0500
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id NAA10192
+	for magick-outgoing; Wed, 23 Feb 2000 13:26:44 -0500 (EST)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-ID: <177E035AF8BDD311858B00A0C9D8E324886AB2 at EMAILSRVR_KPR>
+From: Steve Sapovits <SapovitsS at globalsportsinc.com>
+To: Steve Sapovits <SapovitsS at globalsportsinc.com>, magick at wizards.dupont.com
+Subject: RE: Transparency question
+Date: Wed, 23 Feb 2000 13:31:41 -0500
+MIME-Version: 1.0
+X-Mailer: Internet Mail Service (5.5.2650.21)
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Steve Sapovits <SapovitsS at globalsportsinc.com>
+Content-Type: text/plain
+Status: RO
+Content-Length: 2483
+Lines: 73
+
+
+Someone on this list and my image folks here seem to confirm that the
+problem
+here is with 'fringe' pixels that were not trimmed back as neatly as
+possible.  Any
+suggestions for automating this?  This whole thing needs to be batched.  I
+played
+with the transparency and fuzz options with no real difference noted.
+Trying 
+crop 0x0 makes some of the fringe whitespace areas neater, but it doesn't
+get rid
+of them.
+
+Any suggestions?
+
+> -----Original Message-----
+> From:	Steve Sapovits [SMTP:SapovitsS at globalsportsinc.com]
+> Sent:	Wednesday, February 23, 2000 10:58 AM
+> To:	magick at wizards.dupont.com
+> Subject:	Transparency question
+> 
+> 
+> I'm trying to do the following:
+> 
+> 1)  Take a JPEG image and size it down to a particular size.
+> 2)  Overlay that JPEG on top of an GIF image to form a combined result.
+> 
+> This works fine for the most part:  I use mogrify to resize, followed by 
+> combine to overlay.
+> 
+> Now I'm presented with GIF images (the ones the JPEG is put on top of)
+> that have colors or other background attributes we want to 'show through'
+> the overlay where there is no image.
+> 
+> Even without any transparency options this seems to ALMOST work.  The
+> problem is that there's a small area around each image of 'white' that
+> always
+> shows up.  Trying transparency or the 'matte' option of '-draw' seems to
+> have
+> no effect.
+> 
+> Any ideas?  I'm an engineer -- not an image expert.  The images in
+> question
+> are handed to me.  I can change them if necessary and if it can be done
+> via
+> the ImageMagick tool.  The volume we generate makes manual changes to 
+> each image out of the question.
+> 
+> ----
+> Steve Sapovits
+> Global Sports Interactive
+> Work Email: sapovitss at globalsportsinc.com
+> Home Email: steves at delanet.com
+> Work Phone: 610-491-7087
+> Cell:       610-574-7706
+> Pager:      877-239-4003
+> 
+> 
+> ***********************************************************************
+> To remove yourself from this mailing list, send mail to:
+> 	majordomo at wizards.dupont.com
+> 
+> Include the following command in the body of your message:
+> 	unsubscribe magick
+> ***********************************************************************
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at unca-don.wizards.dupont.com Thu Feb 24 17:27 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id RAA19964
+	for <markov at ATComputing.nl>; Thu, 24 Feb 2000 17:27:35 +0100 (MET)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id RAA23400
+	for <markov at ATComputing.nl>; Thu, 24 Feb 2000 17:27:34 +0100
+Received: from mustang.oldcity.dca.net(216.158.38.3) by ns.ATComputing.nl via smap (V2.1)
+	id xma023398; Thu, 24 Feb 00 17:27:10 +0100
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by mustang.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id LAA14646;
+	Thu, 24 Feb 2000 11:25:37 -0500
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id LAA15770
+	for magick-outgoing; Thu, 24 Feb 2000 11:04:56 -0500 (EST)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-ID: <8100014B48DAD111AA4100805F9F3FC903A0E5B2 at host60.corbis.com>
+From: Bill Radcliffe <BillR at corbis.com>
+To: "'Steve Sapovits'" <SapovitsS at globalsportsinc.com>,
+        "'magick at wizards.dupont.com'" <magick at wizards.dupont.com>
+Subject: RE: Transparency question
+Date: Thu, 24 Feb 2000 08:06:44 -0800
+MIME-Version: 1.0
+X-Mailer: Internet Mail Service (5.5.2448.0)
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Bill Radcliffe <BillR at corbis.com>
+Content-Type: text/plain
+Status: RO
+Content-Length: 3362
+Lines: 93
+
+It would help me if you could send some small samples of exactly the effect
+you are trying to achieve. I'm sure IM can do whatever you want but the road
+to get there may not be at all obvious.
+
+> -----Original Message-----
+> From:	Steve Sapovits [SMTP:SapovitsS at globalsportsinc.com]
+> Sent:	Wednesday, February 23, 2000 10:32 AM
+> To:	Steve Sapovits; magick at wizards.dupont.com
+> Subject:	RE: Transparency question
+> 
+> 
+> Someone on this list and my image folks here seem to confirm that the
+> problem
+> here is with 'fringe' pixels that were not trimmed back as neatly as
+> possible.  Any
+> suggestions for automating this?  This whole thing needs to be batched.  I
+> played
+> with the transparency and fuzz options with no real difference noted.
+> Trying 
+> crop 0x0 makes some of the fringe whitespace areas neater, but it doesn't
+> get rid
+> of them.
+> 
+> Any suggestions?
+> 
+> > -----Original Message-----
+> > From:	Steve Sapovits [SMTP:SapovitsS at globalsportsinc.com]
+> > Sent:	Wednesday, February 23, 2000 10:58 AM
+> > To:	magick at wizards.dupont.com
+> > Subject:	Transparency question
+> > 
+> > 
+> > I'm trying to do the following:
+> > 
+> > 1)  Take a JPEG image and size it down to a particular size.
+> > 2)  Overlay that JPEG on top of an GIF image to form a combined result.
+> > 
+> > This works fine for the most part:  I use mogrify to resize, followed by
+> 
+> > combine to overlay.
+> > 
+> > Now I'm presented with GIF images (the ones the JPEG is put on top of)
+> > that have colors or other background attributes we want to 'show
+> through'
+> > the overlay where there is no image.
+> > 
+> > Even without any transparency options this seems to ALMOST work.  The
+> > problem is that there's a small area around each image of 'white' that
+> > always
+> > shows up.  Trying transparency or the 'matte' option of '-draw' seems to
+> > have
+> > no effect.
+> > 
+> > Any ideas?  I'm an engineer -- not an image expert.  The images in
+> > question
+> > are handed to me.  I can change them if necessary and if it can be done
+> > via
+> > the ImageMagick tool.  The volume we generate makes manual changes to 
+> > each image out of the question.
+> > 
+> > ----
+> > Steve Sapovits
+> > Global Sports Interactive
+> > Work Email: sapovitss at globalsportsinc.com
+> > Home Email: steves at delanet.com
+> > Work Phone: 610-491-7087
+> > Cell:       610-574-7706
+> > Pager:      877-239-4003
+> > 
+> > 
+> > ***********************************************************************
+> > To remove yourself from this mailing list, send mail to:
+> > 	majordomo at wizards.dupont.com
+> > 
+> > Include the following command in the body of your message:
+> > 	unsubscribe magick
+> > ***********************************************************************
+> 
+> ***********************************************************************
+> To remove yourself from this mailing list, send mail to:
+> 	majordomo at wizards.dupont.com
+> 
+> Include the following command in the body of your message:
+> 	unsubscribe magick
+> ***********************************************************************
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at unca-don.wizards.dupont.com Thu Feb 24 18:17 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id SAA21506
+	for <markov at ATComputing.nl>; Thu, 24 Feb 2000 18:17:36 +0100 (MET)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id SAA23500
+	for <markov at ATComputing.nl>; Thu, 24 Feb 2000 18:17:35 +0100
+Received: from mustang.oldcity.dca.net(216.158.38.3) by ns.ATComputing.nl via smap (V2.1)
+	id xma023498; Thu, 24 Feb 00 18:17:21 +0100
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by mustang.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id MAA27594;
+	Thu, 24 Feb 2000 12:14:53 -0500
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id LAA16076
+	for magick-outgoing; Thu, 24 Feb 2000 11:52:40 -0500 (EST)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-ID: <8100014B48DAD111AA4100805F9F3FC903A0E5B9 at host60.corbis.com>
+From: Bill Radcliffe <BillR at corbis.com>
+To: "'Steve Sapovits'" <SapovitsS at globalsportsinc.com>
+Cc: "'magick at wizards.dupont.com'" <magick at wizards.dupont.com>
+Subject: RE: Transparency question
+Date: Thu, 24 Feb 2000 08:54:32 -0800
+MIME-Version: 1.0
+X-Mailer: Internet Mail Service (5.5.2448.0)
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Bill Radcliffe <BillR at corbis.com>
+Content-Type: text/plain;
+	charset="ISO-8859-1"
+Status: RO
+Content-Length: 5643
+Lines: 161
+
+Your problem is that you are trying to use transparency, but you really want
+to use alpha channel blending. I'll show you how if you can send me another
+copy of MCS_C_11452.gif before it is flattened out into a GIF file. You need
+to have an input file were the "image" pixels are in the RGB parts of the
+file, and the "cutout" is in the "alpha" channel. The alpha channel contains
+a value for each and every pixel that defines the opacity of the pixel. Two
+file formats that support this are Photoshop and TIFF.
+
+> -----Original Message-----
+> From:	Steve Sapovits [SMTP:SapovitsS at globalsportsinc.com]
+> Sent:	Thursday, February 24, 2000 8:34 AM
+> To:	Bill Radcliffe
+> Subject:	RE: Transparency question
+> 
+> 
+> Good idea, of course.
+> 
+> This is run from a bigger program but I distilled it down to a simpler 
+> set of commands to reproduce.  I run these two commands:
+> 
+> mogrify -geometry 120x120! 'MCS_C_11452.gif'
+> combine 'MCS_C_120x150.gif' -gravity south 'MCS_C_11452.gif' -compose over
+> 'result.gif'
+> 
+> I get this output:
+> 
+> mogrify: no delegates configuration file found (delegates.mgk).
+> mogrify: no encode delegate for this image format (Y).
+> combine: no delegates configuration file found (delegates.mgk).
+> 
+> I've gotten these 'delegates' messages before with no ill effects. 
+> 
+> Here are the files I'm using.  The 'result.gif' has the whitespace I
+> mentioned.  Any help
+> would be greatly appreciated.  I'll write a perl program for you in
+> exchange
+> or something.  8-)
+> 
+>  <<MCS_C_11452.gif>>  <<MCS_C_120x150.gif>>  <<result.gif>> 
+> 
+> 
+> > -----Original Message-----
+> > From:	Bill Radcliffe [SMTP:BillR at corbis.com]
+> > Sent:	Thursday, February 24, 2000 11:07 AM
+> > To:	'Steve Sapovits'; 'magick at wizards.dupont.com'
+> > Subject:	RE: Transparency question
+> > 
+> > It would help me if you could send some small samples of exactly the
+> > effect
+> > you are trying to achieve. I'm sure IM can do whatever you want but the
+> > road
+> > to get there may not be at all obvious.
+> > 
+> > > -----Original Message-----
+> > > From:	Steve Sapovits [SMTP:SapovitsS at globalsportsinc.com]
+> > > Sent:	Wednesday, February 23, 2000 10:32 AM
+> > > To:	Steve Sapovits; magick at wizards.dupont.com
+> > > Subject:	RE: Transparency question
+> > > 
+> > > 
+> > > Someone on this list and my image folks here seem to confirm that the
+> > > problem
+> > > here is with 'fringe' pixels that were not trimmed back as neatly as
+> > > possible.  Any
+> > > suggestions for automating this?  This whole thing needs to be
+> batched.
+> > I
+> > > played
+> > > with the transparency and fuzz options with no real difference noted.
+> > > Trying 
+> > > crop 0x0 makes some of the fringe whitespace areas neater, but it
+> > doesn't
+> > > get rid
+> > > of them.
+> > > 
+> > > Any suggestions?
+> > > 
+> > > > -----Original Message-----
+> > > > From:	Steve Sapovits [SMTP:SapovitsS at globalsportsinc.com]
+> > > > Sent:	Wednesday, February 23, 2000 10:58 AM
+> > > > To:	magick at wizards.dupont.com
+> > > > Subject:	Transparency question
+> > > > 
+> > > > 
+> > > > I'm trying to do the following:
+> > > > 
+> > > > 1)  Take a JPEG image and size it down to a particular size.
+> > > > 2)  Overlay that JPEG on top of an GIF image to form a combined
+> > result.
+> > > > 
+> > > > This works fine for the most part:  I use mogrify to resize,
+> followed
+> > by
+> > > 
+> > > > combine to overlay.
+> > > > 
+> > > > Now I'm presented with GIF images (the ones the JPEG is put on top
+> of)
+> > > > that have colors or other background attributes we want to 'show
+> > > through'
+> > > > the overlay where there is no image.
+> > > > 
+> > > > Even without any transparency options this seems to ALMOST work.
+> The
+> > > > problem is that there's a small area around each image of 'white'
+> that
+> > > > always
+> > > > shows up.  Trying transparency or the 'matte' option of '-draw'
+> seems
+> > to
+> > > > have
+> > > > no effect.
+> > > > 
+> > > > Any ideas?  I'm an engineer -- not an image expert.  The images in
+> > > > question
+> > > > are handed to me.  I can change them if necessary and if it can be
+> > done
+> > > > via
+> > > > the ImageMagick tool.  The volume we generate makes manual changes
+> to 
+> > > > each image out of the question.
+> > > > 
+> > > > ----
+> > > > Steve Sapovits
+> > > > Global Sports Interactive
+> > > > Work Email: sapovitss at globalsportsinc.com
+> > > > Home Email: steves at delanet.com
+> > > > Work Phone: 610-491-7087
+> > > > Cell:       610-574-7706
+> > > > Pager:      877-239-4003
+> > > > 
+> > > > 
+> > > >
+> > ***********************************************************************
+> > > > To remove yourself from this mailing list, send mail to:
+> > > > 	majordomo at wizards.dupont.com
+> > > > 
+> > > > Include the following command in the body of your message:
+> > > > 	unsubscribe magick
+> > > >
+> > ***********************************************************************
+> > > 
+> > >
+> ***********************************************************************
+> > > To remove yourself from this mailing list, send mail to:
+> > > 	majordomo at wizards.dupont.com
+> > > 
+> > > Include the following command in the body of your message:
+> > > 	unsubscribe magick
+> > >
+> *********************************************************************** <<
+> File: MCS_C_11452.gif >>  << File: MCS_C_120x150.gif >>  << File:
+> result.gif >> 
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at unca-don.wizards.dupont.com Thu Feb 24 20:21 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id UAA23276
+	for <markov at ATComputing.nl>; Thu, 24 Feb 2000 20:21:08 +0100 (MET)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id UAA23679
+	for <markov at ATComputing.nl>; Thu, 24 Feb 2000 20:21:08 +0100
+Received: from viper.oldcity.dca.net(216.158.38.4) by ns.ATComputing.nl via smap (V2.1)
+	id xma023676; Thu, 24 Feb 00 20:20:57 +0100
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by viper.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id OAA10625;
+	Thu, 24 Feb 2000 14:17:28 -0500
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id NAA16562
+	for magick-outgoing; Thu, 24 Feb 2000 13:40:21 -0500 (EST)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-ID: <8100014B48DAD111AA4100805F9F3FC903A0E5BF at host60.corbis.com>
+From: Bill Radcliffe <BillR at corbis.com>
+To: "'Steve Sapovits'" <SapovitsS at globalsportsinc.com>
+Cc: "'magick at wizards.dupont.com'" <magick at wizards.dupont.com>
+Subject: RE: Transparency question
+Date: Thu, 24 Feb 2000 10:42:23 -0800
+MIME-Version: 1.0
+X-Mailer: Internet Mail Service (5.5.2448.0)
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Bill Radcliffe <BillR at corbis.com>
+Content-Type: text/plain;
+	charset="ISO-8859-1"
+Status: RO
+Content-Length: 7382
+Lines: 206
+
+OK - here is a "possible" solution. This sequence relies on the fact that
+the input image was originally composited on a white background. It takes
+the image and generates a "fake" alpha channel (mask) and uses this during
+the compositing operation. It looks pretty good, but has the disadvantage
+that the background will tend to influence the colors in the final image
+more then you would want.
+
+: first convert to an RGB format with no more transparency or mask channel
+convert -compression none MCS_C_11452.gif MCS_C_11452_rgb.bmp
+: now make a fake alpha channel using a grayscale version of the image
+(inverted) 
+convert -compression none -colorspace gray -negate MCS_C_11452.gif
+MCS_C_11452_a.bmp
+: combine the original image along with the fake alpha channel onto the
+background
+combine -gravity south -compose over MCS_C_120x150.gif MCS_C_11452.gif
+MCS_C_11452_a.bmp result.gif 
+
+> -----Original Message-----
+> From:	Bill Radcliffe 
+> Sent:	Thursday, February 24, 2000 8:55 AM
+> To:	'Steve Sapovits'
+> Cc:	'magick at wizards.dupont.com'
+> Subject:	RE: Transparency question
+> 
+> Your problem is that you are trying to use transparency, but you really
+> want
+> to use alpha channel blending. I'll show you how if you can send me
+> another
+> copy of MCS_C_11452.gif before it is flattened out into a GIF file. You
+> need
+> to have an input file were the "image" pixels are in the RGB parts of the
+> file, and the "cutout" is in the "alpha" channel. The alpha channel
+> contains
+> a value for each and every pixel that defines the opacity of the pixel.
+> Two
+> file formats that support this are Photoshop and TIFF.
+> 
+> > -----Original Message-----
+> > From:	Steve Sapovits [SMTP:SapovitsS at globalsportsinc.com]
+> > Sent:	Thursday, February 24, 2000 8:34 AM
+> > To:	Bill Radcliffe
+> > Subject:	RE: Transparency question
+> > 
+> > 
+> > Good idea, of course.
+> > 
+> > This is run from a bigger program but I distilled it down to a simpler 
+> > set of commands to reproduce.  I run these two commands:
+> > 
+> > mogrify -geometry 120x120! 'MCS_C_11452.gif'
+> > combine 'MCS_C_120x150.gif' -gravity south 'MCS_C_11452.gif' -compose
+> over
+> > 'result.gif'
+> > 
+> > I get this output:
+> > 
+> > mogrify: no delegates configuration file found (delegates.mgk).
+> > mogrify: no encode delegate for this image format (Y).
+> > combine: no delegates configuration file found (delegates.mgk).
+> > 
+> > I've gotten these 'delegates' messages before with no ill effects. 
+> > 
+> > Here are the files I'm using.  The 'result.gif' has the whitespace I
+> > mentioned.  Any help
+> > would be greatly appreciated.  I'll write a perl program for you in
+> > exchange
+> > or something.  8-)
+> > 
+> >  <<MCS_C_11452.gif>>  <<MCS_C_120x150.gif>>  <<result.gif>> 
+> > 
+> > 
+> > > -----Original Message-----
+> > > From:	Bill Radcliffe [SMTP:BillR at corbis.com]
+> > > Sent:	Thursday, February 24, 2000 11:07 AM
+> > > To:	'Steve Sapovits'; 'magick at wizards.dupont.com'
+> > > Subject:	RE: Transparency question
+> > > 
+> > > It would help me if you could send some small samples of exactly the
+> > > effect
+> > > you are trying to achieve. I'm sure IM can do whatever you want but
+> the
+> > > road
+> > > to get there may not be at all obvious.
+> > > 
+> > > > -----Original Message-----
+> > > > From:	Steve Sapovits [SMTP:SapovitsS at globalsportsinc.com]
+> > > > Sent:	Wednesday, February 23, 2000 10:32 AM
+> > > > To:	Steve Sapovits; magick at wizards.dupont.com
+> > > > Subject:	RE: Transparency question
+> > > > 
+> > > > 
+> > > > Someone on this list and my image folks here seem to confirm that
+> the
+> > > > problem
+> > > > here is with 'fringe' pixels that were not trimmed back as neatly as
+> > > > possible.  Any
+> > > > suggestions for automating this?  This whole thing needs to be
+> > batched.
+> > > I
+> > > > played
+> > > > with the transparency and fuzz options with no real difference
+> noted.
+> > > > Trying 
+> > > > crop 0x0 makes some of the fringe whitespace areas neater, but it
+> > > doesn't
+> > > > get rid
+> > > > of them.
+> > > > 
+> > > > Any suggestions?
+> > > > 
+> > > > > -----Original Message-----
+> > > > > From:	Steve Sapovits [SMTP:SapovitsS at globalsportsinc.com]
+> > > > > Sent:	Wednesday, February 23, 2000 10:58 AM
+> > > > > To:	magick at wizards.dupont.com
+> > > > > Subject:	Transparency question
+> > > > > 
+> > > > > 
+> > > > > I'm trying to do the following:
+> > > > > 
+> > > > > 1)  Take a JPEG image and size it down to a particular size.
+> > > > > 2)  Overlay that JPEG on top of an GIF image to form a combined
+> > > result.
+> > > > > 
+> > > > > This works fine for the most part:  I use mogrify to resize,
+> > followed
+> > > by
+> > > > 
+> > > > > combine to overlay.
+> > > > > 
+> > > > > Now I'm presented with GIF images (the ones the JPEG is put on top
+> > of)
+> > > > > that have colors or other background attributes we want to 'show
+> > > > through'
+> > > > > the overlay where there is no image.
+> > > > > 
+> > > > > Even without any transparency options this seems to ALMOST work.
+> > The
+> > > > > problem is that there's a small area around each image of 'white'
+> > that
+> > > > > always
+> > > > > shows up.  Trying transparency or the 'matte' option of '-draw'
+> > seems
+> > > to
+> > > > > have
+> > > > > no effect.
+> > > > > 
+> > > > > Any ideas?  I'm an engineer -- not an image expert.  The images in
+> > > > > question
+> > > > > are handed to me.  I can change them if necessary and if it can be
+> > > done
+> > > > > via
+> > > > > the ImageMagick tool.  The volume we generate makes manual changes
+> > to 
+> > > > > each image out of the question.
+> > > > > 
+> > > > > ----
+> > > > > Steve Sapovits
+> > > > > Global Sports Interactive
+> > > > > Work Email: sapovitss at globalsportsinc.com
+> > > > > Home Email: steves at delanet.com
+> > > > > Work Phone: 610-491-7087
+> > > > > Cell:       610-574-7706
+> > > > > Pager:      877-239-4003
+> > > > > 
+> > > > > 
+> > > > >
+> > >
+> ***********************************************************************
+> > > > > To remove yourself from this mailing list, send mail to:
+> > > > > 	majordomo at wizards.dupont.com
+> > > > > 
+> > > > > Include the following command in the body of your message:
+> > > > > 	unsubscribe magick
+> > > > >
+> > >
+> ***********************************************************************
+> > > > 
+> > > >
+> > ***********************************************************************
+> > > > To remove yourself from this mailing list, send mail to:
+> > > > 	majordomo at wizards.dupont.com
+> > > > 
+> > > > Include the following command in the body of your message:
+> > > > 	unsubscribe magick
+> > > >
+> > ***********************************************************************
+> <<
+> > File: MCS_C_11452.gif >>  << File: MCS_C_120x150.gif >>  << File:
+> > result.gif >> 
+> 
+> ***********************************************************************
+> To remove yourself from this mailing list, send mail to:
+> 	majordomo at wizards.dupont.com
+> 
+> Include the following command in the body of your message:
+> 	unsubscribe magick
+> ***********************************************************************
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From markov Sun Aug  8 10:04:17 1999
+Subject: Resize with Transparency
+To: magick at wizards.dupont.com
+Date: Sun, 8 Aug 1999 10:04:17 +0200 (MET DST)
+Reply-To: markov at ATComputing.nl (Mark Overmeer)
+X-Mailer: ELM [version 2.4 PL21]
+MIME-Version: 1.0
+Content-Type: text/plain; charset=US-ASCII
+Content-Transfer-Encoding: 7bit
+Status: RO
+Content-Length: 1376
+Lines: 37
+
+
+Hi,
+
+Maybe someone knows a solution, maybe for enhancement:
+
+  I have an image (say black on white), where white is set
+  to be transparent.  I can display the image on any background,
+  without seeing white.
+    Now I resize the image with anti-aliasing.  For that, we have
+  to intermediate pixels, which also requires interpolating
+  the black pixels and background pixels.
+    But: I my case, the background has a different (but known) color
+  every time i.e. need to anti-alias the same image to different
+  backgrounds.  I would like to write:
+
+     my $image->Read('original.gif');
+     $image->Set(background => 'blue');
+     $image->Scale('50%x50%');
+     $image->Write('small.gif');
+
+However, ImageMagick (ImageMagick 4.2.7, PerlMagick 4.27 on Linux)
+takes as value for a transparent pixel not the value of `background',
+but the color used to define a transparent color: in this case
+`white'.  My image reduced as above shows white pixels on my blue
+background.
+
+  Is my expectation wrong?
+
+  Does anyone know a work-around?
+-- 
+Thanks,
+               Mark Overmeer   %-]
+
+------------------------------------------------------------------------
+drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+From magick-owner at unca-don.wizards.dupont.com Thu Mar 30 19:09 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id TAA14579
+	for <markov at ATComputing.nl>; Thu, 30 Mar 2000 19:09:10 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id TAA31447
+	for <markov at ATComputing.nl>; Thu, 30 Mar 2000 19:09:10 +0200
+Received: from viper.oldcity.dca.net(216.158.38.4) by ns.ATComputing.nl via smap (V2.1)
+	id xma031440; Thu, 30 Mar 00 19:08:51 +0200
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by viper.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id MAA10121;
+	Thu, 30 Mar 2000 12:04:52 -0500
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id LAA03360
+	for magick-outgoing; Thu, 30 Mar 2000 11:44:20 -0500 (EST)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-ID: <8100014B48DAD111AA4100805F9F3FC903A0E75D at host60.corbis.com>
+From: Bill Radcliffe <BillR at corbis.com>
+To: "'Ivo'" <ivo.penzar at infolink-software.com>, magick at wizards.dupont.com,
+        tiff at olympiakos.com
+Subject: RE: jpeg2000 question
+Date: Thu, 30 Mar 2000 08:46:50 -0800
+MIME-Version: 1.0
+X-Mailer: Internet Mail Service (5.5.2448.0)
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Bill Radcliffe <BillR at corbis.com>
+Content-Type: text/plain
+Status: RO
+Content-Length: 2759
+Lines: 66
+
+I worked on the definition of the JP2 file format.  The situation with
+JPEG2000 is not at all like JPEG.
+
+You should know is that JP2 is a very simple wrapper around the formal
+JPEG2000 "codestream". It was based on the Quicktime idea of "atoms". This
+simple idea is that you have a tag and a length followed by the "stuff". You
+know what the "stuff" is based on the tag type. You can also nest these
+atoms to build more complex structures.
+
+JP2 is a very simple set of these atoms, most of which are optional. You
+could write a program to implement this in about 15 minutes.  The "hard"
+part of JP2 is the "codestream". This is the encoded JPEG2000 data. Good
+luck on that. We don't have a freely available reference implementation at
+this point because nobody has signed up to do it. There was an effort
+underway by the same group that did the JPEG-LS implementation. This was
+given to the public domain..
+
+http://spmg.ece.ubc.ca/research/jpeg/jpeg_ls/jpegls.html
+
+They actually had an implementation of JPEG2000 on their website but pulled
+it off:
+
+http://www.ece.ubc.ca/~mdadams/jasper/
+
+Apparently, they decided to sell out and try to charge for it instead of
+providing it to the public domain. We all know how well that is going to
+work. When are people going to learn that you can't make money selling
+compression software? It's not a business - its just an enabler.
+
+My opinion is that without a "Tom Lane" type signing up to make a free
+implementation available, JPEG2000 is doomed. You just don't get real
+interoperability from a paper spec. We know this.
+
+The good news is that the Digital Imaging Group (DIG) has a project underway
+to do this. The bad news is that it has not yet started. And so we wait :-)
+
+> -----Original Message-----
+> From:	Ivo [SMTP:ivo.penzar at infolink-software.com]
+> Sent:	Thursday, March 30, 2000 1:37 AM
+> To:	magick at wizards.dupont.com; tiff at olympiakos.com
+> Subject:	jpeg2000 question
+> 
+> Does anybody know of some repository of jp2 (jpeg2000, to be approved by
+> ISO/ITU-T by the end of this year) and/or a tool to write (some sort of)
+> those images.
+> 
+> Thanks,
+> Ivo
+> 
+> 
+> 
+> ***********************************************************************
+> To remove yourself from this mailing list, send mail to:
+> 	majordomo at wizards.dupont.com
+> 
+> Include the following command in the body of your message:
+> 	unsubscribe magick
+> ***********************************************************************
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From markov at ATComputing.nl Fri Mar 31 17:01:17 2000
+Date: Fri, 31 Mar 2000 17:01:17 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: Carl Knoos <cknoos at atg.com>
+Cc: magick at wizards.dupont.com
+Subject: Re: Problem resizing images through perl script
+Message-ID: <20000331170117.B2095 at atcmpg.ATComputing.nl>
+References: <10F4E7B8292FD311B34400A0C978B70532A61B at a254.117.208.207.ded23.interaccess.com> <NDBBJJFDMKFOAIFBEPPJIELLCBAA.cknoos at atg.com>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+X-Mailer: Mutt 1.0pre4i
+In-Reply-To: <NDBBJJFDMKFOAIFBEPPJIELLCBAA.cknoos at atg.com>; from cknoos at atg.com on Thu, Mar 30, 2000 at 06:27:54PM -0500
+Status: RO
+Content-Length: 820
+Lines: 23
+
+* Carl Knoos (cknoos at atg.com) [000331 01:39]:
+> if I run mogrify -geometry 95x95 whatever.jpg
+> I get exactly what I want, except when I try
+> to do it from Perl...
+
+> 		# resize it.
+> 		$result="$mogrifypath/mogrify -geometry 96x96
+> $GalleryPath/tn_$ShortFilename";
+
+I assume you try to execute this code: use back-tics:
+
+$result=`$mogrifypath/mogrify -geometry 96x96 $GalleryPath/tn_$ShortFilename`;
+
+or better qx(...)
+
+Is it just a slip of pen here, or just usual programmers-blindness?
+-- 
+               MarkOv       %-]
+
+------------------------------------------------------------------------
+drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+From magick-owner at unca-don.wizards.dupont.com Fri Mar 31 01:39 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id BAA16135
+	for <markov at ATComputing.nl>; Fri, 31 Mar 2000 01:39:18 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id BAA31743
+	for <markov at ATComputing.nl>; Fri, 31 Mar 2000 01:39:18 +0200
+Received: from viper.oldcity.dca.net(216.158.38.4) by ns.ATComputing.nl via smap (V2.1)
+	id xma031741; Fri, 31 Mar 00 01:39:12 +0200
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by viper.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id SAA08310;
+	Thu, 30 Mar 2000 18:37:29 -0500
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id SAA05154
+	for magick-outgoing; Thu, 30 Mar 2000 18:24:04 -0500 (EST)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+From: "Carl Knoos" <cknoos at atg.com>
+To: <magick at wizards.dupont.com>
+Subject: Problem resizing images through perl script
+Date: Thu, 30 Mar 2000 18:27:54 -0500
+Message-ID: <NDBBJJFDMKFOAIFBEPPJIELLCBAA.cknoos at atg.com>
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+X-Priority: 3 (Normal)
+X-MSMail-Priority: Normal
+X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
+In-Reply-To: <10F4E7B8292FD311B34400A0C978B70532A61B at a254.117.208.207.ded23.interaccess.com>
+Importance: Normal
+X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: "Carl Knoos" <cknoos at atg.com>
+Content-Type: text/plain;
+	charset="iso-8859-1"
+Status: RO
+X-Status: A
+Content-Length: 1270
+Lines: 47
+
+I know this probably doesn't belong here, but
+I don't who else to ask :)
+
+Basically, I have imagemagick installed and it works
+like a charm!
+
+if I run mogrify -geometry 95x95 whatever.jpg
+I get exactly what I want, except when I try
+to do it from Perl...
+
+If I in a perl script say:
+
+sub GenerateThumb {
+	$fsize = -s "$GalleryPath/$ShortFilename";
+	if ($thumbmethod == 1) {
+		# copy image.
+		open(IMGFILE, "$GalleryPath/$ShortFilename");
+		open(TNFILE, ">$GalleryPath/tn_$ShortFilename");
+		binmode(IMGFILE);
+		binmode(TNFILE);
+		read(IMGFILE, $buffer, $fsize);
+		print TNFILE $buffer;
+		close(TNFILE);
+		close(IMGFILE);
+		chmod (0777, "$GalleryPath/tn_$ShortFilename");
+		# resize it.
+		$result="$mogrifypath/mogrify -geometry 96x96
+$GalleryPath/tn_$ShortFilename";
+	}
+}
+
+It all works great until it comes to the resizing, it just seem to skip the
+last step.
+the variable $mogrifypath is set correctly to /usr/bin
+
+Does anyone what I'm doing wrong?
+
+/Carl
+
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at unca-don.wizards.dupont.com Fri Mar 31 02:25 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id CAA16260
+	for <markov at ATComputing.nl>; Fri, 31 Mar 2000 02:25:19 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id CAA31781
+	for <markov at ATComputing.nl>; Fri, 31 Mar 2000 02:25:19 +0200
+Received: from mustang.oldcity.dca.net(216.158.38.3) by ns.ATComputing.nl via smap (V2.1)
+	id xma031779; Fri, 31 Mar 00 02:25:12 +0200
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by mustang.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id TAA21824;
+	Thu, 30 Mar 2000 19:23:29 -0500
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id TAA05326
+	for magick-outgoing; Thu, 30 Mar 2000 19:16:20 -0500 (EST)
+	<10F4E7B8292FD311B34400A0C978B70532A61B at a254.117.208.207.ded23.
+	interaccess.com>
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Mime-Version: 1.0
+X-Sender: leonardr at mail1.netreach.net
+Message-Id: <a04310102b5099e5b4e3f@[207.29.200.50]>
+In-Reply-To: 
+ <10F4E7B8292FD311B34400A0C978B70532A61B at a254.117.208.207.ded23.interaccess.com>
+References: 
+ <10F4E7B8292FD311B34400A0C978B70532A61B at a254.117.208.207.ded23.interaccess.com>
+Date: Thu, 30 Mar 2000 19:15:48 -0500
+To: Joseph Korabelnikov <jkorabelnikov at coolemail.com>
+        magick at wizards.dupont.com
+From: Leonard Rosenthol <leonardr at lazerware.com>
+Subject: Re: Convert HTM, HTML files to the .jpg format
+X-MIME-Autoconverted: from quoted-printable to 8bit by unca-don.wizards.dupont.com id TAA05323
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Leonard Rosenthol <leonardr at lazerware.com>
+X-MIME-Autoconverted: from 8bit to quoted-printable by mustang.oldcity.dca.net id TAA21824
+Content-Transfer-Encoding: 8bit
+X-MIME-Autoconverted: from quoted-printable to 8bit by atcmpg.ATComputing.nl id CAA16260
+Content-Type: text/plain; charset="iso-8859-1" ; format="flowed"
+Status: RO
+Content-Length: 1198
+Lines: 33
+
+At 4:12 PM -0600 3/30/00, Joseph Korabelnikov wrote:
+>I attempted to convert HTML file to the .jpg format from Command Prompt
+>window and got an error :
+>
+>	convert: delegate failed (html2ps -o %o %i).
+>	convert: no delegate for this image format (HTML).
+>
+>As I understood situation I need to install mgtl2ps library. Am I right. If
+>so, where to get it?
+>
+	You can find it at <http://www.tdb.uu.se/~jan/html2ps.html>.
+
+
+
+LDR
+-- 
+----------------------------------------------------------------------------
+                   You've got a SmartFriend in Pennsylvania
+----------------------------------------------------------------------------
+Leonard Rosenthol      			Internet:       leonardr at lazerware.com
+					America Online: MACgician
+Web Site: <http://www.lazerware.com/>
+FTP Site: <ftp://ftp.lazerware.com/>
+PGP Fingerprint: C76E 0497 C459 182D 0C6B  AB6B CA10 B4DF 8067 5E65
+
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From markov at ATComputing.nl Mon Apr  3 08:25:55 2000
+Date: Mon, 3 Apr 2000 08:25:55 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: Carl Knoos <cknoos at atg.com>
+Subject: Re: Problem resizing images through perl script
+Message-ID: <20000403082555.B11537 at atcmpg.ATComputing.nl>
+References: <20000331170117.B2095 at atcmpg.ATComputing.nl> <NDBBJJFDMKFOAIFBEPPJIEOCCBAA.cknoos at atg.com>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+X-Mailer: Mutt 1.0pre4i
+In-Reply-To: <NDBBJJFDMKFOAIFBEPPJIEOCCBAA.cknoos at atg.com>; from cknoos at atg.com on Sat, Apr 01, 2000 at 03:40:32PM -0500
+Status: RO
+Content-Length: 1046
+Lines: 23
+
+* Carl Knoos (cknoos at atg.com) [000401 22:42]:
+> ld.so.1: /usr/local/bin/mogrify: fatal: libttf.so.2: open failed: No such
+> file or directory
+
+Typical for installing ImageMagick binaries: they are precompiled on a
+system with a long list of shared-libs.  IM is very powerful, so there
+are many libs.  While starting, the libs are contacted.
+   Search for a libttf.so : you may not have it, have the wrong version
+or just a lacking link. ttf = True Type Fonts, and the lib is available
+at freetype.org.
+
+> I've asked the company that I rent space from to install
+> PerlMagick on the box, hopefully I won't have all these
+> problems if they do.
+
+Compatibility between all those libs and apps will continue to haunt us.
+-- 
+               MarkOv       %-]
+
+------------------------------------------------------------------------
+drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+From cknoos at atg.com Sat Apr  1 22:42 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id WAA04105
+	for <markov at ATComputing.nl>; Sat, 1 Apr 2000 22:42:15 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id WAA01429
+	for <markov at ATComputing.nl>; Sat, 1 Apr 2000 22:42:14 +0200
+Received: from art.atg.com(205.181.94.1) by ns.ATComputing.nl via smap (V2.1)
+	id xma001427; Sat, 1 Apr 00 22:42:05 +0200
+Received: from donkeykong (donkey-kong.atg.com [205.181.107.218])
+	by art.atg.com (8.9.1/8.9.1) with SMTP id PAA24854
+	for <markov at ATComputing.nl>; Sat, 1 Apr 2000 15:42:29 -0500 (EST)
+From: "Carl Knoos" <cknoos at atg.com>
+To: "Mark Overmeer" <markov at ATComputing.nl>
+Subject: RE: Problem resizing images through perl script
+Date: Sat, 1 Apr 2000 15:40:32 -0500
+Message-ID: <NDBBJJFDMKFOAIFBEPPJIEOCCBAA.cknoos at atg.com>
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+X-Priority: 3 (Normal)
+X-MSMail-Priority: Normal
+X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
+X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
+Importance: Normal
+In-Reply-To: <20000331170117.B2095 at atcmpg.ATComputing.nl>
+Content-Type: text/plain;
+	charset="iso-8859-1"
+Status: RO
+X-Status: A
+Content-Length: 1865
+Lines: 63
+
+Blindness :)
+
+Now I'm on to the next problem though...
+
+when I try to execute the line from the script,
+my webservers error log contains this:
+
+ld.so.1: /usr/local/bin/mogrify: fatal: libttf.so.2: open failed: No such
+file or directory
+
+I'm seriously starting to get ticked now... hehe :)
+
+I've asked the company that I rent space from to install
+PerlMagick on the box, hopefully I won't have all these
+problems if they do.
+
+Thanks for your help! :)
+
+/Carl
+
+
+-----Original Message-----
+From: owner-magick at wizards.dupont.com
+[mailto:owner-magick at wizards.dupont.com]On Behalf Of Mark Overmeer
+Sent: Friday, March 31, 2000 10:01 AM
+To: Carl Knoos
+Cc: magick at wizards.dupont.com
+Subject: Re: Problem resizing images through perl script
+
+
+* Carl Knoos (cknoos at atg.com) [000331 01:39]:
+> if I run mogrify -geometry 95x95 whatever.jpg
+> I get exactly what I want, except when I try
+> to do it from Perl...
+
+> 		# resize it.
+> 		$result="$mogrifypath/mogrify -geometry 96x96
+> $GalleryPath/tn_$ShortFilename";
+
+I assume you try to execute this code: use back-tics:
+
+$result=`$mogrifypath/mogrify -geometry 96x96
+$GalleryPath/tn_$ShortFilename`;
+
+or better qx(...)
+
+Is it just a slip of pen here, or just usual programmers-blindness?
+--
+               MarkOv       %-]
+
+------------------------------------------------------------------------
+drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+
+From markov at ATComputing.nl Tue May  9 15:14:18 2000
+Date: Tue, 9 May 2000 15:14:18 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: Pletschette Andre <andre.pletschette at gmx.net>
+Subject: Re: Undefined Symbol: SetWarningHandler
+Message-ID: <20000509151418.B15139 at atcmpg.ATComputing.nl>
+References: <3917FC90.8B8B0CF at gmx.net>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+X-Mailer: Mutt 1.0pre4i
+In-Reply-To: <3917FC90.8B8B0CF at gmx.net>; from andre.pletschette at gmx.net on Tue, May 09, 2000 at 01:54:56PM +0200
+Status: RO
+Content-Length: 1095
+Lines: 25
+
+* Pletschette Andre (andre.pletschette at gmx.net) [000509 15:11]:
+> When I tried to write a perl script with the following line in it:
+>   use Image::Magick;
+> I get the following error-message:
+> 
+>   perl: error in loading shared librairies:
+>   /usr/lib/perl5/site_perl/5.005/i586-lin
+>   ux/auto/Image/Magick/Magick.so: undefined symbol: SetWarningHandler
+> 
+> Could anybody tell me what this means, and how I can get it run, I run 
+> Suse Linux 6.3 and I've installed Image Magick with the C++ and the Perl
+> Modules.
+
+The Perl::Magick and Image::Magick/ImageMagick modules are not compatible.
+Just reinstall all yourself from www.ImageMagick.org.
+
+Be warned: you have to remove the old Perl::Magick *.pm files too, otherwise
+you may still use the old versions...
+--
+               MarkOv       %-]
+
+------------------------------------------------------------------------
+drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+From magick-owner at unca-don.wizards.dupont.com Tue May  9 15:11 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id PAA15311
+	for <markov at ATComputing.nl>; Tue, 9 May 2000 15:11:14 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id PAA24539
+	for <markov at ATComputing.nl>; Tue, 9 May 2000 15:11:13 +0200
+Received: from mustang.oldcity.dca.net(216.158.38.3) by ns.ATComputing.nl via smap (V2.1)
+	id xma024537; Tue, 9 May 00 15:11:01 +0200
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by mustang.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id JAA17934;
+	Tue, 9 May 2000 09:09:29 -0400
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id IAA13522
+	for magick-outgoing; Tue, 9 May 2000 08:42:00 -0400 (EDT)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-ID: <3917FC90.8B8B0CF at gmx.net>
+Date: Tue, 09 May 2000 13:54:56 +0200
+From: Pletschette Andre <andre.pletschette at gmx.net>
+X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.13 i586)
+X-Accept-Language: fr, en, de
+MIME-Version: 1.0
+To: "magick at wizards.dupont.com" <magick at wizards.dupont.com>
+Subject: Undefined Symbol: SetWarningHandler
+Content-Transfer-Encoding: 7bit
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Pletschette Andre <andre.pletschette at gmx.net>
+Content-Type: text/plain; charset=us-ascii
+Status: RO
+X-Status: A
+Content-Length: 747
+Lines: 19
+
+When I tried to write a perl script with the following line in it:
+  use Image::Magick;
+I get the following error-message:
+
+  perl: error in loading shared librairies:
+  /usr/lib/perl5/site_perl/5.005/i586-lin
+  ux/auto/Image/Magick/Magick.so: undefined symbol: SetWarningHandler
+
+Could anybody tell me what this means, and how I can get it run, I run 
+Suse Linux 6.3 and I've installed Image Magick with the C++ and the Perl
+Modules.
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at unca-don.wizards.dupont.com Wed May 17 16:07 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id QAA15770
+	for <markov at ATComputing.nl>; Wed, 17 May 2000 16:07:07 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id QAA04359
+	for <markov at ATComputing.nl>; Wed, 17 May 2000 16:07:06 +0200
+Received: from mustang.oldcity.dca.net(216.158.38.3) by ns.ATComputing.nl via smap (V2.1)
+	id xma004357; Wed, 17 May 00 16:06:40 +0200
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by mustang.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id KAA02079;
+	Wed, 17 May 2000 10:05:01 -0400
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id JAA23880
+	for magick-outgoing; Wed, 17 May 2000 09:41:41 -0400 (EDT)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Date: Wed, 17 May 2000 08:46:17 -0500 (CDT)
+From: Bob Friesenhahn <bfriesen at simple.dallas.tx.us>
+X-Sender: bfriesen at scooby.simplesystems.org
+To: Martin Bobrovsky <Martin.Bobrovsky at workforce.at>
+cc: ImageMagick Mailing List <magick at wizards.dupont.com>
+Subject: Re: watermarks/embossing
+In-Reply-To: <4.3.1.2.20000517112416.00c72e30 at mail.dot.at>
+Message-ID: <Pine.SO4.4.05.10005170826000.20112-100000 at scooby.simplesystems.org>
+MIME-Version: 1.0
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Bob Friesenhahn <bfriesen at simple.dallas.tx.us>
+Content-Type: TEXT/PLAIN; charset=US-ASCII
+Status: RO
+Content-Length: 1859
+Lines: 53
+
+If you can afford the Digimarc library (see
+http://www.digimarc.com/licensing/sdk.html &
+http://www.digimarc.com/news/pr00-13.html), Bill Radcliffe
+<BillR at corbis.com> can send you source for an ImageMagick module to do
+professional-grade watermarking.
+
+ImageMagick's 'combine' utility supports simplistic hidden
+watermarking via its -stegano option.  If you want a visible logo, you
+could use -compose to compose your logo on top of, or blended with,
+the base image.  Your visible logo can be mostly transparent in order
+to not disturb the image too much.
+
+See this interesting article about digital watermarking:
+http://www.spie.org/web/oer/november/nov99/cover1.html
+
+Bob
+
+On Wed, 17 May 2000, Martin Bobrovsky wrote:
+
+> Hi!
+> 
+> Can someone tell how I achieve the effect of embossing a text onto an 
+> image? My intention is to "secure" images on the web by applying a symbol 
+> or text which on the one hand does not affect the impression of the image 
+> too much, but on the other hand, makes the image "unusable" for 
+> professional printing purposes ...
+> 
+> thanks,
+> martin
+> 
+> 
+> ***********************************************************************
+> To remove yourself from this mailing list, send mail to:
+> 	majordomo at wizards.dupont.com
+> 
+> Include the following command in the body of your message:
+> 	unsubscribe magick
+> ***********************************************************************
+> 
+
+======================================
+Bob Friesenhahn
+bfriesen at simple.dallas.tx.us
+http://www.simplesystems.org/users/bfriesen
+
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-bugs at simple.dallas.tx.us Wed Jun 14 16:54 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id QAA25632
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 16:54:28 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id QAA12167
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 16:54:27 +0200
+Received: from ns.simplesystems.org(204.252.75.242) by ns.ATComputing.nl via smap (V2.1)
+	id xma012165; Wed, 14 Jun 00 16:54:12 +0200
+Received: from localhost (localhost [127.0.0.1])
+	by ns.simplesystems.org (8.9.3/8.9.3) with ESMTP id JAA14556
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 09:54:08 -0500 (CDT)
+From: magick-bugs at simple.dallas.tx.us
+Date: Wed, 14 Jun 2000 09:54:08 -0500 (CDT)
+Message-Id: <200006141454.JAA14556 at ns.simplesystems.org>
+To: markov at ATComputing.nl
+Subject: Re: Annotate problems (PR#298)
+X-Loop: magick-bugs at simple.dallas.tx.us
+Content-Type: text
+Status: RO
+X-Status: A
+Content-Length: 307
+Lines: 9
+
+Thank you for submitting an ImageMagick bug report to
+magick-bugs at simplesystems.org.
+
+Your bug report is available on the web at the URL
+http://www.simplesystems.org/ImageMagick/bugs?findid=298    
+
+Report any problems with the bug tracking system itself to
+Bob Friesenhahn <bfriesen at simple.dallas.tx.us>.
+
+
+From markov at ATComputing.nl Wed Jun 14 17:43:34 2000
+Date: Wed, 14 Jun 2000 17:43:34 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: Cristy <cristy at mystic.es.dupont.com>
+Subject: Re: your mail
+Message-ID: <20000614174334.G22766 at atcmpg.ATComputing.nl>
+References: <8172.960997992 at mystic>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+X-Mailer: Mutt 1.0pre4i
+In-Reply-To: <8172.960997992 at mystic>; from cristy at mystic.es.dupont.com on Wed, Jun 14, 2000 at 11:53:11AM -0400
+Status: RO
+X-Status: A
+Content-Length: 1403
+Lines: 34
+
+* Cristy (cristy at mystic.es.dupont.com) [000614 17:23]:
+>    $img->Read("logo:");
+>    $text="I am a LumberJack";
+>    $poinsize=40;
+>    my ($width, $height) = $img->Get('width', 'height');
+>    $img->Annotate
+>       ( fill    => 'yellow'
+>       , text      => $text
+>       , font      =>
+> '-bitstream-charter-medium-r-normal--40-0-0-0-p-0-iso8859-1'
+>       , gravity   => 'SouthEast'
+>       , 'x'       => 5
+>       , 'y'       => $poinsize+5
+>       );
+>    $img->Write(filename  => "test.gif");
+
+So: gravity work differently from my well known "anchor", where
+x,y defines a point and anchor the location of the point wrt the
+item to be put on the background.  It was not clear from the docs.
+
+It what you propose a feature or a designed thing?  You specify the
+coordinate of the right-top (NorthEast) wrt to the right-bottom
+(SouthEast).  I expect that x=0,y=0,SouthWest will work wrt to
+NorthWest.  It is not logical for me to treat North/South differently
+from East/West (designed before the fall of the Iron curtain?)
+
+And also: the text still appears in black.
+-- 
+               MarkOv       %-]
+
+------------------------------------------------------------------------
+drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+From cristy at mystic.es.dupont.com Wed Jun 14 17:23 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id RAA27207
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 17:23:28 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id RAA12199
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 17:23:27 +0200
+Received: from gatekeeper.es.dupont.com(192.26.233.2) by ns.ATComputing.nl via smap (V2.1)
+	id xma012197; Wed, 14 Jun 00 17:23:08 +0200
+Received: from mystic.es.dupont.com (mystic.es.dupont.com [138.196.253.24])
+	by gatekeeper.es.dupont.com (8.9.3/8.9.3) with ESMTP id LAA26619
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 11:23:06 -0400 (EDT)
+Received: (from cristy at localhost)
+	by mystic.es.dupont.com (8.10.0.Beta12/8.10.0.Beta12) id e5EFrBI08173
+	for markov at ATComputing.nl; Wed, 14 Jun 2000 11:53:11 -0400 (EDT)
+Date: Wed, 14 Jun 2000 11:53:11 -0400 (EDT)
+From: Cristy <cristy at mystic.es.dupont.com>
+Message-ID: <8172.960997992 at mystic>
+Mime-Version: 1.0
+To: markov at ATComputing.nl
+Content-Type: multipart/mixed; boundary="-"
+Status: RO
+X-Status: A
+Content-Length: 1042
+Lines: 21
+
+This is a MIME encoded message.  Decode it with "munpack"
+or any other MIME reading software.  Mpack/munpack is available
+via anonymous FTP in ftp.andrew.cmu.edu:pub/mpack/
+---
+Content-Type: application/octet-stream; name="test.pl"
+Content-Transfer-Encoding: base64
+Content-Disposition: inline; filename="test.pl"
+Content-MD5: el1GVGE1xEpFTeim4lKdYA==
+
+ICAgdXNlIEltYWdlOjpNYWdpY2s7CiAgICRpbWc9SW1hZ2U6Ok1hZ2ljay0+bmV3OwogICAk
+aW1nLT5SZWFkKCJsb2dvOiIpOwogICAkdGV4dD0iSSBhbSBhIEx1bWJlckphY2siOwogICAk
+cG9pbnNpemU9NDA7CiAgIG15ICgkd2lkdGgsICRoZWlnaHQpID0gJGltZy0+R2V0KCd3aWR0
+aCcsICdoZWlnaHQnKTsKICAgJGltZy0+QW5ub3RhdGUKICAgICAgKCBmaWxsICAgID0+ICd5
+ZWxsb3cnCiAgICAgICwgdGV4dCAgICAgID0+ICR0ZXh0CiAgICAgICwgZm9udCAgICAgID0+
+CictYml0c3RyZWFtLWNoYXJ0ZXItbWVkaXVtLXItbm9ybWFsLS00MC0wLTAtMC1wLTAtaXNv
+ODg1OS0xJwogICAgICAsIHBvaW50c2l6ZSA9PiAkcG9pbnNpemUKICAgICAgLCBncmF2aXR5
+ICAgPT4gJ1NvdXRoRWFzdCcKICAgICAgLCAneCcgICAgICAgPT4gNQogICAgICAsICd5JyAg
+ICAgICA9PiAkcG9pbnNpemUrNQogICAgICApOwogICAkaW1nLT5Xcml0ZShmaWxlbmFtZSAg
+PT4gInRlc3QuZ2lmIik7Cgo=
+
+-----
+
+From markov at ATComputing.nl Wed Jun 14 17:49:26 2000
+Date: Wed, 14 Jun 2000 17:49:26 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: Cristy <cristy at mystic.es.dupont.com>
+Subject: Re: your mail
+Message-ID: <20000614174926.H22766 at atcmpg.ATComputing.nl>
+References: <200006141616.e5EGG3x19487 at mystic.es.dupont.com>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+X-Mailer: Mutt 1.0pre4i
+In-Reply-To: <200006141616.e5EGG3x19487 at mystic.es.dupont.com>; from cristy at mystic.es.dupont.com on Wed, Jun 14, 2000 at 12:16:03PM -0400
+Status: RO
+Content-Length: 686
+Lines: 17
+
+* Cristy (cristy at mystic.es.dupont.com) [000614 17:46]:
+> > It was not clear from the docs.
+> 
+> There is alot that is not clear in the docs.  We're writing a book due
+> out next year to fix these sorts of problems.
+
+I'll certainly buy the book.  But: will you also respond to the two
+remaining quesions from my previous mail?
+-- 
+Thanks for the fast response,
+
+               MarkOv       %-]
+
+------------------------------------------------------------------------
+drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+From cristy at mystic.es.dupont.com Wed Jun 14 17:46 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id RAA27475
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 17:46:29 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id RAA12244
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 17:46:28 +0200
+Received: from gatekeeper.es.dupont.com(192.26.233.2) by ns.ATComputing.nl via smap (V2.1)
+	id xma012242; Wed, 14 Jun 00 17:45:59 +0200
+Received: from mystic.es.dupont.com (mystic.es.dupont.com [138.196.253.24])
+	by gatekeeper.es.dupont.com (8.9.3/8.9.3) with ESMTP id LAA26733
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 11:45:58 -0400 (EDT)
+Received: (from cristy at localhost)
+	by mystic.es.dupont.com (8.10.0.Beta12/8.10.0.Beta12) id e5EGG3x19487
+	for markov at ATComputing.nl; Wed, 14 Jun 2000 12:16:03 -0400 (EDT)
+Date: Wed, 14 Jun 2000 12:16:03 -0400 (EDT)
+From: Cristy <cristy at mystic.es.dupont.com>
+Message-Id: <200006141616.e5EGG3x19487 at mystic.es.dupont.com>
+To: markov at ATComputing.nl
+Subject: Re: your mail
+Content-Type: text
+Status: RO
+X-Status: A
+Content-Length: 152
+Lines: 4
+
+> It was not clear from the docs.
+
+There is alot that is not clear in the docs.  We're writing a book due
+out next year to fix these sorts of problems.
+
+From cristy at mystic.es.dupont.com Wed Jun 14 17:56 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id RAA27517
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 17:55:59 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id RAA12254
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 17:55:58 +0200
+Received: from gatekeeper.es.dupont.com(192.26.233.2) by ns.ATComputing.nl via smap (V2.1)
+	id xma012252; Wed, 14 Jun 00 17:55:29 +0200
+Received: from mystic.es.dupont.com (mystic.es.dupont.com [138.196.253.24])
+	by gatekeeper.es.dupont.com (8.9.3/8.9.3) with ESMTP id LAA26777
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 11:55:28 -0400 (EDT)
+Received: (from cristy at localhost)
+	by mystic.es.dupont.com (8.10.0.Beta12/8.10.0.Beta12) id e5EGPYM19527
+	for markov at ATComputing.nl; Wed, 14 Jun 2000 12:25:34 -0400 (EDT)
+Date: Wed, 14 Jun 2000 12:25:34 -0400 (EDT)
+From: Cristy <cristy at mystic.es.dupont.com>
+Message-Id: <200006141625.e5EGPYM19527 at mystic.es.dupont.com>
+To: markov at ATComputing.nl
+Subject: Re: your mail
+Content-Type: text
+Status: RO
+Content-Length: 189
+Lines: 5
+
+> But: will you also respond to the two
+> remaining quesions from my previous mail?
+
+Sure if you remind me what they are.  I get upwards of 100+ e-mails a day
+so it's hard to keep track...
+
+From markov at ATComputing.nl Wed Jun 14 18:00:18 2000
+Date: Wed, 14 Jun 2000 18:00:18 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: Cristy <cristy at mystic.es.dupont.com>
+Subject: Re: your mail
+Message-ID: <20000614180018.I22766 at atcmpg.ATComputing.nl>
+References: <8172.960997992 at mystic> <20000614174334.G22766 at atcmpg.ATComputing.nl>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+X-Mailer: Mutt 1.0pre4i
+In-Reply-To: <20000614174334.G22766 at atcmpg.ATComputing.nl>; from markov at ATComputing.nl on Wed, Jun 14, 2000 at 05:43:34PM +0200
+Status: RO
+Content-Length: 1972
+Lines: 47
+
+
+>> But: will you also respond to the two
+>> remaining quesions from my previous mail?
+
+>Sure if you remind me what they are.  I get upwards of 100+ e-mails a day
+>so it's hard to keep track...
+
+You replied just a few seconds earlier on my message below.  I replied in
+a few seconds to it... but I understand you have to scan mail that fast.
+(I maintain 6 websites, so know getting large amounts of e-mail means)
+Thanks for the example anyway.
+
+* Mark Overmeer (markov at ATComputing.nl) [000614 17:43]:
+> * Cristy (cristy at mystic.es.dupont.com) [000614 17:23]:
+> >    $img->Read("logo:");
+> >    $text="I am a LumberJack";
+> >    $poinsize=40;
+> >    my ($width, $height) = $img->Get('width', 'height');
+> >    $img->Annotate
+> >       ( fill    => 'yellow'
+> >       , text      => $text
+> >       , font      =>
+> > '-bitstream-charter-medium-r-normal--40-0-0-0-p-0-iso8859-1'
+> >       , gravity   => 'SouthEast'
+> >       , 'x'       => 5
+> >       , 'y'       => $poinsize+5
+> >       );
+> >    $img->Write(filename  => "test.gif");
+> 
+> So: gravity work differently from my well known "anchor", where
+> x,y defines a point and anchor the location of the point wrt the
+> item to be put on the background.  It was not clear from the docs.
+> 
+> It what you propose a feature or a designed thing?  You specify the
+> coordinate of the right-top (NorthEast) wrt to the right-bottom
+> (SouthEast).  I expect that x=0,y=0,SouthWest will work wrt to
+> NorthWest.  It is not logical for me to treat North/South differently
+> from East/West (designed before the fall of the Iron curtain?)
+> 
+> And also: the text still appears in black.
+> -- 
+>                MarkOv       %-]
+> 
+> ------------------------------------------------------------------------
+> drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+> AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+> http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+From markov at ATComputing.nl Wed Jun 14 18:17:41 2000
+Date: Wed, 14 Jun 2000 18:17:41 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: Cristy <cristy at mystic.es.dupont.com>
+Subject: Re: your mail
+Message-ID: <20000614181741.J22766 at atcmpg.ATComputing.nl>
+References: <200006141634.e5EGYfI19547 at mystic.es.dupont.com>
+Mime-Version: 1.0
+Content-Type: multipart/mixed; boundary="5vNYLRcllDrimb99"
+X-Mailer: Mutt 1.0pre4i
+In-Reply-To: <200006141634.e5EGYfI19547 at mystic.es.dupont.com>; from cristy at mystic.es.dupont.com on Wed, Jun 14, 2000 at 12:34:41PM -0400
+Status: RO
+Content-Length: 4505
+Lines: 82
+
+--5vNYLRcllDrimb99
+Content-Type: text/plain; charset=us-ascii
+
+* Cristy (cristy at mystic.es.dupont.com) [000614 18:05]:
+> > It what you propose a feature or a designed thing?  You specify the
+> > coordinate of the right-top (NorthEast) wrt to the right-bottom
+> > (SouthEast).  I expect that x=0,y=0,SouthWest will work wrt to
+> > NorthWest.  It is not logical for me to treat North/South differently
+> > from East/West (designed before the fall of the Iron curtain?)
+> 
+> I'll send you a script that illustrates how gravity works.  The x,y
+> offset basically creates a bounding box within the image and the text
+> is placed relative to the virtual bounding box.
+
+As you can see in your own demo script, it is not consequent: W and E
+are inside the square, while N and S are outside... in my run.  Image
+attached.
+
+I changed the line-color you yellow (stroke) which worked, but it still
+does not work for the text.
+
+> Are you using ImageMagick 5.2.0?  When I used the script I sent the
+> text color was indeed yellow.
+
+The latest 5.2.0 (less than 48 hours ago directly from imagemagick.org).
+
+Sorry, no more time to investigate for me today: have to go...
+-- 
+               MarkOv       %-]
+
+------------------------------------------------------------------------
+drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+--5vNYLRcllDrimb99
+Content-Type: image/gif
+Content-Disposition: attachment; filename="test.gif"
+Content-Transfer-Encoding: base64
+
+R0lGODlhkAGQAfECAP///wAAAP//AAAAACH5BAAAAAAALAAAAACQAZABAAL+hI+py+0Po5y0
+2ouz3rz7D4biSJbmiabqyrbuC8fyTNf2jef6zvf+DwwKh8Si8YhMKpfMpvMJjUqn1Kr1is1q
+t9yu9wsOi8fksvmMTqvX7Lb7DY/L5/S6/Y7P6/f8vv8PGCg4SFhoeIiYqLjI2Oj4CBkpOUlZ
+aXmJmam5ydnp+QkaKjpKWmp6ipqqusra6voKGys7S1tre4ubq7vL2+v7CxwsPExcbHyMnKy8
+zNzs/AwdLT1NXW19jZ2tvc3d7f0NHi4+Tl5ufo6err7O3u7+Dh8vP09fb3+Pn6+/z9/v/w8w
+oMCBBAsaPIgwocIgARo2VOAwokQAEh8eiLhiYoL+ijI0IqgIkmM6jx8DXHRY0iRElRkxrqxB
+8mTKl+pcbmRJ0eJJnAZ4qrBZ0gZQmUEhrouZ8+ZNnz5TINU54ylPqBePmkRZdKfSrCweYiVK
+wyvVsU3ZWfyadOZOnGVRnIVKNcZbtlOZmmUJlylduDB05hWKl+5WsCMDB16JN63iFn4bA9ba
+sy7Iu2rjYhWrsq3bvZEfQyY7WFtIm2SvNkWZ+Szi0RBGfy2t2HVcCbIPzwS9MSXrbZZNL/A4
+lLHexR2H4/5IefVvtMG7nkZbfPlxeLOb55QcXTnM59ORF2YAHTLhF7Ove0Yc2ju22uzbu38P
+P778+fTrt1+meW35tqf+5WoUkFtUSPUUWW204XcGgGbkBwyDWyhYhoO+SJgFhGRQyAuGV1g4
+hoa6eFgFh2KAiAuJU4gYhom2qBgFimCwSAuMT7j4hYyy2NgEjV7gCAuPS+jYhY+uCJkEkFwQ
+yQqSRxi5hZKqOFkEk1pAiQqVQ0iZhZWmaBkEllhwSQqYP3h5hZiimNkDmVagCQqbO6hZhZue
+yJkDnFTQyQmeN9g5hZ6a+FkDn1IAigmhMwgahaGWKBoDolAwSgmkLzj6hKSSWNoCpU5gCgmn
+K2jahKeOiJoCqEyQygiqJ5i6hKqKuFoCq0rAigitI8iahK2G6BoCrkjwSgiwH/h6hLCCGNv+
+AbFGIAsIsxsoW4SzfkibAbREUMsHthdYO4S2enhbAbdCgIsHuROIyxCCZqALhLl2uBsBuz/A
+Swe9D8jrg71y6NsAvj3wCwfAC/jLg8BuGJwAwTsgzAbDByisg8NqSAwAxDlQjAbFFuOA8Rka
+e6xuGRvf0PGCCYKszMcmp3zyysmoHGHIZIwslMxj0AyTzWLgHJbOYfAclc9gAN2R0F8QLZfR
+XiDdl9JdME2e01xA7ULJMa+L8sstX6011i4jA/OFUj+YNdhbi82y11ybrTbaXYtc9jFhdzi2
+FlQzVneFcRsz94h5Y3F3V39vuHcxfac4uBWBZ5R4iIUTc/iLjVP+sfhPk5/4+DCR13i5FJU7
+1XmLmQuz+Y6hQ/G5W6fPOHowpQe5uhOpn2C12zO33mAEHE22FkOTucregWm3xlx1nGKkoHXt
+9ib828RjF2C+OllYnu+/Nc82bdCr9y9OHNpaHfZyUwBddxFD9X2uKtZO9wTF8zUvT7M7YJn7
++AmAf/76749/Q/pH9D/+CXCABCygAQnovwMqcIEMbGABE5g/CB6QfX4jn19iczz5VSok9hue
+9lJjHopYDwHza4D5TIgfAy1FhCGUzG5AoEKquEiFTpENVwhUINckDjjhKRj6NmgU8fHNAkBR
+3sV+uKn1Na581TsfS0oInrI4iIKII+L+Cbv3xOgtS4q6m9xwroUSCDVxeehpjRevt8UBjSt4
+ZvTgzXD3i9cdKXY5guOEztY+573xa+NrWx6zdzs+DtGPFdTjzuzYCzk2iY5MgOIIqCg5QlbR
+kD9DZIbwWEhA7nFtfYSbIA2HyUlq8pCfhFwoI0nJoVlyF4qcEiN/tMoPnZJzbiQlJwfpyVuC
+UpKoHGUlS6m5WZqulr/UpSl5SctUHi2WuWhlll6pBEeKAJLJDKQxg4nMYSpzacwskTBhR0xV
+ApN035xjOJc5TteVc5Hn5GY6c5dNcG7zad28hTO/BM0i1XNF63RlO+n5zjj285n/nNo+a3HP
+MuUTCdIMATX+tWlN23Uyon+c6CYlikuKZtKitsToLnPp0WOCtKIZvShJP6pRUXK0mCHF5kg3
+WtKOnlSkKe3lSsV5TXLG05zzNGhA77hTdvaUbD9N5EDxWVCi5lSdQfXnUO120BgdVaFJhWpR
+L9lUgj5Vb1dl5VTXtNAlRXUWCQVrVbm6VHi+VKUxZelMXVrTat4UnWkVaFaRulXAjfVGX41T
+WI3QUBim0D6ELaxhD4vYxMJnIYwNEu92J5IchoV3C3ssDdHxmsbk5TmTNYwPPSue8ZhjOky0
+y2TTQ7K6oJaF39EiccKjp/pVNoiiZS1mSdudMf7kigJSbW3v0sT3sQUwut1OcE3+a5Xj6oZ7
+vfWU8nhbDjW+BoMcMyJxjUdZ4GK3M5dxYnGb+8XfVuOyy0VPajKzGg5WgLy9y6F6OcBeyd7Q
+tvHlDWxJ08PUfre5831oH7ijHfnmrIwck858zRJFA6tlwDQp8HIObNvocpbAnUntg4944QrT
+9hybReFqs1MgHy5Yw6EdbXY3XJXqRta7+K1vY18M4xjLeMY0rrGNb4zjHOt4xzzusY9/DOQg
+C3nIRC6ykY+M5CQreclMbrKTnwzlKEt5ylSuspWvjOUsa3nLXO6yl78M5jCLecxkLrOZz4zm
+NKt5zWxus5vfDOc4y3nOdK6zne+M5zzrec987rOf/wwg6EALetCELrShD43oRCt60YxutKMf
+DelIS3rSlF50AQAAOw==
+
+--5vNYLRcllDrimb99--
+
+From cristy at mystic.es.dupont.com Wed Jun 14 18:05 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id SAA28005
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 18:04:59 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id SAA12271
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 18:04:58 +0200
+Received: from gatekeeper.es.dupont.com(192.26.233.2) by ns.ATComputing.nl via smap (V2.1)
+	id xma012267; Wed, 14 Jun 00 18:04:36 +0200
+Received: from mystic.es.dupont.com (mystic.es.dupont.com [138.196.253.24])
+	by gatekeeper.es.dupont.com (8.9.3/8.9.3) with ESMTP id MAA26846
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 12:04:35 -0400 (EDT)
+Received: (from cristy at localhost)
+	by mystic.es.dupont.com (8.10.0.Beta12/8.10.0.Beta12) id e5EGYfI19547
+	for markov at ATComputing.nl; Wed, 14 Jun 2000 12:34:41 -0400 (EDT)
+Date: Wed, 14 Jun 2000 12:34:41 -0400 (EDT)
+From: Cristy <cristy at mystic.es.dupont.com>
+Message-Id: <200006141634.e5EGYfI19547 at mystic.es.dupont.com>
+To: markov at ATComputing.nl
+Subject: Re: your mail
+Content-Type: text
+Status: RO
+X-Status: A
+Content-Length: 670
+Lines: 14
+
+> It what you propose a feature or a designed thing?  You specify the
+> coordinate of the right-top (NorthEast) wrt to the right-bottom
+> (SouthEast).  I expect that x=0,y=0,SouthWest will work wrt to
+> NorthWest.  It is not logical for me to treat North/South differently
+> from East/West (designed before the fall of the Iron curtain?)
+
+I'll send you a script that illustrates how gravity works.  The x,y
+offset basically creates a bounding box within the image and the text
+is placed relative to the virtual bounding box.
+
+> And also: the text still appears in black.
+
+Are you using ImageMagick 5.2.0?  When I used the script I sent the
+text color was indeed yellow.
+
+From cristy at eplrx7.es.dupont.com Wed Jun 14 18:05 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id SAA28006
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 18:04:59 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id SAA12272
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 18:04:58 +0200
+Received: from gatekeeper.es.dupont.com(192.26.233.2) by ns.ATComputing.nl via smap (V2.1)
+	id xma012268; Wed, 14 Jun 00 18:04:47 +0200
+Received: from eplrx7.es.dupont.com (eplrx7.es.dupont.com [138.196.252.7])
+	by gatekeeper.es.dupont.com (8.9.3/8.9.3) with ESMTP id MAA26850
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 12:04:46 -0400 (EDT)
+Received: from fantasia.es.dupont.com (fantasia.es.dupont.com [138.196.253.22])
+	by eplrx7.es.dupont.com (8.9.3/8.9.3) with ESMTP id MAA06403
+	for <markov at ATComputing.nl>; Wed, 14 Jun 2000 12:04:45 -0400 (EDT)
+Received: by fantasia.es.dupont.com (8.9.3+Sun) id MAA01601; Wed, 14 Jun 2000 12:03:33 -0400 (EDT)
+From: Cristy <cristy at eplrx7.es.dupont.com>
+Date: Wed, 14 Jun 2000 12:03:33 -0400 (EDT)
+Message-ID: <1600.960998613 at fantasia>
+Mime-Version: 1.0
+To: markov at ATComputing.nl
+Content-Type: multipart/mixed; boundary="-"
+Status: RO
+Content-Length: 2009
+Lines: 34
+
+This is a MIME encoded message.  Decode it with "munpack"
+or any other MIME reading software.  Mpack/munpack is available
+via anonymous FTP in ftp.andrew.cmu.edu:pub/mpack/
+---
+Content-Type: application/octet-stream; name="gravity.pl"
+Content-Transfer-Encoding: base64
+Content-Disposition: inline; filename="gravity.pl"
+Content-MD5: faVMCotdBUpHJCDAv7HACA==
+
+IyEvdXNyL2xvY2FsL2Jpbi9wZXJsCgp1c2UgSW1hZ2U6Ok1hZ2ljazsKCiRwaWMgPSBJbWFn
+ZTo6TWFnaWNrLT5uZXcoc2l6ZT0+IjQwMHg0MDAiKTsKJHBpYy0+UmVhZCgieGM6d2hpdGUi
+KTsKCiR4ID0gMTAwOwokeSA9IDEwMDsKJHBpYy0+RHJhdyhwcmltaXRpdmU9PidsaW5lJyxw
+b2ludHM9PiIyMDAsMTAwIDIwMCwzMDAiLHN0cm9rZT0+J2JsYWNrJyk7CiRwaWMtPkRyYXco
+cHJpbWl0aXZlPT4nbGluZScscG9pbnRzPT4iMTAwLDIwMCAzMDAsMjAwIixzdHJva2U9Pidi
+bGFjaycpOwokcGljLT5EcmF3KHByaW1pdGl2ZT0+J3JlY3RhbmdsZScscG9pbnRzPT4iMTAw
+LDEwMCAzMDAsMzAwIixzdHJva2U9PidibGFjaycpOwokcGljLT5Bbm5vdGF0ZShwb2ludHNp
+emU9PjI0LGZvbnQ9PidUaW1lcycsdGV4dD0+Ii1OVy0iLGdyYXZpdHk9PiJOb3J0aFdlc3Qi
+LHg9PiR4LHk9PiR5KTsKJHBpYy0+QW5ub3RhdGUocG9pbnRzaXplPT4yNCxmb250PT4nVGlt
+ZXMnLHRleHQ9PiItTi0iLGdyYXZpdHk9PiJOb3J0aCIseD0+JHgseT0+JHkpOwokcGljLT5B
+bm5vdGF0ZShwb2ludHNpemU9PjI0LGZvbnQ9PidUaW1lcycsdGV4dD0+Ii1ORS0iLGdyYXZp
+dHk9PiJOb3J0aEVhc3QiLHg9PiR4LHk9PiR5KTsKJHBpYy0+QW5ub3RhdGUocG9pbnRzaXpl
+PT4yNCxmb250PT4nVGltZXMnLHRleHQ9PiItRS0iLGdyYXZpdHk9PiJFYXN0Iix4PT4keCx5
+PT4keSk7CiRwaWMtPkFubm90YXRlKHBvaW50c2l6ZT0+MjQsZm9udD0+J1RpbWVzJyx0ZXh0
+PT4iLUMtIixncmF2aXR5PT4iQ2VudGVyIix4PT4keCx5PT4keSk7CiRwaWMtPkFubm90YXRl
+KHBvaW50c2l6ZT0+MjQsZm9udD0+J1RpbWVzJyx0ZXh0PT4iLVNFLSIsZ3Jhdml0eT0+IlNv
+dXRoRWFzdCIseD0+JHgseT0+JHkpOwokcGljLT5Bbm5vdGF0ZShwb2ludHNpemU9PjI0LGZv
+bnQ9PidUaW1lcycsdGV4dD0+Ii1TLSIsZ3Jhdml0eT0+IlNvdXRoIix4PT4keCx5PT4keSk7
+CiRwaWMtPkFubm90YXRlKHBvaW50c2l6ZT0+MjQsZm9udD0+J1RpbWVzJyx0ZXh0PT4iLVNX
+LSIsZ3Jhdml0eT0+IlNvdXRoV2VzdCIseD0+JHgseT0+JHkpOwokcGljLT5Bbm5vdGF0ZShw
+b2ludHNpemU9PjI0LGZvbnQ9PidUaW1lcycsdGV4dD0+Ii1XLSIsZ3Jhdml0eT0+Ildlc3Qi
+LHg9PiR4LHk9PiR5KTsKCiRwaWMtPldyaXRlKGZpbGVuYW1lPT4idGVzdC5naWYiKTsKc3lz
+dGVtKCJkaXNwbGF5IHRlc3QuZ2lmIik7Cg==
+
+-----
+
+From magick-owner at unca-don.wizards.dupont.com Thu Jun 29 18:01 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id SAA10314
+	for <markov at ATComputing.nl>; Thu, 29 Jun 2000 18:01:15 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id SAA00740
+	for <markov at ATComputing.nl>; Thu, 29 Jun 2000 18:01:14 +0200
+Received: from mustang.oldcity.dca.net(216.158.38.3) by ns.ATComputing.nl via smap (V2.1)
+	id xma000732; Thu, 29 Jun 00 18:01:07 +0200
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by mustang.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id MAA07078;
+	Thu, 29 Jun 2000 12:00:36 -0400
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id LAA10740
+	for magick-outgoing; Thu, 29 Jun 2000 11:48:25 -0400 (EDT)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-ID: <395B7519.F40670B at northrim.net>
+Date: Thu, 29 Jun 2000 10:11:05 -0600
+From: Karl Sloth <karl at northrim.net>
+X-Mailer: Mozilla 4.72 [en] (X11; I; Linux 2.2.14 i586)
+X-Accept-Language: en
+MIME-Version: 1.0
+To: magick at wizards.dupont.com
+Subject: mailing list archives
+Content-Transfer-Encoding: 7bit
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Karl Sloth <karl at northrim.net>
+Content-Type: text/plain; charset=us-ascii
+Status: RO
+Content-Length: 552
+Lines: 17
+
+Hi all-
+
+The folks at The Aims Group have added the ImageMagick mailing list to
+their online mailing list archives. They have a searchable history going
+back to 1996.  Very handy.
+
+http://marc.theaimsgroup.com/?l=imagemagick&r=1&w=2
+
+-karl
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From markov at ATComputing.nl Tue Jul  4 12:33:47 2000
+Date: Tue, 4 Jul 2000 12:33:47 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: magick-bugs at simple.dallas.tx.us
+Subject: Re: Annotate problems (PR#298)
+Message-ID: <20000704123347.F2009 at atcmpg.ATComputing.nl>
+References: <200006141454.JAA14556 at ns.simplesystems.org>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+X-Mailer: Mutt 1.0pre4i
+In-Reply-To: <200006141454.JAA14556 at ns.simplesystems.org>; from magick-bugs at simple.dallas.tx.us on Wed, Jun 14, 2000 at 09:54:08AM -0500
+Status: RO
+Content-Length: 573
+Lines: 12
+
+* magick-bugs at simple.dallas.tx.us (magick-bugs at simple.dallas.tx.us) [000614 16:54]:
+> Your bug report is available on the web at the URL
+> http://www.simplesystems.org/ImageMagick/bugs?findid=298    
+
+Both indicated problems are fixed in 5.2.1
+-- 
+               MarkOv       %-]
+
+------------------------------------------------------------------------
+drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+From magick-owner at unca-don.wizards.dupont.com Sun Jul  2 02:40 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id CAA01634
+	for <markov at ATComputing.nl>; Sun, 2 Jul 2000 02:40:25 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id CAA03454
+	for <markov at ATComputing.nl>; Sun, 2 Jul 2000 02:40:24 +0200
+Received: from mustang.oldcity.dca.net(216.158.38.3) by ns.ATComputing.nl via smap (V2.1)
+	id xma003450; Sun, 2 Jul 00 02:40:07 +0200
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by mustang.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id UAA32165;
+	Sat, 1 Jul 2000 20:39:55 -0400
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id UAA16952
+	for magick-outgoing; Sat, 1 Jul 2000 20:30:03 -0400 (EDT)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-ID: <395E8F1F.B804FCB7 at interak.com>
+Date: Sat, 01 Jul 2000 16:38:55 -0800
+From: Marc Grober <marc at interak.com>
+X-Mailer: Mozilla 4.61 [en] (X11; I; UnixWare 5 i386)
+MIME-Version: 1.0
+To: magick at wizards.dupont.com
+Subject: delegates.mgk set-up for unixware printing
+Content-Transfer-Encoding: 7bit
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Marc Grober <marc at interak.com>
+Content-Type: text/plain; charset=us-ascii
+Status: RO
+Content-Length: 1403
+Lines: 45
+
+Under unixware to print from displayt to an HP laserjet (usual command
+to print postscript being
+lp -dhpraw -Tpostscript),  I changed the delegates.mgk file (which I
+found in /usr/local/share/Magick as installed from the SCO skunkware CD)
+
+from
+
+ps<=print
+       /usr/bin/lp -c -s %i
+
+to
+
+ps<=print
+        /usr/bin/lp -dhpraw -c -s -Tpostscript %i
+
+and  it appears everything is working.  The -c make an immediate copy
+and feeds it to the spooler and without it you get an error message
+(below) which my guess is is a bit misleading in that I have to assume
+that what is really happening is that without the -c IM is not passing
+anything to the spooler........
+
+******************************************************************************
+
+Subject: Status of lp request hpraw-347
+
+        Your request hpraw-347 destined for hpraw
+        encountered an error during filtering.
+
+        Reason for failure:
+
+        UX:lp:   ERROR: Cannot read the file "/tmp/hacienda.jpg".
+        TO FIX: See if it still exists and is readable, or
+                consult your system administrator.
+
+
+
+
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at unca-don.wizards.dupont.com Mon Jul  3 16:12 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id QAA28389
+	for <markov at ATComputing.nl>; Mon, 3 Jul 2000 16:12:41 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id QAA05092
+	for <markov at ATComputing.nl>; Mon, 3 Jul 2000 16:12:40 +0200
+Received: from mustang.oldcity.dca.net(216.158.38.3) by ns.ATComputing.nl via smap (V2.1)
+	id xma005088; Mon, 3 Jul 00 16:12:32 +0200
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by mustang.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id KAA12560;
+	Mon, 3 Jul 2000 10:12:03 -0400
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id KAA20768
+	for magick-outgoing; Mon, 3 Jul 2000 10:01:07 -0400 (EDT)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-ID: <395BACF9.CFA6970 at interak.com>
+Date: Thu, 29 Jun 2000 12:09:30 -0800
+From: Marc Grober <marc at interak.com>
+X-Mailer: Mozilla 4.61 [en] (X11; I; UnixWare 5 i386)
+MIME-Version: 1.0
+To: magick at wizards.dupont.com
+Subject: printing solution for UW 7.1
+Content-Transfer-Encoding: 7bit
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Marc Grober <marc at interak.com>
+Content-Type: text/plain; charset=us-ascii
+Status: RO
+Content-Length: 1500
+Lines: 46
+
+Under unixware to print from displayt to an HP laserjet (usual command
+to print postscript being
+lp -dhpraw -Tpostscript),  I changed the delegates.mgk file (which I
+found in /usr/local/share/Magick as installed from the SCO skunkware CD)
+from
+
+ps<=print
+       /usr/bin/lp -c -s %i
+
+to
+
+ps<=print
+        /usr/bin/lp -dhpraw -c -s -Tpostscript %i
+
+and  it appears everything is working.  The -c make an immediate copy
+and feeds it to the spooler and without it you get an error message
+(below) which my guess is is a bit misleading in that I have to assume
+that what is really happening is that without the -c IM is not passing
+anything to the spooler........
+
+******************************************************************************
+
+Subject: Status of lp request hpraw-347
+
+        Your request hpraw-347 destined for hpraw
+        encountered an error during filtering.
+
+        Reason for failure:
+
+        UX:lp:   ERROR: Cannot read the file "/tmp/hacienda.jpg".
+        TO FIX: See if it still exists and is readable, or
+                consult your system administrator.
+
+
+I have tried this with jpegs, gifs etc and in quite a number of
+locations
+Placed the -c -s back in
+
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at unca-don.wizards.dupont.com Fri Jul  7 09:27 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id JAA27505
+	for <markov at ATComputing.nl>; Fri, 7 Jul 2000 09:27:32 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id JAA11016
+	for <markov at ATComputing.nl>; Fri, 7 Jul 2000 09:27:31 +0200
+Received: from viper.oldcity.dca.net(216.158.38.4) by ns.ATComputing.nl via smap (V2.1)
+	id xma011014; Fri, 7 Jul 00 09:27:21 +0200
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by viper.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id DAA06530;
+	Fri, 7 Jul 2000 03:26:27 -0400
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id DAA06369
+	for magick-outgoing; Fri, 7 Jul 2000 03:15:15 -0400 (EDT)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Date: Fri, 7 Jul 2000 17:24:12 +1000
+From: Martien Verbruggen <mgjv at comdyn.com.au>
+To: Geoff Armstrong <geofstro at monaco.mc>
+Cc: ImageMagick Mailing List <magick at wizards.dupont.com>
+Subject: Re: converts new sharpen factors
+Message-ID: <20000707172412.C23320 at martien.heliotrope.home>
+References: <00070515380200.26142 at berlioz>
+Mime-Version: 1.0
+Content-Disposition: inline
+User-Agent: Mutt/1.2.2i
+In-Reply-To: <00070515380200.26142 at berlioz>; from geofstro at monaco.mc on Wed, Jul 05, 2000 at 03:35:26PM +0200
+Organisation: Heliotrope Productions Pty. Ltd.
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Martien Verbruggen <mgjv at comdyn.com.au>
+Content-Type: text/plain; charset=us-ascii
+Status: RO
+Content-Length: 1483
+Lines: 36
+
+-- Geoff Armstrong wrote on Wed  5 Jul 15:35 PM --
+
+> Hi,
+> 
+> I know the sharpen factors for convert have changed since 5.2.0; but I
+> can't find the new factors documented anywhere.
+
+The factors are no longer really factors, but orders for a convolution
+kernel, if I've understood it all correctly. Since convolution has
+become available in ImageMagick, many of the old filters have been
+rewritten to use a kernel (blur, sharpen, charcoal, emboss, edge).
+
+The convert manual page mentions that good values are odd numbers
+between 3 and 31.
+
+Martien
+
+PS. If you don't know what convolution is: apply a matrix to each pixel,
+and it's surrounding neighbors covered by the matrix. The values of each
+covered pixel get multiplied by the matrix cell's value, and all added
+together. The new value for the target pixel is this sum. The 'order'
+that I talked about above is the height and width of the matrix involved
+(in ImageMagick they're always square).
+-- 
+Martien Verbruggen                      |
+Interactive Media Division              | "In a world without fences,
+Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
+NSW, Australia                          |
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at unca-don.wizards.dupont.com Fri Jul  7 17:55 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id RAA13560
+	for <markov at ATComputing.nl>; Fri, 7 Jul 2000 17:55:42 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id RAA15121
+	for <markov at ATComputing.nl>; Fri, 7 Jul 2000 17:55:42 +0200
+Received: from mustang.oldcity.dca.net(216.158.38.3) by ns.ATComputing.nl via smap (V2.1)
+	id xma015105; Fri, 7 Jul 00 17:55:27 +0200
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by mustang.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id LAA24776;
+	Fri, 7 Jul 2000 11:54:30 -0400
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id LAA07897
+	for magick-outgoing; Fri, 7 Jul 2000 11:44:52 -0400 (EDT)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Date: Fri, 7 Jul 2000 12:23:40 -0400 (EDT)
+From: Cristy <cristy at mystic.es.dupont.com>
+Message-Id: <200007071623.e67GNev10760 at mystic.es.dupont.com>
+To: magick at wizards.dupont.com
+Subject: New ImageMagick mailing list
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Cristy <cristy at mystic.es.dupont.com>
+Content-Type: text
+Status: RO
+Content-Length: 1242
+Lines: 31
+
+***********************************************************************
+This list is being decommissioned.  Please join one or more of the new
+ImageMagick mailing lists as described at
+http://www.imagemagick.org/www/magick-list.html.
+***********************************************************************
+
+In response to a number of suggestions and/or complaints about the 
+magick at wizards.dupont.com ImageMagick mailing list, I have created three
+new lists:
+
+    magick-user at imagemagick.org
+    magick-deveoper at imagemagick.org
+    magick-announce at imagemagick.org
+
+See
+
+    http://www.imagemagick.org/www/magick-list.html
+
+for instructions on joining and/or posting.  I will keep the current
+list at magick at wizards.dupont.com running for the next couple of months
+to cause the least amount of disruption.  At your convenience
+unsubscribe from magick at wizards.dupont.com and choose one of the lists
+above, whichever is appropriate.
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From markov at ATComputing.nl Sat Jul  8 10:27:08 2000
+Date: Sat, 8 Jul 2000 10:27:08 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: majordomo at imagemagick.org
+Subject: subscribe
+Message-ID: <20000708102708.B1570 at atcmpg.ATComputing.nl>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+X-Mailer: Mutt 1.0pre4i
+Status: RO
+Content-Length: 27
+Lines: 1
+
+subscribe magick-developer
+
+From markov at ATComputing.nl Sat Jul  8 13:53:18 2000
+Date: Sat, 8 Jul 2000 13:53:18 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: Majordomo at imagemagick.org
+Subject: Re: Confirmation for subscribe magick-developer
+Message-ID: <20000708135318.A2549 at atcmpg.ATComputing.nl>
+References: <200007080855.EAA15589 at imagemagick.org>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+X-Mailer: Mutt 1.0pre4i
+In-Reply-To: <200007080855.EAA15589 at imagemagick.org>; from Majordomo at imagemagick.org on Sat, Jul 08, 2000 at 04:55:40AM -0400
+Status: RO
+Content-Length: 63
+Lines: 1
+
+auth 44b84310 subscribe magick-developer markov at ATComputing.nl
+
+From Majordomo-Owner at imagemagick.org Sat Jul  8 10:27 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id KAA01750
+	for <markov at ATComputing.nl>; Sat, 8 Jul 2000 10:27:39 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id KAA25253
+	for <markov at ATComputing.nl>; Sat, 8 Jul 2000 10:27:38 +0200
+Received: from magick.imagemagick.org(38.220.172.2) by ns.ATComputing.nl via smap (V2.1)
+	id xma025238; Sat, 8 Jul 00 10:27:26 +0200
+Received: (from majordomo at localhost)
+	by imagemagick.org (8.9.3/8.9.3) id EAA15589;
+	Sat, 8 Jul 2000 04:55:40 -0400
+Date: Sat, 8 Jul 2000 04:55:40 -0400
+Message-Id: <200007080855.EAA15589 at imagemagick.org>
+X-Authentication-Warning: magick.imagemagick.org: majordomo set sender to Majordomo-Owner at imagemagick.org using -f
+To: markov at ATComputing.nl
+From: Majordomo at imagemagick.org
+Subject: Confirmation for subscribe magick-developer
+Reply-To: Majordomo at imagemagick.org
+Content-Type: text
+Status: RO
+X-Status: A
+Content-Length: 822
+Lines: 25
+
+--
+
+Someone (possibly you) has requested that your email address be added
+to or deleted from the mailing list "magick-developer at imagemagick.org".
+
+If you really want this action to be taken, please send the following
+commands (exactly as shown) back to "Majordomo at imagemagick.org":
+
+	auth 44b84310 subscribe magick-developer markov at ATComputing.nl
+
+If you do not want this action to be taken, simply ignore this message
+and the request will be disregarded.
+
+If your mailer will not allow you to send the entire command as a single
+line, you may split it using backslashes, like so:
+
+        auth 44b84310 subscribe magick-developer \
+        markov at ATComputing.nl
+
+If you have any questions about the policy of the list owner, please
+contact "magick-developer-approval at imagemagick.org".
+
+Thanks!
+
+Majordomo at imagemagick.org
+
+From owner-magick at imagemagick.org Sat Jul  8 13:53 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id NAA02564
+	for <markov at ATComputing.nl>; Sat, 8 Jul 2000 13:53:33 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id NAA00576
+	for <markov at ATComputing.nl>; Sat, 8 Jul 2000 13:53:28 +0200
+Received: from magick.imagemagick.org(38.220.172.2) by ns.ATComputing.nl via smap (V2.1)
+	id xma000568; Sat, 8 Jul 00 13:53:23 +0200
+Received: (from majordomo at localhost)
+	by imagemagick.org (8.9.3/8.9.3) id IAA16219;
+	Sat, 8 Jul 2000 08:21:42 -0400
+Date: Sat, 8 Jul 2000 08:21:42 -0400
+Message-Id: <200007081221.IAA16219 at imagemagick.org>
+X-Authentication-Warning: magick.imagemagick.org: majordomo set sender to owner-magick at imagemagick.org using -f
+To: markov at ATComputing.nl
+From: Majordomo at imagemagick.org
+Subject: Welcome to magick-developer
+Reply-To: Majordomo at imagemagick.org
+Content-Type: text
+Status: RO
+Content-Length: 11286
+Lines: 274
+
+--
+
+Welcome to the magick-developer mailing list!
+
+Please save this message for future reference.  Thank you.
+
+If you ever want to remove yourself from this mailing list,
+you can send mail to <Majordomo at imagemagick.org> with the following
+command in the body of your email message:
+
+    unsubscribe magick-developer
+
+or from another account, besides markov at ATComputing.nl:
+
+    unsubscribe magick-developer markov at ATComputing.nl
+
+If you ever need to get in contact with the owner of the list,
+(if you have trouble unsubscribing, or have questions about the
+list itself) send email to <owner-magick-developer at imagemagick.org> .
+This is the general rule for most mailing lists when you need
+to contact a human.
+
+ Here's the general information for the list you've subscribed to,
+ in case you don't already have it:
+
+The ImageMagick mailing list (magick at wizards.dupont.com) is a low noise
+and subject oriented mailing list.  The subject is the discussion of
+ImageMagick software and its use.  Although the list is unmoderated, do
+not post off-topic messages to the list.  Off-topic messages will
+result in the offender being silently removed from the list and
+prevented from rejoining.
+
+Please follow these guidelines when posting or responding to posted
+messages:
+
+  1. postings must be related to ImageMagick, PerlMagick, CineMagick,
+     or WebMagick.  Here is an example of what not to post:
+
+       Does anyone know of a program that converts WWF to JPG on the
+       Mac?
+
+     Post these to comp.graphics instead.
+
+  2. postings should be concise but provide enough detail for readers to
+     discern what the problem is and respond with a solution.  Here is
+     an example of what not to post:
+
+       I downloaded ImageMagick and it doesn't work.  What's up?
+
+     Yes, I have seen these messages.  More detail is needed for a
+     proper response.
+
+  3. responses should be sent to the author, and not the list, if the
+     response is not of general interest.  For example,
+
+       I'm converting libMagick to a C++ class library.  Anyone want to
+       help?
+
+     Discuss this privately with the author and make a general
+     announcement when you complete your work.
+
+  4. Only relevant portions of a message should be quoted.  Do not
+     quote the entire message, for example, and give a one line
+     response.
+
+  5. Do not post administriva messages such as "How do I unsubscribe
+     from the list?"  Instead, see
+
+	 http://www.imagemagick.org/www/magick-list.html
+
+     for help.
+
+  6. Do not post test messages to the list.
+
+An archive of all messages posted to the mailing list is available to peruse.
+See
+
+    ftp://ftp.wizards.dupont.com/pub/ImageMagick/mailing-list
+
+You can also browse or search the archive.  See
+
+    http://marc.theaimsgroup.com/?l=imagemagick&r=1&w=2
+
+
+* * *
+
+ImageMagick is a robust collection of tools and libraries to read,
+write, and manipulate an image in many image formats (over 68 major
+formats) including popular formats like TIFF, JPEG, PNG, PDF, Photo CD,
+and GIF. With ImageMagick you can create images dynamically, making it
+suitable for Web applications. You can also resize, rotate, sharpen,
+color reduce, or add special effects to an image and save your completed
+work in the same or differing image format. Image processing operations
+are available from the command line, as well as through C, C++, and
+PERL-based programming interfaces.
+
+Here is just a few examples of what ImageMagick can do:
+
+    Convert an image from one format to another (e.g. TIFF to GIF) 
+    Resize, rotate, sharpen, color reduce, or add special effects to an image 
+    Create a montage of image tumbnails 
+    Create a transparent image suitable for use on the Web 
+    Turn a group of images into a GIF animation sequence 
+    Create a composite image by combining several separate images 
+    Draw shapes or text on an image 
+    Decorate an image with a border or frame 
+    Describe the format and characteristics of an image 
+
+You can access ImageMagick functions directly from the command line
+using the ImageMagick tools convert, mogrify, montage, combine, or
+identify. Use the display program to interactively manipulate your
+images or animate an image sequence from a graphical panel. Finally
+you have access to the various image manipulation methods directly
+from your favorite application development environment: Perl, C++, C,
+or Java. These programs and much more are explained by following the
+links from this page or read the ImageMagick Users Guide.
+
+ImageMagick is known to compile and run on virtually any Unix. system and
+Linux. It also runs under Windows 2000, Windows 95/98, Macintosh, VMS,
+and OS2. See the install guide for compiling instructions. Pre-compiled
+binaries are available for some of the more popular operating systems.
+
+The offical ImageMagick web page is:
+ 
+    http://ww.imagemagick.org/
+
+ImageMagick is available via ftp as
+
+    ftp://ftp.wizards.dupont.com/pub/ImageMagick
+
+Other versions are available as
+
+    ftp://ftp.wizards.dupont.com/pub/ImageMagick/binaries
+    ftp://ftp.wizards.dupont.com/pub/ImageMagick/mac
+    ftp://ftp.wizards.dupont.com/pub/ImageMagick/nt
+    ftp://ftp.wizards.dupont.com/pub/ImageMagick/vms
+    ftp://ftp.wizards.dupont.com/pub/ImageMagick/linux
+
+* * * * * * * * *
+
+ImageMagick Tools
+
+  display
+     Display is a machine architecture independent image and display
+     program.  It can display an image on any workstation display
+     running an X server.  Display can read and write many of the more
+     popular image formats (e.g.  JPEG, TIFF, PNM, Photo CD, etc.).
+     You can perform these functions on the image:
+
+         o load an image from a file
+         o display the next image
+         o display the former image
+         o display a sequence of images as a slide show
+         o write the image to a file
+         o print the image to a Postscript printer
+         o delete the image file
+         o create a Visual Image Directory
+         o select the image to display by its thumbnail rather than name
+         o undo last image transformation
+         o copy a region of the image
+         o paste a region to the image
+         o restore the image to its original size
+         o refresh the image
+         o half the image size
+         o double the image size
+         o resize the image
+         o crop the image
+         o cut the image
+         o flop image in the horizontal direction
+         o flip image in the vertical direction
+         o rotate the image 90 degrees clockwise
+         o rotate the image 90 degrees counter-clockwise
+         o rotate the image
+         o shear the image
+         o trim the image edges
+         o invert the colors of the image
+         o vary the color brightness
+         o vary the color saturation
+         o vary the image hue
+         o gamma correct the image
+         o sharpen the image contrast
+         o dull the image contrast
+         o perform histogram equalization on the image
+         o perform histogram normalization on the image
+         o negate the image colors
+         o convert the image to grayscale
+         o set the maximum number of unique colors in the image
+         o reduce the speckles within an image
+         o eliminate peak noise from an image
+         o detect edges within the image
+         o emboss an image
+         o oil paint an image
+         o segment the image by color
+         o annotate the image with text
+         o draw on the image
+         o edit an image pixel color
+         o edit the image matte information
+         o composite an image with another
+         o add a border to the image
+         o add an image comment
+         o apply image processing techniques to a region of interest
+         o display information about the image
+         o display information about this program
+         o display image to background of a window
+         o set user preferences
+         o discard all images and exit program
+         o change the level of magnification
+         o display images specified by a World Wide Web (WWW)
+           uniform resource locator (URL)
+
+  import
+     Import reads an image from any visible window on an X server and
+     outputs it as an image file.  You can capture a single window, the
+     entire screen, or any rectangular portion of the screen.  You can
+     use display (see display(1)) utility for redisplay, printing,
+     editing, formatting, archiving, image processing, etc.  of the
+     captured image.
+
+     The target window can be specified by id, name, or may be selected
+     by clicking the mouse in the desired window.  If you press a
+     button and then drag, a rectangle will form which expands and
+     contracts as the mouse moves.  To save the portion of the screen
+     defined by the rectangle, just release the button.  The keyboard
+     bell is rung once at the beginning of the screen capture and twice
+     when it completes.
+
+  animate
+     Animate displays a sequence of images on any workstation display
+     running an X server.  Animate first determines the hardware
+     capabilities of the workstation.  If the number of unique colors
+     in an image is less than or equal to the number the workstation
+     can support, the image is displayed in an X window.  Otherwise the
+     number of colors in the image is first reduced to match the color
+     resolution of the workstation before it is displayed.
+
+     This means that a continuous-tone 24 bits/pixel image can display
+     on a 8 bit pseudo-color device or monochrome device.  In most
+     instances the reduced color image closely resembles the original.
+     Alternatively, a monochrome or pseudo-color image sequence can
+     display on a continuous-tone 24 bits/pixels device.
+
+  montage
+     Montage creates a composite image by combining several separate
+     images.  The images are tiled on the composite image with the name
+     of the image optionally appearing just below the individual tile.
+
+  convert
+     Convert converts an input file using one image format to an output
+     file with a differing image format. By default, the image format
+     is determined by it's magic number. To specify a particular image
+     format, precede the filename with an image format name and a colon
+     (i.e.  ps:image) or specify the image type as the filename suffix
+     (i.e. image.ps).  Specify file as - for standard input or output.
+     If file has the extension .Z, the file is decoded with
+     uncompress.
+
+  mogrify
+     Mogrify transforms an image or a sequence of images.  These
+     transforms include image scaling, image rotation, color reduction,
+     and others.  The transmogrified image overwrites the original
+     image.
+
+  identify
+     describes the format and characteristics of one or more image
+     files.  It will also report if an image is incomplete or corrupt.
+     The information displayed includes the scene number, the file
+     name, the width and height of the image, whether the image is
+     colormapped or not, the number of colors in the image, the number
+     of bytes in the image, the format of the image (JPEG, PNM, etc.),
+     and finally the number of seconds it took to read and process the
+     image.
+
+  combine
+     Combine combines images to create new images.
+
+From markov at ATComputing.nl Wed Jul 26 13:32:31 2000
+Date: Wed, 26 Jul 2000 13:32:31 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: Chris Wareham <chris.wareham at catchword.com>
+Subject: Re: core dump in simple ImageMagick example
+Message-ID: <20000726133231.G25170 at atcmpg.ATComputing.nl>
+References: <397C6C6B.989E4BB2 at catchword.com>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+X-Mailer: Mutt 1.0pre4i
+In-Reply-To: <397C6C6B.989E4BB2 at catchword.com>; from chris.wareham at catchword.com on Mon, Jul 24, 2000 at 05:18:51PM +0100
+Status: RO
+Content-Length: 2223
+Lines: 55
+
+* Chris Wareham (chris.wareham at catchword.com) [000724 18:24]:
+> ***********************************************************************
+> This list is being decommissioned.  Please join one or more of the new
+> ImageMagick mailing lists as described at
+> http://www.imagemagick.org/www/magick-list.html.
+> ***********************************************************************
+> 
+> The following snippet of code coew dumps on ReadImage():
+> 
+>  GetExceptionInfo(&exception);
+>  image_info = CloneImageInfo((ImageInfo *)NULL);
+> 
+>  strcpy(image_info->filename, IMAGEDIR);
+>  strcat(image_info->filename, "/");
+>  strcat(image_info->filename, filename);
+> 
+>  image = ReadImage(image_info, &exception);
+>  if(image == (Image *)NULL) {
+>    log_error("unable to read image '%s'", filename);
+>    return;
+>  }
+> 
+> The debugger output is the following:
+> 
+>  Program received signal SIGSEGV, Segmentation fault.
+>  0x403a0058 in _IO_getc (fp=0x67616d69) at getc.c:39
+>  39     getc.c: No such file or directory.
+>  (gdb) bt
+>  #0  0x403a0058 in _IO_getc (fp=0x67616d69) at getc.c:39
+>  #1  0x4005eb8d in SetImageInfo () from /usr/local/lib/libMagick.so.5
+>  #2  0x4003c91e in ReadImage () from /usr/local/lib/libMagick.so.5
+>  #3  0x80491dd in process_image (dbm=0x804bea0, filename=0x806a157
+> "00132aac.tif") at tif2png.c:107
+>  #4  0x8048fd3 in convert_images (args=0xbffff9f4) at tif2png.c:55
+>  #5  0x8048e6c in main (argc=1, argv=0xbffff9f4) at tif2png.c:21
+
+I have the same problem using PerlMagick 5.2.2 calling ReadImage.
+However, it is only reproduceable when this statement is included in
+my huge Perl program with a small IM part, not is a smaller sample
+as you have.
+
+I run Solaris 2.5.1 and all newest image-libs attached.
+
+Did you get any useful reply which fixed your problem.
+Didi you know there is a bug-list:
+http://www.simplesystems.org/ImageMagick/bugs/
+
+Please let me know.
+-- 
+               MarkOv       %-]
+
+------------------------------------------------------------------------
+drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+From magick-owner at unca-don.wizards.dupont.com Mon Jul 24 18:24 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id SAA27465
+	for <markov at ATComputing.nl>; Mon, 24 Jul 2000 18:24:10 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id SAA20827
+	for <markov at ATComputing.nl>; Mon, 24 Jul 2000 18:24:09 +0200
+Received: from viper.oldcity.dca.net(216.158.38.4) by ns.ATComputing.nl via smap (V2.1)
+	id xma020823; Mon, 24 Jul 00 18:23:51 +0200
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by viper.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id MAA20883;
+	Mon, 24 Jul 2000 12:23:50 -0400
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id MAA01738
+	for magick-outgoing; Mon, 24 Jul 2000 12:07:32 -0400 (EDT)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-ID: <397C6C6B.989E4BB2 at catchword.com>
+Date: Mon, 24 Jul 2000 17:18:51 +0100
+From: Chris Wareham <chris.wareham at catchword.com>
+X-Mailer: Mozilla 4.73 [en] (X11; U; Linux 2.2.17pre13 i686)
+X-Accept-Language: en
+MIME-Version: 1.0
+To: magick at wizards.dupont.com
+Subject: core dump in simple ImageMagick example
+Content-Transfer-Encoding: 7bit
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Chris Wareham <chris.wareham at catchword.com>
+Content-Type: text/plain; charset=us-ascii
+Status: RO
+X-Status: A
+Content-Length: 1736
+Lines: 47
+
+***********************************************************************
+This list is being decommissioned.  Please join one or more of the new
+ImageMagick mailing lists as described at
+http://www.imagemagick.org/www/magick-list.html.
+***********************************************************************
+
+The following snippet of code coew dumps on ReadImage():
+
+ GetExceptionInfo(&exception);
+ image_info = CloneImageInfo((ImageInfo *)NULL);
+
+ strcpy(image_info->filename, IMAGEDIR);
+ strcat(image_info->filename, "/");
+ strcat(image_info->filename, filename);
+
+ image = ReadImage(image_info, &exception);
+ if(image == (Image *)NULL) {
+   log_error("unable to read image '%s'", filename);
+   return;
+ }
+
+The debugger output is the following:
+
+ Program received signal SIGSEGV, Segmentation fault.
+ 0x403a0058 in _IO_getc (fp=0x67616d69) at getc.c:39
+ 39     getc.c: No such file or directory.
+ (gdb) bt
+ #0  0x403a0058 in _IO_getc (fp=0x67616d69) at getc.c:39
+ #1  0x4005eb8d in SetImageInfo () from /usr/local/lib/libMagick.so.5
+ #2  0x4003c91e in ReadImage () from /usr/local/lib/libMagick.so.5
+ #3  0x80491dd in process_image (dbm=0x804bea0, filename=0x806a157
+"00132aac.tif") at tif2png.c:107
+ #4  0x8048fd3 in convert_images (args=0xbffff9f4) at tif2png.c:55
+ #5  0x8048e6c in main (argc=1, argv=0xbffff9f4) at tif2png.c:21
+
+image_info->filename points to a valid TIFF image, so
+any ideas as to what gives???
+
+Chris
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From markov at ATComputing.nl Wed Jul 26 13:49:09 2000
+Date: Wed, 26 Jul 2000 13:49:09 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: Chris Wareham <chris.wareham at catchword.com>
+Subject: Re: core dump in simple ImageMagick example
+Message-ID: <20000726134909.I25170 at atcmpg.ATComputing.nl>
+References: <397C6C6B.989E4BB2 at catchword.com> <20000726133231.G25170 at atcmpg.ATComputing.nl> <397ECFEF.598EE285 at catchword.com>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+X-Mailer: Mutt 1.0pre4i
+In-Reply-To: <397ECFEF.598EE285 at catchword.com>; from chris.wareham at catchword.com on Wed, Jul 26, 2000 at 12:47:59PM +0100
+Status: RO
+Content-Length: 754
+Lines: 16
+
+* Chris Wareham (chris.wareham at catchword.com) [000726 13:46]:
+> > I have the same problem using PerlMagick 5.2.2 calling ReadImage.
+ 
+> This solved my problem with a C based ImageMagick client, but
+> I don't know whether it is relevant for PerlMagick programs.
+
+So: to install IM, I need to have the libs installed.  To install
+the libs, I need IM to be installed for Magic-config....
+Ok.  Still strange spot to dump core...
+-- 
+               MarkOv       %-]
+
+------------------------------------------------------------------------
+drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+From chris.wareham at catchword.com Wed Jul 26 13:46 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id NAA29434
+	for <markov at ATComputing.nl>; Wed, 26 Jul 2000 13:46:33 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id NAA24001
+	for <markov at ATComputing.nl>; Wed, 26 Jul 2000 13:46:32 +0200
+Received: from figaro.catchword.co.uk(194.129.29.1) by ns.ATComputing.nl via smap (V2.1)
+	id xma023999; Wed, 26 Jul 00 13:46:13 +0200
+Received: from catchword.com (valkyrie.catchword.co.uk [194.129.29.105])
+	by figaro.catchword.co.uk (8.9.2/8.9.2) with ESMTP id LAA10217
+	for <markov at ATComputing.nl>; Wed, 26 Jul 2000 11:49:37 GMT
+Sender: cwareham at figaro.catchword.co.uk
+Message-ID: <397ECFEF.598EE285 at catchword.com>
+Date: Wed, 26 Jul 2000 12:47:59 +0100
+From: Chris Wareham <chris.wareham at catchword.com>
+X-Mailer: Mozilla 4.74 [en] (X11; U; Linux 2.2.17pre13 i686)
+X-Accept-Language: en
+MIME-Version: 1.0
+To: Mark Overmeer <markov at ATComputing.nl>
+Subject: Re: core dump in simple ImageMagick example
+References: <397C6C6B.989E4BB2 at catchword.com> <20000726133231.G25170 at atcmpg.ATComputing.nl>
+Content-Transfer-Encoding: 7bit
+Content-Type: text/plain; charset=us-ascii
+Status: RO
+X-Status: A
+Content-Length: 882
+Lines: 26
+
+Mark Overmeer wrote:
+>  
+> I have the same problem using PerlMagick 5.2.2 calling ReadImage.
+> However, it is only reproduceable when this statement is included in
+> my huge Perl program with a small IM part, not is a smaller sample
+> as you have.
+> 
+> I run Solaris 2.5.1 and all newest image-libs attached.
+> 
+> Did you get any useful reply which fixed your problem.
+> Didi you know there is a bug-list:
+> http://www.simplesystems.org/ImageMagick/bugs/
+> 
+> Please let me know.
+>
+
+I wasn't passing all the required compiler flags when building
+my program. I had looked at the output of Magick-config, and
+simply copied the library dependencies into a Makefile. To
+successfully build, ImageMagick clients also need the correct
+CFLAGS arguments, etc.
+
+This solved my problem with a C based ImageMagick client, but
+I don't know whether it is relevant for PerlMagick programs.
+
+Chris
+
+From markov at ATComputing.nl Mon Aug  7 11:38:44 2000
+Date: Mon, 7 Aug 2000 11:38:44 +0200
+From: Mark Overmeer <markov at ATComputing.nl>
+To: Bryan Burchette <blburch at mindspring.com>
+Subject: Re: Core Dump on ReadImage
+Message-ID: <20000807113844.A22119 at atcmpg.ATComputing.nl>
+References: <4.3.1.0.20000801154753.00ae3ed0 at mindspring.com>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+X-Mailer: Mutt 1.0pre4i
+In-Reply-To: <4.3.1.0.20000801154753.00ae3ed0 at mindspring.com>; from blburch at mindspring.com on Tue, Aug 01, 2000 at 03:54:42PM -0400
+Status: RO
+Content-Length: 1041
+Lines: 24
+
+
+(I was away for holidays last week, so not able to response earlier)
+
+* Bryan Burchette (blburch at mindspring.com) [000801 22:37]:
+> I am using ImageMagick 5.2.2 and for testing puposes I am using the little 
+> test program on the website under the API section. No matter what I do, the 
+> program cores on ReadImage().
+
+> Current function is main
+>     33     image=ReadImage(image_info,&exception);
+
+I located the problem in the getc() of ReadImage using PerlMagick.  I did
+not succeed in creating a reduced sized example for my program which
+reproduces the problem, so I'm glad I'm not the only one with this problem.
+
+Is there are more clarity on the cause of the crash?  Any response from the
+developers?
+-- 
+               Mark Overmeer   %-]
+
+------------------------------------------------------------------------
+drs Mark A.C.J. Overmeer                           markov at ATComputing.nl
+AT Computing, UNIX Training and Consultancy    http://www.ATComputing.nl
+http://www.dhp.nl/~markov/                         http://satfoto.dhp.nl
+
+From magick-owner at unca-don.wizards.dupont.com Tue Aug  1 22:37 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id WAA14913
+	for <markov at ATComputing.nl>; Tue, 1 Aug 2000 22:37:13 +0200 (MET DST)
+Received: (from nobody at localhost)
+	by ns.ATComputing.nl (8.8.8/8.8.8) id WAA04892
+	for <markov at ATComputing.nl>; Tue, 1 Aug 2000 22:37:12 +0200
+Received: from viper.oldcity.dca.net(216.158.38.4) by ns.ATComputing.nl via smap (V2.1)
+	id xma004890; Tue, 1 Aug 00 22:37:04 +0200
+Received: from unca-don.wizards.dupont.com ([204.183.81.133])
+	by viper.oldcity.dca.net (8.9.3/8.9.3/DCANET) with ESMTP id QAA28454;
+	Tue, 1 Aug 2000 16:36:07 -0400
+Received: (from majordomo at localhost)
+	by unca-don.wizards.dupont.com (8.9.3/8.9.3) id PAA24962
+	for magick-outgoing; Tue, 1 Aug 2000 15:46:55 -0400 (EDT)
+X-Authentication-Warning: unca-don.wizards.dupont.com: majordomo set sender to owner-magick at wizards.dupont.com using -f
+Message-Id: <4.3.1.0.20000801154753.00ae3ed0 at mindspring.com>
+X-Sender: blburch at mindspring.com
+X-Mailer: QUALCOMM Windows Eudora Version 4.3.1
+Date: Tue, 01 Aug 2000 15:54:42 -0400
+To: magick at wizards.dupont.com
+From: Bryan Burchette <blburch at mindspring.com>
+Subject: Core Dump on ReadImage
+Mime-Version: 1.0
+Sender: owner-magick at wizards.dupont.com
+Precedence: bulk
+Reply-To: Bryan Burchette <blburch at mindspring.com>
+Content-Type: text/plain; charset="us-ascii"; format=flowed
+Status: RO
+X-Status: A
+Content-Length: 2042
+Lines: 55
+
+***********************************************************************
+This list is being decommissioned.  Please join one or more of the new
+ImageMagick mailing lists as described at
+http://www.imagemagick.org/www/magick-list.html.
+***********************************************************************
+
+Hey List,
+    This has me stumped! Maybe I am just missing something really obvious. 
+I am using ImageMagick 5.2.2 and for testing puposes I am using the little 
+test program on the website under the API section. No matter what I do, the 
+program cores on ReadImage().
+
+This is the program I am using to test:
+http://www.wizards.dupont.com/cristy/www/api.html
+
+I have pointed the MagickIncarnate() function to the appropriate directory 
+on my box.
+
+Does anybody have any ideas?? What could I be doing wrong.
+
+Here is my ouput from DBX
+(dbx) step
+stopped in main at line 29 in file "test.c"
+    29     GetExceptionInfo(&exception);
+(dbx) where
+=>[1] main(argc = 1, argv = 0xeffff3c4 "\xef\xff\xf5^H"), line 29 in "test.c"
+(dbx) step
+stopped in main at line 30 in file "test.c"
+    30     image_info=CloneImageInfo((ImageInfo *) NULL);
+(dbx) step
+stopped in main at line 31 in file "test.c"
+    31     (void) strcpy(image_info->filename,"test.jpg");
+(dbx) step
+stopped in main at line 32 in file "test.c"
+    32     printf("iamge_info->filename is %s\n",image_info->filename);
+(dbx) step
+iamge_info->filename is test.jpg
+stopped in main at line 33 in file "test.c"
+    33     image=ReadImage(image_info,&exception);
+(dbx) step
+signal SEGV (no mapping at the fault address) in getc at 0xef267b24
+0xef267b24: getc+0x0024:        ld      [%i0], %o0
+Current function is main
+    33     image=ReadImage(image_info,&exception);
+
+
+
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at wizards.dupont.com
+
+Include the following command in the body of your message:
+	unsubscribe magick
+***********************************************************************
+
+From magick-owner at imagemagick.org Wed Oct  4 19:56 MET 2000
+Received: from ns.ATComputing.nl (ns.ATComputing.nl [195.108.229.25])
+	by atcmpg.ATComputing.nl (8.9.0/8.9.0) with ESMTP id TAA26427
+	for <markov at ATComputing.nl>; Wed, 4 Oct 2000 19:56:00 +0200 (MET DST)
+Received: from imagemagick.org (magick.imagemagick.org [38.220.172.2])
+	by ns.ATComputing.nl (Postfix) with ESMTP id 84B2DED32
+	for <markov at ATComputing.nl>; Wed,  4 Oct 2000 19:55:58 +0200 (CEST)
+Received: (from majordomo at localhost)
+	by imagemagick.org (8.11.0.Beta3/8.9.3) id e94IMj420302
+	for magick-developer-outgoing; Wed, 4 Oct 2000 14:22:45 -0400
+X-Authentication-Warning: magick.imagemagick.org: majordomo set sender to owner-magick at imagemagick.org using -f
+From: cristy at mystic.es.dupont.com
+Date: Wed, 4 Oct 2000 14:22:35 -0400 (EDT)
+Message-Id: <200010041822.e94IMZr19712 at mystic.es.dupont.com>
+To: magick-developer at imagemagick.org
+Subject: Font metrics
+Sender: owner-magick at imagemagick.org
+Precedence: bulk
+Reply-To: cristy at mystic.es.dupont.com
+Content-Type: text
+Status: RO
+Content-Length: 1620
+Lines: 32
+
+The problem with general font metrics in ImageMagick is that there are
+four schemes for obtaining fonts FreeType 1, FreeType 2,
+Postscript/Ghostscript fonts, and X11 fonts.  Freetype returns plenty
+of information associated with font metrics.  I know of no way to get
+the font metrics from Ghostscript and X11 fonts returns metrics but
+they do not exactly match the information returned by Freetype.
+Layered on top of that is the fonts can be manipulated with an affine
+matrix with varying results for the different font schemes.  Currently
+I write fonts to an image that bounds the font and turn all pixels not
+covered by the font lettering to transparent then composite this on top
+of the image being annotated.
+
+The only metrics available now are the maximum font height and string
+width.  In Perl, for example, use
+
+  $font->Read('label:This is a test');
+  ($width,$height)=$font->Get('width','height');
+
+I can certainly include other metric information as well but how to do
+this consistently for all font schemes?  Perhaps I could retain the
+font metrics for Freetype fonts only?  Or can you think of a few
+specific font metrics that would be useful to you that we can get for
+FreeType, X11, and Postscript fonts?  What is a minimal set of font
+metrics you need to make annotating more useable?
+
+***********************************************************************
+To remove yourself from this mailing list, send mail to:
+	majordomo at imagemagick.org
+
+Include the following command in the body of your message:
+	unsubscribe magick-developer
+***********************************************************************
+




More information about the Pkg-perl-cvs-commits mailing list