Subject: Bug?

From: Lars Hallberg <[email-masked]>
Date: Thu, 18 Dec 2003 20:10:37 +0100

Hello

After realising all the trouble with sorting uw-imap 'owned' mailfolders 
with procmail I wrote my own 'reprocmail' in PHP using c-client. Works 
mostly great! I have found one bug thou. It might be obsolet, as i run 
an old c-client (from debian stable).

Anyway, I have a 'kill' option that removes the mailbox if it is empty 
after the mail in it has been resorted. But if it contains a pseudo 
messages, the removal of the folder fail becose it's not empty - but it 
is exept for the pseudo messages. It might be a matter of opinion, but I 
consider that a bug. Not a terable one, but a slightly anoying one.

I use old fasion unix mailbox format if thats of relevans, probably 
shuld switch to mbx :-)

If anyone shuld be intrested in 'reprocmal', mail me and I put it on a 
website, quick and dirty.

Thanks /LaH

-- 
------------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------

---

From: Brad Arlt <[email-masked]>
Date: Thu, 18 Dec 2003 12:21:51 -0700

> consider that a bug. Not a terable one, but a slightly anoying one.

I don't consider this a bug.  The message is real.  Pine, mutt, and
friends all see it as a message if you open the file directly.  The
IMAP and POP servers treat it special (I think, it may be the clients
though), but I don't think c-client should.  The solution is to
examine this one remaining message and see if it "counts".
-----------------------------------------------------------------------
   __o		Bradley Arlt			Security Team Lead
 _ \<_		[email-masked]		University Of Calgary
(_)/(_) 	Joyously Canadian	 	Computer Science

---

From: Mark Crispin <[email-masked]>
Date: Thu, 18 Dec 2003 11:37:29 -0800 (PST)

On Thu, 18 Dec 2003, Lars Hallberg wrote:
> Anyway, I have a 'kill' option that removes the mailbox if it is empty after
> the mail in it has been resorted. But if it contains a pseudo messages, the
> removal of the folder fail becose it's not empty - but it is exept for the
> pseudo messages.

Don't use "filesize = 0" as the test.  Use "stream->nmsgs = 0" (from a
c-client stream open on the mailbox) instead.

mbx format also has a non-empty file when it is empty of messages.

-- Mark --

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

---

From: Mark Crispin <[email-masked]>
Date: Thu, 18 Dec 2003 11:38:18 -0800 (PST)

On Thu, 18 Dec 2003, Brad Arlt wrote:
> though), but I don't think c-client should.

Pine certainly does not see the message; nor does any other c-client based
application.  The support for the pseudo-message is in c-client, not in
imapd/ipop3d.

-- Mark --

---

From: Lars Hallberg <[email-masked]>
Date: Thu, 18 Dec 2003 20:40:00 +0100

>examine this one remaining message and see if it "counts".

Don't see hove I can do that thru c-client. I'l can go directly for the 
file of course (I do that now manaly).

But the pseudo message is automagicly added by c-client, and therfor 
shuld be likewise automagicly removed... i think :-)

I also think the pseudo message shuld say somthing like this in clear text:

If you see this message, You are doing something wrong. You shuld only 
access these maileboxes thru c-client based programs!

Or att least point to a document listing every consideration You have to 
do elsehow (not litle).

/LaH

---

From: Lars Hallberg <[email-masked]>
Date: Thu, 18 Dec 2003 20:55:01 +0100

>c-client stream open on the mailbox) instead.
I do that, and pases that test. But then the actuly delete of the 
mailbox fail, but not if it hase no pseudo message, dont realy know why, 
but they not always ther. Here is the code, I open the imap chanel 
whitout user/server data to go strajt to the filesystem thru client. 
Works great - for everything else anyway :-/

$mbox = imap_open($mailbox, "", "");
 
$n = imap_num_msg($mbox);
 
if(!$n) {
        if(imap_deletemailbox($mbox, $mailbox)) {
                    print("$mailbox KILLED!\n\n");
        } else {
                    print("ERROR: $mailbox not killed\n\n");
        }
} else {
        print("$mailbox NOT killed, not empty!\n\n");
}
imap_close($mbox);

Sorry, this is PHP interface to c-client - might not look to familiar :-/

/LaH

---

From: Mark Crispin <[email-masked]>
Date: Thu, 18 Dec 2003 12:40:57 -0800 (PST)

You can not delete a mailbox which is open.  Close it first, then delete
it.

-- Mark --

---

From: Lars Hallberg <[email-masked]>
Date: Thu, 18 Dec 2003 23:23:11 +0100

>You can not delete a mailbox which is open.  Close it first, then delete

Thanks, works!

Strange thou it sometimes did work  anyway. I'm not 100% sure, but it 
did seam to be related to pseudo message... every folder failing did at 
least have pseudo messages :-/

Thanks again /LaH