From 2a06362a155582cd59ae2ef6f0df71694a7eede3 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Wed, 1 Nov 2006 23:54:47 +0100 Subject: [PATCH] begin to work on a lib-mime that will hold most of the MIME related stuff. Signed-off-by: Pierre Habouzit --- Makefile.am | 9 ++--- attach.c | 3 +- base64.c | 3 +- commands.c | 3 +- compose.c | 3 +- configure.ac | 1 + copy.c | 3 +- crypt-gpgme.c | 3 +- crypt.c | 3 +- gnupgparse.c | 3 +- handler.c | 3 +- hcache.c | 3 +- hdrline.c | 4 ++- lib-mime/Makefile.am | 6 ++++ rfc2231.c => lib-mime/rfc2231.c | 23 +++++++++++-- mime.h | 58 --------------------------------- muttlib.c | 3 +- nntp/newsrc.c | 3 +- nntp/nntp.c | 3 +- parse.c | 4 +-- pattern.c | 3 +- pgp.c | 3 +- pgpkey.c | 3 +- pgpmicalg.c | 4 ++- postpone.c | 3 +- recvattach.c | 3 +- recvcmd.c | 3 +- rfc2047.c | 3 +- rfc2231.h | 11 ------- send.c | 3 +- sendlib.c | 4 +-- smime.c | 4 +-- url.c | 3 +- 33 files changed, 89 insertions(+), 105 deletions(-) create mode 100644 lib-mime/Makefile.am rename rfc2231.c => lib-mime/rfc2231.c (91%) delete mode 100644 mime.h delete mode 100644 rfc2231.h diff --git a/Makefile.am b/Makefile.am index 3abf33b..4710973 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,7 +19,7 @@ NNTP_SUBDIR = nntp NNTP_INCLUDES = -I$(top_srcdir)/nntp endif -SUBDIRS = intl m4 po lib-lib lib-hash doc contrib lib $(IMAP_SUBDIR) $(POP_SUBDIR) $(NNTP_SUBDIR) +SUBDIRS = intl m4 po lib-lib lib-mime lib-hash doc contrib lib $(IMAP_SUBDIR) $(POP_SUBDIR) $(NNTP_SUBDIR) bin_SCRIPTS = muttngbug fleang @@ -37,17 +37,18 @@ muttng_SOURCES = $(BUILT_SOURCES) \ main.c mbox.c mbyte.c menu.c mh.c muttlib.c mutt_idna.c mx.c \ pager.c parse.c pattern.c postpone.c \ query.c \ - recvattach.c recvcmd.c rfc822.c rfc1524.c rfc2047.c rfc2231.c rfc3676.c \ + recvattach.c recvcmd.c rfc822.c rfc1524.c rfc2047.c rfc3676.c \ score.c send.c sendlib.c sidebar.c signal.c sort.c state.c status.c system.c \ thread.c \ url.c utf8.c \ wcwidth.c muttng_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(LIBPOP) $(LIBNNTP) \ - -Llib-lib -llib -Llib-hash -lhash -Llib -lsane $(MUTTLIBS) $(INTLLIBS) $(LIBICONV) + -Llib-lib -llib -Llib-mime -lmime -Llib-hash -lhash -Llib -lsane $(MUTTLIBS) $(INTLLIBS) $(LIBICONV) muttng_DEPENDENCIES = @MUTT_LIB_OBJECTS@ @LIBOBJS@ \ $(top_builddir)/lib-lib/liblib.a \ + $(top_builddir)/lib-mime/libmime.a \ $(top_builddir)/lib-hash/libhash.a \ $(top_builddir)/lib/libsane.a \ $(LIBIMAPDEPS) $(LIBPOPDEPS) $(LIBNNTPDEPS) $(INTLDEPS) @@ -86,7 +87,7 @@ EXTRA_DIST = config.rpath COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO \ mime.h mutt.h mutt_curses.h mutt_menu.h \ mutt_sasl.h mutt_socket.h mutt_ssl.h mutt_tunnel.h \ mbox.h mh.h mx.h pager.h pgp.h protos.h rfc1524.h rfc2047.h \ - rfc2231.h rfc822.h rfc3676.h \ + rfc822.h rfc3676.h \ sort.h mime.types autogen.sh \ _regex.h OPS.MIX remailer.c remailer.h browser.h state.h \ mbyte.h lib.h extlib.c pgpewrap.c smime_keys.pl pgplib.h Muttngrc.head Muttngrc \ diff --git a/attach.c b/attach.c index 4afb1fb..c590309 100644 --- a/attach.c +++ b/attach.c @@ -18,6 +18,8 @@ #include #include +#include + #include "mutt.h" #include "handler.h" #include "recvattach.h" @@ -25,7 +27,6 @@ #include "mutt_curses.h" #include "keymap.h" #include "rfc1524.h" -#include "mime.h" #include "pager.h" #include "copy.h" #include "mx.h" diff --git a/base64.c b/base64.c index 728171b..0b72009 100644 --- a/base64.c +++ b/base64.c @@ -43,8 +43,9 @@ # include "config.h" #endif +#include + #include "mutt.h" -#include "mime.h" /* raw bytes to null-terminated base 64 string */ void mutt_to_base64 (unsigned char *out, const unsigned char *in, size_t len, diff --git a/commands.c b/commands.c index edc09da..b80e250 100644 --- a/commands.c +++ b/commands.c @@ -17,12 +17,13 @@ #include #include +#include + #include "mutt.h" #include "enter.h" #include "recvattach.h" #include "mutt_curses.h" #include "mutt_menu.h" -#include "mime.h" #include "sort.h" #include "copy.h" #include "mx.h" diff --git a/compose.c b/compose.c index f94fe4c..91a2894 100644 --- a/compose.c +++ b/compose.c @@ -21,13 +21,14 @@ #include #include +#include + #include "mutt.h" #include "enter.h" #include "mutt_curses.h" #include "mutt_idna.h" #include "mutt_menu.h" #include "rfc1524.h" -#include "mime.h" #include "attach.h" #include "recvattach.h" #include "sort.h" diff --git a/configure.ac b/configure.ac index 9a04920..5b381ac 100644 --- a/configure.ac +++ b/configure.ac @@ -1171,6 +1171,7 @@ AC_OUTPUT(Makefile intl/Makefile m4/Makefile po/Makefile.in doc/Makefile contrib/Makefile muttbug.sh lib-lib/Makefile + lib-mime/Makefile lib-hash/Makefile lib/Makefile imap/Makefile diff --git a/copy.c b/copy.c index 27cf073..d0af92d 100644 --- a/copy.c +++ b/copy.c @@ -17,12 +17,13 @@ #include #include +#include + #include "mutt.h" #include "handler.h" #include "mx.h" #include "copy.h" #include "rfc2047.h" -#include "mime.h" #include "mutt_crypt.h" #include "mutt_idna.h" diff --git a/crypt-gpgme.c b/crypt-gpgme.c index e920128..dfd2645 100644 --- a/crypt-gpgme.c +++ b/crypt-gpgme.c @@ -24,13 +24,14 @@ #include #include +#include + #include "mutt.h" #include "mutt_crypt.h" #include "mutt_menu.h" #include "mutt_curses.h" #include "handler.h" #include "enter.h" -#include "mime.h" #include "copy.h" #include "pager.h" #include "recvattach.h" diff --git a/crypt.c b/crypt.c index b10ed05..ab611bf 100644 --- a/crypt.c +++ b/crypt.c @@ -22,10 +22,11 @@ #include #include +#include + #include "mutt.h" #include "handler.h" #include "mutt_curses.h" -#include "mime.h" #include "copy.h" #include "mutt_crypt.h" #include "pgp.h" diff --git a/gnupgparse.c b/gnupgparse.c index 1f84aaf..a05d2da 100644 --- a/gnupgparse.c +++ b/gnupgparse.c @@ -36,12 +36,13 @@ #include #include +#include + #include "mutt.h" #include "pgp.h" #include "charset.h" /* for hexval */ -#include "mime.h" #include "lib/debug.h" diff --git a/handler.c b/handler.c index 2bee349..3a9dd14 100644 --- a/handler.c +++ b/handler.c @@ -24,6 +24,8 @@ #include #include +#include + #include "mutt.h" #include "recvattach.h" #include "handler.h" @@ -31,7 +33,6 @@ #include "rfc1524.h" #include "rfc3676.h" #include "keymap.h" -#include "mime.h" #include "copy.h" #include "charset.h" #include "mutt_crypt.h" diff --git a/hcache.c b/hcache.c index 877afd0..e6a1b6d 100644 --- a/hcache.c +++ b/hcache.c @@ -43,11 +43,12 @@ #include #include +#include + #include "mutt.h" #ifdef USE_IMAP #include "message.h" #endif -#include "mime.h" #include "mx.h" #include "lib.h" diff --git a/hdrline.c b/hdrline.c index 91d469a..a568c9a 100644 --- a/hdrline.c +++ b/hdrline.c @@ -18,9 +18,11 @@ #include "charset.h" #include "mutt_crypt.h" #include "mutt_idna.h" -#include "mime.h" #include + +#include + #include "lib/rx.h" #include diff --git a/lib-mime/Makefile.am b/lib-mime/Makefile.am new file mode 100644 index 0000000..1e8cda2 --- /dev/null +++ b/lib-mime/Makefile.am @@ -0,0 +1,6 @@ +noinst_LIBRARIES = libmime.a + +libmime_a_SOURCES = mime.h rfc2231.c + +noinst_HEADERS = mime.h + diff --git a/rfc2231.c b/lib-mime/rfc2231.c similarity index 91% rename from rfc2231.c rename to lib-mime/rfc2231.c index 0f9a2f5..b21c425 100644 --- a/rfc2231.c +++ b/lib-mime/rfc2231.c @@ -1,3 +1,22 @@ +/* + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * Copyright © 2006 Pierre Habouzit + */ + /* * Copyright notice from original mutt: * Copyright (C) 1999-2000 Thomas Roessler @@ -25,11 +44,11 @@ #include #include +#include + #include "mutt.h" -#include "mime.h" #include "charset.h" #include "rfc2047.h" -#include "rfc2231.h" #include #include diff --git a/mime.h b/mime.h deleted file mode 100644 index 887a4c4..0000000 --- a/mime.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright notice from original mutt: - * Copyright (C) 1996-2000 Michael R. Elkins - * - * This file is part of mutt-ng, see http://www.muttng.org/. - * It's licensed under the GNU General Public License, - * please see the file GPL in the top level source directory. - */ - -/* Content-Type */ -enum { - TYPEOTHER, - TYPEAUDIO, - TYPEAPPLICATION, - TYPEIMAGE, - TYPEMESSAGE, - TYPEMODEL, - TYPEMULTIPART, - TYPETEXT, - TYPEVIDEO, - TYPEANY -}; - -/* Content-Transfer-Encoding */ -enum { - ENCOTHER, - ENC7BIT, - ENC8BIT, - ENCQUOTEDPRINTABLE, - ENCBASE64, - ENCBINARY, - ENCUUENCODED -}; - -/* Content-Disposition values */ -enum { - DISPINLINE, - DISPATTACH, - DISPFORMDATA -}; - -/* MIME encoding/decoding global vars */ - -#define is_multipart(x) \ - ((x)->type == TYPEMULTIPART \ - || ((x)->type == TYPEMESSAGE && (!strcasecmp((x)->subtype, "rfc822") \ - || !strcasecmp((x)->subtype, "news")))) - -extern const char *BodyTypes[]; -extern const char *BodyEncodings[]; - -#define TYPE(X) ((X->type == TYPEOTHER) && (X->xtype != NULL) ? X->xtype : BodyTypes[(X->type)]) -#define ENCODING(X) BodyEncodings[(X)] - -/* other MIME-related global variables */ -#ifndef _SENDLIB_C -extern char MimeSpecials[]; -#endif diff --git a/muttlib.c b/muttlib.c index 04c0b3a..f82560a 100644 --- a/muttlib.c +++ b/muttlib.c @@ -19,10 +19,11 @@ #include #include +#include + #include "mutt.h" #include "enter.h" #include "mutt_curses.h" -#include "mime.h" #include "mx.h" #include "url.h" #include "attach.h" diff --git a/nntp/newsrc.c b/nntp/newsrc.c index 94585e7..1af28c2 100644 --- a/nntp/newsrc.c +++ b/nntp/newsrc.c @@ -18,11 +18,12 @@ #include #include +#include + #include "mutt.h" #include "mutt_curses.h" #include "sort.h" #include "mx.h" -#include "mime.h" #include "nntp.h" #include "rfc822.h" #include "rfc1524.h" diff --git a/nntp/nntp.c b/nntp/nntp.c index 5ad2719..d5b7991 100644 --- a/nntp/nntp.c +++ b/nntp/nntp.c @@ -18,12 +18,13 @@ #include #include +#include + #include "mutt.h" #include "mutt_curses.h" #include "sort.h" #include "mx.h" #include "mx_nntp.h" -#include "mime.h" #include "rfc1524.h" #include "rfc2047.h" #include "nntp.h" diff --git a/parse.c b/parse.c index b415ad3..8175f6f 100644 --- a/parse.c +++ b/parse.c @@ -17,13 +17,13 @@ #include #include +#include + #include "mutt.h" #include "enter.h" #include "recvattach.h" #include "mx.h" -#include "mime.h" #include "rfc2047.h" -#include "rfc2231.h" #include "mutt_crypt.h" #include "url.h" diff --git a/pattern.c b/pattern.c index b1dba84..7a535bb 100644 --- a/pattern.c +++ b/pattern.c @@ -19,13 +19,14 @@ #include #include +#include + #include "mutt.h" #include "handler.h" #include "enter.h" #include "mx.h" #include "keymap.h" #include "copy.h" -#include "mime.h" #ifdef USE_IMAP diff --git a/pgp.c b/pgp.c index bdb78d6..bdcba07 100644 --- a/pgp.c +++ b/pgp.c @@ -27,12 +27,13 @@ #include #include +#include + #include "mutt.h" #include "enter.h" #include "handler.h" #include "mutt_curses.h" #include "pgp.h" -#include "mime.h" #include "copy.h" #include "attach.h" diff --git a/pgpkey.c b/pgpkey.c index a4689ab..425289e 100644 --- a/pgpkey.c +++ b/pgpkey.c @@ -18,12 +18,13 @@ #include #include +#include + #include "mutt.h" #include "enter.h" #include "recvattach.h" #include "mutt_curses.h" #include "mutt_menu.h" -#include "mime.h" #include "pgp.h" #include "pager.h" #include "sort.h" diff --git a/pgpmicalg.c b/pgpmicalg.c index 7010761..1c322be 100644 --- a/pgpmicalg.c +++ b/pgpmicalg.c @@ -19,7 +19,6 @@ #include "handler.h" #include "pgp.h" #include "pgppacket.h" -#include "mime.h" #include "charset.h" #include @@ -28,6 +27,9 @@ #include #include + +#include + #include "lib/debug.h" static struct { diff --git a/postpone.c b/postpone.c index 73a1057..fd338e5 100644 --- a/postpone.c +++ b/postpone.c @@ -19,12 +19,13 @@ #include #include +#include + #include "mutt.h" #include "enter.h" #include "handler.h" #include "mutt_menu.h" #include "rfc1524.h" -#include "mime.h" #include "sort.h" #include "thread.h" #include "mx.h" diff --git a/recvattach.c b/recvattach.c index 1121d2d..fd064cc 100644 --- a/recvattach.c +++ b/recvattach.c @@ -19,6 +19,8 @@ #include #include +#include + #include "mutt.h" #include "enter.h" #include "handler.h" @@ -26,7 +28,6 @@ #include "mutt_curses.h" #include "mutt_menu.h" #include "rfc1524.h" -#include "mime.h" #include "attach.h" #include "mx.h" #include "copy.h" diff --git a/recvcmd.c b/recvcmd.c index 7cd9a16..f5fe28b 100644 --- a/recvcmd.c +++ b/recvcmd.c @@ -17,6 +17,8 @@ #include #include +#include + #include "mutt.h" #include "enter.h" #include "state.h" @@ -25,7 +27,6 @@ #include "mutt_curses.h" #include "mutt_menu.h" #include "rfc1524.h" -#include "mime.h" #include "attach.h" #include "mx.h" #include "copy.h" diff --git a/rfc2047.c b/rfc2047.c index 9ac1cd7..d8e4a5d 100644 --- a/rfc2047.c +++ b/rfc2047.c @@ -16,8 +16,9 @@ #include #include +#include + #include "mutt.h" -#include "mime.h" #include "charset.h" #include "rfc2047.h" #include "thread.h" diff --git a/rfc2231.h b/rfc2231.h deleted file mode 100644 index f088ddd..0000000 --- a/rfc2231.h +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright notice from original mutt: - * Copyright (C) 1999-2000 Thomas Roessler - * - * This file is part of mutt-ng, see http://www.muttng.org/. - * It's licensed under the GNU General Public License, - * please see the file GPL in the top level source directory. - */ - -void rfc2231_decode_parameters (PARAMETER **); -int rfc2231_encode_string (char **); diff --git a/send.c b/send.c index dfed65c..30db12a 100644 --- a/send.c +++ b/send.c @@ -17,13 +17,14 @@ #include #include +#include + #include "mutt.h" #include "enter.h" #include "mutt_curses.h" #include "rfc2047.h" #include "rfc3676.h" #include "keymap.h" -#include "mime.h" #include "copy.h" #include "mx.h" #include "mutt_crypt.h" diff --git a/sendlib.c b/sendlib.c index 7c22e2b..b82ff18 100644 --- a/sendlib.c +++ b/sendlib.c @@ -19,14 +19,14 @@ #include #include +#include + #include "mutt.h" #include "handler.h" #include "recvattach.h" #include "mutt_curses.h" #include "rfc2047.h" -#include "rfc2231.h" #include "mx.h" -#include "mime.h" #include "copy.h" #include "pager.h" #include "charset.h" diff --git a/smime.c b/smime.c index 5a8f7e7..092c1bd 100644 --- a/smime.c +++ b/smime.c @@ -18,13 +18,13 @@ #include #include +#include + #include "mutt.h" #include "enter.h" #include "handler.h" #include "mutt_curses.h" #include "mutt_menu.h" -#include "smime.h" -#include "mime.h" #include "copy.h" #include "lib/debug.h" diff --git a/url.c b/url.c index 67a94cd..55204c5 100644 --- a/url.c +++ b/url.c @@ -19,10 +19,11 @@ #include #include +#include + #include "mutt.h" #include "url.h" -#include "mime.h" #include -- 2.20.1