[comp.mail.mh] Filtering the body of a message

sechrest@mist.cs.orst.edu (John Sechrest) (02/21/88)

I have been trying to find a way to filter the body of a message 
thru a program. Here are a couple of example of things I would like 
to do:

store the body of a mail message in compressed format
send the body of a message in an encrypted format
store the process of a go game in a mail message and have the filter ask
	for the next move of the game. 


Has anyone thought about how to do some of these things?

	


					johns
					
-----------------------------------------------------------------------------
			.
John Sechrest		.		Internet: sechrest@cs.orst.edu
Lab Coordinator		 .       	UUCP:	  tektronix!orstcs!sechrest
Computer Science Dept	  .      	UUCP:	  hplabs!hp-pcd!orstcs!sechest
Oregon State University	    .
Corvallis,Oregon 97331         . 
(503) 754-3273                      .
				           .
					             .
						               .
							                     .
`'`'`'`'`'`'`'`'`'`'`'`'`'`'`'`'`'`'`'`'`'`'`'`'`'`'`'`'`'`'`'`'`'`'`'`'`'`'`'`

bd@hpsemc.HP.COM (bob desinger) (03/09/88)

John Sechrest (sechrest@mist.cs.orst.edu) writes:
> I have been trying to find a way to filter the body of a message 
> thru a program. Here are a couple of example of things I would like 
> to do:
> store the body of a mail message in compressed format
> send the body of a message in an encrypted format

One way is to write a shell script that invokes `show' so that it only
displays the body.  Assuming your mh-6.5 source-tree-root is, say,
/usr/src/public/mh-6.5, do this (also assuming you run csh or ksh, or
some shell that understands the ~ notation to mean your $HOME):

	% cd /usr/src/public/mh-6.5
	% cd miscellany/mtrenv/mhbox
	% cp mhl.body ~/Mail/body	# or wherever your MH files live

Now you have a form that you can use with mhl to give you just the
body.  (Make sure you have

	showproc: mhl

in your ~/.mh_profile file.)  Type:

	% show
	% show -form body

to see the difference.  Now just use this latter form in a shell
script.  F'rinstance, to compress the body, put the following lines in
a script called `showz':

	show -form body | compress > "$@".Z

Then, after you read a message about, say, frobozz that you'd like to
compress, you'd type

	% showz frobozz

This would compress the body into a file named frobozz.Z.
You could put this into a csh alias or shell function, too.
An alternate way to do it, if you're fond of programs that force you
to be interactive, is to ask for the filename in the script:

	echo -n 'Name to save into (WITHOUT the .Z extension): ' # bsd
	echo 'Name to save into (WITHOUT the .Z extension): \c'  # sys5
	read name
	show $* -form body | compress > $name.Z

Choose one of the echo statements above for your system type.
This method, with the "$*", allows you to type:

	% showz 33-35

in order to save messages 33 through 35 as one compressed lump.
(Doesn't seem as useful as the first version; who wants to concatenate
their mail?)

> store the process of a go game in a mail message and have the filter ask
> 	for the next move of the game. 

I'm not sure what you mean by "process", but it's probably not the
executing process because you can't save that in a mail message.  If
you mean "progress", you'd write a script that calls `read' as above,
then does something with the reply like pipe it to the other player or
blow it at the local go program.

-- bd