summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfukachan <fukachan>2002-07-15 15:27:13 +0000
committerfukachan <fukachan>2002-07-15 15:27:13 +0000
commit67ca162e475b706fe2c48bd0898b72b4e686e4e6 (patch)
treea013ae7a4399ffa230abe03fd1e4dd2ecf232119
parent09aa33f70f3ee62223bab571f4e658ab23cf808b (diff)
downloadfml8-67ca162e475b706fe2c48bd0898b72b4e686e4e6.tar.gz
fml8-67ca162e475b706fe2c48bd0898b72b4e686e4e6.tar.bz2
fml8-67ca162e475b706fe2c48bd0898b72b4e686e4e6.zip
define the following access methods:
config() pcb() incoming_message_header() incoming_message_body() incoming_message() article_header() article_body() article_message() modified to use incoming_message_header() incoming_message_body() incoming_message() article_header() article_body() article_message().
-rw-r--r--fml/lib/FML/Command/DataCheck.pm4
-rw-r--r--fml/lib/FML/Filter/BodyCheck.pm6
-rw-r--r--fml/lib/FML/Process/Command.pm8
-rw-r--r--fml/lib/FML/Process/Distribute.pm20
-rw-r--r--fml/lib/FML/Process/Error.pm4
-rw-r--r--fml/lib/FML/Process/Kernel.pm7
-rw-r--r--fml/lib/FML/Process/Utils.pm159
7 files changed, 180 insertions, 28 deletions
diff --git a/fml/lib/FML/Command/DataCheck.pm b/fml/lib/FML/Command/DataCheck.pm
index 4820c804..28d44272 100644
--- a/fml/lib/FML/Command/DataCheck.pm
+++ b/fml/lib/FML/Command/DataCheck.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: DataCheck.pm,v 1.2 2002/04/26 10:29:12 fukachan Exp $
+# $FML: DataCheck.pm,v 1.3 2002/05/19 11:23:57 fukachan Exp $
#
package FML::Command::DataCheck;
@@ -122,7 +122,7 @@ sub find_commands_for_stranger
my ($self, $curproc) = @_;
my $config = $curproc->{ config };
my $commands = $config->get_as_array_ref('commands_for_stranger');
- my $body = $curproc->{ incoming_message }->{ body };
+ my $body = $curproc->incoming_message_body();
my $msg = $body->find_first_plaintext_message();
my (@body) = split(/\n/, $msg->message_text );
my $comname = '';
diff --git a/fml/lib/FML/Filter/BodyCheck.pm b/fml/lib/FML/Filter/BodyCheck.pm
index 8bb5ef07..5cffc98e 100644
--- a/fml/lib/FML/Filter/BodyCheck.pm
+++ b/fml/lib/FML/Filter/BodyCheck.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: BodyCheck.pm,v 1.19 2002/05/18 02:22:42 tmu Exp $
+# $FML: BodyCheck.pm,v 1.20 2002/07/02 12:39:00 fukachan Exp $
#
package FML::Filter::BodyCheck;
@@ -86,8 +86,8 @@ C<$msg> is C<Mail::Message> object.
C<Usage>:
use FML::Filter::BodyCheck;
- my $obj = new FML::Filter::BodyCheck;
- my $msg = $curproc->{ incoming_message }->{ body };
+ my $obj = new FML::Filter::BodyCheck;
+ my $msg = $curproc->incoming_message_body();
$obj->body_check($msg, $args);
if ($obj->error()) {
diff --git a/fml/lib/FML/Process/Command.pm b/fml/lib/FML/Process/Command.pm
index 0b6375bb..37cd08b3 100644
--- a/fml/lib/FML/Process/Command.pm
+++ b/fml/lib/FML/Process/Command.pm
@@ -3,7 +3,7 @@
# Copyright (C) 2000,2001,2002 Ken'ichi Fukamachi
# All rights reserved.
#
-# $FML: Command.pm,v 1.63 2002/07/02 03:58:32 fukachan Exp $
+# $FML: Command.pm,v 1.64 2002/07/14 15:15:29 fukachan Exp $
#
package FML::Process::Command;
@@ -156,7 +156,7 @@ sub run
}
# append the incoming message as the reference
- my $msg = $curproc->{ incoming_message }->{ message };
+ my $msg = $curproc->incoming_message();
$curproc->reply_message( $msg );
unless (defined $reason) { $reason = 'unknown';}
@@ -614,7 +614,7 @@ sub _evaluate_command_lines
my $argv = $curproc->command_line_argv();
my $prompt = $config->{ command_prompt } || '>>>';
my $mode = 'unknown';
- my $rbody = $curproc->{ incoming_message }->{ body };
+ my $rbody = $curproc->incoming_message_body();
my $msg = $rbody->find_first_plaintext_message();
# preliminary scanning for message to find "confirm" or "admin"
@@ -754,7 +754,7 @@ sub _evaluate_command_lines
# send bak the original input message if needed
{
- my $msg = $curproc->{ incoming_message }->{ message };
+ my $msg = $curproc->incoming_message();
# in the case "confirm"
if ($status->{ context }->{ under_confirmation }) {
diff --git a/fml/lib/FML/Process/Distribute.pm b/fml/lib/FML/Process/Distribute.pm
index c119ec3e..b1779516 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.82 2002/07/02 12:40:37 fukachan Exp $
+# $FML: Distribute.pm,v 1.83 2002/07/14 15:15:29 fukachan Exp $
#
package FML::Process::Distribute;
@@ -208,7 +208,7 @@ sub run
$curproc->reply_message_nl("error.reject_post", $r);
}
- my $msg = $curproc->{ incoming_message }->{ message };
+ my $msg = $curproc->incoming_message();
$curproc->reply_message( $msg );
# inform maintainer too.
@@ -357,10 +357,9 @@ sub _build_article_object
sub _header_rewrite
{
my ($curproc, $args) = @_;
-
my $config = $curproc->{ config };
- my $header = $curproc->{ article }->{ header };
- my $rules = $curproc->{ config }->{ article_header_rewrite_rules };
+ my $header = $curproc->article_header();
+ my $rules = $config->{ article_header_rewrite_rules };
my $id = $args->{ id };
for my $rule (split(/\s+/, $rules)) {
@@ -386,11 +385,10 @@ sub _header_rewrite
sub _deliver_article
{
my ($curproc, $args) = @_;
-
- my $config = $curproc->{ config }; # FML::Config object
- my $message = $curproc->{ article }->{ message }; # Mail::Message object
- my $header = $curproc->{ article }->{ header }; # FML::Header object
- my $body = $curproc->{ article }->{ body }; # Mail::Message object
+ my $config = $curproc->{ config }; # FML::Config object
+ my $message = $curproc->article_message(); # Mail::Message object
+ my $header = $curproc->article_header(); # FML::Header object
+ my $body = $curproc->article_body(); # Mail::Message object
unless ( $config->yes( 'use_article_delivery' ) ) {
return;
@@ -468,7 +466,7 @@ sub _thread_check
rewrite_header => $is_rewrite_hdr,
};
- my $msg = $curproc->{ article }->{ message };
+ my $msg = $curproc->article_message();
eval q{
use Mail::ThreadTrack;
diff --git a/fml/lib/FML/Process/Error.pm b/fml/lib/FML/Process/Error.pm
index 22e1412d..2f86a93d 100644
--- a/fml/lib/FML/Process/Error.pm
+++ b/fml/lib/FML/Process/Error.pm
@@ -3,7 +3,7 @@
# Copyright (C) 2002 Ken'ichi Fukamachi
# All rights reserved.
#
-# $FML: Error.pm,v 1.9 2002/06/27 08:25:50 fukachan Exp $
+# $FML: Error.pm,v 1.10 2002/06/30 05:18:46 fukachan Exp $
#
package FML::Process::Error;
@@ -137,7 +137,7 @@ sub run
my $config = $curproc->{ config };
my $found = 0;
my $pcb = $curproc->{ pcb };
- my $msg = $curproc->{ incoming_message }->{ message };
+ my $msg = $curproc->incoming_message();
my $eval = $config->get_hook( 'error_run_start_hook' );
if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; }
diff --git a/fml/lib/FML/Process/Kernel.pm b/fml/lib/FML/Process/Kernel.pm
index efb06ac3..554a2fd0 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.112 2002/07/14 04:13:58 fukachan Exp $
+# $FML: Kernel.pm,v 1.113 2002/07/14 15:15:29 fukachan Exp $
#
package FML::Process::Kernel;
@@ -363,9 +363,8 @@ sub simple_loop_check
{
my ($curproc, $args) = @_;
my $config = $curproc->{ config };
- my $r_msg = $curproc->{ incoming_message };
- my $header = $r_msg->{ header };
- my $match = 0;
+ my $header = $curproc->incoming_message_header();
+ my $match = 0;
RULES:
for my $rule (split(/\s+/, $config->{ header_loop_check_rules })) {
diff --git a/fml/lib/FML/Process/Utils.pm b/fml/lib/FML/Process/Utils.pm
index 47a18156..ad119694 100644
--- a/fml/lib/FML/Process/Utils.pm
+++ b/fml/lib/FML/Process/Utils.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: Utils.pm,v 1.32 2002/07/02 12:48:42 fukachan Exp $
+# $FML: Utils.pm,v 1.33 2002/07/14 15:11:01 fukachan Exp $
#
package FML::Process::Utils;
@@ -24,7 +24,162 @@ See FML::Process::Kernel.
=head1 DESCRIPTION
-=head1 METHODS
+=head1 access METHODS to handle configuration space
+
+=cut
+
+
+# Descriptions: return FML::Config object
+# Arguments: OBJ($curproc)
+# Side Effects: none
+# Return Value: OBJ
+sub config
+{
+ my ($curproc) = @_;
+
+ if (defined $curproc->{ config }) {
+ return $curproc->{ config };
+ }
+ else {
+ return undef;
+ }
+}
+
+
+# Descriptions: return FML::PCB object
+# Arguments: OBJ($curproc)
+# Side Effects: none
+# Return Value: OBJ
+sub pcb
+{
+ my ($curproc) = @_;
+
+ if (defined $curproc->{ pcb }) {
+ return $curproc->{ pcb };
+ }
+ else {
+ return undef;
+ }
+}
+
+
+=head1 access METHODS to handle incoming_message
+
+available all processes which eats message via STDIN.
+
+=cut
+
+
+# Descriptions: return incoming_message header object if could
+# Arguments: OBJ($curproc)
+# Side Effects: none
+# Return Value: OBJ
+sub incoming_message_header
+{
+ my ($curproc) = @_;
+
+ if (defined $curproc->{ incoming_message }->{ header }) {
+ return $curproc->{ incoming_message }->{ header };
+ }
+ else {
+ return undef;
+ }
+}
+
+
+# Descriptions: return incoming_message body object if could
+# Arguments: OBJ($curproc)
+# Side Effects: none
+# Return Value: OBJ
+sub incoming_message_body
+{
+ my ($curproc) = @_;
+
+ if (defined $curproc->{ incoming_message }->{ body }) {
+ return $curproc->{ incoming_message }->{ body };
+ }
+ else {
+ return undef;
+ }
+}
+
+
+# Descriptions: return incoming_message message object if could
+# Arguments: OBJ($curproc)
+# Side Effects: none
+# Return Value: OBJ
+sub incoming_message
+{
+ my ($curproc) = @_;
+
+ if (defined $curproc->{ incoming_message }->{ message }) {
+ return $curproc->{ incoming_message }->{ message };
+ }
+ else {
+ return undef;
+ }
+}
+
+
+=head1 access METHODS to handle article
+
+available only in C<libexec/distribute> process.
+
+=cut
+
+
+# Descriptions: return article header object if could
+# Arguments: OBJ($curproc)
+# Side Effects: none
+# Return Value: OBJ
+sub article_header
+{
+ my ($curproc) = @_;
+
+ if (defined $curproc->{ article }->{ header }) {
+ return $curproc->{ article }->{ header };
+ }
+ else {
+ return undef;
+ }
+}
+
+
+# Descriptions: return article body object if could
+# Arguments: OBJ($curproc)
+# Side Effects: none
+# Return Value: OBJ
+sub article_body
+{
+ my ($curproc) = @_;
+
+ if (defined $curproc->{ article }->{ body }) {
+ return $curproc->{ article }->{ body };
+ }
+ else {
+ return undef;
+ }
+}
+
+
+# Descriptions: return article message object if could
+# Arguments: OBJ($curproc)
+# Side Effects: none
+# Return Value: OBJ
+sub article_message
+{
+ my ($curproc) = @_;
+
+ if (defined $curproc->{ article }->{ message }) {
+ return $curproc->{ article }->{ message };
+ }
+ else {
+ return undef;
+ }
+}
+
+
+=head1 METHODS for convenience
=head2 fml_version()