comparison src/lib-storage/index/mbox/mbox-expunge.c @ 0:3b1985cbc908 HEAD

Initial revision
author Timo Sirainen <tss@iki.fi>
date Fri, 09 Aug 2002 12:15:38 +0300
parents
children 82b7de533f98
comparison
equal deleted inserted replaced
-1:000000000000 0:3b1985cbc908
1 /* Copyright (C) 2002 Timo Sirainen */
2
3 #include "lib.h"
4 #include "mbox-storage.h"
5
6 int mbox_expunge_locked(IndexMailbox *ibox,
7 MailExpungeFunc expunge_func, void *user_data)
8 {
9 MailIndexRecord *rec;
10 unsigned int seq, uid;
11
12 /* FIXME: open the mbox file, lock it, and remove the deleted
13 blocks. probably better to do it in small blocks than to
14 memmove() megabytes of data.. */
15
16 rec = index_expunge_seek_first(ibox, &seq);
17 while (rec != NULL) {
18 if (rec->msg_flags & MAIL_DELETED) {
19 /* save UID before deletion */
20 uid = rec->uid;
21
22 if (!ibox->index->expunge(ibox->index, rec,
23 seq, FALSE))
24 return FALSE;
25
26 if (expunge_func != NULL)
27 expunge_func(&ibox->box, seq, uid, user_data);
28 seq--;
29 }
30 rec = ibox->index->next(ibox->index, rec);
31 seq++;
32 }
33
34 return TRUE;
35 }