imap-sync.c revision 42507d758b053bb483de58fba55c73a9eb5d3fba
/* Copyright (C) 2002-2004 Timo Sirainen */
#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;
bool failed;
};
struct imap_sync_context *
{
struct imap_sync_context *ctx;
struct mailbox_status status;
/* if keyword list changed, send the new list before flag changes */
}
return ctx;
}
{
struct mailbox_status status;
return -1;
}
mailbox_transaction_commit(&ctx->t, 0);
t_push();
}
}
t_pop();
return 0;
}
{
enum mail_flags flags;
const char *const *keywords;
int ret = 1;
t_push();
for (;;) {
/* get next one */
if (ret <= 0) {
if (ret == 0) {
/* all finished ok */
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;
t_pop();
return -1;
}
str_truncate(str, 0);
}
}
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;
}
}
t_pop();
return ret;
}
{
struct mailbox_sync_context *ctx;
struct mailbox_sync_rec sync_rec;
;
}
{
int ret;
ret = 0;
else {
return FALSE;
}
if (ret < 0)
}
return TRUE;
}
{
struct cmd_sync_context *ctx;
return TRUE;
}
if ((client_workarounds & WORKAROUND_DELAY_NEWMAIL) != 0 &&
(flags & MAILBOX_SYNC_FLAG_FAST) != 0) {
/* expunges might break just as badly as new mail
notifications. besides, currently indexing code doesn't
handle expunges + no-newmail so this is required, unless
we did this only for no-expunges case.. */
}
imap_flags, flags);
return cmd_sync_continue(cmd);
}