index-mail.h revision a12399903f415a7e14c2816cffa2f7a09dcbb097
#ifndef __INDEX_MAIL_H
#define __INDEX_MAIL_H
#include "message-size.h"
#include "mail-cache.h"
#include "mail-storage-private.h"
enum index_cache_field {
/* fixed size fields */
MAIL_CACHE_FLAGS = 0,
/* variable sized field */
};
#define IMAP_BODY_PLAIN_7BIT_ASCII \
"\"text\" \"plain\" (\"charset\" \"us-ascii\") NIL NIL \"7bit\""
enum mail_cache_record_flag {
/* If binary flags are set, it's not checked whether mail is
missing CRs. So this flag may be set as an optimization for
regular non-binary mails as well if it's known that it contains
valid CR+LF line breaks. */
MAIL_CACHE_FLAG_BINARY_HEADER = 0x0001,
MAIL_CACHE_FLAG_BINARY_BODY = 0x0002,
/* Mail header or body is known to contain NUL characters. */
MAIL_CACHE_FLAG_HAS_NULS = 0x0004,
/* Mail header or body is known to not contain NUL characters. */
MAIL_CACHE_FLAG_HAS_NO_NULS = 0x0008,
/* BODY is IMAP_BODY_PLAIN_7BIT_ASCII and rest of BODYSTRUCTURE
fields are NIL */
};
enum index_mail_access_part {
READ_HDR = 0x01,
READ_BODY = 0x02,
PARSE_HDR = 0x04,
PARSE_BODY = 0x08
};
struct mail_sent_date {
};
struct index_mail_line {
unsigned int field_idx;
unsigned int cache:1;
};
struct message_header_line;
struct index_mail_data {
enum mail_flags flags;
struct mail_sent_date sent_date;
struct index_mail_line parse_line;
struct message_part *parts;
struct message_part_envelope_data *envelope_data;
const struct mail_index_record *rec;
struct message_parser_ctx *parser_ctx;
int parsing_count;
const struct mail_cache_field *all_cache_fields;
unsigned int all_cache_fields_count;
unsigned int save_sent_date:1;
unsigned int save_envelope:1;
unsigned int save_bodystructure_header:1;
unsigned int save_bodystructure_body:1;
unsigned int save_message_parts:1;
unsigned int parsed_bodystructure:1;
unsigned int hdr_size_set:1;
unsigned int body_size_set:1;
unsigned int messageparts_saved_to_cache:1;
unsigned int header_parsed:1;
};
struct index_mail {
struct mail_private mail;
struct index_mail_data data;
struct index_mailbox *ibox;
struct index_transaction_context *trans;
struct index_header_lookup_ctx *wanted_headers;
/* per-mail variables, here for performance reasons: */
};
struct mail *
index_mail_alloc(struct mailbox_transaction_context *t,
struct mailbox_header_lookup_ctx *wanted_headers);
struct mailbox_header_lookup_ctx *headers);
struct message_header_line *hdr,
struct index_mail *mail);
struct mailbox_header_lookup_ctx *headers);
const char *const *
struct istream *
struct mailbox_header_lookup_ctx *headers);
struct message_size *hdr_size,
struct message_size *body_size);
enum mail_fetch_field field);
enum mail_flags flags);
struct mail_keywords *keywords);
enum index_cache_field field);
#endif