imapc-sync.c revision 4bbaac4215ccd435c78e0f0c5d010aff4693c580
/* Copyright (c) 2007-2011 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "ioloop.h"
#include "str.h"
#include "imap-util.h"
#include "index-sync-private.h"
#include "imapc-storage.h"
#include "imapc-client.h"
#include "imapc-seqmap.h"
#include "imapc-sync.h"
void *context)
{
;
/* maybe the message was expunged already.
some servers fail STOREs with NO in such situation. */
/* the disconnection is already logged, don't flood
the logs unnecessarily */
} else {
}
if (--ctx->sync_command_count == 0)
}
{
}
static void
{
const struct mail_index_record *rec;
const char *cmd;
/* if any of them has a missing \Deleted flag,
just add it to all of them. */
break;
}
}
}
const struct mail_index_sync_rec *sync_rec)
{
}
if (sync_rec->remove_flags != 0) {
str_truncate(str, 0);
}
}
static void
const struct mail_index_sync_rec *sync_rec)
{
const char *const *kw_p;
char change_char;
change_char = '+';
break;
change_char = '-';
break;
default:
i_unreached();
}
}
static void
{
const struct mail_index_record *rec;
str_truncate(str, 0);
}
}
{
enum imapc_capability caps;
return;
if ((caps & IMAPC_CAPABILITY_UIDPLUS) == 0) {
/* just expunge everything */
return;
}
/* build a list of UIDs to expunge */
}
{
struct mail_index_sync_rec sync_rec;
/* already expunged, nothing to do. */
/* don't care */
break;
break;
break;
break;
break;
}
} T_END;
while (ctx->sync_command_count > 0)
}
static int
{
struct imapc_sync_context *ctx;
int ret;
if (!force)
if (ret <= 0) {
if (ret < 0)
return ret;
}
return 0;
}
{
if (ret == 0) {
ret = -1;
}
} else {
}
return ret;
}
{
struct imapc_sync_context *sync_ctx;
struct imapc_seqmap *seqmap;
/* if there are any pending expunges, they're now committed. syncing
will return a view where they no longer exist, so reset the seqmap
before syncing. */
return -1;
return 0;
if (imapc_sync_finish(&sync_ctx) < 0)
return -1;
/* syncing itself may have also seen new expunges, which are also now
committed and synced. reset the seqmap again. */
return 0;
}
struct mailbox_sync_context *
{
enum imapc_capability capabilities;
bool changes;
int ret = 0;
if (mailbox_open(box) < 0)
ret = -1;
}
if ((capabilities & IMAPC_CAPABILITY_IDLE) == 0) {
/* IDLE not supported. do NOOP to get latest changes
before starting sync. */
}
ret = -1;
ret == 0)
/* we're now out of sync and can't safely continue */
}
}
struct mailbox_sync_status *status_r)
{
int ret;
return ret;
return ret;
}