MH & nmh: Email for Users & Programmers

May, 2006

rfl Manual Page (HTML version)


NAME

rfl - add messages to a storage digest

SYNOPSIS

rfl [+dest-folder] [msgs] [-add component [-add component...]] [-inplace] [-noinplace] [-keep] [-nokeep] [-query] [-noquery] [[-range msgs] OR [-to msg]] [-src +src-folder] [-verbose] [-noverbose] [-help]

DESCRIPTION

rfl is a Perl script. It reads the message(s) (default: current message) named on the command line from the current folder (or another folder, if you name it with -src). rfl appends the message(s) to the last message with the same Subject: in the destination folder. The destination message will be changed into an RFC934-compatible digest format (if it isn't already) that you can feed to burst(1) to get the individual messages back. You can add more messages to the digest by using rfl again. A special X-mhglue: field is added to mark the digest; if you delete this field, rfl won't recognize the digest.

For example, this command:

    rfl 23 24 +foobar
    
would read message 23 from the current folder, find the last message with the same Subject: in the +foobar folder, and add it to the end. Then, it will do the same thing for message 24 (find message with same subject, append message 24 to it).

rfl will edit the destination message in place, so any links to it won't be broken. If you use the -noinplace switch, rfl will create a new message from a copy of the destination message.

rfl always tells you which message is being added to which. The -verbose switch makes rfl tell you more.

The -query switch shows you a scan(1) list of messages in the destination folder and asks which one to append each message to.

The program searches the destination folder starting at the last (highest-numbered) message. By default, rfl checks the last 998 messages in the destination folder. If the folder has a lot of messages, that can take a while. So, if you use the -range switch (typically, in your MH profile), rfl will only search those particular messages. For example:

    rfl @sub -range last:20
    
would check the last 20 messages in the @sub subfolder and add the current message from the current folder to the last message that matches. To give a range of specific numbers, quote the argument (so the shell will pass all of it as one argument). For instance, to make rfl search the previous 50 and next 50 messages:
    rfl -range "prev:50 next:50" ...
    
If rfl can't find a matching message (unless you use -query, of course), it skips the message and tries the next one (if any).

You can also use -to msg to specify the exact destination message (no subject searching). This is handy for adding other messages to the current message (cur) or when you know the exact message number (like last). For example, to add the last 2 messages from the current folder to the last message in +reports:

    rfl -to last +reports last:2
    
To add messages 1 and 5 from +junk to the current message in the current folder, type:
    rfl 1 5 -src +junk -to cur
    

By default, rfl copies all message headers into the digest body. If you have a file named rfl.skiphdrs in your top-level mail directory, rfl will not copy the fields listed there. List the fields to skip, one per line, in the file. You can also use perl-type (basically, ed-type) regular expressions in the file. For instance, to omit Received:, Sender:, and any X- fields, use these three lines (not indented):

    received
    sender
    x-.*
    

By default, rfl copies the From:, To:, and Subject: fields to the header of the digest. (It also adds a Date: field with the time the digest was edited.) The -add switch names other fields to add. For example, to add Message-ID: and cc: fields, use:

    rfl -add message-id -add cc ...
    
Note: the same -add switches must be used every time you append more messages to the digest. Otherwise, the extra fields you -added before won't be copied to the new digest.

By default, rfl uses rmm(1) on the source message(s) after copying. If you use the -keep switch, rfl won't use rmm.

You can put an rfl: field in your MH profile with default switches you want (like -verbose). And, as with most MH commands, you can make rfl versions (links) with other names. For example, to simulate the old mhadd script I used to have that adds other messages to the current message, I made a symbolic link named mhadd pointing to rfl. Then I put this line in my MH profile:

    mhadd: -to cur
    
Then I can use:
    mhadd 23
    
to add message 23 to the current message. (Note: the rfl.skiphdrs file won't be used when you call rfl by a different name. This is a feature. Create another file -- here, for example, mhadd.skiphdrs -- or just link the other file to your original rfl.skiphdrs.)

DISCLAIMER (SIGH)

USE THIS CODE AT YOUR OWN RISK. THE AUTHOR(S) CANNOT BE RESPONSIBLE FOR ANY PROBLEMS YOU HAVE WITH THE SCRIPT OR LIABLE FOR ANY DAMAGES THAT THIS SCRIPT CAUSES, DIRECTLY OR INDIRECTLY. THE USER IS ASSUMED TO UNDERSTAND MH AND PERL WELL ENOUGH TO DECIDE WHETHER OR NOT THIS SCRIPT IS SUITABLE AND WILL WORK CORRECTLY. ETC. ETC.

This program is in the public domain. If you modify it, please add comments to the code that mark your revisions clearly (so people will know that it isn't the original rfl). Please also send me a copy of any changes you make so that I can think about folding them into a new release.

FILES

$MH or $HOME/.mh_profile -- The user profile
<mh-dir>/<prog>.skiphdrs -- Header fields not to copy

PROFILE COMPONENTS

Path: -- To determine the user's MH directory
Current-Folder: -- To find the default current folder

SEE ALSO

"Proposed Standard for Message Encapsulation" (aka RFC-934), perl(1), refile(1), burst(1), scan(1), rmm(1), mh-mail(5).

CONTEXT

If -src +folder is given, it will become the current folder.

BUGS

mhpath(1) refuses to handle folders with more than 998 messages, so rfl can't use a destination -range of more than 998 messages.

rfl can't add an rfl digest to another rfl digest and keep the same digest format.

With a command like rfl 19 20, you can accidentally add the first message (19) to the second message (20) if they both have the same subject. Then the second message can't be added to anything because it's an rfl digest. Workaround (until rfl can add digests to digests): use -range "1-18 21-last".

rfl does lots of work to make the digest header have Subject: fields without newlines or multiple spaces. That's because repl(1) formats the subjects of messages it replies to in the same way.

rfl checks pathnames to be sure a message isn't added to itself. But that doesn't stop rfl from adding a message to the message's own link.

Some coding is kind of ugly or inefficient. (This is my first Perl script.)

Prints informative messages without the -verbose switch. This is actually a feature...

AUTHOR

Jerry Peek