
	miscellaneous topics

------------------------------------------------------------
I	misc

1	misc
1.1	URL where you can send FML commands
1.2	send back "thank you" mail for enquete
1.3	MIME-Decode MIME parts of mail to distribute
1.4	forward confirm message to MAINTAINER 

2	locsk
2.1	Lock Algorithm
2.2	remove lockfiles when lock is broken?

3	spool 

3	spool saved what ?
3.1	data input to fml is saved ?
3.2	Not spooling of articles
3.3	read permission for ML's spool ($SPOOL_DIR)
3.4	reconvert MIME characters in the spool
3.5	read not MH in the spool which is sent back by "mget".

4	other topics
4.1	Core part of FML package
4.2	temporary stop an ML
4.3	daily renewal

5	movement
5.1	fml pop versoin on NT

6	summary file
6.1	change summary file format

7	hack Subject:
7.1	add each number for each thread

II	rentalled servers (e.g. ISP ...)
III	examples

8	examples
8.1	site*ph sample (mnews ML)
------------------------------------------------------------


I	misc

1	misc

1.1	URL where you can send FML commands
	http://www.infosite.ne.jp/fml/

    in fml-support: Count: 01585
    From: Yuao Tanigawa <yuao@infonia.or.jp>
    
URL where you can send the fml command,

1.2	send back "thank you" mail for enquete

We accept opinions by mail from anyone and send back the reply "thank
you for your opinion" to the sender.

object:
return guide if fml receives post from the member.

config.ph configuration Example 1:

1. permit post from anyone
2. add $START_HOOK to send back "guide"

    ### sample configuration ###
    $PERMIT_POST_FROM              = "anyone";
    
    # YOU CAN EDIT MANUALLY AFTER HERE.
    $START_HOOK = q# 
       if (! &MailListMemberP($From_address)) { &GuideRequest(*Envelope);} 
    #;

config.ph configuration Example 2:
return another file not guilde with the header:

From: $MAIL_LIST
Subject: Thanks you for your mail

    ### sample configuration ###
    $PERMIT_POST_FROM              = "anyone";
    
    # YOU CAN EDIT MANUALLY AFTER HERE.
    $RECRUIT_ACK_STATEMENT = "Thanks you for your mail";
    $RECRUIT_ACK_FILE      = "$DIR/recruit_reply";
    
    $START_HOOK = q#
        if (! &MailListMemberP($From_address)) {
    	&DEFINE_FIELD_OF_REPORT_MAIL('From', $MAIL_LIST);
            &SendFile($From_address, $RECRUIT_ACK_STATEMENT, $RECRUIT_ACK_FILE);
        }
    #;

1.3	MIME-Decode MIME parts of mail to distribute

To MIME-Decode MIME parts of mail to distribute is to change

    if ($USE_LIBMIME && ($MailHeaders =~ /ISO\-2022\-JP/o)) {
        require 'libMIME.pl';
	$Summary_Subject = &DecodeMimeStrings($Summary_Subject);
    }

to

    if ($USE_LIBMIME && ($MailHeaders =~ /ISO\-2022\-JP/o)) {
        require 'libMIME.pl';
	$Summary_Subject = &DecodeMimeStrings($Summary_Subject);
	$MailBody = &DecodeMimeStrings($MailBody);
    }

1.4	forward confirm message to MAINTAINER 

fml-support: 08960

By default confirmation is sent to the use who send subscribe request.
If this mail should be forwarded to MAINTAINER, try the following
hook.

	confirm 200010302002481472410938048 Tomoyo Daidouji

    $FML_EXIT_HOOK = q#
       if (! &MailListMemberP($From_address)) {
            $Envelope{'message:h:to'} = $MAINTAINER;
       }
    #;

2	locsk

2.1	Lock Algorithm

FML uses flock(2) in default. If you use flock(2), set

	$USE_FLOCK    = 1; (default 1)

If flock(2) does not work on your OS, set

	$USE_FLOCK    = 0;

to use a lock based on link(2). This algorithm uses lockfiles whereas
flock(2) is only in kernel.  If the machine shutdowns or reboots
suddenly, temporary lock files may be left in the lock spool. If
exists, please remove them. 

2.2	remove lockfiles when lock is broken?

remove all lockfiles if fml processes not run.

3	spool 

3	spool saved what ?

articles delivered in mailing list. 
Each ML has each spool directory where one article is one file.

3.1	data input to fml is saved ?

