mhonarc-users

Re: Automatic linking to a mhonarc archive

2002-08-08 22:23:36
On August 9, 2002 at 01:00, Alan Burlison wrote:

I'd quite like to link to the appropriate place on the appropriate
message index page, rather than directly to one of the messages

A clarification: Are you stating that you would like to link the
location in the index page that lists the message with the specified
bug ID?

see how to do that without picking apart the .mhonarc.db file.  Is there any
easy way to do this that I'm missing?

Since you will be linking to something based upon the message number
assigned to an archived message, I would map the bug-id to the
message number since the message number is used as anchors in index
pages, assuming this is what you want.

Now, to do the mapping, I would do it in the $mhonarc::CBMessageBodyRead
callback since you do not have some (guaranteed) information available
when $mhonarc::CBMessageHeadRead is read (and the information I am
refering to is the message number assigned to the message).

In your $mhonarc::CBMessageBodyRead, you can get the message number
as follows:

  $msg_number = mhonarc::fmt_msgnum(
                    $mhonarc::IndexNum{$fields_hash_ref{'x-mha-index'}});

Accessing the message number is not abstracted out very good since
you need to access the %IndexNum hash directly.  If you want the
actual filename for the message, do:

  $msg_file = mhonarc::get_filename_from_index(
                    $fields_hash_ref{'x-mha-index'});

Since the message filename is based upon the message number, you could
extract the number for $msg_file.


Now, with all that said, you may be better off using a search
engine tool, and the link you make to the archive actually invokes
a search.  This way, you will actually link to all messages that
have the bug ID mentioned in it.

--ewh

---------------------------------------------------------------------
To sign-off this list, send email to majordomo(_at_)mhonarc(_dot_)org with the
message text UNSUBSCRIBE MHONARC-USERS