NeoMutt  2021-10-29-43-g6b8931
Teaching an old dog new tricks
DOXYGEN
adata.c File Reference

Notmuch-specific Account data. More...

#include "config.h"
#include <stddef.h>
#include "private.h"
#include "mutt/lib.h"
#include "core/lib.h"
#include "adata.h"
+ Include dependency graph for adata.c:

Go to the source code of this file.

Functions

void nm_adata_free (void **ptr)
 Free the private Account data - Implements Account::adata_free() More...
 
struct NmAccountDatanm_adata_new (void)
 Allocate and initialise a new NmAccountData structure. More...
 
struct NmAccountDatanm_adata_get (struct Mailbox *m)
 Get the Notmuch Account data. More...
 

Detailed Description

Notmuch-specific Account data.

Authors
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file adata.c.

Function Documentation

◆ nm_adata_free()

void nm_adata_free ( void **  ptr)

Free the private Account data - Implements Account::adata_free()

Definition at line 39 of file adata.c.

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 }
#define FREE(x)
Definition: memory.h:40
void nm_db_free(notmuch_database_t *db)
Decoupled way to close a Notmuch database.
Definition: db.c:215
void * adata
Private data (for Mailbox backends)
Definition: account.h:43
Notmuch-specific Account data -.
Definition: adata.h:35
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nm_adata_new()

struct NmAccountData* nm_adata_new ( void  )

Allocate and initialise a new NmAccountData structure.

Return values
ptrNew NmAccountData

Definition at line 55 of file adata.c.

56 {
57  struct NmAccountData *adata = mutt_mem_calloc(1, sizeof(struct NmAccountData));
58 
59  return adata;
60 }
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nm_adata_get()

struct NmAccountData* nm_adata_get ( struct Mailbox m)

Get the Notmuch Account data.

Parameters
mMailbox
Return values
ptrSuccess
NULLFailure, not a Notmuch mailbox

Definition at line 68 of file adata.c.

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 }
@ MUTT_NOTMUCH
'Notmuch' (virtual) Mailbox type
Definition: mailbox.h:54
A group of associated Mailboxes.
Definition: account.h:37
enum MailboxType type
Mailbox type.
Definition: mailbox.h:105
struct Account * account
Account that owns this Mailbox.
Definition: mailbox.h:131
+ Here is the caller graph for this function: