imap-message-cache.h revision 7317807bed321d9d8a7e7b9086947f38e2d9e333
#ifndef __IMAP_MESSAGE_CACHE_H
#define __IMAP_MESSAGE_CACHE_H
/* IMAP message cache. Caches are mailbox-specific and must be cleared
if UID validity changes. Also if message data may have changed,
imap_msgcache_close() must be called.
Caching is mostly done to avoid parsing the same message multiple times
when client fetches the message in parts.
*/
#include "message-parser.h"
typedef enum {
IMAP_CACHE_BODY = 0x01,
IMAP_CACHE_BODYSTRUCTURE = 0x02,
IMAP_CACHE_ENVELOPE = 0x04,
IMAP_CACHE_MESSAGE_OPEN = 0x08,
IMAP_CACHE_MESSAGE_PART = 0x10,
IMAP_CACHE_MESSAGE_HDR_SIZE = 0x20,
IMAP_CACHE_MESSAGE_BODY_SIZE = 0x40
typedef struct _ImapMessageCache ImapMessageCache;
ImapMessageCache *imap_msgcache_alloc(void);
/* Returns TRUE if all given fields are fully cached, or at least the
message is open (ie. you don't need imap_msgcache_message()). */
/* Parse and cache the message. If pv_headers_size and pv_body_size is
non-zero, they're set to saved to message's both physical and virtual
sizes (ie. doesn't need to be calculated). */
void *user_data),
void *user_data);
/* Close the IOBuffer for cached message. */
/* Store a value for field in cache */
/* Returns the field from cache, or NULL if it's not cached. */
/* Returns the root MessagePart for message, or NULL if it's not cached. */
/* Returns FALSE if message isn't in cache. If inbuf is not NULL, it's set
to point to beginning of message, or to beginning of message body if
hdr_size is NULL. */
/* Returns FALSE if message isn't in cache. *inbuf is set to point to the first
non-skipped character. size is set to specify the full size of message. */
/* Returns FALSE if message isn't in cache. *inbuf is set to point to
beginning of message. */
#endif