NeoMutt  2023-11-03-85-g512e01
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
msg_save_hcache()

Save message to the header cache. More...

+ Collaboration diagram for msg_save_hcache():

Functions

static int comp_msg_save_hcache (struct Mailbox *m, struct Email *e)
 Save message to the header cache - Implements MxOps::msg_save_hcache() -.
 
int imap_msg_save_hcache (struct Mailbox *m, struct Email *e)
 Save message to the header cache - Implements MxOps::msg_save_hcache() -.
 
static int maildir_msg_save_hcache (struct Mailbox *m, struct Email *e)
 Save message to the header cache - Implements MxOps::msg_save_hcache() -.
 
static int mh_msg_save_hcache (struct Mailbox *m, struct Email *e)
 Save message to the header cache - Implements MxOps::msg_save_hcache() -.
 
static int pop_msg_save_hcache (struct Mailbox *m, struct Email *e)
 Save message to the header cache - Implements MxOps::msg_save_hcache() -.
 

Detailed Description

Save message to the header cache.

Parameters
mMailbox
eEmail
Return values
0Success
-1Failure
Precondition
m is not NULL
e is not NULL

Function Documentation

◆ comp_msg_save_hcache()

static int comp_msg_save_hcache ( struct Mailbox m,
struct Email e 
)
static

Save message to the header cache - Implements MxOps::msg_save_hcache() -.

Definition at line 844 of file compress.c.

845{
846 if (!m->compress_info)
847 return 0;
848
849 struct CompressInfo *ci = m->compress_info;
850
851 const struct MxOps *ops = ci->child_ops;
852 if (!ops || !ops->msg_save_hcache)
853 return 0;
854
855 return ops->msg_save_hcache(m, e);
856}
Private data for compress.
Definition: lib.h:47
const struct MxOps * child_ops
callbacks of de-compressed file
Definition: lib.h:52
void * compress_info
Compressed mbox module private data.
Definition: mailbox.h:120
Definition: mxapi.h:91
int(* msg_save_hcache)(struct Mailbox *m, struct Email *e)
Definition: mxapi.h:289

◆ imap_msg_save_hcache()

int imap_msg_save_hcache ( struct Mailbox m,
struct Email e 
)

Save message to the header cache - Implements MxOps::msg_save_hcache() -.

Definition at line 2181 of file message.c.

2182{
2183 int rc = 0;
2184#ifdef USE_HCACHE
2185 bool close_hc = true;
2187 struct ImapMboxData *mdata = imap_mdata_get(m);
2188 if (!mdata || !adata)
2189 return -1;
2190 if (mdata->hcache)
2191 close_hc = false;
2192 else
2193 imap_hcache_open(adata, mdata);
2194 rc = imap_hcache_put(mdata, e);
2195 if (close_hc)
2197#endif
2198 return rc;
2199}
struct ImapAccountData * imap_adata_get(struct Mailbox *m)
Get the Account data for this mailbox.
Definition: adata.c:123
struct ImapMboxData * imap_mdata_get(struct Mailbox *m)
Get the Mailbox data for this mailbox.
Definition: mdata.c:60
int imap_hcache_put(struct ImapMboxData *mdata, struct Email *e)
Add an entry to the header cache.
Definition: util.c:378
void imap_hcache_close(struct ImapMboxData *mdata)
Close the header cache.
Definition: util.c:338
void imap_hcache_open(struct ImapAccountData *adata, struct ImapMboxData *mdata)
Open a header cache.
Definition: util.c:297
void * adata
Private data (for Mailbox backends)
Definition: account.h:43
IMAP-specific Account data -.
Definition: adata.h:40
IMAP-specific Mailbox data -.
Definition: mdata.h:40
void * mdata
Driver specific data.
Definition: mailbox.h:131
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maildir_msg_save_hcache()

static int maildir_msg_save_hcache ( struct Mailbox m,
struct Email e 
)
static

Save message to the header cache - Implements MxOps::msg_save_hcache() -.

Definition at line 1716 of file maildir.c.

1717{
1718 int rc = 0;
1719#ifdef USE_HCACHE
1720 const char *const c_header_cache = cs_subset_path(NeoMutt->sub, "header_cache");
1721 struct HeaderCache *hc = hcache_open(c_header_cache, mailbox_path(m), NULL);
1722 const char *key = maildir_hcache_key(e);
1723 int keylen = maildir_hcache_keylen(key);
1724 rc = hcache_store(hc, key, keylen, e, 0);
1725 hcache_close(&hc);
1726#endif
1727 return rc;
1728}
const char * cs_subset_path(const struct ConfigSubset *sub, const char *name)
Get a path config item by name.
Definition: helpers.c:169
int hcache_store(struct HeaderCache *hc, const char *key, size_t keylen, struct Email *e, uint32_t uidvalidity)
Multiplexor for StoreOps::store.
Definition: hcache.c:687
struct HeaderCache * hcache_open(const char *path, const char *folder, hcache_namer_t namer)
Multiplexor for StoreOps::open.
Definition: hcache.c:495
void hcache_close(struct HeaderCache **ptr)
Multiplexor for StoreOps::close.
Definition: hcache.c:564
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
Definition: mailbox.h:210
static size_t maildir_hcache_keylen(const char *fn)
Calculate the length of the Maildir path.
Definition: maildir.c:632
static const char * maildir_hcache_key(struct Email *e)
Get the header cache key for an Email.
Definition: maildir.c:106
Header Cache.
Definition: lib.h:88
Container for Accounts, Notifications.
Definition: neomutt.h:41
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:45
+ Here is the call graph for this function:

◆ mh_msg_save_hcache()

static int mh_msg_save_hcache ( struct Mailbox m,
struct Email e 
)
static

Save message to the header cache - Implements MxOps::msg_save_hcache() -.

Definition at line 784 of file mh.c.

785{
786 int rc = 0;
787#ifdef USE_HCACHE
788 const char *const c_header_cache = cs_subset_path(NeoMutt->sub, "header_cache");
789 struct HeaderCache *hc = hcache_open(c_header_cache, mailbox_path(m), NULL);
790 rc = hcache_store(hc, e->path, strlen(e->path), e, 0);
791 hcache_close(&hc);
792#endif
793 return rc;
794}
char * path
Path of Email (for local Mailboxes)
Definition: email.h:68
+ Here is the call graph for this function:

◆ pop_msg_save_hcache()

static int pop_msg_save_hcache ( struct Mailbox m,
struct Email e 
)
static

Save message to the header cache - Implements MxOps::msg_save_hcache() -.

Definition at line 1140 of file pop.c.

1141{
1142 int rc = 0;
1143#ifdef USE_HCACHE
1144 struct PopAccountData *adata = pop_adata_get(m);
1145 struct PopEmailData *edata = e->edata;
1146 struct HeaderCache *hc = pop_hcache_open(adata, mailbox_path(m));
1147 rc = hcache_store(hc, edata->uid, strlen(edata->uid), e, 0);
1148 hcache_close(&hc);
1149#endif
1150
1151 return rc;
1152}
struct PopAccountData * pop_adata_get(struct Mailbox *m)
Get the Account data for this mailbox.
Definition: adata.c:73
static struct HeaderCache * pop_hcache_open(struct PopAccountData *adata, const char *path)
Open the header cache.
Definition: pop.c:300
void * edata
Driver-specific data.
Definition: email.h:72
POP-specific Account data -.
Definition: adata.h:37
POP-specific Email data -.
Definition: edata.h:32
const char * uid
UID of email.
Definition: edata.h:33
+ Here is the call graph for this function: