EXPORTED int mailbox_update_xconvmodseq(struct mailbox *mailbox, modseq_t newmodseq, int force)
{
    conv_status_t status = CONV_STATUS_INIT;
    int r;

    struct conversations_state *cstate = mailbox_get_cstate(mailbox);
    if (!cstate) return 0;

    r = conversation_getstatus(cstate,
                               CONV_FOLDER_KEY_MBOX(cstate, mailbox), &status);
    if (r) return r;

    if (newmodseq > status.threadmodseq || (force && newmodseq < status.threadmodseq)) {
        status.threadmodseq = newmodseq;
        r = conversation_setstatus(cstate,
                                   CONV_FOLDER_KEY_MBOX(cstate, mailbox), &status);
    }

    return r;
}
EXPORTED int mailbox_update_xconvmodseq(struct mailbox *mailbox, modseq_t newmodseq, int force)
{
    conv_status_t status = CONV_STATUS_INIT;
    int r;

    struct conversations_state *cstate = mailbox_get_cstate(mailbox);
    if (!cstate) return 0;

    r = conversation_getstatus(cstate,
                               CONV_FOLDER_KEY_MBOX(cstate, mailbox), &status);
    if (r) return r;

    if (newmodseq > status.threadmodseq || (force && newmodseq < status.threadmodseq)) {
        status.threadmodseq = newmodseq;
        r = conversation_setstatus(cstate,
                                   CONV_FOLDER_KEY_MBOX(cstate, mailbox), &status);
    }

    return r;
}