summaryrefslogtreecommitdiff
path: root/fml
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-01-24 06:35:46 +0000
committerfukachan <fukachan>2001-01-24 06:35:46 +0000
commite00836b542f2df20d8fa34669d9edd79333fa298 (patch)
tree9951c13c3b658ad19292def4a05079b3f9488d27 /fml
parente6a9111ca4122b24ebbc7d33bc2fcf607155a9db (diff)
downloadfml8-e00836b542f2df20d8fa34669d9edd79333fa298.tar.gz
fml8-e00836b542f2df20d8fa34669d9edd79333fa298.tar.bz2
fml8-e00836b542f2df20d8fa34669d9edd79333fa298.zip
ticket system be more independent of header_rewrite, and clean up more
Diffstat (limited to 'fml')
-rw-r--r--fml/etc/default_config.cf.ja2
-rw-r--r--fml/etc/defaults/log.cf.ja2
-rw-r--r--fml/lib/FML/Article.pm5
-rw-r--r--fml/lib/FML/Config.pm2
-rw-r--r--fml/lib/FML/Header.pm19
-rw-r--r--fml/lib/FML/Process/Distribute.pm39
-rw-r--r--fml/lib/FML/Process/Kernel.pm2
-rw-r--r--fml/lib/FML/Ticket/Model/toymodel.pm2
8 files changed, 35 insertions, 38 deletions
diff --git a/fml/etc/default_config.cf.ja b/fml/etc/default_config.cf.ja
index c64a5002..1fdd72fc 100644
--- a/fml/etc/default_config.cf.ja
+++ b/fml/etc/default_config.cf.ja
@@ -74,7 +74,7 @@ lock_type = flock
###
# logfile
-log_file = /tmp/log
+log_file = $ml_home_dir/log
# type of logging
# value: file / syslog
diff --git a/fml/etc/defaults/log.cf.ja b/fml/etc/defaults/log.cf.ja
index 98ede8ff..68061b10 100644
--- a/fml/etc/defaults/log.cf.ja
+++ b/fml/etc/defaults/log.cf.ja
@@ -3,7 +3,7 @@
###
# logfile
-log_file = /tmp/log
+log_file = $ml_home_dir/log
# type of logging
# value: file / syslog
diff --git a/fml/lib/FML/Article.pm b/fml/lib/FML/Article.pm
index 814762f0..eb1fb0ee 100644
--- a/fml/lib/FML/Article.pm
+++ b/fml/lib/FML/Article.pm
@@ -49,11 +49,6 @@ sub _setup_article_template
# create an article template by duplicating the incoming message
$curproc->{ article }->{ header } = $msg->{'header'}->dup();
$curproc->{ article }->{ body } = $msg->{'body'};
-
- # initialize the header object
- use FML::Header;
- $curproc->{'article'}->{'header'}->check;
- $curproc->{'article'}->{'header'}->rewrite;
}
diff --git a/fml/lib/FML/Config.pm b/fml/lib/FML/Config.pm
index 8f17a13d..47beecb2 100644
--- a/fml/lib/FML/Config.pm
+++ b/fml/lib/FML/Config.pm
@@ -7,9 +7,9 @@
package FML::Config;
-use vars qw(%_fml_config);
use strict;
use Carp;
+use vars qw(%_fml_config);
sub new
diff --git a/fml/lib/FML/Header.pm b/fml/lib/FML/Header.pm
index 9e7d753b..39709033 100644
--- a/fml/lib/FML/Header.pm
+++ b/fml/lib/FML/Header.pm
@@ -108,25 +108,6 @@ sub add_x_sequence
}
-sub add_ticket_tag
-{
- my ($header, $config, $args) = @_;
- my $model = $config->{ ticket_model };
-
- if ($model eq 'toymodel') {
- my $pkg = "FML::Ticket::Model::${model}";
- eval qq{ require $pkg; $pkg->import();};
- unless ($@) {
- my $ts = $pkg->new;
- $ts->add_ticket($header, $config, $args);
- }
- else {
- Log($@);
- }
- }
-}
-
-
sub rewrite_subject_tag
{
my ($header, $config, $args) = @_;
diff --git a/fml/lib/FML/Process/Distribute.pm b/fml/lib/FML/Process/Distribute.pm
index 7ec4f95e..2cf21b16 100644
--- a/fml/lib/FML/Process/Distribute.pm
+++ b/fml/lib/FML/Process/Distribute.pm
@@ -73,6 +73,7 @@ sub finish
sub _distribute
{
my ($curproc, $args) = @_;
+ my $config = $curproc->{ config };
# XXX $ah is "article handler" object.
# XXX $ah != $curproc->{ article } (which is just a key)
@@ -82,6 +83,9 @@ sub _distribute
# get sequence number
my $id = $ah->increment_id;
+ # ticket system checks the message before header rewritings.
+ $curproc->_ticket_system_check($args) if $config->yes('use_ticket');
+
# header operations
# XXX we need $curproc->{ article }, which is prepared above.
$curproc->_header_rewrite({ id => $id });
@@ -116,7 +120,7 @@ sub _header_rewrite
my $id = $args->{ id };
for my $rule (split(/\s+/, $rules)) {
- Log("_header_rewrite( $rule )");
+ Log("_header_rewrite( $rule )") if $config->yes('debug');
if ($rule eq 'rewrite_subject_tag') {
$header->rewrite_subject_tag($config, { id => $id } );
@@ -147,13 +151,6 @@ sub _header_rewrite
mode => 'distribute',
});
}
-
- # ticket system
- if ($rule eq 'add_ticket_tag') {
- $header->add_ticket_tag($config, {
- mode => 'distribute',
- });
- }
}
}
@@ -192,6 +189,32 @@ sub _deliver_article
}
+sub _ticket_system_check
+{
+ my ($curproc, $args) = @_;
+ my $config = $curproc->{ config };
+ my $header = $curproc->{ article }->{ header }; # FML::Header object
+ my $model = $config->{ ticket_model };
+ my $pkg = "FML::Ticket::Model::";
+
+ if ($model eq 'toymodel') {
+ $pkg .= $model;
+ }
+ else {
+ Log("ticket: unknown model");
+ return;
+ }
+
+ eval qq{ require $pkg; $pkg->import();};
+ unless ($@) {
+ my $ts = $pkg->new;
+ $ts->add_ticket($header, $config, $args) if $ts->can('add_ticket');
+ }
+ else {
+ Log($@);
+ }
+}
+
=head1 NAME
diff --git a/fml/lib/FML/Process/Kernel.pm b/fml/lib/FML/Process/Kernel.pm
index 92262a52..8a17fd16 100644
--- a/fml/lib/FML/Process/Kernel.pm
+++ b/fml/lib/FML/Process/Kernel.pm
@@ -24,7 +24,7 @@ sub new
{
my ($self, $args) = @_;
my ($curproc) = {}; # alloc memory as the struct current_process.
- my $cfargs = {};
+ my ($cfargs) = {};
# import variables
my (@import_vars) = qw(ml_home_dir ml_home_prefix);
diff --git a/fml/lib/FML/Ticket/Model/toymodel.pm b/fml/lib/FML/Ticket/Model/toymodel.pm
index 2cf31779..02cb8943 100644
--- a/fml/lib/FML/Ticket/Model/toymodel.pm
+++ b/fml/lib/FML/Ticket/Model/toymodel.pm
@@ -39,8 +39,6 @@ sub add_ticket
# if the header carries "Subject: Re: ...",
# out ticket system does nothing.
unless ( FML::Header::Subject->is_reply( $subject ) ) {
- Log( "seq: ". $config->{ ticket_sequence_file } );
-
# call SUPER class's FML::Ticket::System::increment_id()
my $id = $self->increment_id( $config->{ ticket_sequence_file } );
unless ($self->error) {