[prev] [thread] [next] [lurker] [Date index for 2003/08/10]
Author: richardc Date: 2003-08-10 18:38:52 +0100 (Sun, 10 Aug 2003) New Revision: 1302 Added: trunk/Email-LocalDelivery-Ezmlm/ trunk/Email-LocalDelivery-Ezmlm/Build.PL trunk/Email-LocalDelivery-Ezmlm/lib/ trunk/Email-LocalDelivery-Ezmlm/lib/Email/ trunk/Email-LocalDelivery-Ezmlm/lib/Email/LocalDelivery/ trunk/Email-LocalDelivery-Ezmlm/lib/Email/LocalDelivery/Ezmlm.pm Log: on the hack again Added: trunk/Email-LocalDelivery-Ezmlm/Build.PL =================================================================== --- trunk/Email-LocalDelivery-Ezmlm/Build.PL 2003-08-10 11:06:08 UTC (rev 1301) +++ trunk/Email-LocalDelivery-Ezmlm/Build.PL 2003-08-10 17:38:52 UTC (rev 1302) @@ -0,0 +1,15 @@ +use strict; +use Module::Build; + +Module::Build + ->new( module_name => "Email::LocalDelivery::Ezmlm", + license => 'perl', + build_requires => { + 'Test::More' => 0, + }, + requires => { + 'Email::LocalDelivery' => 0, + }, + create_makefile_pl => 'traditional', + ) + ->create_build_script; Added: trunk/Email-LocalDelivery-Ezmlm/lib/Email/LocalDelivery/Ezmlm.pm =================================================================== --- trunk/Email-LocalDelivery-Ezmlm/lib/Email/LocalDelivery/Ezmlm.pm 2003-08-10 11:06:08 UTC (rev 1301) +++ trunk/Email-LocalDelivery-Ezmlm/lib/Email/LocalDelivery/Ezmlm.pm 2003-08-10 17:38:52 UTC (rev 1302) @@ -0,0 +1,78 @@ +use strict; +package Email::LocalDelivery::Ezmlm; +our $VERSION = '0.10'; + +=head1 NAME + +Email::LocalDelivery::Ezmlm - deliver mail into ezmlm archives + +=head1 SYNOPSIS + +=head1 DESCRIPTION + +This module delivers RFC822 messages into ezmlm-style archive folders. + +This module was created to allow easy interoperability between +L<Siesta> and L<colobus>. Colobus is an nntp server which uses ezmlm +archives as its message store. + + +=head1 METHODS + +=head2 ->deliver( $message, @folders ) + +used as a class method. returns the names of the files ultimately +delivered to + +=cut + +sub deliver { + my ($class, $mail, @folders) = @_; + + my @delivered; + for my $folder (@folders) { + # XXX should lock the folder - figure out how ezmlm does that + + my $num; + if (open my $fh, "$folder/num") { + ($num) = (<$fh> =~ m/^\(d+)/); + } + ++$num; + + my $filename = sprintf('%s/archive/%d/%02d', + $folder, $num / 100, $num % 100); + eval { mkpath( dirname $filename ) }; + open my $fh, ">$filename" or next; + print $fh $mail; + close $fh or next; + + open my $fh, ">$folder/num" or do { unlink $filename; next }; + print $fh "$num\n"; + close $fh or die "couldn't rewrite '$folder/num' $!"; + push @delivered, $filename; + } + return @delivered; +} + +1; +__END__ + + +=head1 AUTHOR + +Richard Clamp <richardc@xxxxxxxxx.xxx> based on the source of +C<colobus> by Jim Winstead Jr. + +=head1 COPYRIGHT + +Copyright (C) 2003 Richard Clamp. All Rights Reserved. + +This module is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +=head1 SEE ALSO + +L<colobus|http://trainedmonkey.com/colobus/>, L<Email::LocalDelivery> + +=cut +
Generated at 13:57 on 01 Jul 2004 by mariachi 0.52