begin to move rfc2047 into lib-mime.
authorPierre Habouzit <madcoder@debian.org>
Fri, 3 Nov 2006 22:13:04 +0000 (23:13 +0100)
committerPierre Habouzit <madcoder@debian.org>
Fri, 3 Nov 2006 22:13:04 +0000 (23:13 +0100)
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
13 files changed:
Makefile.am
copy.c
lib-mime/mime.h
lib-mime/rfc2231.c
mutt.h
mx.c
nntp/newsrc.c
nntp/nntp.c
parse.c
rfc2047.c
rfc2047.h
send.c
sendlib.c

index 0ba9066..d80b973 100644 (file)
@@ -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 \
        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 \
        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 (file)
--- a/copy.c
+++ b/copy.c
@@ -23,7 +23,6 @@
 #include "handler.h"
 #include "mx.h"
 #include "copy.h"
 #include "handler.h"
 #include "mx.h"
 #include "copy.h"
-#include "rfc2047.h"
 #include "mutt_crypt.h"
 #include "mutt_idna.h"
 
 #include "mutt_crypt.h"
 #include "mutt_idna.h"
 
index 6f20910..2382579 100644 (file)
@@ -19,6 +19,7 @@
 
 /*
  * Copyright notice from original mutt:
 
 /*
  * Copyright notice from original mutt:
+ * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
  * Copyright (C) 1999-2000 Thomas Roessler <roessler@does-not-exist.org>
  *
  * This file is part of mutt-ng, see http://www.muttng.org/.
  * Copyright (C) 1999-2000 Thomas Roessler <roessler@does-not-exist.org>
  *
  * This file is part of mutt-ng, see http://www.muttng.org/.
@@ -32,6 +33,7 @@
 #include <stdlib.h>
 
 #include <lib-lib/mem.h>
 #include <stdlib.h>
 
 #include <lib-lib/mem.h>
+#include <lib-lib/buffer.h>
 #include <lib-lib/list.h>
 
 /* Content-Type */
 #include <lib-lib/list.h>
 
 /* Content-Type */
@@ -72,6 +74,53 @@ typedef struct parameter {
     struct parameter *next;
 } 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[];
 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                  */
 /****************************************************************************/
 
 /*                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 *);
 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 *);
 
 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[];
 
 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                                                                 */
 
 /****************************************************************************/
 /* RFC 2231                                                                 */
index 3f19406..865877d 100644 (file)
@@ -47,7 +47,6 @@
 #include <lib-mime/mime.h>
 
 #include "charset.h"
 #include <lib-mime/mime.h>
 
 #include "charset.h"
-#include "rfc2047.h"
 
 typedef struct rfc2231_param {
     struct rfc2231_param *next;
 
 typedef struct rfc2231_param {
     struct rfc2231_param *next;
diff --git a/mutt.h b/mutt.h
index e4e192d..e0b9fb3 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -535,37 +535,6 @@ int mutt_matches_ignore (const char *, LIST *);
 
 void mutt_init (int, 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 */
 /* 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 (file)
--- a/mx.c
+++ b/mx.c
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
 
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
 
+#include <lib-mime/mime.h>
+
 #include "mutt.h"
 #include "buffy.h"
 #include "mx.h"
 #include "mbox.h"
 #include "mh.h"
 #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"
 #include "sort.h"
 #include "thread.h"
 #include "copy.h"
index 6f3d867..94929bd 100644 (file)
@@ -26,7 +26,6 @@
 #include "mx.h"
 #include "nntp.h"
 #include "rfc1524.h"
 #include "mx.h"
 #include "nntp.h"
 #include "rfc1524.h"
-#include "rfc2047.h"
 
 #include "lib/debug.h"
 
 
 #include "lib/debug.h"
 
index ae2bec1..6869b21 100644 (file)
@@ -26,7 +26,6 @@
 #include "mx.h"
 #include "mx_nntp.h"
 #include "rfc1524.h"
 #include "mx.h"
 #include "mx_nntp.h"
 #include "rfc1524.h"
-#include "rfc2047.h"
 #include "nntp.h"
 #include "sidebar.h"
 #include "buffy.h"
 #include "nntp.h"
 #include "sidebar.h"
 #include "buffy.h"
diff --git a/parse.c b/parse.c
index fd8e92b..df02f23 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -23,7 +23,6 @@
 #include "enter.h"
 #include "recvattach.h"
 #include "mx.h"
 #include "enter.h"
 #include "recvattach.h"
 #include "mx.h"
-#include "rfc2047.h"
 #include "mutt_crypt.h"
 #include "url.h"
 
 #include "mutt_crypt.h"
 #include "url.h"
 
index dd62416..bed0353 100644 (file)
--- 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 <me@mutt.org>
 /*
  * Copyright notice from original mutt:
  * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
 
 #include "mutt.h"
 #include "charset.h"
 
 #include "mutt.h"
 #include "charset.h"
-#include "rfc2047.h"
 #include "thread.h"
 
 #include "thread.h"
 
-
 #include <ctype.h>
 #include <errno.h>
 #include <stdio.h>
 #include <ctype.h>
 #include <errno.h>
 #include <stdio.h>
index 6bf5b5d..1340703 100644 (file)
--- a/rfc2047.h
+++ b/rfc2047.h
@@ -1,6 +1,5 @@
 /*
  * Copyright notice from original mutt:
 /*
  * Copyright notice from original mutt:
- * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
  *
  * This file is part of mutt-ng, see http://www.muttng.org/.
  * It's licensed under the GNU General Public License,
  *
  * 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"
 
 
 #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 (file)
--- a/send.c
+++ b/send.c
@@ -22,7 +22,6 @@
 #include "mutt.h"
 #include "enter.h"
 #include "mutt_curses.h"
 #include "mutt.h"
 #include "enter.h"
 #include "mutt_curses.h"
-#include "rfc2047.h"
 #include "rfc3676.h"
 #include "keymap.h"
 #include "copy.h"
 #include "rfc3676.h"
 #include "keymap.h"
 #include "copy.h"
index b2d283d..2a62bd3 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -25,7 +25,6 @@
 #include "handler.h"
 #include "recvattach.h"
 #include "mutt_curses.h"
 #include "handler.h"
 #include "recvattach.h"
 #include "mutt_curses.h"
-#include "rfc2047.h"
 #include "mx.h"
 #include "copy.h"
 #include "pager.h"
 #include "mx.h"
 #include "copy.h"
 #include "pager.h"