NeoMutt  2025-12-11-911-gd8d604
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
ac_add()

Add a Mailbox to an Account. More...

+ Collaboration diagram for ac_add():

Functions

static bool comp_ac_add (struct Account *a, struct Mailbox *m)
 Add a Mailbox to an Account - Implements MxOps::ac_add() -.
 
static bool imap_ac_add (struct Account *a, struct Mailbox *m)
 Add a Mailbox to an Account - Implements MxOps::ac_add() -.
 
bool maildir_ac_add (struct Account *a, struct Mailbox *m)
 Add a Mailbox to an Account - Implements MxOps::ac_add() -.
 
static bool mbox_ac_add (struct Account *a, struct Mailbox *m)
 Add a Mailbox to an Account - Implements MxOps::ac_add() -.
 
static bool mh_ac_add (struct Account *a, struct Mailbox *m)
 Add a Mailbox to an Account - Implements MxOps::ac_add() -.
 
static bool nntp_ac_add (struct Account *a, struct Mailbox *m)
 Add a Mailbox to an Account - Implements MxOps::ac_add() -.
 
static bool nm_ac_add (struct Account *a, struct Mailbox *m)
 Add a Mailbox to an Account - Implements MxOps::ac_add() -.
 
static bool pop_ac_add (struct Account *a, struct Mailbox *m)
 Add a Mailbox to an Account - Implements MxOps::ac_add() -.
 

Detailed Description

Add a Mailbox to an Account.

Parameters
aAccount to add to
mMailbox to add
Return values
trueSuccess
falseError
Precondition
a is not NULL
m is not NULL

Function Documentation

◆ comp_ac_add()

static bool comp_ac_add ( struct Account * a,
struct Mailbox * m )
static

Add a Mailbox to an Account - Implements MxOps::ac_add() -.

Definition at line 405 of file compress.c.

406{
407 return true;
408}

◆ imap_ac_add()

static bool imap_ac_add ( struct Account * a,
struct Mailbox * m )
static

Add a Mailbox to an Account - Implements MxOps::ac_add() -.

Definition at line 1924 of file imap.c.

1925{
1926 struct ImapAccountData *adata = a->adata;
1927
1928 if (!adata)
1929 {
1930 struct ConnAccount cac = { { 0 } };
1931 char mailbox[PATH_MAX] = { 0 };
1932
1933 if (imap_parse_path(mailbox_path(m), &cac, mailbox, sizeof(mailbox)) < 0)
1934 return false;
1935
1936 adata = imap_adata_new(a);
1937 adata->conn = mutt_conn_new(&cac);
1938 if (!adata->conn)
1939 {
1940 imap_adata_free((void **) &adata);
1941 return false;
1942 }
1943
1945
1946 if (imap_login(adata) < 0)
1947 {
1948 imap_adata_free((void **) &adata);
1949 return false;
1950 }
1951
1952 a->adata = adata;
1954 }
1955
1956 if (!m->mdata)
1957 {
1958 struct Url *url = url_parse(mailbox_path(m));
1959 if (!url)
1960 return false;
1961 struct ImapMboxData *mdata = imap_mdata_new(adata, url->path);
1962
1963 /* fixup path and realpath, mainly to replace / by /INBOX */
1964 char buf[1024] = { 0 };
1965 imap_qualify_path(buf, sizeof(buf), &adata->conn->account, mdata->name);
1966 buf_strcpy(&m->pathbuf, buf);
1968
1969 m->mdata = mdata;
1971 url_free(&url);
1972 }
1973 return true;
1974}
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition buffer.c:395
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
Definition mailbox.h:216
void imap_adata_free(void **ptr)
Free the private Account data - Implements Account::adata_free() -.
Definition adata.c:105
void imap_mdata_free(void **ptr)
Free the private Mailbox data - Implements Mailbox::mdata_free() -.
Definition mdata.c:40
void exec_account_hook(const char *url)
Perform an account hook.
Definition exec.c:328
struct ImapAccountData * imap_adata_new(struct Account *a)
Allocate and initialise a new ImapAccountData structure.
Definition adata.c:136
int imap_parse_path(const char *path, struct ConnAccount *cac, char *mailbox, size_t mailboxlen)
Parse an IMAP mailbox name into ConnAccount, name.
Definition util.c:482
struct ImapMboxData * imap_mdata_new(struct ImapAccountData *adata, const char *name)
Allocate and initialise a new ImapMboxData structure.
Definition mdata.c:74
void imap_qualify_path(char *buf, size_t buflen, struct ConnAccount *conn_account, char *path)
Make an absolute IMAP folder target.
Definition util.c:860
int imap_login(struct ImapAccountData *adata)
Open an IMAP connection.
Definition imap.c:2013
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition string.c:284
#define PATH_MAX
Definition mutt.h:49
struct Connection * mutt_conn_new(const struct ConnAccount *cac)
Create a new Connection.
Definition mutt_socket.c:47
void(* adata_free)(void **ptr)
Definition account.h:53
void * adata
Private data (for Mailbox backends)
Definition account.h:42
Login details for a remote server.
Definition connaccount.h:59
struct ConnAccount account
Account details: username, password, etc.
Definition connection.h:49
IMAP-specific Account data -.
Definition adata.h:40
struct Connection * conn
Connection to IMAP server.
Definition adata.h:41
IMAP-specific Mailbox data -.
Definition mdata.h:40
void(* mdata_free)(void **ptr)
Definition mailbox.h:145
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
Definition mailbox.h:83
void * mdata
Driver specific data.
Definition mailbox.h:134
struct Buffer pathbuf
Path of the Mailbox.
Definition mailbox.h:82
A parsed URL proto://user:password@host:port/path?a=1&b=2
Definition url.h:69
char * path
Path.
Definition url.h:75
struct Url * url_parse(const char *src)
Fill in Url.
Definition url.c:242
void url_free(struct Url **ptr)
Free the contents of a URL.
Definition url.c:124
+ Here is the call graph for this function:

