- update isyncmaxuid properly
This commit is contained in:
parent
2012aadc5b
commit
a4f2725bad
2
TODO
2
TODO
|
@ -1,7 +1,5 @@
|
|||
add support for syncing with other: and shared: via NAMESPACE
|
||||
|
||||
--fast downloads the last message again if no new messages have arrived
|
||||
|
||||
isync gets confused when new mail is delivered while in the middle of an
|
||||
IMAP session. need to handled those asynchronous notifications properly.
|
||||
|
||||
|
|
|
@ -198,9 +198,6 @@ maildir_open (const char *path, int flags)
|
|||
if (read_uid (m->path, "isyncmaxuid", &m->maxuid) == -1)
|
||||
goto err;
|
||||
|
||||
if (flags & OPEN_FAST)
|
||||
return m;
|
||||
|
||||
snprintf (buf, sizeof (buf), "%s/isyncuidmap", m->path);
|
||||
m->db = dbm_open (buf, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
|
||||
if (m->db == NULL)
|
||||
|
@ -209,6 +206,9 @@ maildir_open (const char *path, int flags)
|
|||
goto err;
|
||||
}
|
||||
|
||||
if (flags & OPEN_FAST)
|
||||
return m;
|
||||
|
||||
cur = &m->msgs;
|
||||
for (; count < 2; count++)
|
||||
{
|
||||
|
|
11
src/sync.c
11
src/sync.c
|
@ -94,8 +94,6 @@ sync_mailbox (mailbox_t * mbox, imap_t * imap, int flags,
|
|||
if (mbox->maxuid == 0 || imap->maxuid > mbox->maxuid)
|
||||
{
|
||||
mbox->maxuid = imap->maxuid;
|
||||
if (maildir_update_maxuid (mbox))
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* if we are --fast mode, the mailbox wont have been loaded, so
|
||||
|
@ -153,11 +151,13 @@ sync_mailbox (mailbox_t * mbox, imap_t * imap, int flags,
|
|||
|
||||
cur->size = sb.st_size;
|
||||
cur->uid = imap_append_message (imap, fd, cur);
|
||||
/* if the server gave us back a uid, update the db */
|
||||
if (cur->uid != (unsigned int) -1) {
|
||||
/* update the db */
|
||||
set_uid (mbox->db, cur->file, cur->uid);
|
||||
if (!cur->uid)
|
||||
printf("warning: no uid for new messge %s\n", cur->file);
|
||||
else if (cur->uid > mbox->maxuid)
|
||||
mbox->maxuid = cur->uid;
|
||||
}
|
||||
|
||||
close (fd);
|
||||
|
@ -373,6 +373,8 @@ sync_mailbox (mailbox_t * mbox, imap_t * imap, int flags,
|
|||
{
|
||||
/* update the db with the UID mapping for this file */
|
||||
set_uid (mbox->db, p + 1, cur->uid);
|
||||
if (cur->uid > mbox->maxuid)
|
||||
mbox->maxuid = cur->uid;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -383,5 +385,8 @@ sync_mailbox (mailbox_t * mbox, imap_t * imap, int flags,
|
|||
|
||||
info (" %d messages\n", fetched);
|
||||
|
||||
if (maildir_update_maxuid (mbox))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user