[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Automatic linking to a mhonarc archive



Earl Hood 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?

Yes, that's it.  I've tweaked the index page layout so it looks something
like this:

4490164: It's all badly broken 
	Joe.Bloggs   Mon 10 Jun 2002 07:00:26 PM UTC 
	Bart.Simpson  Mon 10 Jun 2002 07:50:27 PM UTC
4502645: And this doesn't work either 
	Someone.Else   Mon 10 Jun 2002 01:20:46 PM UTC 
	Someone.Else   Tue 11 Jun 2002 11:16:52 AM UTC 

where the first (subject) line in each block is a link target with a name
attribute equal to the message ID of the first message in the following
list, and the subsequent (author) lines are links to the emails in the
archive related to a particular bugid.  So if I build an index where I add
the (bugid, message id) pair the first time I encounter a given bugid, I can
then work out the link target I need for a given bugid.  However the missing
piece of information is the name of index file that a given link is in (I'm
running with <MultiPg>).  I don't see any obvious way of hooking into the
index page creation process, so my other thought was to look in the
.mhonarc.db for the <IdxSize> and friends, and work out which index page a
given link will be in that way.

> > 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.

Yep, that's exactly it.

> 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.

Yep, that all makes sense - thanks.

> 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.

Yes, that's another possibility.  However, as I can guarantee that all the
mail subjects will be of the form "<bugid> <synopsis>" I can easily group
them together by sorting the index by subject instead of date, with
<SubSort>, so I was just looking for some way of easily exploiting the
well-formed nature of the mails I'm dealing with ;-)

Many thanks for all your help and suggestions - I'm now off to look through
the examples and source code ;-)

-- 
Alan Burlison
--
$ head -1 /dev/bollocks
aspirationally re-role seamless initiatives

---------------------------------------------------------------------
To sign-off this list, send email to majordomo@mhonarc.org with the
message text UNSUBSCRIBE MHONARC-USERS


[Index of Archives]     [Bugtraq]     [Yosemite News]     [Mhonarc Home]