Re: MHonArc v2.5.4 Released

2002-05-03 16:26:52
On May 3, 2002 at 09:06, "Edward Wildgoose" wrote:

Just an idea with regards to the previous threads.  Would it be
sensible/efficient/possible to use this to expand the $NOTE$ automatically
to include the body of each email?

Ah, you caught the motivation behind the additional API callbacks.

Is this the right way to go about it, or is it best for me to try and work
this modification into the code elsewhere?

I think you would will need to use multiple API callbacks.  There
is more than one way to do it.  One way would use the
$CBMessageBodyRead, $CBRcVarExpand, and $CBDbSave callbacks.

The $CBMessageBodyRead is used to extract out the first X characters
from the converted message body.  I'd probably strip out any HTML
tags since the data is only to give a brief look at what the message
may be.  The data extracted would be stored in a custom hash, lets
call it %X_MesgPreview where the keys are the message index and the
values are the extracted preview text.

For the $CBRcVarExpand callback, it will check for variable references
called $X-MSG-PREVIEW$ and expand it using the %X_MesgPreview hash.

The $CBDbSave callback can be usd to save the %X_MesgPreview to the
database file so it will be reloaded each time the archive is processed.

Since I wanted to see if all this is actually possible, I wrote
a custom front-end myself.  The program is attached to this message
along with the manpage and a sample resource file to test it out.

BTW, an alternative approach is to never store message preview data
in the database but to always extract it from the message pages.  The
problem with this is it would be very I/O intensive.


Attachment: mha-preview
Description: mha-preview

Description: mha-preview manpage

Attachment: preview.mrc
Description: Sample resource file

<Prev in Thread] Current Thread [Next in Thread>