summaryrefslogtreecommitdiff
path: root/fml/lib/FML/Process
diff options
context:
space:
mode:
authorfukachan <fukachan>2004-03-23 06:34:14 +0000
committerfukachan <fukachan>2004-03-23 06:34:14 +0000
commit88d5b43d9435519f2928dd5ceab04af30f424c17 (patch)
treefdc09e82b178b0af75ac1b95d60995286dcbd0a4 /fml/lib/FML/Process
parent19b4570124d6c04831902d1bccf3538a92033336 (diff)
downloadfml8-88d5b43d9435519f2928dd5ceab04af30f424c17.tar.gz
fml8-88d5b43d9435519f2928dd5ceab04af30f424c17.tar.bz2
fml8-88d5b43d9435519f2928dd5ceab04af30f424c17.zip
allow CUI(fml,makefml) to send messages.
this function disabled by default. fml and makefml can use --allow-send-message --send-to=ADDRESS option for it.
Diffstat (limited to 'fml/lib/FML/Process')
-rw-r--r--fml/lib/FML/Process/Kernel.pm7
-rw-r--r--fml/lib/FML/Process/Utils.pm75
2 files changed, 64 insertions, 18 deletions
diff --git a/fml/lib/FML/Process/Kernel.pm b/fml/lib/FML/Process/Kernel.pm
index acabf17c..048d7fb9 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.220 2004/03/14 06:33:14 fukachan Exp $
+# $FML: Kernel.pm,v 1.221 2004/03/20 16:27:01 fukachan Exp $
#
package FML::Process::Kernel;
@@ -1449,7 +1449,10 @@ sub _reply_message_queuein
# process running under MTA can handle reply messages by mail.
unless ($curproc->allow_reply_message()) {
- $curproc->logwarn("(debug) $myname disables reply_message()");
+ unless ($curproc->error_message_get_count("disable_reply_message")) {
+ $curproc->logwarn("(debug) $myname disables reply_message()");
+ $curproc->error_message_set_count("disable_reply_message");
+ }
return;
}
diff --git a/fml/lib/FML/Process/Utils.pm b/fml/lib/FML/Process/Utils.pm
index b031e4d3..fbdae955 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.108 2004/03/13 10:27:43 fukachan Exp $
+# $FML: Utils.pm,v 1.109 2004/03/23 04:20:46 fukachan Exp $
#
package FML::Process::Utils;
@@ -801,19 +801,6 @@ sub command_line_options
}
-# Descriptions: return comman specific options (-O key=value) as HASH_REF.
-# Arguments: OBJ($curproc)
-# Side Effects: none
-# Return Value: HASH_REF
-sub cui_command_specific_options
-{
- my ($curproc) = @_;
- my $args = $curproc->{ __parent_args };
-
- return( $args->{ options }->{ O } || {} );
-}
-
-
=head2 set_config_files_list($cf_file_path_array)
set configuration file (.cf) to internal list.
@@ -1232,6 +1219,10 @@ sub __get_ml_home_prefix_maps
}
+=head2 is_cui_process()
+
+inform whether this process runs as CUI (fml/makefml) ?
+
=head2 is_cgi_process()
inform whether this process runs as cgi ?
@@ -1243,6 +1234,24 @@ inform whether this process runs under MTA ?
=cut
+# Descriptions: whether this process runs as CUI ?
+# Arguments: OBJ($curproc)
+# Side Effects: none
+# Return Value: NUM(1 or 0)
+sub is_cui_process
+{
+ my ($curproc) = @_;
+ my $name = $curproc->myname() || '';
+
+ # XXX-TODO: HARD CODED
+ if ($name eq 'fml' || $name eq 'makefml') {
+ return 1;
+ }
+
+ return 0;
+}
+
+
# Descriptions: whether this process runs as cgi ?
# Arguments: OBJ($curproc)
# Side Effects: none
@@ -1290,13 +1299,13 @@ return 0 if not.
For example, processes running under MTA e.g. libexec/distribute,
libexec/command receives a mail and reply it if needed.
-But makefml command do not.
+But makefml command do not.
=cut
# Descriptions: check if we can send messages to the sender or
-# specified address.
+# specified address.
# Arguments: OBJ($curproc)
# Side Effects: none
# Return Value: NUM(1 or 0)
@@ -1829,6 +1838,40 @@ sub get_debug_level
}
+=head1 CUI specific
+
+=cut
+
+
+# Descriptions: return comman specific options (-O key=value) as HASH_REF.
+# Arguments: OBJ($curproc)
+# Side Effects: none
+# Return Value: HASH_REF
+sub cui_command_specific_options
+{
+ my ($curproc) = @_;
+ my $args = $curproc->{ __parent_args };
+
+ return( $args->{ options }->{ O } || {} );
+}
+
+
+# Descriptions: return sender or recipient specified by --send-to option.
+# Arguments: OBJ($curproc)
+# Side Effects: none
+# Return Value: STR
+sub command_specific_recipient
+{
+ my ($curproc) = @_;
+ my $args = $curproc->{ __parent_args };
+ my $rcpt = $args->{ options }->{ 'send-to' } || '';
+ my $cred = $curproc->{ credential };
+ my $sender = $cred->sender() || '';
+
+ return( $rcpt || $sender || '' );
+}
+
+
=head1 CODING STYLE
See C<http://www.fml.org/software/FNF/> on fml coding style guide.