diff options
| author | fukachan <fukachan> | 2004-06-09 14:57:26 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2004-06-09 14:57:26 +0000 |
| commit | c90cb60f082d08eb99f9c2d6f2d376d11890e364 (patch) | |
| tree | e94368af7f1949d5d709fa64849beb8c55e901e4 /fml | |
| parent | 144ad8827a022f951210eae5b8d2984450c64335 (diff) | |
| download | fml8-c90cb60f082d08eb99f9c2d6f2d376d11890e364.tar.gz fml8-c90cb60f082d08eb99f9c2d6f2d376d11890e364.tar.bz2 fml8-c90cb60f082d08eb99f9c2d6f2d376d11890e364.zip | |
separate message-id duplication check and cache updating.
cache updating when process ends.
Diffstat (limited to 'fml')
| -rw-r--r-- | fml/lib/FML/Header.pm | 50 | ||||
| -rw-r--r-- | fml/lib/FML/Process/Kernel.pm | 26 |
2 files changed, 60 insertions, 16 deletions
diff --git a/fml/lib/FML/Header.pm b/fml/lib/FML/Header.pm index 8e81a813..2a39d723 100644 --- a/fml/lib/FML/Header.pm +++ b/fml/lib/FML/Header.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: Header.pm,v 1.74 2004/03/12 11:45:47 fukachan Exp $ +# $FML: Header.pm,v 1.75 2004/05/01 14:29:41 fukachan Exp $ # package FML::Header; @@ -633,16 +633,6 @@ check whether message-id is unique or not. If the message-id is found in the past message-id cache, the injected message must causes a mail loop. -=head2 check_x_ml_info($config, $rw_args) - -The injected message loops if x-ml-info: has our own -C<article_post_address> address. - -=head2 check_list_post($config, $rw_args) - -The injected message loops if list-post: has our own -C<article_post_address> address. - =cut @@ -668,16 +658,50 @@ sub check_message_id # we can tind the $mid in the past message-id cache ? $dup = $db->{ $mid }; Log( "message-id duplicated" ) if $dup; + } + } + + return $dup; +} + + +# Descriptions: store message-id into the cache. +# Arguments: OBJ($header) OBJ($config) HASH_REF($rw_args) +# Side Effects: update cache +# Return Value: STR or 0 +sub update_message_id_cache +{ + my ($header, $config, $rw_args) = @_; + my $dir = $config->{ 'message_id_cache_dir' }; + my $mid = $header->get('message-id'); + + $mid = $header->address_clean_up($mid); + if ($mid) { + use FML::Header::MessageID; + my $xargs = { directory => $dir }; + my $db = FML::Header::MessageID->new->db_open($xargs); + if (defined $db) { # save the current id $db->{ $mid } = 1; } } - - return $dup; } +=head2 check_x_ml_info($config, $rw_args) + +The injected message loops if x-ml-info: has our own +C<article_post_address> address. + +=head2 check_list_post($config, $rw_args) + +The injected message loops if list-post: has our own +C<article_post_address> address. + +=cut + + # Descriptions: check X-ML-Info: duplication against mail loop. # Arguments: OBJ($header) OBJ($config) HASH_REF($rw_args) # Side Effects: none diff --git a/fml/lib/FML/Process/Kernel.pm b/fml/lib/FML/Process/Kernel.pm index b85bc80b..66068685 100644 --- a/fml/lib/FML/Process/Kernel.pm +++ b/fml/lib/FML/Process/Kernel.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: Kernel.pm,v 1.229 2004/05/24 13:59:45 fukachan Exp $ +# $FML: Kernel.pm,v 1.230 2004/05/25 04:02:07 fukachan Exp $ # package FML::Process::Kernel; @@ -590,7 +590,8 @@ sub verify_sender_credential =head2 simple_loop_check($args) -loop checks following rules of $config->{ incoming_mail_header_loop_check_rules }. +loop checks following rules of +$config->{ incoming_mail_header_loop_check_rules }. The autual check is done by header->C<$rule()> for a C<rule>. See C<FML::Header> object for more details. @@ -606,7 +607,8 @@ sub simple_loop_check my ($curproc) = @_; my $config = $curproc->config(); my $header = $curproc->incoming_message_header(); - my $rules = $config->get_as_array_ref( 'incoming_mail_header_loop_check_rules' ); + my $rules = + $config->get_as_array_ref( 'incoming_mail_header_loop_check_rules' ); my $match = 0; RULE: @@ -630,6 +632,21 @@ sub simple_loop_check } +# Descriptions: commit message-id cache update transaction. +# Arguments: OBJ($curproc) +# Side Effects: update cache. +# Return Value: none +sub _commit_message_id_cache_update_transaction +{ + my ($curproc) = @_; + my $config = $curproc->config(); + my $header = $curproc->incoming_message_header(); + + # XXX-TODO: more granuar + $header->update_message_id_cache($config); +} + + =head2 resolve_ml_specific_variables( $args ) determine ml specific variables @@ -2924,6 +2941,9 @@ sub finalize # log rotation $curproc->log_rorate(); + + # commit transaction + $curproc->_commit_message_id_cache_update_transaction(); } |
