On 1 September 1998 at 12:24, Nathan Bailey
<Nathan(_dot_)Bailey(_at_)cc(_dot_)monash(_dot_)edu(_dot_)au> wrote:
Speaking of new features, one thing that has been bugging me recently
is sending people MIME'd messages, but forgetting to MIME, so they get
messages with things like:
#text/plain [processSugg.pl]|cat /net/tools/ldap/processSugg.pl
which bemuses the technical folk and confuses the non-technical, and
makes me look silly :-)
ie. I'm forgetting to type 'mime' at the "What now?" prompt -- would it
be possible to put a check in there before it sends ('s') "This messages
has something that looks MIME part, are you sure you don't want to
'mime' first?"
You can set
automimeproc: 1
in your MH profile file, and nmh will do a 'mime' automatically. But
(unless the intelligence of 'mime' (actually, mhbuild) has improved
since the last time I used an automimeproc), it will choke on any
draft line that starts with a # but isn't a valid MIME directive.
You might want to look at 'automhn' in the online MH book. It tries
to be smarter about #-directives; it changes a leading '#' to '##'
when the # doesn't seem to start a directive. It's not perfect, but
it helps.
The other thing you could do is to write your own buildmimeproc.
If it spots a line starting with a #, it could suggest that you might
want to run 'mime'. Here's some UNTESTED code to give you the idea:
#!/usr/bin/perl
while (<>) {
if (/^#/) {
unless (/^#[@<]?(forw|begin|end$|([a-z0-9=#-]+\/[a-z0-9-]))/) {
print "This message has something that looks a MIME part.\n";
print "Are you sure you don't want to 'mime' first?\n";
# Make 'send' print another "What now? " prompt:
exit(1);
}
}
}
That code will keep asking every time you send; it won't take "no" for
an answer. So you could modify it to prompt and take a yes/no answer.
If the answer is yes, the script can invoke mhbuild and return a 0
status so send will send the message. On a no answer, just return 0.
The script could also display the lines that it's complaining about.
I don't have any Perl books handy, so I'll leave that to whoever.
BUT, if someone does implement this (or something like it), I'd
appreciate getting a copy so I can add it to the next update of
the online MH book.
--
Jerry Peek, jpeek(_at_)jpeek(_dot_)com, http://www.jpeek.com/~jpeek/