Subject: Troubles with mail_move()

From: Guy Davis <[email-masked]>
Date: 12 Sep 2002 15:04:00 -0600

I'm running into some strange behavior when I call the mail_move()
method.  It seems like while other calls like mail_create() strip off
the remote part of the mail specification when sending the actual IMAP
command, the mail_move() call doesn't.  Here's the C calls I making and
the IMAP debug output they produce (INBOX is selected):

	mail_create(queue, "{localhost:143}~/Mail/web_queue");
	00000005 Create ~/Mail/web_queue
	00000005 OK CREATE completed
	mail_move(queue, "1", "{localhost:143}~/Mail/web_queue");
	00000006 COPY 1 "{localhost:143}~/Mail/web_queue"
	00000006 NO COPY failed: Can't access server for append

This on a RH7.3 box with imap2001a rpms.  Any ideas on what I'm doing
wrong?

Another question I have is how to get the mail_create() to use the
default RH mailbox format (UNIX/mbox I think) rather than the mbx
format.

Thanks for your help.

-- 
Guy Davis          Phone: (403) 301-3426       Fax: (403) 301-3499
Pason Systems      Calgary, Alberta            Canada

Digitally signed by GnuPG (DSA ID 759A998E at www.keyserver.net)
PGP Fingerprint: F685 97D0 0FC6 F016 E9EB CCD3 F183 1BC7 759A 998E

---

From: Mark Crispin <[email-masked]>
Date: Thu, 12 Sep 2002 15:55:55 -0700 (Pacific Daylight Time)

On Thu, 12 Sep 2002, Guy Davis wrote:
> command, the mail_move() call doesn't.

mail_copy() and mail_move() are different from all other c-client calls in
that they apply to the current mailbox, but take a mailbox name argument
as the destination.

The mailbox name in these two calls is *NOT* a c-client mailbox name, but
rather a mailbox name in the context of the currently selected stream.
This has a number of subtle implications.

In the case of a local selected mailbox, the destination mailbox name must
be a mailbox name in the same format as the source, UNLESS the application
has armed a mailproxycopy_t routine.  If a mailproxycopy_t routine is
armed, then c-client only verifies that the destination mailbox exists,
and then has the mailproxycopy_t routine do the work.

In the case of a POP3 or NNTP mailbox, mail_copy()/mail_move() calls are
invalid unless the application has armed a mailprroxycopy_t routine; if so
then the mailproxycopy_t routine is called to do the work.

In the case of an IMAP mailbox, the entire destination mailbox name is a
mailbox name on the IMAP server.  If the IMAP server returns a referral
*AND* a mailproxycopy_t routine is armed, the mailproxycopy_t routine is
called to do the work on the name returned by the referral.

> default RH mailbox format (UNIX/mbox I think) rather than the mbx

mail_create() defaults to whatever the default format it was built with,
which normally is the traditional UNIX mailbox format.  If c-client was
built to default to creating in mbx format, the person doing the build
presumably had a reason for doing so, and you should not override it in
your application.

If you insist upon overriding it in your application, you can either
provide the driver prototype for the traditional UNIX mailbox format as
the MAILSTREAM to mail_create(), or you can prefix the name with
"#driver.unix/".

Note that if I get a bug report saying "I built c-client to default to mbx
format, but such-and-such application still creates in traditional UNIX
format even after I relunk it with the new c-client", I will probably not
be very complimentary in my commentary about the application author after
wasting hours of time only to find out that it's because my advice was
ignored.......  ;-)

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.