[PREVIOUS CHAPTER] [NEXT CHAPTER]
2 Examples

2.1	Send back $DIR/uja for anyone


1	requests from anyone are O.K.
2	keyword "uja" in the mail body to send back the file "uja".

$START_HOOK = q#
    $UJA_FILE = "$DIR/uja";

    if ($Envelope{'Body'} =~ /^[\n\s]*\#\s*uja/) {
	&SendFile($Envelope{'Addr2Reply:'}, "UJA $ML_FN", $UJA_FILE);
	&Log("UJA");
	$DO_NOTHING = 1;
    }
#;


2.2	Automatic Replay Server


Please set a file to $GUIDE_FILE in config.ph and set up $START_HOOK
in the following hook:


	$START_HOOK = q#
		&SendFile($From_address, "Guide $ML_FN", $GUIDE_FILE);
		&Log("Guide request from $From_address");
		$DO_NOTHING = 1;
	#;


2.3	make a new command what send back a file


E.g. "news" command is to send back $DIR/news file.


In config.ph

%LocalProcedure = (
		    # help for usage of commands
		    'news',	'ProcFileSendBack',
		    '#news',	"$DIR/news",

		);


2.4	get some files by not "get" commands 


get-SOMETHING gets file in SOMETHING directory.

%LocalProcedure = (
		   'get-spool',   'mySendFile',  # $DIR/spool
		   'get-archive', 'mySendFile',  # $DIR/archive
		   'get-etc',     'mySendFile',  # $DIR/etc
		   );

sub mySendFile
{
    local($proc, *Fld, *e, *misc) = @_;

    if ($proc =~ /^get-([a-z]+)$/io) {
	local($dir) = $1;
	if (-f "$dir/$Fld[2]") {
	    &SendFile($to, "Get $dir/$Fld[2] $ML_FN", "$dir/$Fld[2]");
	}
    }
}


2.5	you gets back article 100 in MIME/multipart format by "get 100" command


A: always identify "get" and "mget" commands internally.


append it to config.ph.

   $MGET_MODE_DEFAULT = "mp";
   %LocalProcedure = ('get', 'ProcMgetMakeList');

(fml-support: 06997)

[PREVIOUS CHAPTER] [NEXT CHAPTER]