From c7b2a5be2c694b00cc775f7a382d8beac87fbaba Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Tue, 28 Nov 2017 15:16:06 +0000 Subject: [PATCH] rename rfc822.c to address.c --- Makefile.am | 4 +-- Makefile.autosetup | 2 +- addrbook.c | 1 - rfc822.c => address.c | 2 +- address.h | 42 ++++++++++++++++++++++++ alias.c | 1 - commands.c | 2 +- compose.c | 2 +- copy.c | 1 - edit.c | 2 +- envelope.c | 2 +- group.c | 1 - hcache/hcache.c | 1 - hdrline.c | 1 - init.c | 1 - main.c | 1 - mbox.c | 1 - mutt_address.c | 2 +- mutt_lua.c | 2 +- muttlib.c | 1 - ncrypt/crypt.c | 1 - ncrypt/crypt_gpgme.c | 1 - ncrypt/pgp.c | 1 - ncrypt/pgpinvoke.c | 1 - ncrypt/pgpkey.c | 1 - ncrypt/smime.c | 1 - parse.c | 2 +- po/POTFILES.in | 2 +- pop_auth.c | 2 +- query.c | 1 - recvcmd.c | 2 +- remailer.c | 1 - rfc2047.c | 4 +-- rfc822.h | 74 ------------------------------------------- send.c | 1 - sendlib.c | 1 - url.c | 2 +- 37 files changed, 58 insertions(+), 112 deletions(-) rename rfc822.c => address.c (99%) delete mode 100644 rfc822.h diff --git a/Makefile.am b/Makefile.am index 3f313aa7c..1c729b69e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -53,7 +53,7 @@ neomutt_SOURCES = mutt_account.c addrbook.c address.h alias.c alias.h attach.c \ mx.c newsrc.c nntp.c options.h pager.c parameter.c parameter.h \ parse.c pattern.c pattern.h pop.c pop_auth.c pop_lib.c postpone.c \ query.c recvattach.c recvcmd.c rfc1524.c rfc2047.c rfc2231.c rfc3676.c \ - rfc822.c safe_asprintf.c score.c send.c sendlib.c sidebar.c mutt_signal.c \ + address.c safe_asprintf.c score.c send.c sendlib.c sidebar.c mutt_signal.c \ smtp.c sort.c state.c state.h status.c system.c thread.c thread.h url.c \ version.c where.h mutt_tags.c @@ -92,7 +92,7 @@ EXTRA_DIST = mutt_account.h attach.h bcache.h browser.h buffy.h \ mutt_options.h mutt_regex.h \ mutt_socket.h mx.h myvar.h nntp.h opcodes.h pager.h \ pgpewrap.c pop.h protos.h README.md README.SSL remailer.c remailer.h \ - rfc1524.h rfc2047.h rfc2231.h rfc3676.h rfc822.h sidebar.h \ + rfc1524.h rfc2047.h rfc2231.h rfc3676.h sidebar.h \ sort.h txt2c.c txt2c.sh version.h mutt_tags.h EXTRA_SCRIPTS = diff --git a/Makefile.autosetup b/Makefile.autosetup index bcb94c827..a2d9f8601 100644 --- a/Makefile.autosetup +++ b/Makefile.autosetup @@ -63,7 +63,7 @@ NEOMUTTOBJS= mutt_account.o addrbook.o alias.o attach.o bcache.o body.o \ mutt_socket.o mutt_tags.o mx.o \ newsrc.o nntp.o pager.o parameter.o parse.o pattern.o pop.o \ pop_auth.o pop_lib.o postpone.o query.o recvattach.o recvcmd.o \ - rfc1524.o rfc2047.o rfc2231.o rfc3676.o rfc822.o \ + rfc1524.o rfc2047.o rfc2231.o rfc3676.o address.o \ safe_asprintf.o score.o send.o sendlib.o sidebar.o mutt_signal.o \ smtp.o sort.o state.o status.o system.o thread.o url.o \ version.o diff --git a/addrbook.c b/addrbook.c index 659a5880b..c75e1c1c8 100644 --- a/addrbook.c +++ b/addrbook.c @@ -36,7 +36,6 @@ #include "opcodes.h" #include "options.h" #include "protos.h" -#include "rfc822.h" #include "sort.h" #define RSORT(x) (SortAlias & SORT_REVERSE) ? -x : x diff --git a/rfc822.c b/address.c similarity index 99% rename from rfc822.c rename to address.c index 60378c947..6f0ab2d1e 100644 --- a/rfc822.c +++ b/address.c @@ -54,7 +54,7 @@ #include #include #include "mutt/mutt.h" -#include "rfc822.h" +#include "address.h" #include "mutt_idna.h" /** diff --git a/address.h b/address.h index a39649eba..a38410945 100644 --- a/address.h +++ b/address.h @@ -38,4 +38,46 @@ struct Address bool intl_checked : 1; }; +/** + * enum AddressError - possible values for RFC822Error + */ +enum AddressError +{ + ERR_MEMORY = 1, + ERR_MISMATCH_PAREN, + ERR_MISMATCH_QUOTE, + ERR_BAD_ROUTE, + ERR_BAD_ROUTE_ADDR, + ERR_BAD_ADDR_SPEC +}; + +void rfc822_free_address(struct Address **p); +void rfc822_qualify(struct Address *addr, const char *host); +struct Address *rfc822_parse_adrlist(struct Address *top, const char *s); +struct Address *rfc822_cpy_adr(struct Address *addr, int prune); +struct Address *rfc822_cpy_adr_real(struct Address *addr); +struct Address *rfc822_append(struct Address **a, struct Address *b, int prune); +int rfc822_write_address(char *buf, size_t buflen, struct Address *addr, int display); +void rfc822_write_address_single(char *buf, size_t buflen, struct Address *addr, int display); +void rfc822_cat(char *buf, size_t buflen, const char *value, const char *specials); +bool rfc822_valid_msgid(const char *msgid); +int rfc822_remove_from_adrlist(struct Address **a, const char *mailbox); + +extern int RFC822Error; +extern const char *const RFC822Errors[]; +extern const char RFC822Specials[]; + +#define rfc822_error(x) RFC822Errors[x] + +/** + * rfc822_new_address - Create a new Address + * @retval ptr Newly allocated Address + * + * Free the result with free_address() or rfc822_free_address() + */ +static inline struct Address *rfc822_new_address(void) +{ + return mutt_mem_calloc(1, sizeof(struct Address)); +} + #endif /* _MUTT_ADDRESS_H */ diff --git a/alias.c b/alias.c index 205f5319f..dcf51d523 100644 --- a/alias.c +++ b/alias.c @@ -43,7 +43,6 @@ #include "mutt_idna.h" #include "options.h" #include "protos.h" -#include "rfc822.h" struct Address *mutt_lookup_alias(const char *s) { diff --git a/commands.c b/commands.c index 6dcd2c6af..be4cc61d4 100644 --- a/commands.c +++ b/commands.c @@ -58,7 +58,7 @@ #include "pager.h" #include "parameter.h" #include "protos.h" -#include "rfc822.h" +#include "address.h" #include "sort.h" #ifdef USE_IMAP #include "imap/imap.h" diff --git a/compose.c b/compose.c index b1dd75d71..734a7e0a0 100644 --- a/compose.c +++ b/compose.c @@ -55,7 +55,7 @@ #include "opcodes.h" #include "options.h" #include "protos.h" -#include "rfc822.h" +#include "address.h" #include "sort.h" #ifdef MIXMASTER #include "remailer.h" diff --git a/copy.c b/copy.c index ab1f403df..63c44db70 100644 --- a/copy.c +++ b/copy.c @@ -44,7 +44,6 @@ #include "options.h" #include "protos.h" #include "rfc2047.h" -#include "rfc822.h" #include "state.h" #ifdef USE_NOTMUCH #include "mutt_notmuch.h" diff --git a/edit.c b/edit.c index 316ab8b19..187c6be6f 100644 --- a/edit.c +++ b/edit.c @@ -45,7 +45,7 @@ #include "mutt_idna.h" #include "options.h" #include "protos.h" -#include "rfc822.h" +#include "address.h" /* * SLcurses_waddnstr() can't take a "const char *", so this is only diff --git a/envelope.c b/envelope.c index 88d2f280b..192e6940e 100644 --- a/envelope.c +++ b/envelope.c @@ -38,7 +38,7 @@ #include "mutt/memory.h" #include "mutt/queue.h" #include "envelope.h" -#include "rfc822.h" +#include "address.h" /** * mutt_new_envelope - Create a new Envelope diff --git a/group.c b/group.c index 3f19c989d..97998d717 100644 --- a/group.c +++ b/group.c @@ -29,7 +29,6 @@ #include "address.h" #include "globals.h" #include "protos.h" -#include "rfc822.h" struct Group *mutt_pattern_group(const char *k) { diff --git a/hcache/hcache.c b/hcache/hcache.c index 0a5d8d3aa..0683fd546 100644 --- a/hcache/hcache.c +++ b/hcache/hcache.c @@ -62,7 +62,6 @@ #include "mutt_tags.h" #include "parameter.h" #include "protos.h" -#include "rfc822.h" static unsigned int hcachever = 0x0; diff --git a/hdrline.c b/hdrline.c index 30e4f6408..4be904b78 100644 --- a/hdrline.c +++ b/hdrline.c @@ -46,7 +46,6 @@ #include "ncrypt/ncrypt.h" #include "options.h" #include "protos.h" -#include "rfc822.h" #include "sort.h" #include "thread.h" #ifdef USE_NOTMUCH diff --git a/init.c b/init.c index b4a71221d..dbfb236bb 100644 --- a/init.c +++ b/init.c @@ -62,7 +62,6 @@ #include "ncrypt/ncrypt.h" #include "options.h" #include "pattern.h" -#include "rfc822.h" #include "sidebar.h" #include "version.h" #ifdef USE_NOTMUCH diff --git a/main.c b/main.c index c1d79a517..5201b94ad 100644 --- a/main.c +++ b/main.c @@ -57,7 +57,6 @@ #include "ncrypt/ncrypt.h" #include "options.h" #include "protos.h" -#include "rfc822.h" #include "url.h" #include "version.h" #ifdef USE_SIDEBAR diff --git a/mbox.c b/mbox.c index 26e4f85cd..2d1e50227 100644 --- a/mbox.c +++ b/mbox.c @@ -48,7 +48,6 @@ #include "options.h" #include "parameter.h" #include "protos.h" -#include "rfc822.h" #include "sort.h" #include "thread.h" diff --git a/mutt_address.c b/mutt_address.c index 8dcdecb6a..7861ce34b 100644 --- a/mutt_address.c +++ b/mutt_address.c @@ -25,8 +25,8 @@ #include #include #include "mutt/mutt.h" +#include "address.h" #include "mutt_idna.h" -#include "rfc822.h" void rfc822_write_address_single(char *buf, size_t buflen, struct Address *addr, int display) { diff --git a/mutt_lua.c b/mutt_lua.c index 7faa2fbd1..7bfc2efb8 100644 --- a/mutt_lua.c +++ b/mutt_lua.c @@ -39,7 +39,7 @@ #include "mutt_options.h" #include "options.h" #include "protos.h" -#include "rfc822.h" +#include "address.h" static int handle_panic(lua_State *l) { diff --git a/muttlib.c b/muttlib.c index 6c49bec75..0e20bcc81 100644 --- a/muttlib.c +++ b/muttlib.c @@ -65,7 +65,6 @@ #include "options.h" #include "parameter.h" #include "protos.h" -#include "rfc822.h" #include "url.h" #ifdef USE_IMAP #include "imap/imap.h" diff --git a/ncrypt/crypt.c b/ncrypt/crypt.c index 59d7731d3..545deef2e 100644 --- a/ncrypt/crypt.c +++ b/ncrypt/crypt.c @@ -50,7 +50,6 @@ #include "options.h" #include "parameter.h" #include "protos.h" -#include "rfc822.h" #include "state.h" /** diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index 711eb2427..e8e537b0a 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -66,7 +66,6 @@ #include "pager.h" #include "parameter.h" #include "protos.h" -#include "rfc822.h" #include "sort.h" #include "state.h" diff --git a/ncrypt/pgp.c b/ncrypt/pgp.c index ae0fc3ed2..ce9eb97dd 100644 --- a/ncrypt/pgp.c +++ b/ncrypt/pgp.c @@ -64,7 +64,6 @@ #include "pgplib.h" #include "pgpmicalg.h" #include "protos.h" -#include "rfc822.h" #include "state.h" char PgpPass[LONG_STRING]; diff --git a/ncrypt/pgpinvoke.c b/ncrypt/pgpinvoke.c index 6daddd0a2..04e626f9c 100644 --- a/ncrypt/pgpinvoke.c +++ b/ncrypt/pgpinvoke.c @@ -41,7 +41,6 @@ #include "pgp.h" #include "pgpkey.h" #include "protos.h" -#include "rfc822.h" /** * struct PgpCommandContext - Data for a PGP command diff --git a/ncrypt/pgpkey.c b/ncrypt/pgpkey.c index 8e569ce0e..d9a1cc372 100644 --- a/ncrypt/pgpkey.c +++ b/ncrypt/pgpkey.c @@ -54,7 +54,6 @@ #include "pgpinvoke.h" #include "pgplib.h" #include "protos.h" -#include "rfc822.h" #include "sort.h" /** diff --git a/ncrypt/smime.c b/ncrypt/smime.c index 64e8b9ce2..6417a0c6f 100644 --- a/ncrypt/smime.c +++ b/ncrypt/smime.c @@ -54,7 +54,6 @@ #include "options.h" #include "parameter.h" #include "protos.h" -#include "rfc822.h" #include "smime.h" #include "state.h" diff --git a/parse.c b/parse.c index e6ca1678a..c651966eb 100644 --- a/parse.c +++ b/parse.c @@ -44,7 +44,7 @@ #include "protos.h" #include "rfc2047.h" #include "rfc2231.h" -#include "rfc822.h" +#include "address.h" #include "url.h" struct Address; diff --git a/po/POTFILES.in b/po/POTFILES.in index 248167b3d..0efd84473 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,4 +1,5 @@ addrbook.c +address.c alias.c attach.c bcache.c @@ -128,7 +129,6 @@ rfc1524.c rfc2047.c rfc2231.c rfc3676.c -rfc822.c safe_asprintf.c score.c send.c diff --git a/pop_auth.c b/pop_auth.c index 3f4e10227..b9e3b3e50 100644 --- a/pop_auth.c +++ b/pop_auth.c @@ -33,7 +33,7 @@ #include "options.h" #include "pop.h" #include "protos.h" -#include "rfc822.h" +#include "address.h" #ifdef USE_SASL #include #include diff --git a/query.c b/query.c index 0933d6d1e..f61ed1311 100644 --- a/query.c +++ b/query.c @@ -45,7 +45,6 @@ #include "mutt_menu.h" #include "opcodes.h" #include "protos.h" -#include "rfc822.h" /** * struct Query - An entry from an external address-book diff --git a/recvcmd.c b/recvcmd.c index 4fc2167a5..f3ca65b3c 100644 --- a/recvcmd.c +++ b/recvcmd.c @@ -38,7 +38,7 @@ #include "mutt_idna.h" #include "options.h" #include "protos.h" -#include "rfc822.h" +#include "address.h" #include "state.h" /** diff --git a/remailer.c b/remailer.c index 65b7def54..1cdd58c5d 100644 --- a/remailer.c +++ b/remailer.c @@ -45,7 +45,6 @@ #include "opcodes.h" #include "options.h" #include "protos.h" -#include "rfc822.h" /** * struct Coord - Screen coordinates diff --git a/rfc2047.c b/rfc2047.c index 367c9edbe..40cbd5057 100644 --- a/rfc2047.c +++ b/rfc2047.c @@ -51,8 +51,6 @@ #define CONTINUATION_BYTE(c) (((c) &0xc0) == 0x80) -extern char RFC822Specials[]; - typedef size_t (*encoder_t)(char *s, const char *d, size_t dlen, const char *tocode); static size_t convert_string(const char *f, size_t flen, const char *from, @@ -426,7 +424,7 @@ static size_t choose_block(char *d, size_t dlen, int col, const char *fromcode, * if col is non-zero, the preceding character was a space. */ static int rfc2047_encode(const char *d, size_t dlen, int col, const char *fromcode, - const char *charsets, char **e, size_t *elen, char *specials) + const char *charsets, char **e, size_t *elen, const char *specials) { int rc = 0; char *buf = NULL; diff --git a/rfc822.h b/rfc822.h deleted file mode 100644 index d983ab800..000000000 --- a/rfc822.h +++ /dev/null @@ -1,74 +0,0 @@ -/** - * @file - * RFC822 Email format routines - * - * @authors - * Copyright (C) 1996-2000 Michael R. Elkins - * Copyright (C) 2012 Michael R. Elkins - * - * @copyright - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 2 of the License, or (at your option) any later - * version. - * - * 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 . - */ - -#ifndef _MUTT_RFC822_H -#define _MUTT_RFC822_H - -#include -#include -#include "address.h" -#include "mutt/mutt.h" - -/** - * enum AddressError - possible values for RFC822Error - */ -enum AddressError -{ - ERR_MEMORY = 1, - ERR_MISMATCH_PAREN, - ERR_MISMATCH_QUOTE, - ERR_BAD_ROUTE, - ERR_BAD_ROUTE_ADDR, - ERR_BAD_ADDR_SPEC -}; - -void rfc822_free_address(struct Address **p); -void rfc822_qualify(struct Address *addr, const char *host); -struct Address *rfc822_parse_adrlist(struct Address *top, const char *s); -struct Address *rfc822_cpy_adr(struct Address *addr, int prune); -struct Address *rfc822_cpy_adr_real(struct Address *addr); -struct Address *rfc822_append(struct Address **a, struct Address *b, int prune); -int rfc822_write_address(char *buf, size_t buflen, struct Address *addr, int display); -void rfc822_write_address_single(char *buf, size_t buflen, struct Address *addr, int display); -void rfc822_cat(char *buf, size_t buflen, const char *value, const char *specials); -bool rfc822_valid_msgid(const char *msgid); -int rfc822_remove_from_adrlist(struct Address **a, const char *mailbox); - -extern int RFC822Error; -extern const char *const RFC822Errors[]; -extern const char RFC822Specials[]; - -#define rfc822_error(x) RFC822Errors[x] - -/** - * rfc822_new_address - Create a new Address - * @retval ptr Newly allocated Address - * - * Free the result with free_address() or rfc822_free_address() - */ -static inline struct Address *rfc822_new_address(void) -{ - return mutt_mem_calloc(1, sizeof(struct Address)); -} - -#endif /* _MUTT_RFC822_H */ diff --git a/send.c b/send.c index 032f7eab1..01607c31a 100644 --- a/send.c +++ b/send.c @@ -55,7 +55,6 @@ #include "protos.h" #include "rfc2047.h" #include "rfc3676.h" -#include "rfc822.h" #include "sort.h" #include "url.h" #ifdef USE_NNTP diff --git a/sendlib.c b/sendlib.c index 72e10db38..92bfc9b5b 100644 --- a/sendlib.c +++ b/sendlib.c @@ -64,7 +64,6 @@ #include "protos.h" #include "rfc2047.h" #include "rfc2231.h" -#include "rfc822.h" #include "state.h" #ifdef USE_NNTP #include "nntp.h" diff --git a/url.c b/url.c index bfd6ef877..557ea0779 100644 --- a/url.c +++ b/url.c @@ -36,7 +36,7 @@ #include "mime.h" #include "protos.h" #include "rfc2047.h" -#include "rfc822.h" +#include "address.h" static const struct Mapping UrlMap[] = { { "file", U_FILE }, { "imap", U_IMAP }, { "imaps", U_IMAPS }, -- 2.40.0