mhonarc-users

Re: add + remove = move

2001-02-20 20:40:33
On February 6, 2001 at 02:24, stephan-mhonarc(_at_)sugarmotor(_dot_)net wrote:

Looking at the mhonarc documentation I could find an add function and
a remove function. But the add function seems to work with raw email
messages, not the files produced by mhonarc.

The move I am thinking of is pretty simple : given source folder,
destination folder and message number update the mhonarc-db files in both
and move the files that belong to the message being moved (attachments..)
(Or initializes mhonarc-db file in destination folder if it doesn't exist)

Has this been taken care of? Does this look sensible?? Other comments?

A core problem is with MHonArc's old architecture (due to Perl 4).
You cannot process multiple archives at the same time in a single
processes.  You can only do it in sequence.

An approach is to first copy the message from the source archive to
the destination archive, and then delete the message from the old.
The way to do this is that you do not load the source archive database
during the copy, but just read the message file to copy.  The
mhmsgfile.pl library contains a function for parsing the comment
declarations of the file, so you can get the necessary information
about the file w/o reading the source archive database.

By using load_data_from_msg_file() carefully, you can probably directly
load the data into the destination archive by opening the dest archive
and calling load_data_from_msg_file() on the file in the source archive.
The key is setting the $msgnum argument to a proper value.  You should
be able to use the return value mhonarc::getNewMsgNum() as the argument.
Note, mhonarc::getNewMsgNum() has the side effect of incrementing the
total message count.

You will still need deal with derived files, which may require renaming
to avoid conflicts with dest archive and edits to the message page being
moved to to update links/URLs to those files.  Also, do not forget to
copy the message page and any derived files over into the dest archive
location.  You can use mhonarc::msgnum_filename($msgnum) to determine
the proper filename to use for the dest archive.

Once the message has been successfully copied over, you can just use
the built-in rmm feature in MHonArc to remove it from the source archive.

There is a basic API for opening and closing archives via a Perl
program.  Currently, they are not documented.  You can look at the
source for "mhonarc", "mha-dbedit", and "mha-dbrecover" to get an
idea.  If you are glutton for punishment, you can also look at the
"admin/mhaadmin.cgi" program.  Browsing through mhamain.pl can also
help you in seeing what is available.

Hope this information helps,

--ewh

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