This fixes the use case where a bunch of messages are tagged, removed,
then the mailbox is sync'd in a thread view. In this case, the sequence
number given by email->index is not monotonic, which results in weird
sequence sets being passed to UID STORE.
return false;
}
+static int compare_uid(const void *a, const void *b)
+{
+ struct Email **ea = (struct Email **) a;
+ struct Email **eb = (struct Email **) b;
+ return imap_edata_get(*ea)->uid - imap_edata_get(*eb)->uid;
+}
+
/**
* imap_exec_msgset - Prepare commands for all messages matching conditions
* @param m Selected Imap Mailbox
memcpy(m->emails, emails, m->msg_count * sizeof(struct Email *));
Sort = SORT_ORDER;
- qsort(m->emails, m->msg_count, sizeof(struct Email *), mutt_get_sort_func(SORT_ORDER));
+ qsort(m->emails, m->msg_count, sizeof(struct Email *), compare_uid);
}
pos = 0;