NeoMutt  2021-02-05-666-ge300cd
Teaching an old dog new tricks
DOXYGEN
adata.c File Reference

Nntp-specific Account data. More...

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

Go to the source code of this file.

Functions

void nntp_adata_free (void **ptr)
 Free the private Account data - Implements Account::adata_free() More...
 
struct NntpAccountDatanntp_adata_new (struct Connection *conn)
 Allocate and initialise a new NntpAccountData structure. More...
 

Detailed Description

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

◆ nntp_adata_free()

void nntp_adata_free ( void **  ptr)

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

The NntpAccountData struct stores global NNTP data, such as the connection to the database. This function will close the database, free the resources and the struct itself.

Definition at line 43 of file adata.c.

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 }
char * newsrc_file
Definition: adata.h:52
void mutt_hash_free(struct HashTable **ptr)
Free a hash table.
Definition: hash.c:449
struct HashTable * groups_hash
Definition: adata.h:62
NNTP-specific Account data -.
Definition: adata.h:36
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
Definition: file.c:153
char * overview_fmt
Definition: adata.h:54
void * adata
Private data (for Mailbox backends)
Definition: account.h:43
struct Connection * conn
Definition: adata.h:63
char * authenticators
Definition: adata.h:53
void ** groups_list
Definition: adata.h:61
FILE * fp_newsrc
Definition: adata.h:51
#define FREE(x)
Definition: memory.h:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nntp_adata_new()

struct NntpAccountData* nntp_adata_new ( struct Connection conn)

Allocate and initialise a new NntpAccountData structure.

Parameters
connNetwork connection
Return values
ptrNew NntpAccountData

Definition at line 62 of file adata.c.

63 {
64  struct NntpAccountData *adata = mutt_mem_calloc(1, sizeof(struct NntpAccountData));
65  adata->conn = conn;
68  adata->groups_max = 16;
69  adata->groups_list =
70  mutt_mem_malloc(adata->groups_max * sizeof(struct NntpMboxData *));
71  return adata;
72 }
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
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 * groups_hash
Definition: adata.h:62
NNTP-specific Account data -.
Definition: adata.h:36
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:293
unsigned int groups_max
Definition: adata.h:60
void * mutt_mem_malloc(size_t size)
Allocate memory on the heap.
Definition: memory.c:90
void * adata
Private data (for Mailbox backends)
Definition: account.h:43
NNTP-specific Mailbox data -.
Definition: mdata.h:32
struct Connection * conn
Definition: adata.h:63
void ** groups_list
Definition: adata.h:61
struct HashTable * mutt_hash_new(size_t num_elems, HashFlags flags)
Create a new Hash Table (with string keys)
Definition: hash.c:251
#define MUTT_HASH_NO_FLAGS
No flags are set.
Definition: hash.h:100
+ Here is the call graph for this function:
+ Here is the caller graph for this function: