[comp.mail.mush] using folders with other formats

duanev@kauai.ACA.MCC.COM (Duane Voth) (08/18/89)

Can mush be configured to handle folders with the following
headers?

	Return-Path: @bloom-beacon.mit.edu:xpert-request@expo.lcs.mit.edu
	Received: ...
	Received: ...
	Date: 19 Jun 89 12:19:48 GMT
	From: Colas NAHABOO <mcvax!inria!mirsa!colas@uunet.uu.net>
	Organization: Koala Project -- BULL/INRIA
	Subject: GWM Announcement
	Message-Id: <189@mirsa.inria.fr>
	Sender: xpert-request@expo.lcs.mit.edu
	To: xpert@expo.lcs.mit.edu

Several times I have pointed mush at such a format only to see:

	"mail.gwm": 0 messages, 0 new, 0 unread

I would be happy with a folder *converter* as well - which is
likely an easier solution. :)  Anyone with an existing script or
program?

duane

-- 
--- duane voth             duanev@mcc.com
----           ALL systems are arbitrary!
--- effectiveness is the measure of Truth
--

dv@well.sf.ca.us (David W. Vezie) (08/18/89)

(Dan and Bart, if I goof up here, let me know, but I'm taking your
suggestion of other people piping in with answers, so it isn't just you two)


> Can mush be configured to handle folders with the following
> headers?
> 
> 	Return-Path: @bloom-beacon.mit.edu:xpert-request@expo.lcs.mit.edu
> 	Received: ...
> 	Received: ...
> 	Date: 19 Jun 89 12:19:48 GMT
> 	From: Colas NAHABOO <mcvax!inria!mirsa!colas@uunet.uu.net>
> 	Organization: Koala Project -- BULL/INRIA
> 	Subject: GWM Announcement
> 	Message-Id: <189@mirsa.inria.fr>
> 	Sender: xpert-request@expo.lcs.mit.edu
> 	To: xpert@expo.lcs.mit.edu


Mush by default looks for a line, after a blank line, that begins
with "From ".  If it doesn't see any such lines, then it won't find
any messages (treat everything as "garbage before the first line").

I take it from your message that there is no such line in the file.
Is there some recognizable pattern that begins each message?  You
can either use some program to add a From_ line in front of each
pattern, or you can set mush to use that pattern as the message
separator (via MSG_SEPARATOR in config.h).

Here's a little sed script that I think would work for you:

sed 's/^\(Return-Path: \)\(.*\)/From \2 Thu Aug 17 17:55:54 1989\
\1\2/' < mail.gwm > mush.gwm

Keep in mind that the date part of the From line isn't used in mush
when a Date: field exists.

This also assumes that all headers begin with Return-Path.

> -- 
> --- duane voth             duanev@mcc.com
> ----           ALL systems are arbitrary!
> --- effectiveness is the measure of Truth
> --

-- 
  Name:             David W. Vezie | Company:           Lucasfilm Ltd
  UUCP:    {apple|pacbell}!well!dv | Last-name-pronounced:   "VEE-zee"
  Internet:       dv@well.sf.ca.us | Phone:            +1 415 662 1222
  Best_Picture:      Indiana Jones and the Last Crusade (what else!!)

schaefer@ogccse.ogc.edu (Barton E. Schaefer) (08/23/89)

In article <8908180042.AA05056@well.UUCP> dv@well.sf.ca.us (David W. Vezie) writes:
} (Dan and Bart, if I goof up here, let me know, but I'm taking your
} suggestion of other people piping in with answers, so it isn't just you two)

Your suggestion was just fine.  Only a couple comments to add.

} > Can mush be configured to handle folders with the following
} > headers?
} > 
} > 	Return-Path: @bloom-beacon.mit.edu:xpert-request@expo.lcs.mit.edu
} > 	Received: ...
} > 	Received: ...
	[ other headers deleted ]
} 
} Mush by default looks for a line, after a blank line, that begins
} with "From ".  If it doesn't see any such lines, then it won't find
} any messages (treat everything as "garbage before the first line").

Comment One:  True on many systems, but some use one or two lines of
nonprintable characters as a separator (e.g. four ctrl-A characters).
I suspect that the folder with the headers described above may have
originally had that type of separator and they were lost somehow.

} Is there some recognizable pattern that begins each message?  You
} can either use some program to add a From_ line in front of each
} pattern, or you can set mush to use that pattern as the message
} separator (via MSG_SEPARATOR in config.h).

Comment Two:  MSG_SEPARATOR must match a full line (not counting the
trailing newline, except for MMDF which uses two separators).  If there
is no line common to all messages, MSG_SEPARATOR can't be used.  The
Return-Path: header won't work because the path may be different for
each message.

} Here's a little sed script that I think would work for you:
} 
} sed 's/^\(Return-Path: \)\(.*\)/From \2 Thu Aug 17 17:55:54 1989\
} \1\2/' < mail.gwm > mush.gwm
}
} Keep in mind that the date part of the From line isn't used in mush
} when a Date: field exists.

Comment Three:  Not true.  The date in the From_ line is used to record
the date when the message was received.  The closest equivalent date can
be taken from the topmost Received: header if it is important.  It is
the string following the first semicolon in the Received: header, but it
may not be in the correct format and may require some rewriting.  The
sed command above is fine for simple conversion, though.

If you don't care about the date received, and you don't want to worry
about generating a correctly formed From_ line yourself, you can insert
a line of 8 or more hyphens like this:
--------
between each of the messages in the folder, mail the folder to yourself
as one big message, and then use the "undigest" command in mush to
unpack it.  "undigest" will create From_ lines based on the From: and
Date: headers of the messages, or insert message separators if that's
the way your system is set up.

The next release of mush (presently in beta-test) allows you to pass a
pattern to the undigest command that will be used as the separator, so
with that version you could just say "undigest -p Return-Path" and not
need to bother with inserting the "--------" lines.
-- 
Bart Schaefer           "And if you believe that, you'll believe anything."
                                                            -- DangerMouse
CSNET / Internet                schaefer@cse.ogc.edu
UUCP                            ...{sequent,tektronix,verdix}!ogccse!schaefer