const struct mail_search_arg *arg,
string_t *str)
{
- enum imapc_capability capa =
- imapc_client_get_capabilities(mbox->storage->client->client);
struct mail_search_arg arg2 = *arg;
const char *error;
return TRUE;
case SEARCH_BEFORE:
case SEARCH_SINCE:
- if ((capa & IMAPC_CAPABILITY_WITHIN) == 0) {
+ if ((mbox->capabilities & IMAPC_CAPABILITY_WITHIN) == 0) {
/* a bit kludgy way to check this.. */
size_t pos = str_len(str);
if (!mail_search_arg_to_imap(str, arg, &error))
return mail_search_arg_to_imap(str, arg, &error);
/* extensions */
case SEARCH_MODSEQ:
- if ((capa & IMAPC_CAPABILITY_CONDSTORE) == 0)
+ if ((mbox->capabilities & IMAPC_CAPABILITY_CONDSTORE) == 0)
return FALSE;
return mail_search_arg_to_imap(str, arg, &error);
case SEARCH_INTHREAD:
const struct mail_search_args *args,
const char **query_r)
{
- enum imapc_capability capa =
- imapc_client_get_capabilities(mbox->storage->client->client);
string_t *str = t_str_new(128);
if (!IMAPC_BOX_HAS_FEATURE(mbox, IMAPC_FEATURE_SEARCH)) {
/* SEARCH command passthrough not enabled */
return FALSE;
}
- if ((capa & IMAPC_CAPABILITY_ESEARCH) == 0) {
+ if ((mbox->capabilities & IMAPC_CAPABILITY_ESEARCH) == 0) {
/* FIXME: not supported for now */
return FALSE;
}
bool imapc_mailbox_has_modseqs(struct imapc_mailbox *mbox)
{
- enum imapc_capability capa =
- imapc_client_get_capabilities(mbox->storage->client->client);
-
- return (capa & (IMAPC_CAPABILITY_CONDSTORE |
- IMAPC_CAPABILITY_QRESYNC)) != 0 &&
+ return (mbox->capabilities & (IMAPC_CAPABILITY_CONDSTORE |
+ IMAPC_CAPABILITY_QRESYNC)) != 0 &&
IMAPC_BOX_HAS_FEATURE(mbox, IMAPC_FEATURE_MODSEQ);
}
imapc_client_stop(ctx->mbox->storage->client->client);
}
-static void imapc_mailbox_get_extensions(struct imapc_mailbox *mbox)
+static void imapc_mailbox_get_capabilities(struct imapc_mailbox *mbox)
{
- enum imapc_capability capa =
- imapc_client_get_capabilities(mbox->storage->client->client);
+ mbox->capabilities = imapc_client_get_capabilities(mbox->storage->client->client);
+}
+static void imapc_mailbox_get_extensions(struct imapc_mailbox *mbox)
+{
if (mbox->guid_fetch_field_name == NULL) {
/* see if we can get message GUIDs somehow */
- if ((capa & IMAPC_CAPABILITY_X_GM_EXT_1) != 0) {
+ if ((mbox->capabilities & IMAPC_CAPABILITY_X_GM_EXT_1) != 0) {
/* GMail */
mbox->guid_fetch_field_name = "X-GM-MSGID";
}
if (mbox->storage->client->auth_failed) {
return -1;
}
+ imapc_mailbox_get_capabilities(mbox);
if (imapc_mailbox_has_modseqs(mbox)) {
if (!array_is_created(&mbox->rseq_modseqs))
struct imapc_simple_context sctx;
string_t *str;
+ imapc_mailbox_get_capabilities(mbox);
+
str = t_str_new(256);
if ((items & STATUS_MESSAGES) != 0)
str_append(str, " MESSAGES");
return 0;
}
-static int imapc_mailbox_get_namespaces(struct imapc_storage *storage)
+static int imapc_mailbox_get_namespaces(struct imapc_mailbox *mbox)
{
- enum imapc_capability capa;
+ struct imapc_storage *storage = mbox->storage;
struct imapc_command *cmd;
struct imapc_simple_context sctx;
if (storage->namespaces_requested)
return 0;
- capa = imapc_client_get_capabilities(storage->client->client);
- if ((capa & IMAPC_CAPABILITY_NAMESPACE) == 0) {
+ imapc_mailbox_get_capabilities(mbox);
+ if ((mbox->capabilities & IMAPC_CAPABILITY_NAMESPACE) == 0) {
/* NAMESPACE capability not supported */
return 0;
}
items &= ~MAILBOX_METADATA_GUID;
}
if ((items & MAILBOX_METADATA_BACKEND_NAMESPACE) != 0) {
- if (imapc_mailbox_get_namespaces(mbox->storage) < 0)
+ if (imapc_mailbox_get_namespaces(mbox) < 0)
return -1;
ns = imapc_namespace_find_mailbox(mbox->storage, box->name);
struct imapc_mailbox *mbox = (struct imapc_mailbox *)box;
const struct mail_storage_settings *set = box->storage->set;
struct imapc_command *cmd;
- enum imapc_capability capa;
if (box->notify_callback == NULL) {
if (mbox->to_idle_check != NULL)
return;
}
- capa = imapc_client_get_capabilities(mbox->storage->client->client);
- if ((capa & IMAPC_CAPABILITY_IDLE) != 0) {
+ if ((mbox->capabilities & 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
static void imapc_sync_expunge_finish(struct imapc_sync_context *ctx)
{
string_t *str;
- enum imapc_capability caps;
if (array_count(&ctx->expunged_uids) == 0)
return;
- caps = imapc_client_get_capabilities(ctx->mbox->storage->client->client);
- if ((caps & IMAPC_CAPABILITY_UIDPLUS) == 0) {
+ if ((ctx->mbox->capabilities & IMAPC_CAPABILITY_UIDPLUS) == 0) {
/* just expunge everything */
imapc_sync_cmd(ctx, "EXPUNGE");
return;
static void
imapc_noop_if_needed(struct imapc_mailbox *mbox, enum mailbox_sync_flags flags)
{
- enum imapc_capability capabilities;
-
- capabilities = imapc_client_get_capabilities(mbox->storage->client->client);
if (!mbox->initial_sync_done) {
/* we just SELECTed/EXAMINEd the mailbox, don't do another
NOOP. */
- } else if ((capabilities & IMAPC_CAPABILITY_IDLE) == 0 ||
+ } else if ((mbox->capabilities & IMAPC_CAPABILITY_IDLE) == 0 ||
(flags & MAILBOX_SYNC_FLAG_FULL_READ) != 0) {
/* do NOOP to make sure we have the latest changes before
starting sync. this is necessary either because se don't