dsync-brain-mails.c revision ea245d7a9683e7bb9cd74fcdf1a26d049b2947eb
/* Copyright (c) 2013 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "istream.h"
#include "dsync-ibc.h"
#include "dsync-mail.h"
#include "dsync-mailbox-import.h"
#include "dsync-mailbox-export.h"
#include "dsync-brain-private.h"
"mailbox",
"changes",
"mail_requests",
"mails",
"recv_last_common",
"done"
};
{
const struct dsync_mailbox *dsync_box;
enum dsync_ibc_recv_ret ret;
return FALSE;
if (ret == DSYNC_IBC_RECV_RET_FINISHED) {
i_error("Remote sent end-of-list instead of a mailbox");
return TRUE;
}
sizeof(dsync_box->mailbox_guid)) != 0) {
i_error("Remote sent mailbox with a wrong GUID");
return TRUE;
}
if (dsync_box->mailbox_lost) {
/* remote lost the mailbox. it's probably already deleted, but
verify it on next sync just to be sure */
return TRUE;
}
/* no fields appear to have changed, skip this mailbox */
return TRUE;
}
return TRUE;
return TRUE;
}
{
const struct dsync_mail_change *change;
enum dsync_ibc_recv_ret ret;
return FALSE;
if (ret == DSYNC_IBC_RECV_RET_FINISHED) {
else
return TRUE;
}
return TRUE;
}
{
const struct dsync_mail_change *change;
return;
}
else
}
{
const struct dsync_mail_request *request;
enum dsync_ibc_recv_ret ret;
return FALSE;
if (ret == DSYNC_IBC_RECV_RET_FINISHED) {
return TRUE;
}
return TRUE;
}
{
const struct dsync_mail_request *request;
return TRUE;
}
return FALSE;
else {
}
return TRUE;
}
{
struct dsync_mailbox_state state;
const char *error;
return;
/* finished with this mailbox */
&error) < 0) {
i_error("Exporting mailbox %s failed: %s",
return;
}
}
sizeof(state.mailbox_guid));
/* this mailbox didn't exist on remote */
} else {
&state.changes_during_sync) < 0) {
return;
}
if (state.changes_during_sync)
}
}
{
struct dsync_mail *mail;
enum dsync_ibc_recv_ret ret;
return FALSE;
if (ret == DSYNC_IBC_RECV_RET_FINISHED) {
return TRUE;
}
i_debug("brain %c: import mail uid %u guid %s",
}
return TRUE;
}
{
const struct dsync_mail *mail;
return TRUE;
}
if (brain->mail_requests &&
/* wait for mail requests to finish */
return changed;
}
return TRUE;
}
{
enum dsync_ibc_recv_ret ret;
struct dsync_mailbox_state state;
return FALSE;
if (ret == DSYNC_IBC_RECV_RET_FINISHED) {
i_error("Remote sent end-of-list instead of a mailbox state");
return TRUE;
}
sizeof(state.mailbox_guid)) == 0);
/* normally the last_common_* values should be the same in local and
remote, but during unexpected changes they may differ. use the
values that are lower as the final state. */
if (state.changes_during_sync)
return TRUE;
}
{
i_debug("brain %c: in box '%s' recv_state=%s send_state=%s",
}
switch (brain->box_recv_state) {
case DSYNC_BOX_STATE_MAILBOX:
break;
case DSYNC_BOX_STATE_CHANGES:
break;
break;
case DSYNC_BOX_STATE_MAILS:
break;
break;
case DSYNC_BOX_STATE_DONE:
break;
}
switch (brain->box_send_state) {
case DSYNC_BOX_STATE_MAILBOX:
/* wait for mailbox to be received first */
break;
case DSYNC_BOX_STATE_CHANGES:
break;
break;
case DSYNC_BOX_STATE_MAILS:
if (dsync_brain_send_mail(brain))
break;
i_unreached();
case DSYNC_BOX_STATE_DONE:
break;
}
}
i_debug("brain %c: out box '%s' recv_state=%s send_state=%s changed=%d",
}
return changed;
}