NeoMutt  2021-10-29-220-g2b1eec
Teaching an old dog new tricks
DOXYGEN
adata.c
Go to the documentation of this file.
1 
29 #include "config.h"
30 #include <stddef.h>
31 #include "private.h"
32 #include "mutt/lib.h"
33 #include "core/lib.h"
34 #include "adata.h"
35 
39 void nm_adata_free(void **ptr)
40 {
41  struct NmAccountData *adata = *ptr;
42  if (adata->db)
43  {
44  nm_db_free(adata->db);
45  adata->db = NULL;
46  }
47 
48  FREE(ptr);
49 }
50 
56 {
57  struct NmAccountData *adata = mutt_mem_calloc(1, sizeof(struct NmAccountData));
58 
59  return adata;
60 }
61 
69 {
70  if (!m || (m->type != MUTT_NOTMUCH))
71  return NULL;
72 
73  struct Account *a = m->account;
74  if (!a)
75  return NULL;
76 
77  return a->adata;
78 }
Convenience wrapper for the core headers.
@ MUTT_NOTMUCH
'Notmuch' (virtual) Mailbox type
Definition: mailbox.h:54
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
#define FREE(x)
Definition: memory.h:40
Convenience wrapper for the library headers.
void nm_adata_free(void **ptr)
Free the private Account data - Implements Account::adata_free()
Definition: adata.c:39
struct NmAccountData * nm_adata_new(void)
Allocate and initialise a new NmAccountData structure.
Definition: adata.c:55
struct NmAccountData * nm_adata_get(struct Mailbox *m)
Get the Notmuch Account data.
Definition: adata.c:68
void nm_db_free(notmuch_database_t *db)
Decoupled way to close a Notmuch database.
Definition: db.c:215
Pop-specific Account data.
GUI display the mailboxes in a side panel.
A group of associated Mailboxes.
Definition: account.h:37
void * adata
Private data (for Mailbox backends)
Definition: account.h:43
A mailbox.
Definition: mailbox.h:82
enum MailboxType type
Mailbox type.
Definition: mailbox.h:105
struct Account * account
Account that owns this Mailbox.
Definition: mailbox.h:131
Notmuch-specific Account data -.
Definition: adata.h:35