NeoMutt  2021-10-29-43-g6b8931
Teaching an old dog new tricks
DOXYGEN
adata.c
Go to the documentation of this file.
1 
29 #include "config.h"
30 #include "private.h"
31 #include "mutt/lib.h"
32 #include "adata.h"
33 
34 struct Connection;
35 
43 void nntp_adata_free(void **ptr)
44 {
45  struct NntpAccountData *adata = *ptr;
46 
47  mutt_file_fclose(&adata->fp_newsrc);
48  FREE(&adata->newsrc_file);
49  FREE(&adata->authenticators);
50  FREE(&adata->overview_fmt);
51  FREE(&adata->conn);
52  FREE(&adata->groups_list);
53  mutt_hash_free(&adata->groups_hash);
54  FREE(ptr);
55 }
56 
63 {
64  struct NntpAccountData *adata = mutt_mem_calloc(1, sizeof(struct NntpAccountData));
65  adata->conn = conn;
66  adata->groups_hash = mutt_hash_new(1009, MUTT_HASH_NO_FLAGS);
68  adata->groups_max = 16;
69  adata->groups_list =
70  mutt_mem_malloc(adata->groups_max * sizeof(struct NntpMboxData *));
71  return adata;
72 }
73 
74 #if 0
79 struct NntpAccountData *nntp_adata_get(struct Mailbox *m)
80 {
81  if (!m || (m->type != MUTT_NNTP))
82  return NULL;
83  struct Account *a = m->account;
84  if (!a)
85  return NULL;
86  return a->adata;
87 }
88 #endif
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
Definition: file.c:153
void nntp_hashelem_free(int type, void *obj, intptr_t data)
Free our hash table data - Implements hash_hdata_free_t -.
Definition: nntp.c:117
struct HashTable * mutt_hash_new(size_t num_elems, HashFlags flags)
Create a new Hash Table (with string keys)
Definition: hash.c:259
void mutt_hash_set_destructor(struct HashTable *table, hash_hdata_free_t fn, intptr_t fn_data)
Set the destructor for a Hash Table.
Definition: hash.c:301
void mutt_hash_free(struct HashTable **ptr)
Free a hash table.
Definition: hash.c:457
#define MUTT_HASH_NO_FLAGS
No flags are set.
Definition: hash.h:109
@ MUTT_NNTP
'NNTP' (Usenet) Mailbox type
Definition: mailbox.h:52
void * mutt_mem_malloc(size_t size)
Allocate memory on the heap.
Definition: memory.c:90
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.
struct NntpAccountData * nntp_adata_new(struct Connection *conn)
Allocate and initialise a new NntpAccountData structure.
Definition: adata.c:62
void nntp_adata_free(void **ptr)
Free the private Account data - Implements Account::adata_free()
Definition: adata.c:43
struct NntpAccountData * nntp_adata_get(struct Mailbox *m)
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
NNTP-specific Account data -.
Definition: adata.h:37
struct Connection * conn
Connection to NNTP Server.
Definition: adata.h:63
NNTP-specific Mailbox data -.
Definition: mdata.h:33