From ab12fea9d01b3b9bc53081ae4ccc046243f1cb9f Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Thu, 2 Nov 2006 21:41:22 +0100 Subject: [PATCH] move rfc822.c as well Signed-off-by: Pierre Habouzit --- Makefile.am | 4 +-- alias.h | 2 +- lib-mime/Makefile.am | 2 +- lib-mime/mime.h | 41 +++++++++++++++++++++++++++++++ rfc822.c => lib-mime/rfc822.c | 24 ++++++++++++++---- mutt.h | 1 - mutt_idna.h | 6 ++++- nntp/newsrc.c | 1 - pgpinvoke.c | 3 ++- rfc2047.c | 2 -- rfc822.h | 46 ----------------------------------- sendlib.c | 2 -- 12 files changed, 71 insertions(+), 63 deletions(-) rename rfc822.c => lib-mime/rfc822.c (95%) delete mode 100644 rfc822.h diff --git a/Makefile.am b/Makefile.am index 4710973..0ba9066 100644 --- a/Makefile.am +++ b/Makefile.am @@ -37,7 +37,7 @@ 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 rfc3676.c \ + recvattach.c recvcmd.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 \ @@ -87,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 \ - rfc822.h rfc3676.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/alias.h b/alias.h index 32fa20c..f20e8af 100644 --- a/alias.h +++ b/alias.h @@ -9,7 +9,7 @@ #ifndef _MUTT_ALIAS_H #define _MUTT_ALIAS_H -#include "rfc822.h" +#include typedef struct alias { struct alias *self; /* XXX - ugly hack */ diff --git a/lib-mime/Makefile.am b/lib-mime/Makefile.am index 4cb982c..b7835fa 100644 --- a/lib-mime/Makefile.am +++ b/lib-mime/Makefile.am @@ -1,6 +1,6 @@ noinst_LIBRARIES = libmime.a -libmime_a_SOURCES = mime.h mime.c rfc2231.c +libmime_a_SOURCES = mime.h mime.c rfc822.c rfc2231.c noinst_HEADERS = mime.h diff --git a/lib-mime/mime.h b/lib-mime/mime.h index 03acd98..1cf264a 100644 --- a/lib-mime/mime.h +++ b/lib-mime/mime.h @@ -29,6 +29,8 @@ #ifndef MUTT_LIB_MIME_MIME_H #define MUTT_LIB_MIME_MIME_H +#include + /* Content-Type */ enum { TYPEOTHER, @@ -80,6 +82,45 @@ extern const char *BodyEncodings[]; #define TYPE(X) ((X->type == TYPEOTHER) && (X->xtype != NULL) ? X->xtype : BodyTypes[(X->type)]) #define ENCODING(X) BodyEncodings[(X)] +/****************************************************************************/ +/* RFC 822 */ +/* Standard for ARPA Internet Text Messages */ +/****************************************************************************/ + +/* possible values for RFC822Error */ +enum { + ERR_MEMORY = 1, + ERR_MISMATCH_PAREN, + ERR_MISMATCH_QUOTE, + ERR_BAD_ROUTE, + ERR_BAD_ROUTE_ADDR, + ERR_BAD_ADDR_SPEC +}; + +typedef struct address_t { + char *personal; /* real name of address */ + char *mailbox; /* mailbox and host address */ + int group; /* group mailbox? */ + struct address_t *next; +} ADDRESS; + +void rfc822_free_address(ADDRESS **); +void rfc822_qualify(ADDRESS *, const char *); +ADDRESS *rfc822_parse_adrlist(ADDRESS *, const char *s); +ADDRESS *rfc822_cpy_adr(ADDRESS * addr); +ADDRESS *rfc822_cpy_adr_real(ADDRESS * addr); +ADDRESS *rfc822_append(ADDRESS ** a, ADDRESS * b); +void rfc822_write_address(char *, size_t, ADDRESS *, int); +void rfc822_write_address_single(char *, size_t, ADDRESS *, int); +void rfc822_cat(char *, size_t, const char *, const char *); + +extern int RFC822Error; +extern const char *RFC822Errors[]; +extern const char RFC822Specials[]; + +#define rfc822_error(x) RFC822Errors[x] +#define rfc822_new_address() calloc(1,sizeof(ADDRESS)) + /****************************************************************************/ /* RFC 2231 */ /* MIME Parameter Value and Encoded Word Extensions: */ diff --git a/rfc822.c b/lib-mime/rfc822.c similarity index 95% rename from rfc822.c rename to lib-mime/rfc822.c index 30f1379..82c3e7c 100644 --- a/rfc822.c +++ b/lib-mime/rfc822.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) 1996-2000 Michael R. Elkins @@ -7,10 +26,6 @@ * please see the file GPL in the top level source directory. */ -#if HAVE_CONFIG_H -# include "config.h" -#endif - #include #include #include @@ -20,7 +35,6 @@ #include #include -#include "mutt.h" #include "mutt_idna.h" diff --git a/mutt.h b/mutt.h index 75b6796..2ef4a1b 100644 --- a/mutt.h +++ b/mutt.h @@ -47,7 +47,6 @@ #include -#include "rfc822.h" #include "charset.h" #include "lib/rx.h" diff --git a/mutt_idna.h b/mutt_idna.h index 508f200..1149283 100644 --- a/mutt_idna.h +++ b/mutt_idna.h @@ -10,7 +10,11 @@ #ifndef _MUTT_IDNA_H # define _MUTT_IDNA_H -#include "rfc822.h" +#if HAVE_CONFIG_H +# include "config.h" +#endif + +#include #include "charset.h" #ifdef HAVE_LIBIDN diff --git a/nntp/newsrc.c b/nntp/newsrc.c index 1af28c2..6f3d867 100644 --- a/nntp/newsrc.c +++ b/nntp/newsrc.c @@ -25,7 +25,6 @@ #include "sort.h" #include "mx.h" #include "nntp.h" -#include "rfc822.h" #include "rfc1524.h" #include "rfc2047.h" diff --git a/pgpinvoke.c b/pgpinvoke.c index 2fb8917..b24687f 100644 --- a/pgpinvoke.c +++ b/pgpinvoke.c @@ -30,11 +30,12 @@ #include #include +#include + #include "mutt.h" #include "mutt_curses.h" #include "mutt_idna.h" #include "pgp.h" -#include "rfc822.h" #include "lib/debug.h" diff --git a/rfc2047.c b/rfc2047.c index 23fffd4..a181e9d 100644 --- a/rfc2047.c +++ b/rfc2047.c @@ -46,8 +46,6 @@ #define CONTINUATION_BYTE(c) (((c) & 0xc0) == 0x80) -extern char RFC822Specials[]; - typedef size_t (*encoder_t) (char *, const char *, size_t, const char *); diff --git a/rfc822.h b/rfc822.h deleted file mode 100644 index 0c55020..0000000 --- a/rfc822.h +++ /dev/null @@ -1,46 +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. - */ - -#ifndef rfc822_h -#define rfc822_h - -/* possible values for RFC822Error */ -enum { - ERR_MEMORY = 1, - ERR_MISMATCH_PAREN, - ERR_MISMATCH_QUOTE, - ERR_BAD_ROUTE, - ERR_BAD_ROUTE_ADDR, - ERR_BAD_ADDR_SPEC -}; - -typedef struct address_t { - char *personal; /* real name of address */ - char *mailbox; /* mailbox and host address */ - int group; /* group mailbox? */ - struct address_t *next; -} ADDRESS; - -void rfc822_free_address (ADDRESS **); -void rfc822_qualify (ADDRESS *, const char *); -ADDRESS *rfc822_parse_adrlist (ADDRESS *, const char *s); -ADDRESS *rfc822_cpy_adr (ADDRESS * addr); -ADDRESS *rfc822_cpy_adr_real (ADDRESS * addr); -ADDRESS *rfc822_append (ADDRESS ** a, ADDRESS * b); -void rfc822_write_address (char *, size_t, ADDRESS *, int); -void rfc822_write_address_single (char *, size_t, ADDRESS *, int); -void rfc822_cat (char *, size_t, const char *, const char *); - -extern int RFC822Error; -extern const char *RFC822Errors[]; - -#define rfc822_error(x) RFC822Errors[x] -#define rfc822_new_address() calloc(1,sizeof(ADDRESS)) - -#endif /* rfc822_h */ diff --git a/sendlib.c b/sendlib.c index 91490fe..208b434 100644 --- a/sendlib.c +++ b/sendlib.c @@ -69,8 +69,6 @@ #include #endif -extern char RFC822Specials[]; - #define DISPOSITION(X) X==DISPATTACH?"attachment":"inline" static char MsgIdPfx = 'A'; -- 2.20.1