imap-sync.c revision 88286b0527bcc0711e312e9db65ca121a45213e3
/* 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 {
struct mailbox_transaction_context *t;
struct mailbox_sync_context *sync_ctx;
struct mailbox_sync_rec sync_rec;
unsigned int messages_count;
int failed;
};
struct imap_sync_context *
enum mailbox_sync_flags flags)
{
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;
}
}
case MAILBOX_SYNC_TYPE_FLAGS:
ret = 1;
if (ret <= 0)
break;
t_pop();
return -1;
}
str_truncate(str, 0);
}
break;
ctx->messages_count -=
}
ret = 1;
if (ret <= 0)
break;
str_truncate(str, 0);
}
break;
}
if (ret <= 0) {
/* failure / buffer full */
break;
}
}
t_pop();
return ret;
}
{
struct mailbox_sync_context *ctx;
struct mailbox_sync_rec sync_rec;
struct mailbox_status status;
;
}
{
int ret;
return FALSE;
if (ret < 0)
}
return TRUE;
}
const char *tagline)
{
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.. */
}
flags);
return cmd_sync_continue(cmd);
}