diff options
| author | fukachan <fukachan> | 2001-02-19 01:57:03 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-02-19 01:57:03 +0000 |
| commit | 92c65006fb5138a24297ffcc43084f5cb1d3f2ea (patch) | |
| tree | a8d3efbb4fbf7cc44330a12bacd73b78fe5706c5 /fml/lib/FML/Process | |
| parent | 0ed6b31ebec050701e8849c6e9447d108db8e575 (diff) | |
| download | fml8-92c65006fb5138a24297ffcc43084f5cb1d3f2ea.tar.gz fml8-92c65006fb5138a24297ffcc43084f5cb1d3f2ea.tar.bz2 fml8-92c65006fb5138a24297ffcc43084f5cb1d3f2ea.zip | |
we use dynamic binding to $header object for simple coding
if ($header->can($rule)) { $header->$rule($config, { ... }); }
Diffstat (limited to 'fml/lib/FML/Process')
| -rw-r--r-- | fml/lib/FML/Process/Distribute.pm | 46 |
1 files changed, 9 insertions, 37 deletions
diff --git a/fml/lib/FML/Process/Distribute.pm b/fml/lib/FML/Process/Distribute.pm index b9aed79b..2652386a 100644 --- a/fml/lib/FML/Process/Distribute.pm +++ b/fml/lib/FML/Process/Distribute.pm @@ -150,42 +150,14 @@ sub _header_rewrite for my $rule (split(/\s+/, $rules)) { Log("_header_rewrite( $rule )") if $config->yes('debug'); - if ($rule eq 'rewrite_subject_tag') { - $header->rewrite_subject_tag($config, { id => $id } ); - } - - if ($rule eq 'rewrite_reply_to') { - $header->rewrite_reply_to($config); - } - - if ($rule eq 'add_software_info') { - $header->add_software_info($config, { id => $id } ); - } - - if ($rule eq 'add_fml_traditional_article_id') { - $header->add_fml_traditional_article_id($config, { id => $id } ); - } - - if ($rule eq 'add_fml_ml_name') { - $header->add_fml_ml_name($config, { id => $id } ); - } - - if ($rule eq 'add_fml_article_id') { - $header->add_fml_article_id($config, { id => $id } ); - } - - if ($rule eq 'add_x_sequence') { - $header->add_x_sequence($config, { - name => $config->{ address_for_post }, + if ($header->can($rule)) { # See FML::Header and FML::Header::* + $header->$rule($config, { # for methods themself + mode => 'distribute', id => $id, }); } - - if ($rule eq 'add_rfc2369') { - $header->add_rfc2369($config, { - id => $id, - mode => 'distribute', - }); + else { + Log("Error: header->$rule is undefined"); } } } @@ -195,10 +167,10 @@ sub _deliver_article { my ($curproc, $args) = @_; - my $config = $curproc->{ config }; # FML::Config object - my $body = $curproc->{ article }->{ body }; # MailingList::Messages; - my $header = $curproc->{ article }->{ header };# FML::Header; - + my $config = $curproc->{ config }; # FML::Config object; + my $body = $curproc->{ article }->{ body }; # MailingList::Messages object; + my $header = $curproc->{ article }->{ header };# FML::Header object; + unless ( $config->yes( 'use_article_delivery' ) ) { return; } |
