index-mail.c revision dfbf03518468bee9a2ca54c104a9be71b38d4436
/* Copyright (C) 2002 Timo Sirainen */
#include "lib.h"
#include "istream.h"
#include "str.h"
#include "message-address.h"
#include "message-date.h"
#include "message-part-serialize.h"
#include "imap-bodystructure.h"
#include "imap-envelope.h"
#include "mail-index.h"
#include "mail-index-util.h"
#include "mail-custom-flags.h"
#include "index-storage.h"
#include "index-mail.h"
#include <ctype.h>
{
struct message_part *part;
const void *part_data;
const char *error;
return NULL;
}
&error);
"Corrupted cached message_part data (%s)", error);
return NULL;
}
/* we know the NULs now, update them */
} else {
}
return part;
}
enum mail_data_field field)
{
const char *ret;
}
enum mail_data_field field,
const char *field_name)
{
"Corrupted cached %s", field_name);
}
}
{
}
{
"Corrupted cached received time");
}
}
{
int deleted;
return FALSE;
}
return TRUE;
}
{
struct cached_header *hdr;
}
{
const char *const *tmp;
}
}
{
struct cached_header *cached_hdr;
if (data->save_envelope) {
/* finalize the envelope */
}
}
/* end of headers */
if (data->save_sent_time) {
/* not found */
data->sent_timezone = 0;
}
return;
}
return;
}
&data->sent_timezone)) {
/* 0 == parse error */
data->sent_timezone = 0;
}
}
while (cached_hdr != NULL) {
/* save only the first header */
break;
break;
}
break;
}
}
}
{
if (!open_stream(mail, 0))
return FALSE;
return TRUE;
}
{
}
{
}
if (!open_stream(mail, 0))
return NULL;
/* we know the NULs now, update them */
} else {
}
}
{
return data->received_date;
return data->received_date;
}
return data->received_date;
}
{
const char *result;
}
} else {
&result))
return (time_t)-1;
if (!message_date_parse((const unsigned char *) result,
&data->sent_timezone))
}
}
{
}
}
{
"header size");
}
}
}
}
}
{
}
if (!get_msgpart_sizes(mail)) {
if (data->parse_header)
}
}
/* maybe it's binary */
}
/* have to parse, slow.. */
return (uoff_t)-1;
}
}
}
{
struct cached_header *hdr;
enum imap_envelope_field env_field = 0;
const char *str;
char *ret;
}
/* if we have to parse the header, do it even if we could use
envelope - envelope parsing would just slow up. */
}
return NULL;
} else {
t_push();
&str))
t_pop();
return ret;
}
}
static const struct message_address *
{
const char *str;
/* don't bother with checking envelope - we're most likely
creating it */
return NULL;
}
{
enum imap_envelope_field env_field;
const char *str;
/* prefer parsing envelope - faster than having to actually
parse the header field */
t_push();
&str))
t_pop();
} else {
struct message_address *addr;
return NULL;
(const unsigned char *) str,
}
return ret;
}
struct message_size *hdr_size,
struct message_size *body_size)
{
if (!open_stream(mail, 0))
return NULL;
if (!get_msgpart_sizes(mail))
}
if (!data->hdr_size_set) {
NULL);
}
}
if (!data->body_size_set) {
NULL);
}
}
}
{
char *str;
switch (field) {
case MAIL_FETCH_IMAP_BODY:
/* fall through */
if (field == MAIL_FETCH_IMAP_BODYSTRUCTURE)
return data->bodystructure;
/* create BODY from cached BODYSTRUCTURE */
t_push();
data->bodystructure));
t_pop();
}
t_push();
t_pop();
if (field == MAIL_FETCH_IMAP_BODYSTRUCTURE)
else
return str;
case MAIL_FETCH_IMAP_ENVELOPE:
}
default:
i_unreached();
return NULL;
}
}
static struct mail index_mail = {
0, 0, 0, 0, 0, 0,
};
const char *const wanted_headers[])
{
}
{
t_push();
/* close the old one */
/* if some wanted fields are cached, get them */
}
/* see if we have to parse the message */
parse_header = TRUE;
parse_header = TRUE;
/* FIXME: this isn't helping really.. */
const char *const *tmp;
enum imap_envelope_field env_field;
else {
parse_header = TRUE;
break;
}
}
}
if (!parse_header && envelope_headers &&
parse_header = TRUE;
}
if (open_mail || parse_header) {
int deleted;
else
ret = 1;
} else {
/* check this only after open_mail() */
}
ret = 1;
}
t_pop();
return ret;
}
{
}
}