#include "url.h"
/* mutt_account_match: compare account info (host/port/user) */
-int mutt_account_match(const ACCOUNT *a1, const ACCOUNT *a2)
+int mutt_account_match(const struct Account *a1, const struct Account *a2)
{
const char *user = NONULL(Username);
}
/* mutt_account_fromurl: fill account with information from url. */
-int mutt_account_fromurl(ACCOUNT *account, ciss_url_t *url)
+int mutt_account_fromurl(struct Account *account, ciss_url_t *url)
{
/* must be present */
if (url->host)
* is a set of pointers into account - don't free or edit account until
* you've finished with url (make a copy of account if you need it for
* a while). */
-void mutt_account_tourl(ACCOUNT *account, ciss_url_t *url)
+void mutt_account_tourl(struct Account *account, ciss_url_t *url)
{
url->scheme = U_UNKNOWN;
url->user = NULL;
url->pass = account->pass;
}
-/* mutt_account_getuser: retrieve username into ACCOUNT, if necessary */
-int mutt_account_getuser(ACCOUNT *account)
+/* mutt_account_getuser: retrieve username into Account, if necessary */
+int mutt_account_getuser(struct Account *account)
{
char prompt[SHORT_STRING];
return 0;
}
-int mutt_account_getlogin(ACCOUNT *account)
+int mutt_account_getlogin(struct Account *account)
{
/* already set */
if (account->flags & MUTT_ACCT_LOGIN)
return 0;
}
-/* mutt_account_getpass: fetch password into ACCOUNT, if necessary */
-int mutt_account_getpass(ACCOUNT *account)
+/* mutt_account_getpass: fetch password into Account, if necessary */
+int mutt_account_getpass(struct Account *account)
{
char prompt[SHORT_STRING];
return 0;
}
-void mutt_account_unsetpass(ACCOUNT *account)
+void mutt_account_unsetpass(struct Account *account)
{
account->flags &= ~MUTT_ACCT_PASS;
}
#define MUTT_ACCT_PASS (1 << 3)
#define MUTT_ACCT_SSL (1 << 4)
-typedef struct
+struct Account
{
char user[64];
char login[64];
unsigned short port;
unsigned char type;
unsigned char flags;
-} ACCOUNT;
-
-int mutt_account_match(const ACCOUNT *a1, const ACCOUNT *m2);
-int mutt_account_fromurl(ACCOUNT *account, ciss_url_t *url);
-void mutt_account_tourl(ACCOUNT *account, ciss_url_t *url);
-int mutt_account_getuser(ACCOUNT *account);
-int mutt_account_getlogin(ACCOUNT *account);
-int mutt_account_getpass(ACCOUNT *account);
-void mutt_account_unsetpass(ACCOUNT *account);
+};
+
+int mutt_account_match(const struct Account *a1, const struct Account *m2);
+int mutt_account_fromurl(struct Account *account, ciss_url_t *url);
+void mutt_account_tourl(struct Account *account, ciss_url_t *url);
+int mutt_account_getuser(struct Account *account);
+int mutt_account_getlogin(struct Account *account);
+int mutt_account_getpass(struct Account *account);
+void mutt_account_unsetpass(struct Account *account);
#endif /* _MUTT_ACCOUNT_H */
size_t pathlen;
};
-static int bcache_path(ACCOUNT *account, const char *mailbox, char *dst, size_t dstlen)
+static int bcache_path(struct Account *account, const char *mailbox, char *dst, size_t dstlen)
{
char host[STRING];
char path[_POSIX_PATH_MAX];
return 0;
}
-body_cache_t *mutt_bcache_open(ACCOUNT *account, const char *mailbox)
+body_cache_t *mutt_bcache_open(struct Account *account, const char *mailbox)
{
struct body_cache *bcache = NULL;
* mailboxes or hierarchies)
* Returns NULL on failure.
*/
-body_cache_t *mutt_bcache_open(ACCOUNT *account, const char *mailbox);
+body_cache_t *mutt_bcache_open(struct Account *account, const char *mailbox);
/* free all memory of bcache and finally FREE() it, too */
void mutt_bcache_close(body_cache_t **bcache);
/* imap_conn_find: Find an open IMAP connection matching account, or open
* a new one if none can be found. */
-IMAP_DATA *imap_conn_find(const ACCOUNT *account, int flags)
+IMAP_DATA *imap_conn_find(const struct Account *account, int flags)
{
CONNECTION *conn = NULL;
- ACCOUNT *creds = NULL;
+ struct Account *creds = NULL;
IMAP_DATA *idata = NULL;
int new = 0;
if (!creds)
creds = &conn->account;
else
- memcpy(&conn->account, creds, sizeof(ACCOUNT));
+ memcpy(&conn->account, creds, sizeof(struct Account));
idata = conn->data;
if (flags & MUTT_IMAP_CONN_NONEW)
/* -- data structures -- */
typedef struct
{
- ACCOUNT account;
+ struct Account account;
char *mbox;
} IMAP_MBOX;
int imap_wait_keepalive(pid_t pid);
void imap_keepalive(void);
-int imap_account_match(const ACCOUNT *a1, const ACCOUNT *a2);
+int imap_account_match(const struct Account *a1, const struct Account *a2);
void imap_get_parent(char *output, const char *mbox, size_t olen, char delim);
void imap_get_parent_path(char *output, const char *path, size_t olen);
void imap_clean_path(char *path, size_t plen);
int flag, int changed, int invert);
int imap_open_connection(IMAP_DATA *idata);
void imap_close_connection(IMAP_DATA *idata);
-IMAP_DATA *imap_conn_find(const ACCOUNT *account, int flags);
+IMAP_DATA *imap_conn_find(const struct Account *account, int flags);
int imap_read_literal(FILE *fp, IMAP_DATA *idata, long bytes, progress_t *pbar);
void imap_expunge_mailbox(IMAP_DATA *idata);
void imap_logout(IMAP_DATA **idata);
idata->reopen &= ~IMAP_REOPEN_ALLOW;
}
-int imap_account_match(const ACCOUNT *a1, const ACCOUNT *a2)
+int imap_account_match(const struct Account *a1, const struct Account *a2)
{
IMAP_DATA *a1_idata = imap_conn_find(a1, MUTT_IMAP_CONN_NONEW);
IMAP_DATA *a2_idata = imap_conn_find(a2, MUTT_IMAP_CONN_NONEW);
- const ACCOUNT *a1_canon = a1_idata == NULL ? a1 : &a1_idata->conn->account;
- const ACCOUNT *a2_canon = a2_idata == NULL ? a2 : &a2_idata->conn->account;
+ const struct Account *a1_canon = a1_idata == NULL ? a1 : &a1_idata->conn->account;
+ const struct Account *a2_canon = a2_idata == NULL ? a2 : &a2_idata->conn->account;
return mutt_account_match(a1_canon, a2_canon);
}
return SASL_OK;
}
-/* mutt_sasl_cb_authname: callback to retrieve authname or user from ACCOUNT */
+/* mutt_sasl_cb_authname: callback to retrieve authname or user from Account */
static int mutt_sasl_cb_authname(void *context, int id, const char **result, unsigned *len)
{
- ACCOUNT *account = (ACCOUNT *) context;
+ struct Account *account = (struct Account *) context;
if (!result)
return SASL_FAIL;
static int mutt_sasl_cb_pass(sasl_conn_t *conn, void *context, int id, sasl_secret_t **psecret)
{
- ACCOUNT *account = (ACCOUNT *) context;
+ struct Account *account = (struct Account *) context;
int len;
if (!account || !psecret)
return SASL_OK;
}
-static sasl_callback_t *mutt_sasl_get_callbacks(ACCOUNT *account)
+static sasl_callback_t *mutt_sasl_get_callbacks(struct Account *account)
{
sasl_callback_t *callback = NULL;
* connections after the given connection (allows higher level socket code
* to make more fine-grained searches than account info - eg in IMAP we may
* wish to find a connection which is not in IMAP_SELECTED state) */
-CONNECTION *mutt_conn_find(const CONNECTION *start, const ACCOUNT *account)
+CONNECTION *mutt_conn_find(const CONNECTION *start, const struct Account *account)
{
CONNECTION *conn = NULL;
ciss_url_t url;
char hook[LONG_STRING];
/* account isn't actually modified, since url isn't either */
- mutt_account_tourl((ACCOUNT *) account, &url);
+ mutt_account_tourl((struct Account *) account, &url);
url.path = NULL;
url_ciss_tostring(&url, hook, sizeof(hook), 0);
mutt_account_hook(hook);
}
conn = socket_new_conn();
- memcpy(&conn->account, account, sizeof(ACCOUNT));
+ memcpy(&conn->account, account, sizeof(struct Account));
conn->next = Connections;
Connections = conn;
typedef struct _connection
{
- ACCOUNT account;
+ struct Account account;
/* security strength factor, in bits */
unsigned int ssf;
void *data;
/* stupid hack for imap_logout_all */
CONNECTION *mutt_socket_head(void);
void mutt_socket_free(CONNECTION *conn);
-CONNECTION *mutt_conn_find(const CONNECTION *start, const ACCOUNT *account);
+CONNECTION *mutt_conn_find(const CONNECTION *start, const struct Account *account);
int raw_socket_read(CONNECTION *conn, char *buf, size_t len);
int raw_socket_write(CONNECTION *conn, const char *buf, size_t count);
static int ssl_passwd_cb(char *buf, int size, int rwflag, void *userdata)
{
- ACCOUNT *account = (ACCOUNT *) userdata;
+ struct Account *account = (struct Account *) userdata;
if (mutt_account_getuser(account))
return 0;
}
/* Make fully qualified cache file name */
-static void cache_expand(char *dst, size_t dstlen, ACCOUNT *acct, char *src)
+static void cache_expand(char *dst, size_t dstlen, struct Account *acct, char *src)
{
char *c = NULL;
char file[_POSIX_PATH_MAX];
}
/* Make fully qualified url from newsgroup name */
-void nntp_expand_path(char *line, size_t len, ACCOUNT *acct)
+void nntp_expand_path(char *line, size_t len, struct Account *acct)
{
ciss_url_t url;
const char *elsestring, unsigned long data, format_flag flags)
{
NNTP_SERVER *nserv = (NNTP_SERVER *) data;
- ACCOUNT *acct = &nserv->conn->account;
+ struct Account *acct = &nserv->conn->account;
ciss_url_t url;
char fn[SHORT_STRING], tmp[SHORT_STRING], *p = NULL;
char *p = NULL;
#endif
int rc;
- ACCOUNT acct;
+ struct Account acct;
NNTP_SERVER *nserv = NULL;
NNTP_DATA *nntp_data = NULL;
CONNECTION *conn = NULL;
int nntp_newsrc_parse(NNTP_SERVER *nserv);
void nntp_newsrc_close(NNTP_SERVER *nserv);
void nntp_buffy(char *buf, size_t len);
-void nntp_expand_path(char *line, size_t len, ACCOUNT *acct);
+void nntp_expand_path(char *line, size_t len, struct Account *acct);
void nntp_clear_cache(NNTP_SERVER *nserv);
const char *nntp_format_str(char *dest, size_t destlen, size_t col, int cols,
char op, const char *src, const char *fmt,
int ret;
char buf[LONG_STRING];
CONNECTION *conn = NULL;
- ACCOUNT acct;
+ struct Account acct;
POP_DATA *pop_data = NULL;
ciss_url_t url;
CONNECTION *conn = NULL;
CONTEXT ctx;
MESSAGE *msg = NULL;
- ACCOUNT acct;
+ struct Account acct;
POP_DATA *pop_data = NULL;
if (!PopHost)
/* pop_lib.c */
#define pop_query(A, B, C) pop_query_d(A, B, C, NULL)
-int pop_parse_path(const char *path, ACCOUNT *acct);
+int pop_parse_path(const char *path, struct Account *acct);
int pop_connect(POP_DATA *pop_data);
int pop_open_connection(POP_DATA *pop_data);
int pop_query_d(POP_DATA *pop_data, char *buf, size_t buflen, char *msg);
*/
int pop_authenticate(POP_DATA *pop_data)
{
- ACCOUNT *acct = &pop_data->conn->account;
+ struct Account *acct = &pop_data->conn->account;
const pop_auth_t *authenticator = NULL;
char *methods = NULL;
char *comma = NULL;
#endif
/* given an POP mailbox name, return host, port, username and password */
-int pop_parse_path(const char *path, ACCOUNT *acct)
+int pop_parse_path(const char *path, struct Account *acct)
{
ciss_url_t url;
char *c = NULL;
}
-static int smtp_fill_account(ACCOUNT *account)
+static int smtp_fill_account(struct Account *account)
{
static unsigned short SmtpPort = 0;
const ADDRESS *bcc, const char *msgfile, int eightbit)
{
CONNECTION *conn = NULL;
- ACCOUNT account;
+ struct Account account;
const char *envfrom = NULL;
char buf[1024];
int ret = -1;