pop3c-mail.c revision 5f8d497e88fae77fbeb625246bc18260f6775b83
/* Copyright (c) 2011-2016 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "ioloop.h"
#include "istream.h"
#include "index-mail.h"
#include "pop3c-settings.h"
#include "pop3c-client.h"
#include "pop3c-sync.h"
#include "pop3c-storage.h"
struct mail *
pop3c_mail_alloc(struct mailbox_transaction_context *t,
struct mailbox_header_lookup_ctx *wanted_headers)
{
struct pop3c_mail *mail;
}
{
/* wait for any prefetch to finish before closing the mail */
while (pmail->prefetching)
}
{
int tz;
/* we don't care about the date, just return the current date */
*date_r = ioloop_time;
return 0;
}
/* FIXME: we could also parse the first Received: header and get
the date from there, but since this code is unlikely to be called
except during migration, I don't think it really matters. */
}
{
/* FIXME: we could use a value stored in cache */
}
return 0;
}
{
/* virtual size is already known. it's the same as our
(correct) physical size */
return 0;
}
return 0;
}
/* kludge: we want output for POP3 LIST with
pop3_fast_size_lookups=yes. use the remote's LIST values
regardless of their correctness */
if (pop3c_sync_get_sizes(mbox) < 0)
return -1;
}
return 0;
}
/* slow way: get the whole message body */
return -1;
return 0;
}
{
unsigned int cache_idx;
return;
/* make sure it's not cached twice */
}
}
static void
{
switch (state) {
case POP3C_COMMAND_STATE_OK:
break;
case POP3C_COMMAND_STATE_ERR:
/* let pop3c_mail_get_stream() figure out the error handling.
in case of a -ERR a retry might even work. */
break;
}
}
{
enum pop3c_capability capa;
const char *cmd;
if (pmail->prefetching_body)
else
return !pmail->prefetching;
}
return index_mail_prefetch(_mail);
}
static int
struct message_size *hdr_size,
{
enum pop3c_capability capa;
while (pmail->prefetching) {
/* wait for prefetch to finish */
}
}
/* we've fetched the body */
/* we've fetched the header, but we need the body
now too */
} else {
}
}
} else {
}
return -1;
}
return -1;
}
}
if (get_body)
}
/* if this stream is used by some filter stream, make the
filter stream blocking */
}
static int
const char **value_r)
{
switch (field) {
case MAIL_FETCH_UIDL_BACKEND:
case MAIL_FETCH_GUID:
if (pop3c_sync_get_uidls(mbox) < 0)
return -1;
}
return 0;
default:
}
}
struct mail_vfuncs pop3c_mail_vfuncs = {
NULL,
};