static int mailbox_update_indexes(struct mailbox *mailbox,
                                  const struct index_record *old,
                                  struct index_record *new)
{
    int r = 0;

    // 'new' is not static because conversations might change the CID
    r = mailbox_update_conversations(mailbox, old, new);
    if (r) return r;

#ifdef WITH_DAV
    r = mailbox_update_dav(mailbox, old, new);
    if (r) return r;
#endif

#ifdef WITH_JMAP
    r = mailbox_update_email_alarms(mailbox, old, new);
    if (r) return r;
#endif

#ifdef USE_SIEVE
    r = mailbox_update_sieve(mailbox, old, new);
    if (r) return r;
#endif

    /* NOTE - we do these last, once the counts are updated */

    if (old)
        mailbox_index_update_counts(mailbox, old, 0);
    if (new)
        mailbox_index_update_counts(mailbox, new, 1);

    return 0;
}
static int mailbox_update_indexes(struct mailbox *mailbox,
                                  const struct index_record *old,
                                  struct index_record *new)
{
    int r = 0;

     
    r = mailbox_update_conversations(mailbox, old, new);
    if (r) return r;

#ifdef WITH_DAV
    r = mailbox_update_dav(mailbox, old, new);
    if (r) return r;
#endif

#ifdef WITH_JMAP
    r = mailbox_update_email_alarms(mailbox, old, new);
    if (r) return r;
#endif

#ifdef USE_SIEVE
    r = mailbox_update_sieve(mailbox, old, new);
    if (r) return r;
#endif

     

    if (old)
        mailbox_index_update_counts(mailbox, old, 0);
    if (new)
        mailbox_index_update_counts(mailbox, new, 1);

    return 0;
}