NeoMutt  2022-04-29-247-gc6aae8
Teaching an old dog new tricks
DOXYGEN
adata.c File Reference

Imap-specific Account data. More...

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

Go to the source code of this file.

Functions

void imap_adata_free (void **ptr)
 Free the private Account data - Implements Account::adata_free() More...
 
struct ImapAccountDataimap_adata_new (struct Account *a)
 Allocate and initialise a new ImapAccountData structure. More...
 
struct ImapAccountDataimap_adata_get (struct Mailbox *m)
 Get the Account data for this mailbox. More...
 

Detailed Description

Imap-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

◆ imap_adata_free()

void imap_adata_free ( void **  ptr)

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

Definition at line 40 of file adata.c.

41{
42 if (!ptr || !*ptr)
43 return;
44
45 struct ImapAccountData *adata = *ptr;
46
47 FREE(&adata->capstr);
48 mutt_buffer_dealloc(&adata->cmdbuf);
49 FREE(&adata->buf);
50 FREE(&adata->cmds);
51
52 if (adata->conn)
53 {
54 if (adata->conn->close)
55 adata->conn->close(adata->conn);
56 FREE(&adata->conn);
57 }
58
59 FREE(ptr);
60}
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:309
#define FREE(x)
Definition: memory.h:43
void * adata
Private data (for Mailbox backends)
Definition: account.h:43
IMAP-specific Account data -.
Definition: adata.h:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ imap_adata_new()

struct ImapAccountData * imap_adata_new ( struct Account a)

Allocate and initialise a new ImapAccountData structure.

Return values
ptrNew ImapAccountData

Definition at line 66 of file adata.c.

67{
68 struct ImapAccountData *adata = mutt_mem_calloc(1, sizeof(struct ImapAccountData));
69 adata->account = a;
70
71 static unsigned char new_seqid = 'a';
72
73 adata->seqid = new_seqid;
74 const short c_imap_pipeline_depth = cs_subset_number(NeoMutt->sub, "imap_pipeline_depth");
75 adata->cmdslots = c_imap_pipeline_depth + 2;
76 adata->cmds = mutt_mem_calloc(adata->cmdslots, sizeof(*adata->cmds));
77
78 if (++new_seqid > 'z')
79 new_seqid = 'a';
80
81 return adata;
82}
short cs_subset_number(const struct ConfigSubset *sub, const char *name)
Get a number config item by name.
Definition: helpers.c:169
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
Container for Accounts, Notifications.
Definition: neomutt.h:37
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ imap_adata_get()

struct ImapAccountData * imap_adata_get ( struct Mailbox m)

Get the Account data for this mailbox.

Parameters
mMailbox
Return values
ptrPrivate data

Definition at line 89 of file adata.c.

90{
91 if (!m || (m->type != MUTT_IMAP) || !m->account)
92 return NULL;
93 return m->account->adata;
94}
@ MUTT_IMAP
'IMAP' Mailbox type
Definition: mailbox.h:50
enum MailboxType type
Mailbox type.
Definition: mailbox.h:102
struct Account * account
Account that owns this Mailbox.
Definition: mailbox.h:127
+ Here is the caller graph for this function: