summaryrefslogtreecommitdiff
path: root/fml/lib/FML/Command/DataCheck.pm
diff options
context:
space:
mode:
authorfukachan <fukachan>2002-04-26 10:29:12 +0000
committerfukachan <fukachan>2002-04-26 10:29:12 +0000
commitf18acdd8a89b4557c57abb57f0424ac2c0eac5b7 (patch)
tree7efe500bd484613e4077bfa5f2700217daf09574 /fml/lib/FML/Command/DataCheck.pm
parenta76f5a85c06a87869719aae460b42e6d2fdb4d80 (diff)
downloadfml8-f18acdd8a89b4557c57abb57f0424ac2c0eac5b7.tar.gz
fml8-f18acdd8a89b4557c57abb57f0424ac2c0eac5b7.tar.bz2
fml8-f18acdd8a89b4557c57abb57f0424ac2c0eac5b7.zip
permit_commands_for_stranger works
Diffstat (limited to 'fml/lib/FML/Command/DataCheck.pm')
-rw-r--r--fml/lib/FML/Command/DataCheck.pm38
1 files changed, 37 insertions, 1 deletions
diff --git a/fml/lib/FML/Command/DataCheck.pm b/fml/lib/FML/Command/DataCheck.pm
index 00d1d2e6..9799e3cd 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$
+# $FML: DataCheck.pm,v 1.1 2002/04/26 09:20:17 fukachan Exp $
#
package FML::Command::DataCheck;
@@ -112,6 +112,42 @@ sub find_special_keyword
}
+# Descriptions: check message of the current process
+# whether it contais keyword e.g. "confirm".
+# Arguments: OBJ($self) OBJ($curproc) ARRAY_REF($ra_data)
+# Side Effects: none
+# Return Value: NUM( 1 or )
+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 $msg = $body->find_first_plaintext_message();
+ my (@body) = split(/\n/, $msg->message_text );
+ my $comname = '';
+
+ LINE:
+ for my $buf (@body) {
+ ($comname) = $self->parse_command_buffer( $buf );
+ next LINE unless defined($comname) && $comname;
+
+ # $comname matches one of $commands_for_stranger ?
+ COMMAND:
+ for my $proc (@$commands) {
+ next COMMAND unless defined($proc) && $proc;
+
+ return 1 if $comname eq $proc;
+ }
+ };
+
+ my $data = $self->find_special_keyword($curproc, \@body);
+ return 1 if $data->{ confirm_keyword };
+
+ return 0;
+}
+
+
# Descriptions: clean up the given string and return a cleaned one.
# For example, "# ls uja " -> "ls uja"
# Arguments: OBJ($self) STR($s)