NeoMutt  2025-01-09-117-gace867
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 400 of file compress.c.

401{
402 return true;
403}

◆ 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 1691 of file imap.c.

1692{
1693 struct ImapAccountData *adata = a->adata;
1694
1695 if (!adata)
1696 {
1697 struct ConnAccount cac = { { 0 } };
1698 char mailbox[PATH_MAX] = { 0 };
1699
1700 if (imap_parse_path(mailbox_path(m), &cac, mailbox, sizeof(mailbox)) < 0)
1701 return false;
1702
1703 adata = imap_adata_new(a);
1704 adata->conn = mutt_conn_new(&cac);
1705 if (!adata->conn)
1706 {
1707 imap_adata_free((void **) &adata);
1708 return false;
1709 }
1710
1712
1713 if (imap_login(adata) < 0)
1714 {
1715 imap_adata_free((void **) &adata);
1716 return false;
1717 }
1718
1719 a->adata = adata;
1721 }
1722
1723 if (!m->mdata)
1724 {
1725 struct Url *url = url_parse(mailbox_path(m));
1726 if (!url)
1727 return false;
1728 struct ImapMboxData *mdata = imap_mdata_new(adata, url->path);
1729
1730 /* fixup path and realpath, mainly to replace / by /INBOX */
1731 char buf[1024] = { 0 };
1732 imap_qualify_path(buf, sizeof(buf), &adata->conn->account, mdata->name);
1733 buf_strcpy(&m->pathbuf, buf);
1735
1736 m->mdata = mdata;
1738 url_free(&url);
1739 }
1740 return true;
1741}
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:223
void imap_adata_free(void **ptr)
Free the private Account data - Implements Account::adata_free() -.
Definition: adata.c:69
void imap_mdata_free(void **ptr)
Free the private Mailbox data - Implements Mailbox::mdata_free() -.
Definition: mdata.c:40
void mutt_account_hook(const char *url)
Perform an account hook.
Definition: hook.c:888
struct ImapAccountData * imap_adata_new(struct Account *a)
Allocate and initialise a new ImapAccountData structure.
Definition: adata.c:98
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:477
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:855
int imap_login(struct ImapAccountData *adata)
Open an IMAP connection.
Definition: imap.c:1780
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:281
#define PATH_MAX
Definition: mutt.h:42
struct Connection * mutt_conn_new(const struct ConnAccount *cac)
Create a new Connection.
Definition: mutt_socket.c:48
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:53
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:143
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
Definition: mailbox.h:81
void * mdata
Driver specific data.
Definition: mailbox.h:132
struct Buffer pathbuf
Path of the Mailbox.
Definition: mailbox.h:80
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:239
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 790 of file mbox.c.

791{
792 return true;
793}

◆ 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 808 of file mh.c.

809{
810 return true;
811}

◆ 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 2051 of file notmuch.c.

2052{
2053 if (a->adata)
2054 return true;
2055
2056 struct NmAccountData *adata = nm_adata_new();
2057 a->adata = adata;
2059
2060 return true;
2061}
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 710 of file pop.c.

711{
712 if (a->adata)
713 return true;
714
715 struct ConnAccount cac = { { 0 } };
716 if (pop_parse_path(mailbox_path(m), &cac))
717 {
718 mutt_error(_("%s is an invalid POP path"), mailbox_path(m));
719 return false;
720 }
721
723 adata->conn = mutt_conn_new(&cac);
724 if (!adata->conn)
725 {
726 pop_adata_free((void **) &adata);
727 return false;
728 }
729 a->adata = adata;
731
732 return true;
733}
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:93
#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: