NeoMutt  2021-02-05-666-ge300cd
Teaching an old dog new tricks
DOXYGEN
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() -. More...
 
int imap_msg_save_hcache (struct Mailbox *m, struct Email *e)
 Save message to the header cache - Implements MxOps::msg_save_hcache() -. More...
 
static int maildir_msg_save_hcache (struct Mailbox *m, struct Email *e)
 Save message to the header cache - Implements MxOps::msg_save_hcache() -. More...
 
int mh_msg_save_hcache (struct Mailbox *m, struct Email *e)
 Save message to the header cache - Implements MxOps::msg_save_hcache() -. More...
 
static int pop_msg_save_hcache (struct Mailbox *m, struct Email *e)
 Save message to the header cache - Implements MxOps::msg_save_hcache() -. More...
 

Detailed Description

Save message to the header cache.

Parameters
mMailbox
eEmail
Return values
0Success
-1Failure

Contract

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 823 of file compress.c.

824 {
825  if (!m->compress_info)
826  return 0;
827 
828  struct CompressInfo *ci = m->compress_info;
829 
830  const struct MxOps *ops = ci->child_ops;
831  if (!ops || !ops->msg_save_hcache)
832  return 0;
833 
834  return ops->msg_save_hcache(m, e);
835 }
int(* msg_save_hcache)(struct Mailbox *m, struct Email *e)
Definition: mxapi.h:316
Private data for compress.
Definition: lib.h:46
void * compress_info
Compressed mbox module private data.
Definition: mailbox.h:124
const struct MxOps * child_ops
callbacks of de-compressed file
Definition: lib.h:52
Definition: mxapi.h:103

◆ 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 2153 of file message.c.

2154 {
2155  int rc = 0;
2156 #ifdef USE_HCACHE
2157  bool close_hc = true;
2158  struct ImapAccountData *adata = imap_adata_get(m);
2159  struct ImapMboxData *mdata = imap_mdata_get(m);
2160  if (!mdata || !adata)
2161  return -1;
2162  if (mdata->hcache)
2163  close_hc = false;
2164  else
2165  imap_hcache_open(adata, mdata);
2166  rc = imap_hcache_put(mdata, e);
2167  if (close_hc)
2168  imap_hcache_close(mdata);
2169 #endif
2170  return rc;
2171 }
int imap_hcache_put(struct ImapMboxData *mdata, struct Email *e)
Add an entry to the header cache.
Definition: util.c:381
struct HeaderCache * hcache
Definition: mdata.h:62
void imap_hcache_close(struct ImapMboxData *mdata)
Close the header cache.
Definition: util.c:340
struct ImapMboxData * imap_mdata_get(struct Mailbox *m)
Get the Mailbox data for this mailbox.
Definition: mdata.c:59
void * mdata
Driver specific data.
Definition: mailbox.h:136
void * adata
Private data (for Mailbox backends)
Definition: account.h:43
struct ImapAccountData * imap_adata_get(struct Mailbox *m)
Get the Account data for this mailbox.
Definition: adata.c:90
IMAP-specific Account data -.
Definition: adata.h:39
IMAP-specific Mailbox data -.
Definition: mdata.h:38
void imap_hcache_open(struct ImapAccountData *adata, struct ImapMboxData *mdata)
Open a header cache.
Definition: util.c:297
+ 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 1571 of file maildir.c.

1572 {
1573  int rc = 0;
1574 #ifdef USE_HCACHE
1575  const char *const c_header_cache =
1576  cs_subset_path(NeoMutt->sub, "header_cache");
1577  struct HeaderCache *hc = mutt_hcache_open(c_header_cache, mailbox_path(m), NULL);
1578  char *key = e->path + 3;
1579  int keylen = maildir_hcache_keylen(key);
1580  rc = mutt_hcache_store(hc, key, keylen, e, 0);
1581  mutt_hcache_close(hc);
1582 #endif
1583  return rc;
1584 }
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
Definition: mailbox.h:215
header cache structure
Definition: lib.h:84
struct HeaderCache * mutt_hcache_open(const char *path, const char *folder, hcache_namer_t namer)
Multiplexor for StoreOps::open.
Definition: hcache.c:332
Container for Accounts, Notifications.
Definition: neomutt.h:36
size_t maildir_hcache_keylen(const char *fn)
Calculate the length of the Maildir path.
Definition: maildir.c:585
int mutt_hcache_store(struct HeaderCache *hc, const char *key, size_t keylen, struct Email *e, uint32_t uidvalidity)
Multiplexor for StoreOps::store.
Definition: hcache.c:556
const char * cs_subset_path(const struct ConfigSubset *sub, const char *name)
Get a path config item by name.
Definition: helpers.c:194
void mutt_hcache_close(struct HeaderCache *hc)
Multiplexor for StoreOps::close.
Definition: hcache.c:435
char * path
Path of Email (for local Mailboxes)
Definition: email.h:92
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
+ Here is the call graph for this function:

◆ mh_msg_save_hcache()

int mh_msg_save_hcache ( struct Mailbox m,
struct Email e 
)

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

Definition at line 810 of file mh.c.

811 {
812  int rc = 0;
813 #ifdef USE_HCACHE
814  const char *const c_header_cache =
815  cs_subset_path(NeoMutt->sub, "header_cache");
816  struct HeaderCache *hc = mutt_hcache_open(c_header_cache, mailbox_path(m), NULL);
817  rc = mutt_hcache_store(hc, e->path, strlen(e->path), e, 0);
818  mutt_hcache_close(hc);
819 #endif
820  return rc;
821 }
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
Definition: mailbox.h:215
header cache structure
Definition: lib.h:84
struct HeaderCache * mutt_hcache_open(const char *path, const char *folder, hcache_namer_t namer)
Multiplexor for StoreOps::open.
Definition: hcache.c:332
Container for Accounts, Notifications.
Definition: neomutt.h:36
int mutt_hcache_store(struct HeaderCache *hc, const char *key, size_t keylen, struct Email *e, uint32_t uidvalidity)
Multiplexor for StoreOps::store.
Definition: hcache.c:556
const char * cs_subset_path(const struct ConfigSubset *sub, const char *name)
Get a path config item by name.
Definition: helpers.c:194
void mutt_hcache_close(struct HeaderCache *hc)
Multiplexor for StoreOps::close.
Definition: hcache.c:435
char * path
Path of Email (for local Mailboxes)
Definition: email.h:92
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
+ 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 1148 of file pop.c.

1149 {
1150  int rc = 0;
1151 #ifdef USE_HCACHE
1152  struct PopAccountData *adata = pop_adata_get(m);
1153  struct PopEmailData *edata = e->edata;
1154  struct HeaderCache *hc = pop_hcache_open(adata, mailbox_path(m));
1155  rc = mutt_hcache_store(hc, edata->uid, strlen(edata->uid), e, 0);
1156  mutt_hcache_close(hc);
1157 #endif
1158 
1159  return rc;
1160 }
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
Definition: mailbox.h:215
header cache structure
Definition: lib.h:84
struct PopAccountData * pop_adata_get(struct Mailbox *m)
Get the Account data for this mailbox.
Definition: adata.c:64
static struct HeaderCache * pop_hcache_open(struct PopAccountData *adata, const char *path)
Open the header cache.
Definition: pop.c:297
const char * uid
Definition: edata.h:33
void * adata
Private data (for Mailbox backends)
Definition: account.h:43
int mutt_hcache_store(struct HeaderCache *hc, const char *key, size_t keylen, struct Email *e, uint32_t uidvalidity)
Multiplexor for StoreOps::store.
Definition: hcache.c:556
POP-specific Email data -.
Definition: edata.h:31
void mutt_hcache_close(struct HeaderCache *hc)
Multiplexor for StoreOps::close.
Definition: hcache.c:435
void * edata
Driver-specific data.
Definition: email.h:111
POP-specific Account data -.
Definition: adata.h:36
+ Here is the call graph for this function: