diff options
| author | fukachan <fukachan> | 2001-02-27 16:00:50 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-02-27 16:00:50 +0000 |
| commit | de534bd68533eb3b7da42690fdf112a22a969368 (patch) | |
| tree | e240d75124b10eda3984bfd035f2e9b574494e4c /fml | |
| parent | 1b2afdbbe3c7a0233655501a0094415814795944 (diff) | |
| download | fml8-de534bd68533eb3b7da42690fdf112a22a969368.tar.gz fml8-de534bd68533eb3b7da42690fdf112a22a969368.tar.bz2 fml8-de534bd68533eb3b7da42690fdf112a22a969368.zip | |
define $available_commands
$config->has_attribute(variable, attribute)
Diffstat (limited to 'fml')
| -rw-r--r-- | fml/etc/default_config.cf.ja | 10 | ||||
| -rw-r--r-- | fml/etc/defaults/command.cf.ja | 10 | ||||
| -rw-r--r-- | fml/lib/FML/Config.pm | 15 | ||||
| -rw-r--r-- | fml/lib/FML/Process/Command.pm | 13 |
4 files changed, 44 insertions, 4 deletions
diff --git a/fml/etc/default_config.cf.ja b/fml/etc/default_config.cf.ja index 6d640526..f6603b92 100644 --- a/fml/etc/default_config.cf.ja +++ b/fml/etc/default_config.cf.ja @@ -202,6 +202,16 @@ command_chaddr_type = confirmation command_unsubscribe_type = confirmation + + +# コマンド一覧 +available_commands = help + get + mget + subscribe + unsubscribe + chaddr + =head1 Tickets / Trouble Tickets System diff --git a/fml/etc/defaults/command.cf.ja b/fml/etc/defaults/command.cf.ja index 299795ea..7a607343 100644 --- a/fml/etc/defaults/command.cf.ja +++ b/fml/etc/defaults/command.cf.ja @@ -4,3 +4,13 @@ command_chaddr_type = confirmation command_unsubscribe_type = confirmation + + + +# コマンド一覧 +available_commands = help + get + mget + subscribe + unsubscribe + chaddr diff --git a/fml/lib/FML/Config.pm b/fml/lib/FML/Config.pm index a3627991..665e5eb1 100644 --- a/fml/lib/FML/Config.pm +++ b/fml/lib/FML/Config.pm @@ -327,6 +327,21 @@ sub no } +# has_attribute( key, attribute ) +# e.g. has_attribute( "available_command_list" , "help" ); +sub has_attribute +{ + my ($self, $key, $attribute) = @_; + my (@attribute) = split(/\s+/, $_fml_config{$key}); + + for my $k (@attribute) { + return 1 if $k eq $attribute; + } + + return 0; +} + + sub FETCH { my ($self, $key) = @_; diff --git a/fml/lib/FML/Process/Command.pm b/fml/lib/FML/Process/Command.pm index be7941c7..917f37d0 100644 --- a/fml/lib/FML/Process/Command.pm +++ b/fml/lib/FML/Process/Command.pm @@ -89,10 +89,15 @@ sub finish sub _evaluate_command { my ( $curproc ) = @_; - my $body = $curproc->{ incoming_message }->{ body }->get_content_body; - my @body = split(/\n/, $body); - - for (@body) { Log($_);} + my $config = $curproc->{ config }; + my $body = $curproc->{ incoming_message }->{ body }->get_content_body; + my @body = split(/\n/, $body); + + for (@body) { + my $valid = $config->has_attribute( "available_commands", $_ ) + ? "valid" : "invalid"; + Log("command($valid) = " . $_); + } } |
