summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2002-11-14 07:09:13 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2002-11-14 07:09:13 +0000
commit0a4c2ccb02e18fc6218bdc975173ac52a7bc6c11 (patch)
treef14d8b62586fbffcf26f757f263aad8d99d0e702
parent67f7c3a75f68dd1cf393268c6423baece33e22d9 (diff)
downloadmailutils-0a4c2ccb02e18fc6218bdc975173ac52a7bc6c11.tar.gz
mailutils-0a4c2ccb02e18fc6218bdc975173ac52a7bc6c11.tar.bz2
(mbox_scan0): Compute uids before calling DISPATCH_ADD_MSG.
-rw-r--r--mailbox/mbx_mboxscan.c58
1 files changed, 30 insertions, 28 deletions
diff --git a/mailbox/mbx_mboxscan.c b/mailbox/mbx_mboxscan.c
index c0e9f1efe..24169281c 100644
--- a/mailbox/mbx_mboxscan.c
+++ b/mailbox/mbx_mboxscan.c
@@ -549,7 +549,7 @@ mbox_scan0 (mailbox_t mailbox, size_t msgno, size_t *pcount, int do_notif)
size_t n = 0;
stream_t stream;
char **sfield = NULL;
-
+ size_t min_uid = 0;
int zn, isfrom = 0;
char *temp;
@@ -636,8 +636,19 @@ mbox_scan0 (mailbox_t mailbox, size_t msgno, size_t *pcount, int do_notif)
{
mum->body_end = total - n - newline;
mum->body_lines = --lines - newline;
+
+ if (mum->uid <= min_uid)
+ {
+ mum->uid = ++min_uid;
+ /* Note that modification for when expunging. */
+ mum->attr_flags |= MU_ATTRIBUTE_MODIFIED;
+ }
+ else
+ min_uid = mum->uid;
+
if (do_notif)
DISPATCH_ADD_MSG(mailbox, mud);
+
}
/* Allocate_msgs will initialize mum. */
ALLOCATE_MSGS(mailbox, mud);
@@ -785,6 +796,16 @@ mbox_scan0 (mailbox_t mailbox, size_t msgno, size_t *pcount, int do_notif)
{
mum->body_end = total - newline;
mum->body_lines = lines - newline;
+
+ if (mum->uid <= min_uid)
+ {
+ mum->uid = ++min_uid;
+ /* Note that modification for when expunging. */
+ mum->attr_flags |= MU_ATTRIBUTE_MODIFIED;
+ }
+ else
+ min_uid = mum->uid;
+
if (do_notif)
DISPATCH_ADD_MSG(mailbox, mud);
}
@@ -805,33 +826,14 @@ mbox_scan0 (mailbox_t mailbox, size_t msgno, size_t *pcount, int do_notif)
mum->attr_flags |= MU_ATTRIBUTE_MODIFIED;
}
}
- /* Reset the IMAP uids, if necessary. UID according to IMAP RFC is a 32 bit
- ascending number for each messages */
- {
- size_t uid;
- size_t ouid;
- size_t i;
- for (uid = ouid = i = 0; i < mud->messages_count; i++)
- {
- mum = mud->umessages[i];
- uid = mum->uid;
- if (uid <= ouid)
- {
- uid = ouid + 1;
- mum->uid = ouid = uid;
- /* Note that modification for when expunging. */
- mum->attr_flags |= MU_ATTRIBUTE_MODIFIED;
- }
- else
- ouid = uid;
- }
- if (mud->messages_count > 0 && uid >= mud->uidnext)
- {
- mum = mud->umessages[0];
- mud->uidnext = uid + 1;
- mum->attr_flags |= MU_ATTRIBUTE_MODIFIED;
- }
- }
+
+ if (mud->messages_count > 0 && min_uid >= mud->uidnext)
+ {
+ mum = mud->umessages[0];
+ mud->uidnext = min_uid + 1;
+ mum->attr_flags |= MU_ATTRIBUTE_MODIFIED;
+ }
+
#ifdef WITH_PTHREAD
pthread_cleanup_pop (0);
#endif

Return to:

Send suggestions and report system problems to the System administrator.