NeoMutt  2025-12-11-1039-g550ac6
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() -.
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()

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

772{
773 if (!m->compress_info)
774 return 0;
775
776 struct CompressInfo *ci = m->compress_info;
777
778 const struct MxOps *ops = ci->child_ops;
779 if (!ops || !ops->msg_save_hcache)
780 return 0;
781
782 return ops->msg_save_hcache(m, e);
783}
Private data for compress.
Definition lib.h:62
const struct MxOps * child_ops
callbacks of de-compressed file
Definition lib.h:67
void * compress_info
Compressed mbox module private data.
Definition mailbox.h:123
Definition mxapi.h:98
int(* msg_save_hcache)(struct Mailbox *m, struct Email *e)
Definition mxapi.h:296

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

2233{
2234 int rc = 0;
2235#ifdef USE_HCACHE
2236 bool close_hc = true;
2238 struct ImapMboxData *mdata = imap_mdata_get(m);
2239 if (!mdata || !adata)
2240 return -1;
2241 if (mdata->hcache)
2242 close_hc = false;
2243 else
2244 imap_hcache_open(adata, mdata, true);
2245 rc = imap_hcache_put(mdata, e);
2246 if (close_hc)
2248#endif
2249 return rc;
2250}
struct ImapAccountData * imap_adata_get(struct Mailbox *m)
Get the Account data for this mailbox.
Definition adata.c:162
struct ImapMboxData * imap_mdata_get(struct Mailbox *m)
Get the Mailbox data for this mailbox.
Definition mdata.c:61
void imap_hcache_open(struct ImapAccountData *adata, struct ImapMboxData *mdata, bool create)
Open a header cache.
Definition util.c:310
int imap_hcache_put(struct ImapMboxData *mdata, struct Email *e)
Add an entry to the header cache.
Definition util.c:391
void imap_hcache_close(struct ImapMboxData *mdata)
Close the header cache.
Definition util.c:351
void * adata
Private data (for Mailbox backends).
Definition account.h:42
IMAP-specific Account data -.
Definition adata.h:40
IMAP-specific Mailbox data -.
Definition mdata.h:40
void * mdata
Driver specific data.
Definition mailbox.h:134
Here is the call graph for this function:
Here is the caller graph for this function:

◆ maildir_msg_save_hcache()

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

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

Definition at line 647 of file message.c.

648{
649 int rc = 0;
650
651 struct HeaderCache *hc = maildir_hcache_open(m);
652 rc = maildir_hcache_store(hc, e);
654
655 return rc;
656}
int maildir_hcache_store(struct HeaderCache *hc, struct Email *e)
Save an Email to the Header Cache.
Definition hcache.c:163
struct HeaderCache * maildir_hcache_open(struct Mailbox *m)
Open the Header Cache.
Definition hcache.c:104
void maildir_hcache_close(struct HeaderCache **ptr)
Close the Header Cache.
Definition hcache.c:77
Header Cache.
Definition lib.h:87
Here is the call graph for this function:

◆ mh_msg_save_hcache()

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 790 of file mh.c.

791{
792 int rc = 0;
793#ifdef USE_HCACHE
794 const char *const c_header_cache = cs_subset_path(NeoMutt->sub, "header_cache");
795 struct HeaderCache *hc = hcache_open(c_header_cache, mailbox_path(m), NULL, true);
796 rc = hcache_store_email(hc, e->path, strlen(e->path), e, 0);
797 hcache_close(&hc);
798#endif
799 return rc;
800}
const char * cs_subset_path(const struct ConfigSubset *sub, const char *name)
Get a path config item by name.
Definition helpers.c:168
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
Definition mailbox.h:216
struct HeaderCache * hcache_open(const char *path, const char *folder, hcache_namer_t namer, bool create)
Multiplexor for StoreOps::open.
Definition hcache.c:492
void hcache_close(struct HeaderCache **ptr)
Multiplexor for StoreOps::close.
Definition hcache.c:564
int hcache_store_email(struct HeaderCache *hc, const char *key, size_t keylen, struct Email *e, uint32_t uidvalidity)
Multiplexor for StoreOps::store.
Definition hcache.c:703
char * path
Path of Email (for local Mailboxes).
Definition email.h:70
Container for Accounts, Notifications.
Definition neomutt.h:41
struct ConfigSubset * sub
Inherited config items.
Definition neomutt.h:49
Here is the call graph for this function:

◆ pop_msg_save_hcache()

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 1165 of file pop.c.

1166{
1167 int rc = 0;
1168#ifdef USE_HCACHE
1169 struct PopAccountData *adata = pop_adata_get(m);
1170 struct PopEmailData *edata = e->edata;
1171 struct HeaderCache *hc = pop_hcache_open(adata, mailbox_path(m));
1172 rc = hcache_store_email(hc, edata->uid, strlen(edata->uid), e, 0);
1173 hcache_close(&hc);
1174#endif
1175
1176 return rc;
1177}
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:319
void * edata
Driver-specific data.
Definition email.h:74
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: