MH & nmh: Email for Users & Programmers

May, 2006

Explanation of rfl

The page you're reading has details about the rfl Perl script, support files, and the format of the storage digests that rfl makes. The page Joining Messages with rfl gives an overview of this script. For more details, read the rfl manual page. Here is the rfl script (you might want to open it in a separate browser window). To install it, first see the Section Programs in This Book's Archive and create the file rfl.

The rfl Script

rfl was written for Perl 4, and has since been upgraded to work on Perl 5. It shouldn't need much configuring; you'll want to set $mhbin and you may need to change $mhprfprg.

Digest Format

It's a help to understand the format of the storage digests that rfl makes. It uses RFC 934-style "bit stuffing"; there's more information in the section called Leave My Dashes Alone. Why doesn't rfl use the more modern MIME digest format -- which doesn't use bit-stuffing? The main reason is that not all MH users have MIME yet. Also, the alternative to bit-stuffing -- the unique separators used in MIME messages -- are tougher to program because rfl can add new messages to the digest at any time.

The example below shows a sample digest that rfl made. It starts with the digest header. Then comes the body of the digest, which has two messages. You may want to open the example in another browser window so you can refer to it as you read the explanation below.

    X-mhglue: rfl,v 1.3 1995/12/04 20:39:59 jerry Exp
    Date: Sun, Apr 20 20:22:09 MDT 1997
    From: don_platt@iq.nvaoi.com
    To: majordomo-workers@GreatCircle.COM
    Subject: idea for spam filter
    Cc: don_platt@iq.nvaoi.com
    Subject: A patch to deter mailbombing
    From: Brandon L Phillips <blp@uh.edu>


    ------------------------------

    Return-Path: owner-majordomo-workers-outgoing@GreatCircle.COM
    From: don_platt@iq.nvaoi.com
    Date: 16 Apr 1997 00:17:30 -0000
    Message-ID: <19970416001730.1345.qmail@iq.nvaoi.com>
    To: majordomo-workers@GreatCircle.COM
    Subject: idea for spam filter

    Hi.  Please pardon if this message covers ground (discussion or work)
       ...rest of message body omitted...
    Thanks, all.

    Don

    ------------------------------ rfl 1.3

    Return-Path: owner-majordomo-workers-outgoing@GreatCircle.COM
    To: majordomo-workers@GreatCircle.COM
    Cc: don_platt@iq.nvaoi.com
    Subject: Re: A patch to deter mailbombing
    References: <19970416001730.1345.qmail@iq.nvaoi.com>
    From: Brandon L Phillips 
    Date: 20 Apr 1997 16:44:13 -0500
    In-Reply-To: don_platt@iq.nvaoi.com's message of 16 Apr 1997 00:17:30 -0000
    Message-ID: <ufau3l1pdxu.fsf@uh.edu>
    Lines: 25

    Hmmm.  Interesting.  I definitely want to do something like this:
    - - have an alpha release by next week
    - - do beta in June or so
    - - release the code by this fall
       ...rest of message body omitted...
    benefits?

     - Brandon

    ------------------------------ rfl 1.3

    
The header starts with an X-mhglue: field. The field holds the rfl version number, but it's more important than that. This field is a flag for rfl and other programs (like scan.rfl) that need to know they're looking at an rfl digest. When you use rfl to add a message to another message, rfl looks for an X-mhglue: field in the destination message header. If there isn't one, rfl converts the destination message to digest format. If there is one, rfl appends to that digest.

The Date: field is the date that the digest was last updated. This isn't always what you want: If all the messages in the digest are much older, then sortm will sort the digest by the time it was last updated instead of by the message dates inside. You could edit the fake_date subroutine to change this; if you do, I'd be glad to get a copy of your code and make it an optional feature. (There are good things about the way rfl works now.)

Notice that the digest has two From: fields and two Subject: fields. That's because the digest has messages with different From: and Subject fields. This makes searching with pick faster because pick doesn't have to search teh whole digest body. When rfl builds or appends to a digest, it merges duplicate header fields into one. (But it doesn't know that, say, jim@foo.org (Jim Smith) is the same person as Jim Smith <jim@foo.org>.) Any Re: or (fwd) is removed from the Subject: in the digest header.

The digest header ends with a row of dashes. Each message in the digest body ends with a row of dashes and the rfl version number that appended the previous message. All other lines that start with a dash (-) have another dash and a space () prepended; this is RFC 934 "bit-stuffing," and you should be sure to maintain it if you ever edit the digest by hand. (Otherwise, burst can't burst the digest correctly.)

The scan.rfl File

Here is the scan.rfl file. It's a scan format file that checks each message for an X-mhglue: field (which marks an rfl digest). Otherwise, it's the same as the default MH scan format file. If you use rfl much, you may want to make this your default scan format file. Put this entry in your MH profile:

    scan: -form scan.rfl