imapc-mail-fetch.c revision 9ed77dd00248e88d731ec129116db5dddc0dd3b5
/* Copyright (c) 2011 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "str.h"
#include "istream.h"
#include "imap-arg.h"
#include "imap-date.h"
#include "imapc-client.h"
#include "imapc-mail.h"
#include "imapc-storage.h"
static void
void *context)
{
struct imapc_mailbox *mbox =
if (--mail->fetch_count == 0) {
struct imapc_mail *const *fetch_mails;
unsigned int i, count;
for (i = 0; i < count; i++) {
if (fetch_mails[i] == mail) {
break;
}
}
mail->fetching_fields = 0;
}
;
reply);
} else {
}
}
static int
{
struct imapc_client_mailbox *client_box;
return -1;
/* drop any fields that we may already be fetching currently */
if (fields == 0)
return 0;
if ((fields & MAIL_FETCH_STREAM_BODY) != 0)
return -1;
if ((fields & MAIL_FETCH_RECEIVED_DATE) != 0)
if ((fields & MAIL_FETCH_STREAM_BODY) != 0)
else if ((fields & MAIL_FETCH_STREAM_HEADER) != 0)
if (mail->fetch_count++ == 0)
return 0;
}
{
enum mail_fetch_field fields = 0;
else
}
} T_END;
}
static bool
{
if ((fields & MAIL_FETCH_RECEIVED_DATE) != 0) {
return FALSE;
}
if ((fields & (MAIL_FETCH_STREAM_HEADER |
MAIL_FETCH_STREAM_BODY)) != 0) {
return FALSE;
}
return TRUE;
}
{
struct imapc_storage *storage =
int ret;
T_BEGIN {
} T_END;
if (ret < 0)
return -1;
/* we'll continue waiting until we've got all the fields we wanted,
or until all FETCH replies have been received (i.e. some FETCHes
failed) */
return 0;
}
{
unsigned int i, count;
for (i = 0; i < reply->file_args_count; i++) {
return TRUE;
}
}
return FALSE;
}
static void
const struct imapc_untagged_reply *reply,
{
const char *value;
if (!body)
return;
/* maybe the existing stream has no body. replace it. */
}
return;
i_error("dup() failed: %m");
return;
}
} else {
return;
return;
}
}
}
return;
}
} else if (body) {
if (ret < 0) {
return;
}
/* we'll assume that the remote server is working properly and
sending CRLF linefeeds */
}
}
const struct imapc_untagged_reply *reply,
{
struct imapc_mailbox *mbox =
unsigned int i;
time_t t;
int tz;
break;
}
}
if (!match) {
/* this is only a FETCH FLAGS update for the wanted mail */
} else {
}
}