static int mailbox_delete_internal(struct mailbox **mailboxptr)
{
    int r = 0;
    struct mailbox *mailbox = *mailboxptr;

    /* mark the quota removed */
    mailbox_quota_dirty(mailbox);

    /* mark the mailbox deleted */
    mailbox_index_dirty(mailbox);
    mailbox->i.options |= OPT_MAILBOX_DELETED;

#ifdef WITH_DAV
    /* remove any DAV records */
    r = mailbox_delete_dav(mailbox);
    if (r) return r;
#endif

#ifdef USE_SIEVE
    /* remove any Sieve records */
    r = mailbox_delete_sieve(mailbox);
    if (r) return r;
#endif

    /* clean up annotations */
    r = annotate_delete_mailbox(mailbox);
    if (r) return r;

    /* commit the changes */
    r = mailbox_commit(mailbox);
    if (r) return r;

    /* remove any seen */
    seen_delete_mailbox(NULL, mailbox);

    /* can't unlink any files yet, because our promise to other
     * users of the mailbox applies! Can only unlink with an
     * exclusive lock.  mailbox_close will try to get one of
     * those.
     */

    syslog(LOG_NOTICE, "Deleted mailbox %s", mailbox_name(mailbox));

    if (config_auditlog)
        syslog(LOG_NOTICE, "auditlog: delete sessionid=<%s> "
                           "mailbox=<%s> uniqueid=<%s>",
                           session_id(),
                           mailbox_name(mailbox), mailbox_uniqueid(mailbox));

    proc_killmbox(mailbox_name(mailbox));

    mailbox_close(mailboxptr);

    return 0;
}
static int mailbox_delete_internal(struct mailbox **mailboxptr)
{
    int r = 0;
    struct mailbox *mailbox = *mailboxptr;

     
    mailbox_quota_dirty(mailbox);

     
    mailbox_index_dirty(mailbox);
    mailbox->i.options |= OPT_MAILBOX_DELETED;

#ifdef WITH_DAV
     
    r = mailbox_delete_dav(mailbox);
    if (r) return r;
#endif

#ifdef USE_SIEVE
     
    r = mailbox_delete_sieve(mailbox);
    if (r) return r;
#endif

     
    r = annotate_delete_mailbox(mailbox);
    if (r) return r;

     
    r = mailbox_commit(mailbox);
    if (r) return r;

     
    seen_delete_mailbox(NULL, mailbox);

     

    syslog(LOG_NOTICE, "Deleted mailbox %s", mailbox_name(mailbox));

    if (config_auditlog)
        syslog(LOG_NOTICE, "auditlog: delete sessionid=<%s> "
                           "mailbox=<%s> uniqueid=<%s>",
                           session_id(),
                           mailbox_name(mailbox), mailbox_uniqueid(mailbox));

    proc_killmbox(mailbox_name(mailbox));

    mailbox_close(mailboxptr);

    return 0;
}