/* Copyright (c) 2007-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "istream.h"
#include "str.h"
#include "index-storage.h"
#include "index-mail.h"
#include "index-pop3-uidl.h"
#include "dbox-attachment.h"
#include "dbox-storage.h"
#include "dbox-file.h"
#include "dbox-mail.h"
struct mail *
struct mailbox_header_lookup_ctx *wanted_headers)
{
}
{
/* close the dbox file only after index is closed, since it may still
try to read from it. */
}
{
return -1;
return -1;
if (dbox_file_metadata_read(*file_r) <= 0)
return -1;
/* we just messed up mail's input stream by reading metadata */
}
return 0;
}
static int
const char **value_r)
{
return -1;
return 0;
}
{
return 0;
return -1;
return 0;
}
{
const char *value;
return 0;
&value) < 0)
return -1;
return -1;
return 0;
}
{
const char *value;
return 0;
&value) < 0)
return -1;
time = 0;
return -1;
return 0;
}
{
return 0;
return -1;
return -1;
}
return 0;
}
static int
enum index_cache_field cache_field,
const char **value_r)
{
const char *value;
if (cache_field == MAIL_CACHE_POP3_ORDER) {
str_truncate(str, 0);
if (order != 0)
else {
/* order=0 means it doesn't exist. we don't
want to return "0" though, because then the
mails get ordered to beginning, while
nonexistent are supposed to be ordered at
the end. */
}
}
return 0;
}
return -1;
value = "";
if (cache_field != MAIL_CACHE_POP3_ORDER) {
} else {
order = 0;
}
/* don't return pointer to dbox metadata directly, since it may
change unexpectedly */
str_truncate(str, 0);
return 0;
}
const char **value_r)
{
int ret;
/* keep the UIDL in cache file, otherwise POP3 would open all
mail files and read the metadata. same for GUIDs if they're
used. */
switch (field) {
case MAIL_FETCH_UIDL_BACKEND:
if (!index_pop3_uidl_can_exist(_mail)) {
*value_r = "";
return 0;
}
if (ret == 0) {
(*value_r)[0] != '\0');
}
return ret;
case MAIL_FETCH_POP3_ORDER:
if (!index_pop3_uidl_can_exist(_mail)) {
/* we're assuming that if there's a POP3 order, there's
also a UIDL */
*value_r = "";
return 0;
}
case MAIL_FETCH_GUID:
default:
break;
}
}
static int
{
int ret;
return ret;
}
return -1;
}
return 1;
else
}
struct message_size *hdr_size,
struct message_size *body_size,
{
int ret;
return -1;
if (ret <= 0) {
if (ret < 0)
return -1;
"uid=%u points to broken data at offset="
return -1;
}
}
stream_r);
}