imap-sync.c revision 389e0ad41d4dd6acf50f855ecd5f0651082c9f31
/* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */
#include "common.h"
#include "str.h"
#include "mail-storage.h"
#include "imap-util.h"
#include "imap-sync.h"
#include "commands.h"
struct cmd_sync_context {
const char *tagline;
struct imap_sync_context *sync_ctx;
};
struct imap_sync_context {
enum imap_sync_flags imap_flags;
struct mailbox_transaction_context *t;
struct mailbox_sync_context *sync_ctx;
struct mailbox_sync_rec sync_rec;
unsigned int messages_count;
unsigned int failed:1;
unsigned int no_newmail:1;
};
struct imap_sync_context *
{
struct imap_sync_context *ctx;
return ctx;
}
{
struct mailbox_status status;
int ret;
return -1;
}
/* most clients would get confused by this. disconnect them. */
"Mailbox UIDVALIDITY changed");
}
if (!ctx->no_newmail) {
i_panic("Message count decreased");
}
!ctx->no_newmail) {
}
}
return ret;
}
{
enum mail_flags flags;
const char *const *keywords;
str_truncate(str, 0);
}
{
int ret = 1;
for (;;) {
/* get next one */
/* finished */
ret = 1;
break;
}
}
/* don't send change notifications of messages we
haven't even announced to client yet */
continue;
}
}
case MAILBOX_SYNC_TYPE_FLAGS:
ret = 1;
if (ret <= 0)
break;
}
break;
ret = 1;
if (ret <= 0)
break;
str_truncate(str, 0);
}
/* update only after we're finished, so that
the seq2 > messages_count check above
doesn't break */
ctx->messages_count -=
}
break;
}
if (ret <= 0) {
/* failure / buffer full */
break;
}
}
return ret;
}
{
int ret;
ret = 0;
else {
return FALSE;
}
if (ret < 0)
}
return TRUE;
}
{
struct cmd_sync_context *ctx;
bool no_newmail;
return TRUE;
}
(imap_flags & IMAP_SYNC_FLAG_SAFE) == 0;
if (no_newmail) {
/* expunges might break the client just as badly as new mail
notifications. */
}
imap_flags, flags);
return cmd_sync_continue(cmd);
}