◆ maildir_ac_add()

bool maildir_ac_add ( struct Account * a,
struct Mailbox * m )

Add a Mailbox to an Account - Implements MxOps::ac_add() -.

Definition at line 37 of file account.c.

38{
39 return true;
40}

◆ mbox_ac_add()

static bool mbox_ac_add ( struct Account * a,
struct Mailbox * m )
static

Add a Mailbox to an Account - Implements MxOps::ac_add() -.

Definition at line 817 of file mbox.c.

818{
819 return true;
820}

◆ mh_ac_add()

static bool mh_ac_add ( struct Account * a,
struct Mailbox * m )
static

Add a Mailbox to an Account - Implements MxOps::ac_add() -.

Definition at line 811 of file mh.c.

812{
813 return true;
814}

◆ nntp_ac_add()

static bool nntp_ac_add ( struct Account * a,
struct Mailbox * m )
static

Add a Mailbox to an Account - Implements MxOps::ac_add() -.

Definition at line 2375 of file nntp.c.

2376{
2377 return true;
2378}

◆ nm_ac_add()

static bool nm_ac_add ( struct Account * a,
struct Mailbox * m )
static

Add a Mailbox to an Account - Implements MxOps::ac_add() -.

Definition at line 2091 of file notmuch.c.

2092{
2093 if (a->adata)
2094 return true;
2095
2096 struct NmAccountData *adata = nm_adata_new();
2097 a->adata = adata;
2099
2100 return true;
2101}
void nm_adata_free(void **ptr)
Free the private Account data - Implements Account::adata_free() -.
Definition adata.c:39
struct NmAccountData * nm_adata_new(void)
Allocate and initialise a new NmAccountData structure.
Definition adata.c:58
Notmuch-specific Account data -.
Definition adata.h:35
+ Here is the call graph for this function:

◆ pop_ac_add()

static bool pop_ac_add ( struct Account * a,
struct Mailbox * m )
static

Add a Mailbox to an Account - Implements MxOps::ac_add() -.

Definition at line 724 of file pop.c.

725{
726 if (a->adata)
727 return true;
728
729 struct ConnAccount cac = { { 0 } };
730 if (pop_parse_path(mailbox_path(m), &cac) != 0)
731 {
732 mutt_error(_("%s is an invalid POP path"), mailbox_path(m));
733 return false;
734 }
735
737 adata->conn = mutt_conn_new(&cac);
738 if (!adata->conn)
739 {
740 pop_adata_free((void **) &adata);
741 return false;
742 }
743 a->adata = adata;
745
746 return true;
747}
void pop_adata_free(void **ptr)
Free the private Account data - Implements Account::adata_free() -.
Definition adata.c:41
#define mutt_error(...)
Definition logging2.h:94
#define _(a)
Definition message.h:28
struct PopAccountData * pop_adata_new(void)
Create a new PopAccountData object.
Definition adata.c:63
int pop_parse_path(const char *path, struct ConnAccount *cac)
Parse a POP mailbox name.
Definition lib.c:82
POP-specific Account data -.
Definition adata.h:37
+ Here is the call graph for this function: