dsync-proxy-server-cmd.c revision e0110438983cbc6bd093a5c35d14e9c6402329c6
/* Copyright (c) 2009 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "str.h"
#include "strescape.h"
#include "network.h"
#include "istream.h"
#include "istream-dot.h"
#include "ostream.h"
#include "imap-util.h"
#include "dsync-worker.h"
#include "dsync-proxy.h"
#include "dsync-proxy-server.h"
#include <stdlib.h>
static bool
{
}
static int
const char *const *args ATTR_UNUSED)
{
struct dsync_mailbox dsync_box;
int ret;
}
&dsync_box)) > 0) {
str_truncate(str, 0);
break;
}
if (ret >= 0) {
/* continue later */
return 0;
}
return -1;
} else {
return 1;
}
}
static int
{
unsigned int i, count;
int ret;
for (i = 0; i < count; i++) {
T_BEGIN {
&mailboxes[i]);
} T_END;
if (ret < 0) {
return -1;
}
}
return 0;
}
static int
{
unsigned int mailbox_idx;
struct dsync_message msg;
int ret;
return -1;
}
&mailbox_idx, &msg)) > 0) {
str_truncate(str, 0);
break;
}
if (ret >= 0) {
/* continue later */
return 0;
}
return -1;
} else {
return 1;
}
}
static int
{
struct dsync_mailbox dsync_box;
const char *error;
&error) < 0) {
return -1;
}
return 1;
}
static int
{
return -1;
}
return 1;
}
static int
{
return -1;
return -1;
}
return 1;
}
static int
{
struct dsync_mailbox dsync_box;
const char *error;
&error) < 0) {
return -1;
}
return 1;
}
static int
{
return -1;
}
return 1;
}
static int
{
struct dsync_message msg;
/* uid modseq flags */
return -1;
return -1;
return 1;
}
static int
{
return -1;
return 1;
}
static int
{
return -1;
return 1;
}
{
}
static int
{
struct dsync_message msg;
const char *error;
/* src_mailbox_guid src_uid <message> */
return -1;
return -1;
}
return 1;
}
static int
{
struct dsync_message msg;
struct dsync_msg_static_data data;
const char *error;
return -1;
}
return -1;
}
/* we rely on save reading the entire input */
return 1;
}
{
const unsigned char *data;
int ret;
while (!proxy_server_is_output_full(server)) {
if (ret == -1) {
/* done */
break;
} else {
/* for now we assume input is blocking */
}
}
}
static void
{
switch (result) {
break;
return;
return;
}
/* then we'll still have to send the message body. */
}
static int
{
return -1;
return -1;
}
if (uid == 0)
return -1;
else {
/* FIXME: why? this shouldn't be needed.. */
}
}
{
}
static int
const char *const *args ATTR_UNUSED)
{
return 1;
}
static struct dsync_proxy_server_command commands[] = {
{ "BOX-LIST", cmd_box_list },
{ "MSG-LIST", cmd_msg_list },
{ "BOX-CREATE", cmd_box_create },
{ "BOX-DELETE", cmd_box_delete },
{ "BOX-RENAME", cmd_box_rename },
{ "BOX-UPDATE", cmd_box_update },
{ "BOX-SELECT", cmd_box_select },
{ "MSG-UPDATE", cmd_msg_update },
{ "MSG-UID-CHANGE", cmd_msg_uid_change },
{ "MSG-EXPUNGE", cmd_msg_expunge },
{ "MSG-COPY", cmd_msg_copy },
{ "MSG-SAVE", cmd_msg_save },
{ "MSG-GET", cmd_msg_get },
{ "FINISH", cmd_finish },
};
struct dsync_proxy_server_command *
dsync_proxy_server_command_find(const char *name)
{
unsigned int i;
return &commands[i];
}
return NULL;
}