use $USE_LOG_MAIL to save input in var/Mail/.

$FML_EXIT_HOOK = q#
	my ($f) = "$SPOOL_DIR.orig/$ID";
	-d "$SPOOL_DIR.orig" || mkdir("$SPOOL_DIR.orig", 0700);
	if (open($f, "> $f)) {
		print $f $Envelope{'Header'}."\n".$Envelope{'Body'};
		close($f);
	}
#;

3.2	Not spooling of articles

If you have not enough disk, you may not spool articles. If so, set

	$NOT_USE_SPOOL = 1;

Of course, "get", "mget" commands do not work.

3.3	read permission for ML's spool ($SPOOL_DIR)

FML runs as an owner of a ML maintainer. In default the only maintainer
can read articles, spools, ...

Some exceptional files exist. For example directories under htdocs/ is
world readable for httpd.

See internals 9 for security.

3.4	reconvert MIME characters in the spool

use lib/MIME/rmime and runs shell scripts like 

	for file in *
	do
	   mv   $file     $file.org
	   perl rmime $file.org > $file
	done

nkf -m must be also useful if nkf is not too old.

3.5	read not MH in the spool which is sent back by "mget".

To create "mbox", you use lib/Utilities/packmbox.pl and runs 

	(cd spool; packmbox.pl ) > ~/mbox

4	other topics

4.1	Core part of FML package

"makefml install" action installs core part of FML. It contains a set
of documents which is large. You can remove it if it is enough for you
to access the latest version always. The latest version of documents
are available via WWW. You can access the latest documents but not
back numbers, so you may lose the version specific descriptions.

Except for documents, which files you can remove depends on functions
you want to use. DO NOT REMOVE "etc", "sbin", "cf" to use "makefml".

4.2	temporary stop an ML

    elena: elena-admin
    elena-ctl: elena-admin
    elena-admin: fml

4.3	daily renewal

	Subject: [elena 00100]

	Subject: [elena 00000]

    #!/bin/sh
    
    ml=elena
    
    date=`date -u +%C%y%m%d`
    
    /usr/local/fml/makefml lock $ml 60 &
    
    cd /var/spool/ml/$ml || exit 1
    
    for file in seq spool summary log
    do
       if [ -f $file ];then
            mv $file $file.$date
       fi
    done

5	movement

5.1	fml pop versoin on NT

Q: change POP/SMTP server name?

	C:\fml\_fml\pop

6	summary file

6.1	change summary file format

It is no easy way. When you change summary file format, use this hook. 

    $DISTRIBUTE_SUMMARY_HOOK = q#
     	&Append2(sprintf("%s [%d:%s] %s", 
     			 $Now, $ID, substr($MAINTAINER, 0, 15), $s),
     		 $SUMMARY_FILE);
    #;

7	hack Subject:

7.1	add each number for each thread

   1 Subject: [ML:1] aaa
   2 Subject: Re: [ML:1] aaa
   3 Subject: Re: [ML:1] aaa
   4 Subject: [ML:4] bbb
   5 Subject: Re: [ML:4] bbb

This is very difficult. If you add each number for each thread, this
hook works. But the number is non continuous since the number is the
number of article.

   $SMTP_OPEN_HOOK = q#
       if ($Envelope{'h:subject:'}  =~ /^\s*Re:/i) {
           $Envelope{'h:Subject:'} = $Envelope{'h:subject:'};
   	undef $SUBJECT_FREE_FORM;
       }
   #;

If you add [ML:2] for article 4, this hook may be useful.
Pay attention this hook has not enough error check codes.

       $SMTP_OPEN_HOOK = q`
           undef $SUBJECT_FREE_FORM;
           if ($Envelope{'h:subject:'}  =~ /^\s*Re:/i) {
               $Envelope{'h:Subject:'} = $Envelope{'h:subject:'};
           } else {
               $SEQ_SUBJ_FILE = "$DIR/seqsubj";
               &Touch($SEQ_SUBJ_FILE) unless -f $SEQ_SUBJ_FILE;
               $IDSUBJ = &GetFirstLineFromFile($SEQ_SUBJ_FILE);
               $IDSUBJ++;
               &Write2($IDSUBJ, $SEQ_SUBJ_FILE);
               #&Log("IDSUBJ=[$IDSUBJ]");
               $Envelope{'h:Subject:'} =~ s/^\s+//;
               $Envelope{'h:Subject:'} = "[$BRACKET:$IDSUBJ] $Envelope{'h:Subject:'}";
           }
       `;
    
II	rentalled servers (e.g. ISP ...)

III	examples
8	examples

8.1	site*ph sample (mnews ML)

    $FACE_MARK     = '(^_^)/~';
    
    $AUTO_REGISTRATION_LINES_LIMIT = -1;
    
    $SUPERFLUOUS_HEADERS = 1;	# preserve more header fields
    
    $USE_LIBMIME   = 1;		# when use MIME Extension in libMIME.pl
    
    $MIME_DECODED_ARTICLE = 1;	# do MIME decoding, then spool
    
    $COMMAND_CHECK_LIMIT = 1;	# the first 3 lines is checked for
     				# mistakes whether the command mode or not?
     				# at &Parsing in fml.pl, 
    
    $USE_RFC934    = 1;		# inMatomeokuri, use mh/burst for the split
    
    $OBJECTIVE_FILE = "$DIR/=objective"; 	# objective file
    $GUIDE_FILE    = "$DIR/=guide";		# the guide file of our Mailing List 
    $HELP_FILE     = "$DIR/=help";		# the help file for useful commands
    $DENY_FILE     = "$DIR/=deny";		# attention to illegal access
    $FAIL_FILE     = "$DIR/=fail";		# attention to illegal access
    $WELCOME_FILE  = "$DIR/=welcome";	# could be "$DIR/welcome"
    
    $MGET_LOGFILE  = "$DIR/log_mget";	# log file for mget routine
    
    $Subject       = '(No Subject in original)';	# Subject field
    
    $Envelope{'macro:s'} = 'localhost';
    
    $PRECEDENCE     = 'bulk';
    
    @NEWSYSLOG_FILES = ("$MSEND_RC.bak", "$MEMBER_LIST.bak", "$ACTIVE_LIST.bak",
                        "${LOGFILE}_archive", "${LOGFILE}_matome");
    
    $SKIP_FIELDS = '|X-Nsubject|X-Confirm-Reading-To';
    
    $START_HOOK = q#
        if ($CONTROL_ADDRESS && ($Envelope{'mode:chk'} =~ /$CONTROL_ADDRESS/i)) {
            if ($Envelope{'Body'} =~ /subscribe/io
                  && $Envelope{'Body'} !~ /unsubscribe/io) {
                &use('utils');
                &AutoRegist(*Envelope);
                $DO_NOTHING = 1;
            }
            $Envelope{'mode:uip'} = 'on'
        } elsif ($Envelope{'mode:uip'}) {
            &Logging("Unsupport Command Mail");
            &SendFile($From_address, 
                      "Unsupport Command Mail this Address $ML_FN", $FAIL_FILE);
            $DO_NOTHING = 1;
        } else {
            &Distribute;
            $DO_NOTHING = 1;
        }
    #;
    
    $SMTP_OPEN_HOOK = q#
        $Envelope{'h:To:'}       = $Envelope{'h:to:'}
              || $Envelope{'h:apparently-to:'} || "$MAIL_LIST $ML_FN";
        $Envelope{'h:Reply-To:'} = $Envelope{'h:reply-to:'} = $MAIL_LIST;
        if ($USE_LIBMIME && $Envelope{'MIME'}) {
            &use('MIME');
            $Envelope{'h:Subject:'} = &DecodeMimeStrings($Envelope{'h:Subject:'});
        }
    #;
    
    $HEADER_ADD_HOOK = q#
        if ($Envelope{'x-nsubject:'}) {
            if ($STRIP_BRACKETS) {
                $_ = $Envelope{'x-nsubject:'};
                local($r)  = 10;
    
                s/\[$BRACKET:\d+\]\s*//g;
    
                while (s/Re:\s*Re:\s*/Re: /gi && $r-- > 0) { ;}
    
                $Envelope{'x-nsubject:'} = $_;
            }
            if ($USE_LIBMIME && $Envelope{'MIME'}) {
                &use('MIME');
                $Envelope{'x-nsubject:'} =
                      &DecodeMimeStrings($Envelope{'x-nsubject:'});
            }
            $body .= "X-Nsubject: [$BRACKET:$ID] $Envelope{'x-nsubject:'}\n";
        }
    #;
    
    $TRF_NAME_HOOK = q#
        $name =~ s/umura@solan\.chu/umura@nn.solan./oi;
    #;


		INDEX

packmbox.pl                                ...   3.5 
$USE_FLOCK                                 ...   2.1 
