imapc-storage.c revision 0d5b4840dbb0abe79e1bddc77608c89fd0419e53
/* Copyright (c) 2011 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "ioloop.h"
#include "str.h"
#include "imap-arg.h"
#include "imap-resp-code.h"
#include "imapc-mail.h"
#include "imapc-client.h"
#include "imapc-list.h"
#include "imapc-sync.h"
#include "imapc-settings.h"
#include "imapc-storage.h"
#define DNS_CLIENT_SOCKET_NAME "dns-client"
struct imapc_open_context {
struct imapc_mailbox *mbox;
int ret;
};
struct imapc_resp_code_map {
const char *code;
enum mail_error error;
};
extern struct mail_storage imapc_storage;
extern struct mailbox imapc_mailbox;
static struct imapc_resp_code_map imapc_resp_code_map[] = {
/* { IMAP_RESP_CODE_CLIENTBUG, 0 }, */
};
struct imapc_storage *storage);
static bool
{
unsigned int i;
return FALSE;
for (i = 0; i < N_ELEMENTS(imapc_resp_code_map); i++) {
return TRUE;
}
}
return FALSE;
}
static struct mail_storage *imapc_storage_alloc(void)
{
struct imapc_storage *storage;
}
enum mail_error default_error,
const struct imapc_command_reply *reply)
{
enum mail_error error;
} else {
}
}
struct imapc_storage *storage)
{
}
{
}
void *context)
{
} else {
}
}
void *context)
{
;
} else {
}
}
void *context)
{
}
void *context)
{
const struct imapc_storage_event_callback *cb;
const struct imapc_mailbox_event_callback *mcb;
}
return;
}
}
}
}
static int
struct mail_namespace *ns,
const char **error_r)
{
struct imapc_client_settings set;
*error_r = "missing imapc_host";
return -1;
}
*error_r = "missing imapc_password";
return -1;
}
else
return 0;
}
{
}
const char *name,
{
struct imapc_storage_event_callback *cb;
}
static void
struct mailbox_list_settings *set)
{
}
static struct mailbox *
{
struct imapc_mailbox *mbox;
}
static void
void *context)
{
} else {
"imapc: Opening mailbox '%s' failed: %s",
}
}
{
struct imapc_open_context ctx;
bool examine;
return -1;
/* We don't actually want to SELECT the mailbox. */
return 0;
}
mbox->client_box =
return -1;
}
return 0;
}
{
}
return index_storage_mailbox_close(box);
}
static int
bool directory)
{
struct imapc_simple_context sctx;
if (directory) {
}
"CREATE %s", name);
}
{
"Not supported");
return -1;
}
struct imapc_storage *storage)
{
struct mailbox_status *status;
unsigned int i;
return;
return;
return;
}
}
enum mailbox_status_items items,
struct mailbox_status *status_r)
{
}
enum mailbox_status_items items,
struct mailbox_status *status_r)
{
struct imapc_simple_context sctx;
return 0;
}
/* mailbox isn't opened yet */
/* getting these requires opening the mailbox */
if (mailbox_open(box) < 0)
return -1;
return 0;
}
if ((items & STATUS_MESSAGES) != 0)
if ((items & STATUS_RECENT) != 0)
if ((items & STATUS_UIDNEXT) != 0)
if ((items & STATUS_UIDVALIDITY) != 0)
if ((items & STATUS_UNSEEN) != 0)
if ((items & STATUS_HIGHESTMODSEQ) != 0)
/* nothing requested */
return 0;
}
}
enum mailbox_metadata_items items,
struct mailbox_metadata *metadata_r)
{
if ((items & MAILBOX_METADATA_GUID) != 0) {
/* a bit ugly way to do this, but better than nothing for now.
FIXME: if indexes are enabled, keep this there. */
}
}
{
}
{
enum imapc_capability capa;
if (box->notify_min_interval == 0) {
return;
}
if ((capa & IMAPC_CAPABILITY_IDLE) != 0) {
/* remote server is already in IDLE. but since some servers
don't notice changes immediately, we'll force them to check
here by sending a NOOP. this helps with clients that break
IDLE when clicking "get mail". */
} else {
/* remote server doesn't support IDLE.
check for changes with NOOP every once in a while. */
}
}
{
return TRUE;
}
struct mail_storage imapc_storage = {
.v = {
NULL,
NULL,
}
};
struct mailbox imapc_mailbox = {
.v = {
NULL,
NULL,
NULL,
NULL,
}
};