diff options
| author | fukachan <fukachan> | 2002-03-30 13:48:25 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2002-03-30 13:48:25 +0000 |
| commit | eed4d6079b291be8b66e2e4d2dd1bed1cdd6e8e1 (patch) | |
| tree | d8314ae7b40d97d8ff76e08047caeee204cdd559 /fml/lib | |
| parent | a6f4e86f12bdc4714d4f7be6adbce43a1590189e (diff) | |
| download | fml8-eed4d6079b291be8b66e2e4d2dd1bed1cdd6e8e1.tar.gz fml8-eed4d6079b291be8b66e2e4d2dd1bed1cdd6e8e1.tar.bz2 fml8-eed4d6079b291be8b66e2e4d2dd1bed1cdd6e8e1.zip | |
FML::Article::filepath() determines the article file path.
Diffstat (limited to 'fml/lib')
| -rw-r--r-- | fml/lib/FML/Article.pm | 32 | ||||
| -rw-r--r-- | fml/lib/FML/Command/SendFile.pm | 6 | ||||
| -rw-r--r-- | fml/lib/FML/Process/Distribute.pm | 22 |
3 files changed, 43 insertions, 17 deletions
diff --git a/fml/lib/FML/Article.pm b/fml/lib/FML/Article.pm index ae3c9081..0954e989 100644 --- a/fml/lib/FML/Article.pm +++ b/fml/lib/FML/Article.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Article.pm,v 1.29 2002/01/16 13:33:58 fukachan Exp $ +# $FML: Article.pm,v 1.30 2002/01/16 13:43:19 fukachan Exp $ # package FML::Article; @@ -161,8 +161,7 @@ sub spool_in mkpath( $spool_dir, 0, 0700 ); } - use File::Spec; - my $file = File::Spec->catfile($spool_dir, $id); + my $file = $self->filepath($curproc, $id); use FileHandle; my $fh = new FileHandle; @@ -181,6 +180,33 @@ sub spool_in } +=head2 filepath($curproc, $id) + +return article file path. + +=cut + + +# Descriptions: return article file path. +# Arguments: OBJ($self) OBJ($curproc) NUM($id) +# Side Effects: none +# Return Value: STR(file path) +sub filepath +{ + my ($self, $id) = @_; + my $curproc = $self->{ curproc }; + my $config = $curproc->{ config }; + my $spool_dir = $config->{ spool_dir }; + + use File::Spec; + my $file = File::Spec->catfile($spool_dir, $id); # ok. + + Log("debug: spooled path = $file"); + + return $file; +} + + =head2 speculate_max_id($spool_dir) scan the spool_dir and get max number among files in it It must be the diff --git a/fml/lib/FML/Command/SendFile.pm b/fml/lib/FML/Command/SendFile.pm index dfd601d5..6f26b32e 100644 --- a/fml/lib/FML/Command/SendFile.pm +++ b/fml/lib/FML/Command/SendFile.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: SendFile.pm,v 1.12 2002/02/17 03:13:48 fukachan Exp $ +# $FML: SendFile.pm,v 1.13 2002/02/23 10:22:16 fukachan Exp $ # package FML::Command::SendFile; @@ -67,7 +67,9 @@ sub send_article my $filelist = $self->_is_valid_argument($curproc, $fn); if (defined $filelist) { for my $fn (@$filelist) { - my $file = File::Spec->catfile($spool_dir, $fn); + use FML::Article; + my $article = new FML::Article $curproc; + my $file = $article->filepath($fn); if (-f $file) { Log("send back article $fn"); $curproc->reply_message( { diff --git a/fml/lib/FML/Process/Distribute.pm b/fml/lib/FML/Process/Distribute.pm index 26968599..c8f6f30b 100644 --- a/fml/lib/FML/Process/Distribute.pm +++ b/fml/lib/FML/Process/Distribute.pm @@ -3,7 +3,7 @@ # Copyright (C) 2000,2001,2002 Ken'ichi Fukamachi # All rights reserved. # -# $FML: Distribute.pm,v 1.64 2002/02/17 03:07:55 fukachan Exp $ +# $FML: Distribute.pm,v 1.65 2002/02/17 13:46:29 fukachan Exp $ # package FML::Process::Distribute; @@ -223,18 +223,17 @@ sub _distribute my ($curproc, $args) = @_; my $config = $curproc->{ config }; - # XXX $ah is "article handler" object. - # XXX $ah != $curproc->{ article } (which is just a key) - # XXX $curproc->{ article } is prepared as a side effect. - my $ah = $curproc->_prepare_article($args); + # XXX $article != $curproc->{ article } (which is just a key) + # XXX $curproc->{ article } is prepared as a side effect for the future. + my $article = $curproc->_build_article_object($args); # get sequence number - my $id = $ah->increment_id; + my $id = $article->increment_id; # XXX debug, remove here in the future { my $ha_msg = $curproc->{ article }->{ body }->data_type_list; - for (@$ha_msg) { Log($_);} + for (@$ha_msg) { Log("debug: $_");} } # thread system checks the message before header rewritings. @@ -245,7 +244,7 @@ sub _distribute $curproc->_header_rewrite({ id => $id }); # spool in the article before delivery - $ah->spool_in($id); + $article->spool_in($id); # delivery starts ! $curproc->_deliver_article($args); @@ -261,7 +260,7 @@ sub _distribute # Arguments: OBJ($curproc) HASH_REF($args) # Side Effects: none # Return Value: OBJ(FML::Article) -sub _prepare_article +sub _build_article_object { my ($curproc, $args) = @_; @@ -428,10 +427,9 @@ sub htmlify my $ml_name = $config->{ ml_name }; my $spool_dir = $config->{ spool_dir }; my $html_dir = $config->{ html_archive_dir }; + my $article = $curproc->_build_article_object($args); my $article_id = $pcb->get('article', 'id'); - - use File::Spec; - my $article_file = File::Spec->catfile($spool_dir, $article_id); + my $article_file = $article->filepath($article_id); eval q{ use Mail::HTML::Lite; |
