mhonarc-users

Re: getting text of message as resource variable

2002-05-21 14:30:07
On May 21, 2002 at 21:51, Greg Matheson wrote:

At the start of May, Earl Hood wrote in reply to me:

I guess I could parse the email messages myself and pass the
bodies in as environmental variables to MHonArc. This solution
still would have the problem of deciding which email message
corresponded with which MHonArc file name.

.... I recommended leveraging the annotation feature to get the
desired effect.  I.e. Pre-create an annotation for each message
including the first few lines of a message and then use the
$NOTE$ resource variable to include it in the index.

This turned out cleaner than I expected using the Mail::Box
modules, but I imagine the MIME::* suite allow the same sort of
thing.
...

You may want to look at recent post I did to the list containing
the program mha-preview.  It is a custom front-end to MHonArc that
supports including the initial text of a message body in indexes.
The program mainly exists to illustrate the MHonArc callback API.

Since others have been asking about including body data within indexes,
I decided to make a stab at it myself without relying on some external
pre-processing and to see if the callback API I have been adding can
actually be used to do something useful.  mha-preview will only work
with v2.5.4 or later.

In the next release, I will include mha-preview in the examples/
directory.  I may, in the future, include such functionality within
MHonArc itself since it should be easy to conditional the functionality
so the overhead in doing it is only done if enabled.

NOTE: If the functionality is added to MHonArc, it will probably not
be compatible with mha-preview.  However, the functionality would
be independent, so mha-preview, if used, can still be used with
later releases and anything add to MHonArc can be ignored.

I get the body of the message and its id and URL-escape it and
pass it to MHonArc. I use the resource variable, $NOTE$ in my rcfile to
put the annotation in the right URL. The only thing I don't like
is having to URL escape the string myself, but there doesn't seem
to be any MHonArc resource that will do it for me. 

What is the URL escaping used for?  Are you placing the body text
within a URL?  Wouldn't that make a large URL?

You can try "$NOTE:U$ to get MHonArc to URL encode the text for you.
The Resource Variables section of the docs list the variable modifiers
you can use.

The other thing I don't like is the MIME garbage left in the body
after decoding, but I can't expect MHonArc to do that for me :-)

The mha-preview program avoids this problem by extracting the
body preview text from the converted HTML and not from the raw
mail data.

--ewh