From 2be61a284ea936ae48903ba18be4215706b72c6d Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Tue, 16 Apr 2019 15:34:33 +0100 Subject: [PATCH] split Address into a separate library Closes: #1619 --- Makefile.autosetup | 28 ++++++++++++++++++------ addrbook.c | 1 + {email => address}/address.c | 2 +- {email => address}/address.h | 0 {email => address}/group.c | 4 ++-- {email => address}/group.h | 0 {email => address}/idna.c | 2 +- {email => address}/idna2.h | 0 address/lib.h | 42 ++++++++++++++++++++++++++++++++++++ alias.c | 1 + commands.c | 1 + compose.c | 1 + config/address.c | 1 + conn/conn_raw.c | 1 + conn/ssl.c | 1 + copy.c | 1 + edit.c | 1 + email/envelope.c | 2 +- email/lib.h | 6 ------ email/parse.c | 2 +- email/rfc2047.c | 2 +- hcache/serialize.c | 1 + hdrline.c | 1 + hook.c | 1 + init.c | 1 + init.h | 3 ++- main.c | 1 + mbox/mbox.c | 1 + muttlib.c | 1 + mx.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 + pattern.c | 1 + pop/pop_auth.c | 1 + query.c | 1 + recvcmd.c | 1 + remailer.c | 1 + send.c | 1 + sendlib.c | 1 + smtp.c | 1 + sort.c | 1 + test/address.c | 2 +- test/config/address.c | 2 +- version.c | 1 + 48 files changed, 108 insertions(+), 22 deletions(-) rename {email => address}/address.c (99%) rename {email => address}/address.h (100%) rename {email => address}/group.c (98%) rename {email => address}/group.h (100%) rename {email => address}/idna.c (99%) rename {email => address}/idna2.h (100%) create mode 100644 address/lib.h diff --git a/Makefile.autosetup b/Makefile.autosetup index 2027cdfc5..2ba78677a 100644 --- a/Makefile.autosetup +++ b/Makefile.autosetup @@ -236,15 +236,24 @@ ALLOBJS+= $(LIBCONFIGOBJS) ############################################################################### # libemail LIBEMAIL= libemail.a -LIBEMAILOBJS= email/address.o email/attach.o email/body.o \ - email/email_globals.o email/envelope.o email/from.o email/group.o \ - email/email.o email/idna.o email/mime.o email/parameter.o \ +LIBEMAILOBJS= email/attach.o email/body.o \ + email/email_globals.o email/envelope.o email/from.o \ + email/email.o email/mime.o email/parameter.o \ email/parse.o email/rfc2047.o email/rfc2231.o email/tags.o \ email/thread.o email/url.o CLEANFILES+= $(LIBEMAIL) $(LIBEMAILOBJS) MUTTLIBS+= $(LIBEMAIL) ALLOBJS+= $(LIBEMAILOBJS) +############################################################################### +# libaddress +LIBADDRESS= libaddress.a +LIBADDRESSOBJS= address/address.o address/group.o address/idna.o + +CLEANFILES+= $(LIBADDRESS) $(LIBADDRESSOBJS) +MUTTLIBS+= $(LIBADDRESS) +ALLOBJS+= $(LIBADDRESSOBJS) + ############################################################################### # libmutt LIBMUTT= libmutt.a @@ -284,6 +293,13 @@ $(LIBMUTT): $(PWD)/mutt $(LIBMUTTOBJS) $(PWD)/mutt: $(MKDIR_P) $(PWD)/mutt +# libaddress +$(LIBADDRESS): $(PWD)/address $(LIBADDRESSOBJS) + $(AR) cr $@ $(LIBADDRESSOBJS) + $(RANLIB) $@ +$(PWD)/address: + $(MKDIR_P) $(PWD)/address + # libemail $(LIBEMAIL): $(PWD)/email $(LIBEMAILOBJS) $(AR) cr $@ $(LIBEMAILOBJS) @@ -374,7 +390,7 @@ git_ver.c: $(ALL_FILES) cmp -s $@.tmp $@ || mv $@.tmp $@; \ rm -f $@.tmp -hcache/hcversion.h: $(SRCDIR)/email/address.h \ +hcache/hcversion.h: $(SRCDIR)/address/address.h \ $(SRCDIR)/email/body.h \ $(SRCDIR)/email/email.h \ $(SRCDIR)/email/envelope.h \ @@ -384,7 +400,7 @@ hcache/hcversion.h: $(SRCDIR)/email/address.h \ $(SRCDIR)/hcache/hcachever.sh $(MKDIR_P) $(PWD)/hcache ( echo '#include "config.h"'; \ - echo '#include "email/address.h"'; \ + echo '#include "address/address.h"'; \ echo '#include "email/body.h"'; \ echo '#include "email/email.h"'; \ echo '#include "email/envelope.h"'; \ @@ -435,7 +451,7 @@ coverage: all test genhtml -o lcov lcov.info # Tests for the config code -config-test: libmutt.a libemail.a libconfig.a +config-test: libmutt.a libemail.a libconfig.a libaddress.a ############################################################################## # include generated dependency files diff --git a/addrbook.c b/addrbook.c index a14476683..af941d767 100644 --- a/addrbook.c +++ b/addrbook.c @@ -34,6 +34,7 @@ #include "config/lib.h" #include "email/lib.h" #include "mutt.h" +#include "address/lib.h" #include "alias.h" #include "curs_lib.h" #include "format_flags.h" diff --git a/email/address.c b/address/address.c similarity index 99% rename from email/address.c rename to address/address.c index 1318fb51b..98679f2ab 100644 --- a/email/address.c +++ b/address/address.c @@ -22,7 +22,7 @@ */ /** - * @page email_address Representation of an email address + * @page addr_address Representation of an email address * * Representation of an email address */ diff --git a/email/address.h b/address/address.h similarity index 100% rename from email/address.h rename to address/address.h diff --git a/email/group.c b/address/group.c similarity index 98% rename from email/group.c rename to address/group.c index 380b6e852..9603eaa9c 100644 --- a/email/group.c +++ b/address/group.c @@ -22,7 +22,7 @@ */ /** - * @page email_group Handling for email address groups + * @page addr_group Handling for email address groups * * Handling for email address groups */ @@ -30,8 +30,8 @@ #include "config.h" #include #include -#include "email/address.h" #include "group.h" +#include "address/lib.h" static struct Hash *Groups = NULL; diff --git a/email/group.h b/address/group.h similarity index 100% rename from email/group.h rename to address/group.h diff --git a/email/idna.c b/address/idna.c similarity index 99% rename from email/idna.c rename to address/idna.c index 83ef80111..539b35aaf 100644 --- a/email/idna.c +++ b/address/idna.c @@ -21,7 +21,7 @@ */ /** - * @page email_idna Handling of international domain names + * @page addr_idna Handling of international domain names * * Handling of international domain names */ diff --git a/email/idna2.h b/address/idna2.h similarity index 100% rename from email/idna2.h rename to address/idna2.h diff --git a/address/lib.h b/address/lib.h new file mode 100644 index 000000000..cbd153054 --- /dev/null +++ b/address/lib.h @@ -0,0 +1,42 @@ +/** + * @file + * Email Address Handling + * + * @authors + * Copyright (C) 2019 Richard Russon + * + * @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 . + */ + +/** + * @page address ADDRESS: Email Address Handling + * + * Email Address Handling + * + * | File | Description | + * | :--------------------- | :----------------------- | + * | address/address.c | @subpage addr_address | + * | address/group.c | @subpage addr_group | + * | address/idna.c | @subpage addr_idna | + */ + +#ifndef MUTT_ADDRESS_LIB_H +#define MUTT_ADDRESS_LIB_H + +#include "address.h" +#include "group.h" +#include "idna2.h" + +#endif /* MUTT_ADDRESS_LIB_H */ diff --git a/alias.c b/alias.c index 162978d8e..cea935b1c 100644 --- a/alias.c +++ b/alias.c @@ -42,6 +42,7 @@ #include "mutt.h" #include "alias.h" #include "addrbook.h" +#include "address/lib.h" #include "curs_lib.h" #include "globals.h" #include "hdrline.h" diff --git a/commands.c b/commands.c index 85fa0e3ba..d93eeb247 100644 --- a/commands.c +++ b/commands.c @@ -40,6 +40,7 @@ #include "email/lib.h" #include "conn/conn.h" #include "mutt.h" +#include "address/lib.h" #include "alias.h" #include "context.h" #include "copy.h" diff --git a/compose.c b/compose.c index cd512b196..959ec6625 100644 --- a/compose.c +++ b/compose.c @@ -41,6 +41,7 @@ #include "conn/conn.h" #include "mutt.h" #include "compose.h" +#include "address/lib.h" #include "alias.h" #include "browser.h" #include "commands.h" diff --git a/config/address.c b/config/address.c index ef90b042e..5e0796fa3 100644 --- a/config/address.c +++ b/config/address.c @@ -34,6 +34,7 @@ #include "mutt/mutt.h" #include "email/lib.h" #include "address.h" +#include "address/lib.h" #include "set.h" #include "types.h" diff --git a/conn/conn_raw.c b/conn/conn_raw.c index e85b13068..47bc5d605 100644 --- a/conn/conn_raw.c +++ b/conn/conn_raw.c @@ -46,6 +46,7 @@ #include "mutt/mutt.h" #include "email/lib.h" #include "conn/connaccount.h" +#include "address/lib.h" #include "conn_globals.h" #include "connection.h" #include "curs_lib.h" diff --git a/conn/ssl.c b/conn/ssl.c index 36b11873b..f59b0edad 100644 --- a/conn/ssl.c +++ b/conn/ssl.c @@ -52,6 +52,7 @@ #include "email/lib.h" #include "mutt.h" #include "ssl.h" +#include "address/lib.h" #include "conn_globals.h" #include "connaccount.h" #include "connection.h" diff --git a/copy.c b/copy.c index 9beab96fc..1850cbdad 100644 --- a/copy.c +++ b/copy.c @@ -36,6 +36,7 @@ #include "email/lib.h" #include "mutt.h" #include "copy.h" +#include "address/lib.h" #include "context.h" #include "globals.h" #include "handler.h" diff --git a/edit.c b/edit.c index eede0ece2..faa87ce3c 100644 --- a/edit.c +++ b/edit.c @@ -38,6 +38,7 @@ #include #include "mutt/mutt.h" #include "email/lib.h" +#include "address/lib.h" #include "alias.h" #include "context.h" #include "curs_lib.h" diff --git a/email/envelope.c b/email/envelope.c index 184afbe38..de1971a24 100644 --- a/email/envelope.c +++ b/email/envelope.c @@ -31,7 +31,7 @@ #include #include "mutt/mutt.h" #include "envelope.h" -#include "address.h" +#include "address/lib.h" /** * mutt_env_new - Create a new Envelope diff --git a/email/lib.h b/email/lib.h index d4baa49a8..6b086a8ea 100644 --- a/email/lib.h +++ b/email/lib.h @@ -27,15 +27,12 @@ * * | File | Description | * | :--------------------- | :----------------------- | - * | email/address.c | @subpage email_address | * | email/attach.c | @subpage email_attach | * | email/body.c | @subpage email_body | * | email/email_globals.c | @subpage email_globals | * | email/envelope.c | @subpage email_envelope | * | email/from.c | @subpage email_from | - * | email/group.c | @subpage email_group | * | email/email.c | @subpage email_email | - * | email/idna.c | @subpage email_idna | * | email/mime.c | @subpage email_mime | * | email/parameter.c | @subpage email_parameter | * | email/parse.c | @subpage email_parse | @@ -49,7 +46,6 @@ #ifndef MUTT_EMAIL_LIB_H #define MUTT_EMAIL_LIB_H -#include "address.h" #include "attach.h" #include "body.h" #include "content.h" @@ -57,8 +53,6 @@ #include "email_globals.h" #include "envelope.h" #include "from.h" -#include "group.h" -#include "idna2.h" #include "mime.h" #include "parameter.h" #include "parse.h" diff --git a/email/parse.c b/email/parse.c index 8b1bcf450..d8f9051d4 100644 --- a/email/parse.c +++ b/email/parse.c @@ -36,7 +36,7 @@ #include "mutt/mutt.h" #include "mutt.h" #include "parse.h" -#include "address.h" +#include "address/lib.h" #include "body.h" #include "email.h" #include "email_globals.h" diff --git a/email/rfc2047.c b/email/rfc2047.c index 95dc04b71..5110a1e3e 100644 --- a/email/rfc2047.c +++ b/email/rfc2047.c @@ -37,7 +37,7 @@ #include #include "mutt/mutt.h" #include "rfc2047.h" -#include "address.h" +#include "address/lib.h" #include "email_globals.h" #include "envelope.h" #include "mime.h" diff --git a/hcache/serialize.c b/hcache/serialize.c index 4b42a8ae6..4c469bdcc 100644 --- a/hcache/serialize.c +++ b/hcache/serialize.c @@ -37,6 +37,7 @@ #include #include "mutt/mutt.h" #include "email/lib.h" +#include "address/lib.h" #include "globals.h" #include "hcache.h" diff --git a/hdrline.c b/hdrline.c index 60bf5b581..1fed6b78c 100644 --- a/hdrline.c +++ b/hdrline.c @@ -40,6 +40,7 @@ #include "email/lib.h" #include "mutt.h" #include "hdrline.h" +#include "address/lib.h" #include "alias.h" #include "context.h" #include "curs_lib.h" diff --git a/hook.c b/hook.c index 76c2e1bce..dc9b2f469 100644 --- a/hook.c +++ b/hook.c @@ -37,6 +37,7 @@ #include "email/lib.h" #include "mutt.h" #include "hook.h" +#include "address/lib.h" #include "alias.h" #include "context.h" #include "globals.h" diff --git a/init.c b/init.c index 37cfe1512..7824412fc 100644 --- a/init.c +++ b/init.c @@ -46,6 +46,7 @@ #include "mutt.h" #include "init.h" #include "account.h" +#include "address/lib.h" #include "alias.h" #include "context.h" #include "filter.h" diff --git a/init.h b/init.h index 1c0f93bef..49aa527d9 100644 --- a/init.h +++ b/init.h @@ -35,6 +35,7 @@ #include "conn/conn.h" #include "mutt.h" #include "addrbook.h" +#include "address/lib.h" #include "bcache.h" #include "browser.h" #include "color.h" @@ -52,11 +53,11 @@ #include "mailbox.h" #include "maildir/lib.h" #include "main.h" -#include "mutt_menu.h" #include "mutt_account.h" #include "mutt_commands.h" #include "mutt_history.h" #include "mutt_logging.h" +#include "mutt_menu.h" #include "mutt_thread.h" #include "muttlib.h" #include "mx.h" diff --git a/main.c b/main.c index 656455b2c..7fa82526f 100644 --- a/main.c +++ b/main.c @@ -48,6 +48,7 @@ #include "conn/conn.h" #include "mutt.h" #include "account.h" +#include "address/lib.h" #include "alias.h" #include "browser.h" #include "color.h" diff --git a/mbox/mbox.c b/mbox/mbox.c index 6e5816c53..c35a096ba 100644 --- a/mbox/mbox.c +++ b/mbox/mbox.c @@ -45,6 +45,7 @@ #include "mutt.h" #include "mbox.h" #include "account.h" +#include "address/lib.h" #include "context.h" #include "copy.h" #include "globals.h" diff --git a/muttlib.c b/muttlib.c index 0a0a8bc40..c911b2270 100644 --- a/muttlib.c +++ b/muttlib.c @@ -47,6 +47,7 @@ #include "conn/conn.h" #include "mutt.h" #include "muttlib.h" +#include "address/lib.h" #include "alias.h" #include "curs_lib.h" #include "filter.h" diff --git a/mx.c b/mx.c index 220152a0c..f6202d8dc 100644 --- a/mx.c +++ b/mx.c @@ -44,6 +44,7 @@ #include "mutt.h" #include "mx.h" #include "account.h" +#include "address/lib.h" #include "alias.h" #include "context.h" #include "copy.h" diff --git a/ncrypt/crypt.c b/ncrypt/crypt.c index 958df3588..0987c1218 100644 --- a/ncrypt/crypt.c +++ b/ncrypt/crypt.c @@ -42,6 +42,7 @@ #include "config/lib.h" #include "email/lib.h" #include "mutt.h" +#include "address/lib.h" #include "alias.h" #include "context.h" #include "copy.h" diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index c210e2ebb..196341bc1 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -53,6 +53,7 @@ #include "config/lib.h" #include "email/lib.h" #include "mutt.h" +#include "address/lib.h" #include "alias.h" #include "crypt.h" #include "curs_lib.h" diff --git a/ncrypt/pgp.c b/ncrypt/pgp.c index 59b736d58..f943a9a75 100644 --- a/ncrypt/pgp.c +++ b/ncrypt/pgp.c @@ -45,6 +45,7 @@ #include "config/lib.h" #include "email/lib.h" #include "mutt.h" +#include "address/lib.h" #include "crypt.h" #include "cryptglue.h" #include "curs_lib.h" diff --git a/ncrypt/pgpinvoke.c b/ncrypt/pgpinvoke.c index 5319de48c..35fe7caf9 100644 --- a/ncrypt/pgpinvoke.c +++ b/ncrypt/pgpinvoke.c @@ -36,6 +36,7 @@ #include #include "mutt/mutt.h" #include "email/lib.h" +#include "address/lib.h" #include "filter.h" #include "format_flags.h" #include "globals.h" diff --git a/ncrypt/pgpkey.c b/ncrypt/pgpkey.c index 897db4fdf..a3d4e2086 100644 --- a/ncrypt/pgpkey.c +++ b/ncrypt/pgpkey.c @@ -43,6 +43,7 @@ #include "email/lib.h" #include "mutt.h" #include "pgpkey.h" +#include "address/lib.h" #include "crypt.h" #include "curs_lib.h" #include "filter.h" diff --git a/ncrypt/smime.c b/ncrypt/smime.c index 2fb9b91fd..528c007a6 100644 --- a/ncrypt/smime.c +++ b/ncrypt/smime.c @@ -39,6 +39,7 @@ #include "config/lib.h" #include "email/lib.h" #include "mutt.h" +#include "address/lib.h" #include "alias.h" #include "context.h" #include "copy.h" diff --git a/pattern.c b/pattern.c index 0bacf9b39..70f943eb7 100644 --- a/pattern.c +++ b/pattern.c @@ -43,6 +43,7 @@ #include "conn/conn.h" #include "mutt.h" #include "pattern.h" +#include "address/lib.h" #include "alias.h" #include "context.h" #include "copy.h" diff --git a/pop/pop_auth.c b/pop/pop_auth.c index 4f1a8359d..a4cbfdb77 100644 --- a/pop/pop_auth.c +++ b/pop/pop_auth.c @@ -35,6 +35,7 @@ #include "mutt/mutt.h" #include "email/lib.h" #include "conn/conn.h" +#include "address/lib.h" #include "mutt_account.h" #include "mutt_logging.h" #include "mutt_socket.h" diff --git a/query.c b/query.c index 47ecfb15b..a8f518447 100644 --- a/query.c +++ b/query.c @@ -35,6 +35,7 @@ #include "mutt/mutt.h" #include "email/lib.h" #include "mutt.h" +#include "address/lib.h" #include "alias.h" #include "curs_lib.h" #include "filter.h" diff --git a/recvcmd.c b/recvcmd.c index 362b25de7..0e9aba126 100644 --- a/recvcmd.c +++ b/recvcmd.c @@ -35,6 +35,7 @@ #include "config/lib.h" #include "email/lib.h" #include "mutt.h" +#include "address/lib.h" #include "alias.h" #include "context.h" #include "copy.h" diff --git a/remailer.c b/remailer.c index 1d0ae3ab6..797f21cc0 100644 --- a/remailer.c +++ b/remailer.c @@ -35,6 +35,7 @@ #include "mutt/mutt.h" #include "email/lib.h" #include "mutt.h" +#include "address/lib.h" #include "curs_lib.h" #include "filter.h" #include "format_flags.h" diff --git a/send.c b/send.c index 47600da10..ced8accd8 100644 --- a/send.c +++ b/send.c @@ -42,6 +42,7 @@ #include "email/lib.h" #include "mutt.h" #include "send.h" +#include "address/lib.h" #include "alias.h" #include "compose.h" #include "context.h" diff --git a/sendlib.c b/sendlib.c index 9903ce07f..55ffcf1e3 100644 --- a/sendlib.c +++ b/sendlib.c @@ -46,6 +46,7 @@ #include "email/lib.h" #include "mutt.h" #include "sendlib.h" +#include "address/lib.h" #include "context.h" #include "copy.h" #include "curs_lib.h" diff --git a/smtp.c b/smtp.c index 6b35be232..04f7efbbf 100644 --- a/smtp.c +++ b/smtp.c @@ -42,6 +42,7 @@ #include "email/lib.h" #include "conn/conn.h" #include "mutt.h" +#include "address/lib.h" #include "globals.h" #include "mutt_account.h" #include "mutt_socket.h" diff --git a/sort.c b/sort.c index 6e2912232..3673f23e8 100644 --- a/sort.c +++ b/sort.c @@ -33,6 +33,7 @@ #include "mutt/mutt.h" #include "email/lib.h" #include "sort.h" +#include "address/lib.h" #include "alias.h" #include "context.h" #include "globals.h" diff --git a/test/address.c b/test/address.c index acd1fd6de..fb69ac78d 100644 --- a/test/address.c +++ b/test/address.c @@ -1,6 +1,6 @@ #define TEST_NO_MAIN #include "acutest.h" -#include "email/address.h" +#include "address/lib.h" #include "mutt/memory.h" #include diff --git a/test/config/address.c b/test/config/address.c index b48f7171d..e68696e05 100644 --- a/test/config/address.c +++ b/test/config/address.c @@ -30,7 +30,7 @@ #include "mutt/mutt.h" #include "config/common.h" #include "config/lib.h" -#include "email/address.h" +#include "address/lib.h" static struct Address *VarApple; static struct Address *VarBanana; diff --git a/version.c b/version.c index 1a098c801..3ab9a05d2 100644 --- a/version.c +++ b/version.c @@ -36,6 +36,7 @@ #include #include "mutt/mutt.h" #include "email/lib.h" +#include "address/lib.h" #include "mutt_curses.h" #include "ncrypt/crypt_gpgme.h" #ifdef USE_INOTIFY -- 2.40.0