mail.c revision 87460b08cb97b31cde640d4975a6aa2c1d0e7226
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen/* Copyright (C) 2002-2003 Timo Sirainen */
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen#include "lib.h"
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen#include "ioloop.h"
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen#include "mail-storage-private.h"
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainenstruct mail *mail_alloc(struct mailbox_transaction_context *t,
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen enum mail_fetch_field wanted_fields,
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen struct mailbox_header_lookup_ctx *wanted_headers)
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen{
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen return t->box->v.mail_alloc(t, wanted_fields, wanted_headers);
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen}
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainenvoid mail_free(struct mail *mail)
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen{
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen return p->v.free(mail);
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen}
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainenint mail_set_seq(struct mail *mail, uint32_t seq)
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen{
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen return p->v.set_seq(mail, seq);
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen}
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainenenum mail_flags mail_get_flags(struct mail *mail)
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen{
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen return p->v.get_flags(mail);
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen}
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainenconst char *const *mail_get_keywords(struct mail *mail)
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen{
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen struct mail_private *p = (struct mail_private *)mail;
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen return p->v.get_keywords(mail);
a4ac325c2802693c6b761e5a8fda961e5d7490eaTimo Sirainen}
const struct message_part *mail_get_parts(struct mail *mail)
{
struct mail_private *p = (struct mail_private *)mail;
return p->v.get_parts(mail);
}
time_t mail_get_received_date(struct mail *mail)
{
struct mail_private *p = (struct mail_private *)mail;
return p->v.get_received_date(mail);
}
time_t mail_get_date(struct mail *mail, int *timezone)
{
struct mail_private *p = (struct mail_private *)mail;
return p->v.get_date(mail, timezone);
}
uoff_t mail_get_virtual_size(struct mail *mail)
{
struct mail_private *p = (struct mail_private *)mail;
return p->v.get_virtual_size(mail);
}
uoff_t mail_get_physical_size(struct mail *mail)
{
struct mail_private *p = (struct mail_private *)mail;
return p->v.get_physical_size(mail);
}
const char *mail_get_first_header(struct mail *mail, const char *field)
{
struct mail_private *p = (struct mail_private *)mail;
return p->v.get_first_header(mail, field);
}
const char *const *mail_get_headers(struct mail *mail, const char *field)
{
struct mail_private *p = (struct mail_private *)mail;
return p->v.get_headers(mail, field);
}
struct istream *
mail_get_header_stream(struct mail *mail,
struct mailbox_header_lookup_ctx *headers)
{
struct mail_private *p = (struct mail_private *)mail;
return p->v.get_header_stream(mail, headers);
}
struct istream *mail_get_stream(struct mail *mail,
struct message_size *hdr_size,
struct message_size *body_size)
{
struct mail_private *p = (struct mail_private *)mail;
return p->v.get_stream(mail, hdr_size, body_size);
}
const char *mail_get_special(struct mail *mail, enum mail_fetch_field field)
{
struct mail_private *p = (struct mail_private *)mail;
return p->v.get_special(mail, field);
}
int mail_update_flags(struct mail *mail, enum modify_type modify_type,
enum mail_flags flags)
{
struct mail_private *p = (struct mail_private *)mail;
return p->v.update_flags(mail, modify_type, flags);
}
int mail_update_keywords(struct mail *mail, enum modify_type modify_type,
struct mail_keywords *keywords)
{
struct mail_private *p = (struct mail_private *)mail;
return p->v.update_keywords(mail, modify_type, keywords);
}
int mail_expunge(struct mail *mail)
{
struct mail_private *p = (struct mail_private *)mail;
return p->v.expunge(mail);
}