NeoMutt  2023-05-17-33-gce4425
Teaching an old dog new tricks
DOXYGEN
lib.h
Go to the documentation of this file.
1
69#ifndef MUTT_HCACHE_LIB_H
70#define MUTT_HCACHE_LIB_H
71
72#include <stddef.h>
73#include <stdbool.h>
74#include <stdint.h>
75
76struct Buffer;
77struct Email;
78
88{
89 char *folder;
90 unsigned int crc;
91 void *ctx;
92 void *cctx;
93};
94
99{
100 uint32_t uidvalidity;
101 unsigned int crc;
102 struct Email *email;
103};
104
113typedef void (*hcache_namer_t)(const char *path, struct Buffer *dest);
114
124struct HeaderCache *mutt_hcache_open(const char *path, const char *folder, hcache_namer_t namer);
125
130void mutt_hcache_close(struct HeaderCache *hc);
131
142int mutt_hcache_store(struct HeaderCache *hc, const char *key, size_t keylen,
143 struct Email *e, uint32_t uidvalidity);
144
156struct HCacheEntry mutt_hcache_fetch(struct HeaderCache *hc, const char *key, size_t keylen, uint32_t uidvalidity);
157
158char *mutt_hcache_fetch_str(struct HeaderCache *hc, const char *key, size_t keylen);
159bool mutt_hcache_fetch_obj_(struct HeaderCache *hc, const char *key, size_t keylen, void *dst, size_t dstlen);
160#define mutt_hcache_fetch_obj(hc, key, keylen, dst) mutt_hcache_fetch_obj_(hc, key, keylen, dst, sizeof(*dst))
161
162int mutt_hcache_store_raw(struct HeaderCache *hc, const char *key, size_t keylen,
163 void *data, size_t dlen);
164
173int mutt_hcache_delete_record(struct HeaderCache *hc, const char *key, size_t keylen);
174
175#endif /* MUTT_HCACHE_LIB_H */
bool mutt_hcache_fetch_obj_(struct HeaderCache *hc, const char *key, size_t keylen, void *dst, size_t dstlen)
Fetch a message's header from the cache into a destination object.
Definition: hcache.c:574
int mutt_hcache_store(struct HeaderCache *hc, const char *key, size_t keylen, struct Email *e, uint32_t uidvalidity)
Store a Header along with a validity datum.
Definition: hcache.c:616
void mutt_hcache_close(struct HeaderCache *hc)
Close the connection to the header cache.
Definition: hcache.c:489
struct HeaderCache * mutt_hcache_open(const char *path, const char *folder, hcache_namer_t namer)
Open the connection to the header cache.
Definition: hcache.c:379
int mutt_hcache_delete_record(struct HeaderCache *hc, const char *key, size_t keylen)
Delete a key / data pair.
Definition: hcache.c:695
int mutt_hcache_store_raw(struct HeaderCache *hc, const char *key, size_t keylen, void *data, size_t dlen)
Store a key / data pair.
Definition: hcache.c:674
void(* hcache_namer_t)(const char *path, struct Buffer *dest)
Definition: lib.h:113
struct HCacheEntry mutt_hcache_fetch(struct HeaderCache *hc, const char *key, size_t keylen, uint32_t uidvalidity)
Fetch and validate a message's header from the cache.
Definition: hcache.c:513
char * mutt_hcache_fetch_str(struct HeaderCache *hc, const char *key, size_t keylen)
Fetch a string from the cache.
Definition: hcache.c:600
String manipulation buffer.
Definition: buffer.h:34
The envelope/body of an email.
Definition: email.h:37
char * path
Path of Email (for local Mailboxes)
Definition: email.h:68
Wrapper for Email retrieved from the header cache.
Definition: lib.h:99
uint32_t uidvalidity
IMAP-specific UIDVALIDITY.
Definition: lib.h:100
struct Email * email
Retrieved email.
Definition: lib.h:102
unsigned int crc
CRC of Email/Body/etc structs.
Definition: lib.h:101
Header cache structure.
Definition: lib.h:88
void * ctx
Store context (handle)
Definition: lib.h:91
unsigned int crc
CRC of the cache entry.
Definition: lib.h:90
char * folder
Folder name.
Definition: lib.h:89
void * cctx
Compression context (handle)
Definition: lib.h:92