diff options
| author | fukachan <fukachan> | 2001-01-21 04:32:59 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-01-21 04:32:59 +0000 |
| commit | 867f507f39869739c50d7559f865d274e2b324e9 (patch) | |
| tree | 70abb55ab267b558d293e1cf49dbf2a577f345df /fml/lib | |
| parent | 40476539b13910686409f05f6f0e48e2d343b574 (diff) | |
| download | fml8-867f507f39869739c50d7559f865d274e2b324e9.tar.gz fml8-867f507f39869739c50d7559f865d274e2b324e9.tar.bz2 fml8-867f507f39869739c50d7559f865d274e2b324e9.zip | |
move rfc2369 to FML::Header class
Diffstat (limited to 'fml/lib')
| -rw-r--r-- | fml/lib/FML/Header.pm | 15 | ||||
| -rw-r--r-- | fml/lib/FML/Process/Distribute.pm | 61 |
2 files changed, 66 insertions, 10 deletions
diff --git a/fml/lib/FML/Header.pm b/fml/lib/FML/Header.pm index 37875a87..529df81a 100644 --- a/fml/lib/FML/Header.pm +++ b/fml/lib/FML/Header.pm @@ -88,4 +88,19 @@ sub check } +sub _add_rfc2369_to_header +{ + my ($header, $config, $args) = @_; + + # addresses + my $post = $config->{ address_for_post }; + my $command = $config->{ address_for_command }; + my $maintainer = $config->{ maintainer }; + + # RFC2369 + $header->add('list-post', "<mailto:${post}>") if $post; + $header->add('list-owner', "<mailto:${maintainer}>") if $maintainer; +} + + 1; diff --git a/fml/lib/FML/Process/Distribute.pm b/fml/lib/FML/Process/Distribute.pm index 700cd6ea..767b1a33 100644 --- a/fml/lib/FML/Process/Distribute.pm +++ b/fml/lib/FML/Process/Distribute.pm @@ -74,15 +74,61 @@ sub _distribute { my ($curproc, $args) = @_; - # use FML::Debug; FML::Debug->show_structure( $curproc ); # XXX DEBUG + # 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); + + # header operations + # XXX we need $curproc->{ article }, which is prepared above. + $curproc->_header_rewrite($args); + + # spool in the article before delivery + my $id = $ah->increment_id; + $ah->spool_in($id); + + # delivery starts ! + $curproc->_deliver_article($args); +} + + +sub _prepare_article +{ + my ($curproc, $args) = @_; # create aritcle to distribute use FML::Article; - my $article = new FML::Article $curproc; - # spool in - my $id = $article->gen_article_id; - $article->spool_in( $id ); + # Side Effects: $article->{ curproc } = $curproc; + return new FML::Article $curproc; +} + + +sub _header_rewrite +{ + my ($curproc, $args) = @_; + + my $config = $curproc->{ config }; + my $header = $curproc->{ article }->{ header }; + my $rules = $curproc->{ config }->{ header_rewrite_rules }; + + for my $rule (split(/\s+/, $rules)) { + Log("_header_rewrite( $rule )"); + if ($rule eq 'add_rfc2369') { + $header->_add_rfc2369_to_header($config, + { mode => 'distribute' }); + } + } +} + + +sub _deliver_article +{ + my ($curproc, $args) = @_; + + my $config = $curproc->{ config }; # FML::Config object + my $body = $curproc->{ article }->{ body }; # Netlib::Messages + my $header = $curproc->{ article }->{ header };# FML::Header # distribute article use Netlib::SMTP; @@ -95,11 +141,6 @@ sub _distribute }; if ($service->error) { Log($service->error); return;} - $article = $curproc->{ article }; - my $body = $article->{ body }; # FML::Body -> Netlib::Messages - my $header = $article->{ header }; # FML::Header object - my $config = $curproc->{ config }; # FML::Config object - $service->deliver( { 'mta' => $config->{'mta'}, |
