From: Richard Russon Date: Mon, 15 May 2017 13:25:32 +0000 (+0100) Subject: replace 'ACCOUNT' with 'struct Account' X-Git-Tag: neomutt-20170526~21^2~85 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7e51358a0ec343c16f484fcfea6b780b63f1bb4c;p=neomutt replace 'ACCOUNT' with 'struct Account' --- diff --git a/account.c b/account.c index 121e2c2dc..8645a5d01 100644 --- a/account.c +++ b/account.c @@ -23,7 +23,7 @@ #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); @@ -67,7 +67,7 @@ int mutt_account_match(const ACCOUNT *a1, const ACCOUNT *a2) } /* 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) @@ -98,7 +98,7 @@ int mutt_account_fromurl(ACCOUNT *account, ciss_url_t *url) * 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; @@ -155,8 +155,8 @@ void mutt_account_tourl(ACCOUNT *account, ciss_url_t *url) 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]; @@ -192,7 +192,7 @@ int mutt_account_getuser(ACCOUNT *account) return 0; } -int mutt_account_getlogin(ACCOUNT *account) +int mutt_account_getlogin(struct Account *account) { /* already set */ if (account->flags & MUTT_ACCT_LOGIN) @@ -219,8 +219,8 @@ int mutt_account_getlogin(ACCOUNT *account) 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]; @@ -259,7 +259,7 @@ int mutt_account_getpass(ACCOUNT *account) return 0; } -void mutt_account_unsetpass(ACCOUNT *account) +void mutt_account_unsetpass(struct Account *account) { account->flags &= ~MUTT_ACCT_PASS; } diff --git a/account.h b/account.h index 87975c2da..24aba4e1d 100644 --- a/account.h +++ b/account.h @@ -39,7 +39,7 @@ enum #define MUTT_ACCT_PASS (1 << 3) #define MUTT_ACCT_SSL (1 << 4) -typedef struct +struct Account { char user[64]; char login[64]; @@ -48,14 +48,14 @@ typedef struct 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 */ diff --git a/bcache.c b/bcache.c index d31af93fe..65ac4dbae 100644 --- a/bcache.c +++ b/bcache.c @@ -36,7 +36,7 @@ struct body_cache 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]; @@ -79,7 +79,7 @@ static int bcache_path(ACCOUNT *account, const char *mailbox, char *dst, size_t 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; diff --git a/bcache.h b/bcache.h index 9095b15c5..fdf90dda6 100644 --- a/bcache.h +++ b/bcache.h @@ -37,7 +37,7 @@ typedef struct body_cache body_cache_t; * 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); diff --git a/imap/imap.c b/imap/imap.c index cdc4f7a7d..bc809091e 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -315,10 +315,10 @@ static int imap_check_capabilities(IMAP_DATA *idata) /* 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; @@ -327,7 +327,7 @@ IMAP_DATA *imap_conn_find(const ACCOUNT *account, int flags) 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) diff --git a/imap/imap.h b/imap/imap.h index 4e4700522..b4181adfd 100644 --- a/imap/imap.h +++ b/imap/imap.h @@ -26,7 +26,7 @@ /* -- data structures -- */ typedef struct { - ACCOUNT account; + struct Account account; char *mbox; } IMAP_MBOX; @@ -68,7 +68,7 @@ void imap_pretty_mailbox(char *path); 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); diff --git a/imap/imap_private.h b/imap/imap_private.h index a1844353b..b1243ad97 100644 --- a/imap/imap_private.h +++ b/imap/imap_private.h @@ -238,7 +238,7 @@ int imap_exec_msgset(IMAP_DATA *idata, const char *pre, const char *post, 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); diff --git a/imap/util.c b/imap/util.c index 62572d146..dc96bc84b 100644 --- a/imap/util.c +++ b/imap/util.c @@ -916,12 +916,12 @@ void imap_disallow_reopen(CONTEXT *ctx) 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); } diff --git a/mutt_sasl.c b/mutt_sasl.c index 37786365f..0148c2c6a 100644 --- a/mutt_sasl.c +++ b/mutt_sasl.c @@ -155,10 +155,10 @@ static int mutt_sasl_start(void) 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; @@ -195,7 +195,7 @@ static int mutt_sasl_cb_authname(void *context, int id, const char **result, uns 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) @@ -217,7 +217,7 @@ static int mutt_sasl_cb_pass(sasl_conn_t *conn, void *context, int id, sasl_secr 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; diff --git a/mutt_socket.c b/mutt_socket.c index 5d812ef90..27e8738e9 100644 --- a/mutt_socket.c +++ b/mutt_socket.c @@ -254,14 +254,14 @@ static CONNECTION *socket_new_conn(void) * 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); @@ -275,7 +275,7 @@ CONNECTION *mutt_conn_find(const CONNECTION *start, const ACCOUNT *account) } conn = socket_new_conn(); - memcpy(&conn->account, account, sizeof(ACCOUNT)); + memcpy(&conn->account, account, sizeof(struct Account)); conn->next = Connections; Connections = conn; diff --git a/mutt_socket.h b/mutt_socket.h index 6a2a6bfcc..5dc50f6c7 100644 --- a/mutt_socket.h +++ b/mutt_socket.h @@ -29,7 +29,7 @@ typedef struct _connection { - ACCOUNT account; + struct Account account; /* security strength factor, in bits */ unsigned int ssf; void *data; @@ -63,7 +63,7 @@ int mutt_socket_write_d(CONNECTION *conn, const char *buf, int len, int dbg); /* 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); diff --git a/mutt_ssl.c b/mutt_ssl.c index eb64cdcac..85150df1e 100644 --- a/mutt_ssl.c +++ b/mutt_ssl.c @@ -276,7 +276,7 @@ static void ssl_dprint_err_stack(void) 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; diff --git a/newsrc.c b/newsrc.c index e89a1e282..6344d2c8d 100644 --- a/newsrc.c +++ b/newsrc.c @@ -479,7 +479,7 @@ int nntp_newsrc_update(NNTP_SERVER *nserv) } /* 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]; @@ -506,7 +506,7 @@ static void cache_expand(char *dst, size_t dstlen, ACCOUNT *acct, char *src) } /* 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; @@ -816,7 +816,7 @@ const char *nntp_format_str(char *dest, size_t destlen, size_t col, int cols, ch 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; @@ -877,7 +877,7 @@ NNTP_SERVER *nntp_select_server(char *server, int leave_lock) char *p = NULL; #endif int rc; - ACCOUNT acct; + struct Account acct; NNTP_SERVER *nserv = NULL; NNTP_DATA *nntp_data = NULL; CONNECTION *conn = NULL; diff --git a/nntp.h b/nntp.h index cc25cdfe8..1de34fe02 100644 --- a/nntp.h +++ b/nntp.h @@ -144,7 +144,7 @@ int nntp_check_children(CONTEXT *ctx, const char *msgid); 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, diff --git a/pop.c b/pop.c index 29a282173..4d80e24ef 100644 --- a/pop.c +++ b/pop.c @@ -396,7 +396,7 @@ static int pop_open_mailbox(CONTEXT *ctx) int ret; char buf[LONG_STRING]; CONNECTION *conn = NULL; - ACCOUNT acct; + struct Account acct; POP_DATA *pop_data = NULL; ciss_url_t url; @@ -780,7 +780,7 @@ void pop_fetch_mail(void) CONNECTION *conn = NULL; CONTEXT ctx; MESSAGE *msg = NULL; - ACCOUNT acct; + struct Account acct; POP_DATA *pop_data = NULL; if (!PopHost) diff --git a/pop.h b/pop.h index 6915221ee..72b1af38c 100644 --- a/pop.h +++ b/pop.h @@ -93,7 +93,7 @@ void pop_apop_timestamp(POP_DATA *pop_data, char *buf); /* 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); diff --git a/pop_auth.c b/pop_auth.c index 3a9ddee8f..f1672b2c8 100644 --- a/pop_auth.c +++ b/pop_auth.c @@ -317,7 +317,7 @@ static const pop_auth_t pop_authenticators[] = { */ 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; diff --git a/pop_lib.c b/pop_lib.c index 521c03808..03d733ab9 100644 --- a/pop_lib.c +++ b/pop_lib.c @@ -31,7 +31,7 @@ #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; diff --git a/smtp.c b/smtp.c index 816bcfc1e..066d9e43c 100644 --- a/smtp.c +++ b/smtp.c @@ -259,7 +259,7 @@ static bool addresses_use_unicode(const ADDRESS *a) } -static int smtp_fill_account(ACCOUNT *account) +static int smtp_fill_account(struct Account *account) { static unsigned short SmtpPort = 0; @@ -618,7 +618,7 @@ int mutt_smtp_send(const ADDRESS *from, const ADDRESS *to, const ADDRESS *cc, 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;