On Jun 21 11:17, Sergey Poznyakoff wrote:
> Dan Born <[EMAIL PROTECTED]> wrote:
> 
> > mailbox_open with only the MU_STREAM_READ flag should open a mailbox
> > read-only, but when an IMAP mailbox is closed, it is also expunged.
> 
> I wasn't able to reproduce this. Could you give some more
> detail, please? What version of mailutils are you referring to?

I did some more experimenting, and simply doing a mailbox_open and a
mailbox_close will not expunge in read-only mode.

I have attached a C program which demonstrates the problem.  It opens
the mailbox in read-only mode, scans the mailbox looking at message
attributes, and then closes the mailbox.  The close triggers an expunge.

The expunge does not happen if either the mailbox_close or the message
scanning loop is removed.

$ mailutils-config --info
VERSION=0.6.90
USE_LIBPAM
WITH_GDBM
WITH_GNUTLS
WITH_GSASL
WITH_GSSAPI
WITH_GUILE
WITH_PTHREAD
WITH_READLINE
HAVE_MYSQL
ENABLE_VIRTUAL_DOMAINS
ENABLE_IMAP
ENABLE_POP
ENABLE_MH
ENABLE_MAILDIR
ENABLE_SMTP
ENABLE_SENDMAIL
ENABLE_NNTP


-- 
Dan Born
#include <stdlib.h>
#include <mailutils/mailutils.h>


int main(int argc, char *argv[]) {
    mailbox_t mbox;
    int status;
    size_t total, msgno, new = 0;
    message_t msg;
    attribute_t attr;
    
    if(argc < 2) {
        fprintf(stderr, "Usage: %s <URL>\n", argv[0]);
        return EXIT_FAILURE;
    }

    mu_register_all_mbox_formats();
    if((status = mailbox_create(&mbox, argv[1])) != 0)
        goto mbox_err;
    if((status = mailbox_open(mbox, MU_STREAM_READ)) != 0)
        goto mbox_err;
    if((status = mailbox_messages_count(mbox, &total)) != 0)
        goto mbox_err;
    for(msgno = 1; msgno <= total; msgno++) {
        if((status = mailbox_get_message(mbox, msgno, &msg)) == 0) {
            if((status = message_get_attribute(msg, &attr)) == 0) {
                if(!(attribute_is_deleted(attr) || attribute_is_read(attr)))
                    new++;
            } else {
                message_destroy(&msg, NULL);
                goto mbox_err;
            }
            message_destroy(&msg, NULL);
        } else {
            goto mbox_err;
        }
    }
    if((status = mailbox_close(mbox)) != 0)
        goto mbox_err;
    printf("%u new messages.\n", new);
    return EXIT_SUCCESS;

  mbox_err:
    mu_error("mailbox error: %s", mu_strerror(status));
    return EXIT_FAILURE;
}
_______________________________________________
Bug-mailutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-mailutils

Reply via email to