[dovecot-cvs] dovecot/src/lib-storage/index index-sync.c,1.40,1.41
cras at dovecot.org
cras at dovecot.org
Sat Oct 9 16:54:31 EEST 2004
Update of /var/lib/cvs/dovecot/src/lib-storage/index
In directory talvi:/tmp/cvs-serv10182/lib-storage/index
Modified Files:
index-sync.c
Log Message:
Recent flag fixes
Index: index-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/index-sync.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- index-sync.c 8 Oct 2004 17:51:49 -0000 1.40
+++ index-sync.c 9 Oct 2004 13:54:28 -0000 1.41
@@ -60,14 +60,26 @@
{
const unsigned char *data;
size_t size;
- uint32_t i, idx, count;
+ uint32_t i, idx, count, move;
- if (seq2 < ibox->recent_flags_start_seq ||
- ibox->recent_flags_start_seq == 0)
+ if (ibox->recent_flags_start_seq == 0) {
+ /* no recent flags */
return;
+ }
- if (seq1 < ibox->recent_flags_start_seq)
+ if (seq2 < ibox->recent_flags_start_seq) {
+ /* expunging messages before recent flags, just modify
+ the recent start position */
+ ibox->recent_flags_start_seq -= seq2 - seq1 + 1;
+ return;
+ }
+
+ if (seq1 < ibox->recent_flags_start_seq) {
+ move = ibox->recent_flags_start_seq - seq1;
seq1 = ibox->recent_flags_start_seq;
+ } else {
+ move = 0;
+ }
idx = seq1 - ibox->recent_flags_start_seq;
count = seq2 - seq1 + 1;
@@ -86,7 +98,7 @@
buffer_copy(ibox->recent_flags, idx,
ibox->recent_flags, idx + count, (size_t)-1);
buffer_set_used_size(ibox->recent_flags, size - count);
-
+ ibox->recent_flags_start_seq -= move;
}
static int index_mailbox_update_recent(struct index_mailbox *ibox,
More information about the dovecot-cvs
mailing list