From: Pierre Habouzit Date: Fri, 3 Nov 2006 22:13:04 +0000 (+0100) Subject: begin to move rfc2047 into lib-mime. X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=commitdiff_plain;h=d0dc8fb657cff90709c15d4b106415b868857f6a begin to move rfc2047 into lib-mime. Signed-off-by: Pierre Habouzit --- diff --git a/Makefile.am b/Makefile.am index 0ba9066..d80b973 100644 --- a/Makefile.am +++ b/Makefile.am @@ -86,7 +86,7 @@ EXTRA_DIST = config.rpath COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO \ globals.h history.h init.h keymap.h mutt_crypt.h \ 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 \ + mbox.h mh.h mx.h pager.h pgp.h protos.h rfc1524.h \ rfc3676.h \ sort.h mime.types autogen.sh \ _regex.h OPS.MIX remailer.c remailer.h browser.h state.h \ diff --git a/copy.c b/copy.c index 05a7371..399a65b 100644 --- a/copy.c +++ b/copy.c @@ -23,7 +23,6 @@ #include "handler.h" #include "mx.h" #include "copy.h" -#include "rfc2047.h" #include "mutt_crypt.h" #include "mutt_idna.h" diff --git a/lib-mime/mime.h b/lib-mime/mime.h index 6f20910..2382579 100644 --- a/lib-mime/mime.h +++ b/lib-mime/mime.h @@ -19,6 +19,7 @@ /* * Copyright notice from original mutt: + * Copyright (C) 1996-2000 Michael R. Elkins * Copyright (C) 1999-2000 Thomas Roessler * * This file is part of mutt-ng, see http://www.muttng.org/. @@ -32,6 +33,7 @@ #include #include +#include #include /* Content-Type */ @@ -72,6 +74,53 @@ typedef struct parameter { struct parameter *next; } PARAMETER; +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_t; + +typedef struct envelope_t { + address_t *return_path; + address_t *from; + address_t *to; + address_t *cc; + address_t *bcc; + address_t *sender; + address_t *reply_to; + address_t *mail_followup_to; + char *list_post; /* this stores a mailto URL, or nothing */ + char *subject; + char *real_subj; /* offset of the real subject */ + char *message_id; + char *supersedes; + char *date; + char *x_label; + char *organization; +#ifdef USE_NNTP + char *newsgroups; + char *xref; + char *followup_to; + char *x_comment_to; +#endif + BUFFER *spam; + LIST *references; /* message references (in reverse order) */ + LIST *in_reply_to; /* in-reply-to header content */ + LIST *userhdrs; /* user defined headers */ + unsigned int irt_changed:1; /* In-Reply-To changed to link/break threads */ + unsigned int refs_changed:1; /* References changed to break thread */ +} ENVELOPE; + + +DO_INIT(address_t, address); +void address_wipe(address_t *); + +DO_NEW(address_t, address); +DO_DELETE(address_t, address); +DO_SLIST(address_t, address); + + extern const char MimeSpecials[]; extern const char *BodyTypes[]; extern const char *BodyEncodings[]; @@ -90,21 +139,6 @@ extern const char *BodyEncodings[]; /* Standard for ARPA Internet Text Messages */ /****************************************************************************/ -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_t; - -DO_INIT(address_t, address); -void address_wipe(address_t *); - -DO_NEW(address_t, address); -DO_DELETE(address_t, address); -DO_SLIST(address_t, address); - - address_t *address_dup(address_t *addr); address_t *address_list_dup(address_t *addr); void rfc822_qualify(address_t *, const char *); @@ -115,10 +149,25 @@ ssize_t rfc822_write_address(char *, ssize_t, address_t *, int); ssize_t rfc822_write_address_single(char *, ssize_t, address_t *, int); ssize_t rfc822_strcpy(char *, ssize_t, const char *, const char *); -extern int RFC822Error; extern const char RFC822Specials[]; -#define rfc822_error(x) RFC822Errors[x] +/****************************************************************************/ +/* RFC 2047 */ +/* MIME (Multipurpose Internet Mail Extensions) Part Three: */ +/* Message Header Extensions for Non-ASCII Text */ +/****************************************************************************/ + +char *mutt_choose_charset(const char *fromcode, const char *charsets, + char *u, size_t ulen, char **d, size_t *dlen); + +void _rfc2047_encode_string(char **, int, int); +void rfc2047_encode_adrlist(address_t *, const char *); + +#define rfc2047_encode_string(a) _rfc2047_encode_string (a, 0, 32); + +void rfc2047_decode(char **); +void rfc2047_decode_adrlist(address_t *); +void rfc2047_decode_envelope(ENVELOPE* e); /****************************************************************************/ /* RFC 2231 */ diff --git a/lib-mime/rfc2231.c b/lib-mime/rfc2231.c index 3f19406..865877d 100644 --- a/lib-mime/rfc2231.c +++ b/lib-mime/rfc2231.c @@ -47,7 +47,6 @@ #include #include "charset.h" -#include "rfc2047.h" typedef struct rfc2231_param { struct rfc2231_param *next; diff --git a/mutt.h b/mutt.h index e4e192d..e0b9fb3 100644 --- a/mutt.h +++ b/mutt.h @@ -535,37 +535,6 @@ int mutt_matches_ignore (const char *, LIST *); void mutt_init (int, LIST *); -typedef struct envelope { - address_t *return_path; - address_t *from; - address_t *to; - address_t *cc; - address_t *bcc; - address_t *sender; - address_t *reply_to; - address_t *mail_followup_to; - char *list_post; /* this stores a mailto URL, or nothing */ - char *subject; - char *real_subj; /* offset of the real subject */ - char *message_id; - char *supersedes; - char *date; - char *x_label; - char *organization; -#ifdef USE_NNTP - char *newsgroups; - char *xref; - char *followup_to; - char *x_comment_to; -#endif - BUFFER *spam; - LIST *references; /* message references (in reverse order) */ - LIST *in_reply_to; /* in-reply-to header content */ - LIST *userhdrs; /* user defined headers */ - unsigned int irt_changed:1; /* In-Reply-To changed to link/break threads */ - unsigned int refs_changed:1; /* References changed to break thread */ -} ENVELOPE; - /* Information that helps in determing the Content-* of an attachment */ typedef struct content { long hibin; /* 8-bit characters */ diff --git a/mx.c b/mx.c index 4f831ca..6f6f779 100644 --- a/mx.c +++ b/mx.c @@ -18,12 +18,13 @@ #include #include +#include + #include "mutt.h" #include "buffy.h" #include "mx.h" #include "mbox.h" #include "mh.h" -#include "rfc2047.h" #include "sort.h" #include "thread.h" #include "copy.h" diff --git a/nntp/newsrc.c b/nntp/newsrc.c index 6f3d867..94929bd 100644 --- a/nntp/newsrc.c +++ b/nntp/newsrc.c @@ -26,7 +26,6 @@ #include "mx.h" #include "nntp.h" #include "rfc1524.h" -#include "rfc2047.h" #include "lib/debug.h" diff --git a/nntp/nntp.c b/nntp/nntp.c index ae2bec1..6869b21 100644 --- a/nntp/nntp.c +++ b/nntp/nntp.c @@ -26,7 +26,6 @@ #include "mx.h" #include "mx_nntp.h" #include "rfc1524.h" -#include "rfc2047.h" #include "nntp.h" #include "sidebar.h" #include "buffy.h" diff --git a/parse.c b/parse.c index fd8e92b..df02f23 100644 --- a/parse.c +++ b/parse.c @@ -23,7 +23,6 @@ #include "enter.h" #include "recvattach.h" #include "mx.h" -#include "rfc2047.h" #include "mutt_crypt.h" #include "url.h" diff --git a/rfc2047.c b/rfc2047.c index dd62416..bed0353 100644 --- a/rfc2047.c +++ b/rfc2047.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 @@ -20,10 +39,8 @@ #include "mutt.h" #include "charset.h" -#include "rfc2047.h" #include "thread.h" - #include #include #include diff --git a/rfc2047.h b/rfc2047.h index 6bf5b5d..1340703 100644 --- a/rfc2047.h +++ b/rfc2047.h @@ -1,6 +1,5 @@ /* * 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, @@ -9,15 +8,3 @@ #include "mutt.h" -char *mutt_choose_charset (const char *fromcode, const char *charsets, - char *u, size_t ulen, char **d, size_t * dlen); - -void _rfc2047_encode_string (char **, int, int); -void rfc2047_encode_adrlist (address_t *, const char *); - -#define rfc2047_encode_string(a) _rfc2047_encode_string (a, 0, 32); - -void rfc2047_decode (char **); -void rfc2047_decode_adrlist (address_t *); - -void rfc2047_decode_envelope (ENVELOPE* e); diff --git a/send.c b/send.c index 4ffad14..9932e67 100644 --- a/send.c +++ b/send.c @@ -22,7 +22,6 @@ #include "mutt.h" #include "enter.h" #include "mutt_curses.h" -#include "rfc2047.h" #include "rfc3676.h" #include "keymap.h" #include "copy.h" diff --git a/sendlib.c b/sendlib.c index b2d283d..2a62bd3 100644 --- a/sendlib.c +++ b/sendlib.c @@ -25,7 +25,6 @@ #include "handler.h" #include "recvattach.h" #include "mutt_curses.h" -#include "rfc2047.h" #include "mx.h" #include "copy.h" #include "pager.h"