mail.c revision c7e14824e4e1ca9dc5d48d1eddc4a38d3041218f
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen/* Copyright (c) 2002-2011 Dovecot authors, see the included COPYING file */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenstruct mail *mail_alloc(struct mailbox_transaction_context *t,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct mailbox_header_lookup_ctx *wanted_headers)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen mail = t->box->v.mail_alloc(t, wanted_fields, wanted_headers);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct mail_private *p = (struct mail_private *)*mail;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenvoid mail_set_seq(struct mail *mail, uint32_t seq)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenbool mail_set_uid(struct mail *mail, uint32_t uid)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenenum mail_flags mail_get_flags(struct mail *mail)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenconst char *const *mail_get_keywords(struct mail *mail)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenconst ARRAY_TYPE(keyword_indexes) *mail_get_keyword_indexes(struct mail *mail)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenint mail_get_parts(struct mail *mail, struct message_part **parts_r)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenint mail_get_date(struct mail *mail, time_t *date_r, int *timezone_r)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen return p->v.get_date(mail, date_r, timezone_r);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenint mail_get_received_date(struct mail *mail, time_t *date_r)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
b4ddb5b3c3722620a8fef387dd8c47bb411a5643Timo Sirainenint mail_get_save_date(struct mail *mail, time_t *date_r)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenint mail_get_virtual_size(struct mail *mail, uoff_t *size_r)
b4ddb5b3c3722620a8fef387dd8c47bb411a5643Timo Sirainen struct mail_private *p = (struct mail_private *)mail;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenint mail_get_physical_size(struct mail *mail, uoff_t *size_r)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenint mail_get_first_header(struct mail *mail, const char *field,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen const char **value_r)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen return p->v.get_first_header(mail, field, FALSE, value_r);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenint mail_get_first_header_utf8(struct mail *mail, const char *field,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen const char **value_r)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen return p->v.get_first_header(mail, field, TRUE, value_r);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenint mail_get_headers(struct mail *mail, const char *field,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen const char *const **value_r)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen return p->v.get_headers(mail, field, FALSE, value_r);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenint mail_get_headers_utf8(struct mail *mail, const char *field,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen const char *const **value_r)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen return p->v.get_headers(mail, field, TRUE, value_r);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen return p->v.get_header_stream(mail, headers, stream_r);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen mail_storage_set_error(mail->box->storage, MAIL_ERROR_NOTPOSSIBLE,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen "Mail field not cached");
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenint mail_get_stream(struct mail *mail, struct message_size *hdr_size,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct message_size *body_size, struct istream **stream_r)
b4ddb5b3c3722620a8fef387dd8c47bb411a5643Timo Sirainen struct mail_private *p = (struct mail_private *)mail;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen if (mail->lookup_abort != MAIL_LOOKUP_ABORT_NEVER)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen return p->v.get_stream(mail, hdr_size, body_size, stream_r);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenint mail_get_special(struct mail *mail, enum mail_fetch_field field,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen const char **value_r)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen return p->v.get_special(mail, field, value_r);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenstruct mail *mail_get_real_mail(struct mail *mail)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenvoid mail_update_flags(struct mail *mail, enum modify_type modify_type,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenvoid mail_update_keywords(struct mail *mail, enum modify_type modify_type,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen p->v.update_keywords(mail, modify_type, keywords);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenvoid mail_update_modseq(struct mail *mail, uint64_t min_modseq)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenvoid mail_update_pop3_uidl(struct mail *mail, const char *uidl)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
const char *mail_generate_guid_string(void)
static unsigned int pid = 0;
for (i = 0; i < MAIL_GUID_128_SIZE; i++) {
if (guid_128[i] != 0)
return FALSE;
return TRUE;