NeoMutt  2024-10-02-37-gfa9146
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
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
39void nm_adata_free(void **ptr)
40{
41 if (!ptr || !*ptr)
42 return;
43
44 struct NmAccountData *adata = *ptr;
45 if (adata->db)
46 {
47 nm_db_free(adata->db);
48 adata->db = NULL;
49 }
50
51 FREE(ptr);
52}
53
59{
60 struct NmAccountData *adata = mutt_mem_calloc(1, sizeof(struct NmAccountData));
61
62 return adata;
63}
64
72{
73 if (!m || (m->type != MUTT_NOTMUCH))
74 return NULL;
75
76 struct Account *a = m->account;
77 if (!a)
78 return NULL;
79
80 return a->adata;
81}
Convenience wrapper for the core headers.
@ MUTT_NOTMUCH
'Notmuch' (virtual) Mailbox type
Definition: mailbox.h:51
void nm_adata_free(void **ptr)
Free the private Account data - Implements Account::adata_free() -.
Definition: adata.c:39
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:51
#define FREE(x)
Definition: memory.h:45
Convenience wrapper for the library headers.
struct NmAccountData * nm_adata_new(void)
Allocate and initialise a new NmAccountData structure.
Definition: adata.c:58
struct NmAccountData * nm_adata_get(struct Mailbox *m)
Get the Notmuch Account data.
Definition: adata.c:71
void nm_db_free(notmuch_database_t *db)
Decoupled way to close a Notmuch database.
Definition: db.c:250
Pop-specific Account data.
GUI display the mailboxes in a side panel.
A group of associated Mailboxes.
Definition: account.h:36
void * adata
Private data (for Mailbox backends)
Definition: account.h:42
A mailbox.
Definition: mailbox.h:79
enum MailboxType type
Mailbox type.
Definition: mailbox.h:102
struct Account * account
Account that owns this Mailbox.
Definition: mailbox.h:127
Notmuch-specific Account data -.
Definition: adata.h:35