mhonarc-dev

Re: Using a SQL Database

2005-06-01 09:54:47
On June 1, 2005 at 12:00, East Coast Coder wrote:

The CBMessageRead callback provides me with everything I need.  I'd
like to take it from there - that is, handle all of the databasing and
message output.  Is there anyway to tell MHonArc to stop after that
callback?  I know that CBMessageHeadRead supports a return 0 to do
this, but CBMessageRead doesn't.

If you do not want mhonarc to output a message page, why do you
need mhonarc to parse the message body?

Is there a configuration option that could set this - don't write to
the db, don't write to any files, just run the callbacks.  Or do I
need to modify some of the code (what?)?

You can suppress the creation of message pages by passing
the -nomsgpgs option to process_input().  Note, if you do use
-nomsgpgs, then the message bodies are completely skipped, bypassing
any callbacks related to message bodies.

As for the db, you can register a $mhonarc::CBDbPreSave callback and
have it return a false value to prevent the database file from being
written.  It would be nicer to have a -nodb option, but I have not
implemented it.  It should be easy to do if the $mhonarc::CBDbPreSave
method is not desirable.

PS I noticed some of the CBMessageHeadRead fields are returned as
scalars and some as arrays (even single value arrays).  What
determines this?

The x-mha-* fields are scalars.  The other fields, which represent
the actual raw message header fields, are arrays.  The reason for
this is the message header parsing code.  It is common for message
headers to have muliple fields of the same name (e.g. Received), so
the parsing code uses arrays.  Of course, some fields, like Subject:
should only occur once, but the header parsing code does not care
about field names.

Note, if you plan to render the messages yourself, you could use
mhonarc to help out in this via the -single mode.  With some clever
use of caching, you can avoid having to do HTML conversion on-the-fly
each time a message is read.  Of course, this assumes you are
keeping the original/raw messages somewhere for rendering purposes.

For example, when a message is to be viewed, your dynamic scripts
first check if the message is in the HTML cache, if not, it invokes
mhonarc with -single to convert the message into a cache directory.
Therefore, subsequent accesses will be retrieving static data.  This
can be handy for dealing with MIME messages and messages with
attachments.

--ewh

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

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