On May 6, 2005 at 02:13, East Coast Coder wrote:
1) Which file/sub does the initial determination if a message is a
response or a new thread?
mhthread.pl and mainly compute_threads() routine. Mhonarc initially
stores any reference message IDs when a message is first read. The
routines in mhthread.pl then use that information for determining
Note, the code is encumbered with relic Perl 4'isms, so it is not
2) For the threadid, I'd like to store it in MHonArc's own message.db.
That is, I'd like to be able to use the db so for any messageid, we
can retreive the threadid. Are there simple routines to add a new
field to the db, and to retreive it given a messageid? (If not, I can
always use another store, like sqllite or something, but I would not
want to have to do this unless needed).
Check out the mha-preview example script in the distro. It shows
how to store and retrieve custom information in .mhonarc.db.
3) What is the best way to persist the counter? Again, can the
message.db do this? Are there any race conditions to be wary of
(doesn't seem like it, since MHonArc works in serial, and locks anyway
- but I want to double check.)
Mhonarc locks an archive when processing it to avoid stomping on itself.
Depending on when you do your thing, you may need to do your own locking.
I.e. If you hook into mhonarc during its own locking, then you do not
need to do anything for locking. If you do things during a post-process
stage (after mhonarc releases the lock), then you need to do your own
Since you are mentioning storing stuff into .mhonarc.db, then those
operations will occur when an archive is locked, so you should be
okay with using the db file for storing a counter.
Of course, you could use an ID generation scheme that does not require
locking so you are safe, regardless. A combination of date/time,
process-id, hostname/ip, and a random string should be sufficient.
Such a technique will be computationally slower than using a simple
counter, but it may be negligable depending on your usage requirements.
To sign-off this list, send email to majordomo(_at_)mhonarc(_dot_)org with the
message text UNSUBSCRIBE MHONARC-DEV