01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen#ifndef POP3C_STORAGE_H
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen#define POP3C_STORAGE_H
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen#include "index-storage.h"
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen#define POP3C_STORAGE_NAME "pop3c"
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainenstruct pop3c_storage {
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen struct mail_storage storage;
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen const struct pop3c_settings *set;
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen};
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainenstruct pop3c_mailbox {
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen struct mailbox box;
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen struct pop3c_storage *storage;
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen struct pop3c_client *client;
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen pool_t uidl_pool;
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen unsigned int msg_count;
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen /* LIST sizes */
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen uoff_t *msg_sizes;
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen /* UIDL strings */
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen const char *const *msg_uidls;
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen /* index UIDs for each message in this session.
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen the UID may not exist for the entire session */
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen uint32_t *msg_uids;
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool logged_in:1;
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen};
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen
afc77c5375cdb8f2bf0ab6280d9229ac27c933c6Timo Sirainenstruct pop3c_mail {
afc77c5375cdb8f2bf0ab6280d9229ac27c933c6Timo Sirainen struct index_mail imail;
84a5175b9768da401404635c9b606264585739bdTimo Sirainen struct istream *prefetch_stream;
afc77c5375cdb8f2bf0ab6280d9229ac27c933c6Timo Sirainen
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool prefetching:1;
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool prefetching_body:1;
afc77c5375cdb8f2bf0ab6280d9229ac27c933c6Timo Sirainen};
afc77c5375cdb8f2bf0ab6280d9229ac27c933c6Timo Sirainen
95d62f8d6d281cc488dc4f488d4388701e559012Josef 'Jeff' Sipek#define POP3C_STORAGE(s) container_of(s, struct pop3c_storage, storage)
95d62f8d6d281cc488dc4f488d4388701e559012Josef 'Jeff' Sipek#define POP3C_MAILBOX(s) container_of(s, struct pop3c_mailbox, box)
120e61ccce21fd33d6b55b6f27346e1690b64bd8Josef 'Jeff' Sipek#define POP3C_MAIL(s) container_of(s, struct pop3c_mail, imail.mail.mail)
95d62f8d6d281cc488dc4f488d4388701e559012Josef 'Jeff' Sipek
afc77c5375cdb8f2bf0ab6280d9229ac27c933c6Timo Sirainenstruct mail *
afc77c5375cdb8f2bf0ab6280d9229ac27c933c6Timo Sirainenpop3c_mail_alloc(struct mailbox_transaction_context *t,
afc77c5375cdb8f2bf0ab6280d9229ac27c933c6Timo Sirainen enum mail_fetch_field wanted_fields,
afc77c5375cdb8f2bf0ab6280d9229ac27c933c6Timo Sirainen struct mailbox_header_lookup_ctx *wanted_headers);
afc77c5375cdb8f2bf0ab6280d9229ac27c933c6Timo Sirainen
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainenextern struct mail_vfuncs pop3c_mail_vfuncs;
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen
01435c38e7d671d5a892c4b802cfb204881cd454Timo Sirainen#endif