]> granicus.if.org Git - neomutt/commitdiff
build: split up mutt.h, protos.h 580/head
authorRichard Russon <rich@flatcap.org>
Sun, 7 May 2017 00:54:44 +0000 (01:54 +0100)
committerRichard Russon <rich@flatcap.org>
Wed, 17 May 2017 18:00:42 +0000 (19:00 +0100)
Move various structs out of mutt.h into their own header files.
Then run IWYU (include-what-you-use) on all files.

208 files changed:
Makefile.am
account.c
account.h
addrbook.c
address.h [new file with mode: 0644]
alias.c
alias.h [new file with mode: 0644]
ascii.c
attach.c
attach.h
base64.c
bcache.c
bcache.h
body.h [new file with mode: 0644]
browser.c
browser.h
buffer.c
buffer.h
buffy.c
buffy.h
charset.c
color.c
commands.c
complete.c
compose.c
compress.c
compress.h
content.h [new file with mode: 0644]
context.h [new file with mode: 0644]
copy.c
copy.h
crypt.c
crypt_gpgme.c
crypt_gpgme.h
crypt_mod.c
crypt_mod.h
crypt_mod_pgp_classic.c
crypt_mod_pgp_gpgme.c
crypt_mod_smime_classic.c
crypt_mod_smime_gpgme.c
cryptglue.c
curs_lib.c
curs_main.c
date.c
dotlock.c
edit.c
editmsg.c
enter.c
enter_state.h [new file with mode: 0644]
envelope.h [new file with mode: 0644]
filter.c
flags.c
format_flags.h [new file with mode: 0644]
from.c
functions.h
gen_defs
getdomain.c
globals.h
gnupgparse.c
group.c
group.h
handler.c
hash.c
hash.h
hcache/bdb.c
hcache/gdbm.c
hcache/hcache.c
hcache/hcache.h
hcache/kc.c
hcache/lmdb.c
hcache/qdbm.c
hcache/tc.c
hdrline.c
header.h [new file with mode: 0644]
headers.c
help.c
history.c
history.h
hook.c
imap/auth.c
imap/auth.h
imap/auth_anon.c
imap/auth_cram.c
imap/auth_gss.c
imap/auth_login.c
imap/auth_plain.c
imap/auth_sasl.c
imap/browse.c
imap/command.c
imap/imap.c
imap/imap.h
imap/imap_private.h
imap/message.c
imap/message.h
imap/utf7.c
imap/util.c
init.c
init.h
keymap.c
keymap.h
lib.c
lib.h
list.h [new file with mode: 0644]
mailbox.h
main.c
mapping.h
mbox.c
mbyte.c
mbyte.h
mbyte_table.h [new file with mode: 0644]
md5.h
menu.c
mh.c
mutt.h
mutt_commands.h
mutt_crypt.h
mutt_curses.h
mutt_idna.c
mutt_idna.h
mutt_lua.c
mutt_lua.h
mutt_menu.h
mutt_notmuch.c
mutt_notmuch.h
mutt_options.h
mutt_regex.h
mutt_sasl.c
mutt_sasl.h
mutt_sasl_plain.c
mutt_socket.c
mutt_socket.h
mutt_ssl.c
mutt_ssl.h
mutt_ssl_gnutls.c
mutt_tunnel.c
mutt_tunnel.h
muttlib.c
mx.c
mx.h
myvar.h
newsrc.c
nntp.c
nntp.h
options.h [new file with mode: 0644]
pager.c
pager.h
parameter.h [new file with mode: 0644]
parse.c
pattern.c
pattern.h [new file with mode: 0644]
pgp.c
pgp.h
pgpinvoke.c
pgpkey.c
pgplib.c
pgplib.h
pgpmicalg.c
pgppacket.c
pgppacket.h
pgppubring.c
pop.c
pop.h
pop_auth.c
pop_lib.c
postpone.c
protos.h
query.c
recvattach.c
recvcmd.c
remailer.c
remailer.h
resize.c
rfc1524.c
rfc1524.h
rfc2047.c
rfc2047.h
rfc2231.c
rfc2231.h
rfc3676.c
rfc3676.h
rfc822.c
rfc822.h
safe_asprintf.c
score.c
send.c
sendlib.c
sha1.h
sidebar.c
sidebar.h
signal.c
smime.c
smime.h
smtp.c
sort.c
sort.h
state.h [new file with mode: 0644]
status.c
system.c
thread.c
thread.h [new file with mode: 0644]
url.c
url.h
utf8.c
version.c
version.h
wcscasecmp.c
wcwidth.c
where.h [new file with mode: 0644]

index c6987ad05cdf98bcc6f498c2c5f65930561cf473..c0a8313a64d5b6e227dc2e653084f474e84e96d9 100644 (file)
@@ -35,19 +35,21 @@ BUILT_SOURCES = keymap_defs.h keymap_alldefs.h git_ver.h conststrings.c
 
 bin_PROGRAMS = mutt $(DOTLOCK_TARGET) $(PGPAUX_TARGET)
 
-mutt_SOURCES = account.c addrbook.c alias.c ascii.c attach.c base64.c bcache.c \
-              browser.c buffer.c buffy.c charset.c color.c commands.c \
-              complete.c compose.c compress.c copy.c crypt_mod.c crypt_mod.h \
-              crypt.c cryptglue.c curs_lib.c curs_main.c date.c edit.c \
-              editmsg.c enter.c filter.c flags.c from.c getdomain.c group.c \
-              handler.c hash.c hdrline.c headers.c help.c history.c hook.c \
-              init.c keymap.c lib.c main.c mbox.c mbyte.c md5.c menu.c mh.c \
-              muttlib.c mutt_idna.c mutt_sasl_plain.c mutt_socket.c \
-              mutt_tunnel.c mx.c newsrc.c nntp.c pager.c parse.c pattern.c \
-              pop.c pop_auth.c pop_lib.c postpone.c query.c recvattach.c \
-              recvcmd.c rfc1524.c rfc2047.c rfc2231.c rfc3676.c rfc822.c \
-              safe_asprintf.c score.c send.c sendlib.c sidebar.c signal.c \
-              smtp.c sort.c status.c system.c thread.c url.c version.c
+mutt_SOURCES = account.c addrbook.c address.h alias.c alias.h ascii.c attach.c \
+       base64.c bcache.c body.h browser.c buffer.c buffy.c charset.c color.c \
+       commands.c complete.c compose.c compress.c content.h context.h copy.c \
+       crypt.c cryptglue.c crypt_mod.c crypt_mod.h curs_lib.c curs_main.c \
+       date.c edit.c editmsg.c enter.c enter_state.h envelope.h filter.c \
+       flags.c format_flags.h from.c getdomain.c group.c handler.c hash.c \
+       hdrline.c header.h headers.c help.c history.c hook.c init.c keymap.c \
+       lib.c list.h main.c mbox.c mbyte.c mbyte_table.h md5.c menu.c mh.c \
+       muttlib.c mutt_idna.c mutt_sasl_plain.c mutt_socket.c \
+       mutt_tunnel.c mx.c newsrc.c nntp.c options.h pager.c parameter.h \
+       parse.c pattern.c pattern.h pop.c pop_auth.c pop_lib.c postpone.c \
+       query.c recvattach.c recvcmd.c rfc1524.c rfc2047.c rfc2231.c rfc3676.c \
+       rfc822.c safe_asprintf.c score.c send.c sendlib.c sidebar.c signal.c \
+       smtp.c sort.c state.h status.c system.c thread.c thread.h url.c \
+       version.c where.h
 
 nodist_mutt_SOURCES = $(BUILT_SOURCES)
 
index 2b160783a72c8bca8a02485ebf3d5b7e385665c2..01cfc6bc91132e3054de17ec4f30080a4331cabb 100644 (file)
--- a/account.c
+++ b/account.c
 /* remote host account manipulation (POP/IMAP) */
 
 #include "config.h"
+#include <stdio.h>
+#include <string.h>
 #include "mutt.h"
 #include "account.h"
+#include "ascii.h"
+#include "globals.h"
+#include "lib.h"
+#include "options.h"
+#include "protos.h"
 #include "url.h"
 
 /* mutt_account_match: compare account info (host/port/user) */
index 4a2c323e1656e49ec15295a600110c97fce1ad03..22aad95d150189ec2b80ba3a1e88abcc784ba84f 100644 (file)
--- a/account.h
+++ b/account.h
@@ -20,7 +20,7 @@
 #ifndef _MUTT_ACCOUNT_H
 #define _MUTT_ACCOUNT_H 1
 
-#include "url.h"
+struct CissUrl;
 
 /* account types */
 enum
index a5cf16932e560bde4906312d4657a49d6ea2806c..3d687a0f9359af7b04ff6e9584c6fd22391453d7 100644 (file)
  */
 
 #include "config.h"
-#include <ctype.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
-#include "mutt.h"
+#include "address.h"
+#include "alias.h"
+#include "ascii.h"
+#include "format_flags.h"
+#include "globals.h"
+#include "keymap.h"
+#include "keymap_defs.h"
+#include "lib.h"
 #include "mapping.h"
-#include "mutt_idna.h"
+#include "mutt_curses.h"
 #include "mutt_menu.h"
+#include "options.h"
+#include "protos.h"
+#include "rfc822.h"
 #include "sort.h"
 
 #define RSORT(x) (SortAlias & SORT_REVERSE) ? -x : x
diff --git a/address.h b/address.h
new file mode 100644 (file)
index 0000000..b303cd6
--- /dev/null
+++ b/address.h
@@ -0,0 +1,36 @@
+/**
+ * Copyright (C) 2017 Richard Russon <rich@flatcap.org>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _MUTT_ADDRESS_H
+#define _MUTT_ADDRESS_H 1
+
+#include <stdbool.h>
+
+struct Address
+{
+#ifdef EXACT_ADDRESS
+  char *val;      /* value of address as parsed */
+#endif
+  char *personal; /* real name of address */
+  char *mailbox;  /* mailbox and host address */
+  int group;      /* group mailbox? */
+  struct Address *next;
+  bool is_intl : 1;
+  bool intl_checked : 1;
+};
+
+#endif /* _MUTT_ADDRESS_H */
diff --git a/alias.c b/alias.c
index f8207bbcebbb38030005b112ad89ed7ebc2233e2..6c58647bebffbd46dd91f580ae878b5f963b3d07 100644 (file)
--- a/alias.c
+++ b/alias.c
  */
 
 #include "config.h"
-#include <ctype.h>
+#include <stddef.h>
 #include <errno.h>
+#include <libintl.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
+#include <wchar.h>
+#include <wctype.h>
 #include "mutt.h"
+#include "alias.h"
+#include "address.h"
+#include "ascii.h"
+#include "charset.h"
+#include "envelope.h"
+#include "globals.h"
+#include "hash.h"
+#include "lib.h"
+#include "list.h"
 #include "mutt_curses.h"
 #include "mutt_idna.h"
-#include "mutt_regex.h"
-
-int mutt_check_alias_name(const char *s, char *dest, size_t destlen);
+#include "options.h"
+#include "protos.h"
+#include "rfc822.h"
 
 struct Address *mutt_lookup_alias(const char *s)
 {
@@ -222,6 +237,50 @@ static void recode_buf(char *buf, size_t buflen)
   FREE(&s);
 }
 
+/*
+ * Sanity-check an alias name:  Only characters which are non-special to both
+ * the RFC 822 and the mutt configuration parser are permitted.
+ */
+int check_alias_name(const char *s, char *dest, size_t destlen)
+{
+  wchar_t wc;
+  mbstate_t mb;
+  size_t l;
+  int rv = 0, bad = 0, dry = !dest || !destlen;
+
+  memset(&mb, 0, sizeof(mbstate_t));
+
+  if (!dry)
+    destlen--;
+  for (; s && *s && (dry || destlen) && (l = mbrtowc(&wc, s, MB_CUR_MAX, &mb)) != 0;
+       s += l, destlen -= l)
+  {
+    bad = l == (size_t)(-1) || l == (size_t)(-2); /* conversion error */
+    bad = bad || (!dry && l > destlen);           /* too few room for mb char */
+    if (l == 1)
+      bad = bad || (strchr("-_+=.", *s) == NULL && !iswalnum(wc));
+    else
+      bad = bad || !iswalnum(wc);
+    if (bad)
+    {
+      if (dry)
+        return -1;
+      if (l == (size_t)(-1))
+        memset(&mb, 0, sizeof(mbstate_t));
+      *dest++ = '_';
+      rv = -1;
+    }
+    else if (!dry)
+    {
+      memcpy(dest, s, l);
+      dest += l;
+    }
+  }
+  if (!dry)
+    *dest = 0;
+  return rv;
+}
+
 void mutt_create_alias(struct Envelope *cur, struct Address *iadr)
 {
   struct Alias *new = NULL, *t = NULL;
@@ -250,7 +309,7 @@ void mutt_create_alias(struct Envelope *cur, struct Address *iadr)
     tmp[0] = '\0';
 
   /* Don't suggest a bad alias name in the event of a strange local part. */
-  mutt_check_alias_name(tmp, buf, sizeof(buf));
+  check_alias_name(tmp, buf, sizeof(buf));
 
 retry_name:
   /* L10N: prompt to add a new alias */
@@ -264,7 +323,7 @@ retry_name:
     return;
   }
 
-  if (mutt_check_alias_name(buf, fixed, sizeof(fixed)))
+  if (check_alias_name(buf, fixed, sizeof(fixed)))
   {
     switch (mutt_yesorno(_("Warning: This alias name may not work.  Fix it?"), MUTT_YES))
     {
@@ -364,7 +423,7 @@ retry_name:
         fputc('\n', rc);
     }
 
-    if (mutt_check_alias_name(new->name, NULL, 0))
+    if (check_alias_name(new->name, NULL, 0))
       mutt_quote_filename(buf, sizeof(buf), new->name);
     else
       strfcpy(buf, new->name, sizeof(buf));
@@ -391,50 +450,6 @@ fseek_err:
   return;
 }
 
-/*
- * Sanity-check an alias name:  Only characters which are non-special to both
- * the RFC 822 and the mutt configuration parser are permitted.
- */
-int mutt_check_alias_name(const char *s, char *dest, size_t destlen)
-{
-  wchar_t wc;
-  mbstate_t mb;
-  size_t l;
-  int rv = 0, bad = 0, dry = !dest || !destlen;
-
-  memset(&mb, 0, sizeof(mbstate_t));
-
-  if (!dry)
-    destlen--;
-  for (; s && *s && (dry || destlen) && (l = mbrtowc(&wc, s, MB_CUR_MAX, &mb)) != 0;
-       s += l, destlen -= l)
-  {
-    bad = l == (size_t)(-1) || l == (size_t)(-2); /* conversion error */
-    bad = bad || (!dry && l > destlen);           /* too few room for mb char */
-    if (l == 1)
-      bad = bad || (strchr("-_+=.", *s) == NULL && !iswalnum(wc));
-    else
-      bad = bad || !iswalnum(wc);
-    if (bad)
-    {
-      if (dry)
-        return -1;
-      if (l == (size_t)(-1))
-        memset(&mb, 0, sizeof(mbstate_t));
-      *dest++ = '_';
-      rv = -1;
-    }
-    else if (!dry)
-    {
-      memcpy(dest, s, l);
-      dest += l;
-    }
-  }
-  if (!dry)
-    *dest = 0;
-  return rv;
-}
-
 /*
  * This routine looks to see if the user has an alias defined for the given
  * address.
diff --git a/alias.h b/alias.h
new file mode 100644 (file)
index 0000000..46480c6
--- /dev/null
+++ b/alias.h
@@ -0,0 +1,43 @@
+/**
+ * Copyright (C) 2017 Richard Russon <rich@flatcap.org>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _MUTT_ALIAS_H
+#define _MUTT_ALIAS_H 1
+
+#include <stdbool.h>
+
+struct Envelope;
+struct Address;
+
+struct Alias
+{
+  struct Alias *self; /* XXX - ugly hack */
+  char *name;
+  struct Address *addr;
+  struct Alias *next;
+  bool tagged;
+  bool del;
+  short num;
+};
+
+struct Address *mutt_lookup_alias(const char *s);
+struct Address *mutt_expand_aliases(struct Address *a);
+void mutt_expand_aliases_env(struct Envelope *env);
+struct Address *mutt_get_address(struct Envelope *env, char **pfxp);
+void mutt_create_alias(struct Envelope *cur, struct Address *iadr);
+
+#endif /* _MUTT_ALIAS_H */
diff --git a/ascii.c b/ascii.c
index d4bec6a0755dc4bbcd1d58ef6d7481272172a13c..89442f992b78913fa1d07aca48ccdb078d91e85b 100644 (file)
--- a/ascii.c
+++ b/ascii.c
@@ -23,7 +23,6 @@
 
 #include "config.h"
 #include <stdio.h>
-#include <stdlib.h>
 #include "ascii.h"
 
 int ascii_strcasecmp(const char *a, const char *b)
index 5ed0ddcaa6caabbe0dd6a65aad7a46f5e6678ffb..339c24f9d5ea86d83cbd2ff935f79911c054004b 100644 (file)
--- a/attach.c
+++ b/attach.c
  */
 
 #include "config.h"
-#include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <stdlib.h>
+#include <limits.h>
 #include <string.h>
 #include <sys/stat.h>
-#include <sys/wait.h>
 #include <unistd.h>
 #include "mutt.h"
 #include "attach.h"
+#include "ascii.h"
+#include "body.h"
+#include "context.h"
 #include "copy.h"
 #include "filter.h"
-#include "keymap.h"
+#include "globals.h"
+#include "header.h"
+#include "lib.h"
+#include "list.h"
 #include "mailbox.h"
 #include "mime.h"
 #include "mutt_crypt.h"
 #include "mutt_curses.h"
-#include "mutt_menu.h"
 #include "mx.h"
+#include "options.h"
 #include "pager.h"
+#include "protos.h"
 #include "rfc1524.h"
+#include "state.h"
 
 int mutt_get_tmp_attachment(struct Body *a)
 {
index 2c541200e63fba7fc2ec69b7787b2c6622ea136b..6a40bd0e1e9e3b8dc35ae829ff63ba53af96ef9f 100644 (file)
--- a/attach.h
+++ b/attach.h
 #ifndef _MUTT_ATTACH_H
 #define _MUTT_ATTACH_H 1
 
-#include "mutt_menu.h"
+#include <stdbool.h>
+#include <stdio.h>
+
+struct Menu;
+struct Header;
+struct Body;
 
 struct AttachPtr
 {
index 3fe24988681d334d53a6d761a70763a1c37f3eab..10d6eadf9ff736d44cdb8145d9f7701695781ab1 100644 (file)
--- a/base64.c
+++ b/base64.c
@@ -35,7 +35,7 @@
  */
 
 #include "config.h"
-#include "mutt.h"
+#include <stddef.h>
 #include "mime.h"
 
 #define BAD -1
index 10041a7ebea54a99b31dab0dfc82cada34d271e8..1fe7400bc2ecf7de618b2181fca2931bf708f83d 100644 (file)
--- a/bcache.c
+++ b/bcache.c
 #include "config.h"
 #include <dirent.h>
 #include <errno.h>
+#include <limits.h>
 #include <stdio.h>
+#include <string.h>
 #include <sys/stat.h>
-#include <sys/types.h>
-#include "mutt.h"
+#include <unistd.h>
 #include "bcache.h"
 #include "account.h"
+#include "globals.h"
 #include "lib.h"
+#include "protos.h"
 #include "url.h"
 
 static int mutt_bcache_move(struct BodyCache *bcache, const char *id, const char *newid);
index 4b2bebb198c465eba289b5b49ee103e69818f4ae..cb1ef605ae8932b2cab2d239b6a4966c7a9fdd9c 100644 (file)
--- a/bcache.h
+++ b/bcache.h
 #ifndef _MUTT_BCACHE_H
 #define _MUTT_BCACHE_H 1
 
-#include "account.h"
-
-/*
- * support for body cache
- */
+#include <stdio.h>
 
+struct Account;
 struct BodyCache;
 
 /*
diff --git a/body.h b/body.h
new file mode 100644 (file)
index 0000000..bc9d918
--- /dev/null
+++ b/body.h
@@ -0,0 +1,102 @@
+/**
+ * Copyright (C) 2017 Richard Russon <rich@flatcap.org>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _MUTT_BODY_H
+#define _MUTT_BODY_H 1
+
+#include <stdbool.h>
+#include <time.h>
+#include <sys/types.h>
+
+struct Body
+{
+  char *xtype;          /* content-type if x-unknown */
+  char *subtype;        /* content-type subtype */
+  struct Parameter *parameter; /* parameters of the content-type */
+  char *description;    /* content-description */
+  char *form_name;      /* Content-Disposition form-data name param */
+  long hdr_offset;      /* offset in stream where the headers begin.
+                         * this info is used when invoking metamail,
+                         * where we need to send the headers of the
+                         * attachment
+                         */
+  LOFF_T offset;        /* offset where the actual data begins */
+  LOFF_T length;        /* length (in bytes) of attachment */
+  char *filename;       /* when sending a message, this is the file
+                         * to which this structure refers
+                         */
+  char *d_filename;     /* filename to be used for the
+                         * content-disposition header.
+                         * If NULL, filename is used
+                         * instead.
+                         */
+  char *charset;        /* charset of attached file */
+  struct Content *content;     /* structure used to store detailed info about
+                         * the content of the attachment.  this is used
+                         * to determine what content-transfer-encoding
+                         * is required when sending mail.
+                         */
+  struct Body *next;    /* next attachment in the list */
+  struct Body *parts;   /* parts of a multipart or message/rfc822 */
+  struct Header *hdr;   /* header information for message/rfc822 */
+
+  struct AttachPtr *aptr; /* Menu information, used in recvattach.c */
+
+  signed short attach_count;
+
+  time_t stamp; /* time stamp of last
+                 * encoding update.
+                 */
+
+  unsigned int type : 4;        /* content-type primary type */
+  unsigned int encoding : 3;    /* content-transfer-encoding */
+  unsigned int disposition : 2; /* content-disposition */
+  bool use_disp : 1;            /* Content-Disposition uses filename= ? */
+  bool unlink : 1;              /* flag to indicate the file named by
+                                 * "filename" should be unlink()ed before
+                                 * free()ing this structure
+                                 */
+  bool tagged : 1;
+  bool deleted : 1; /* attachment marked for deletion */
+
+  bool noconv : 1; /* don't do character set conversion */
+  bool force_charset : 1;
+  /* send mode: don't adjust the character
+   * set when in send-mode.
+   */
+  bool is_signed_data : 1; /* A lot of MUAs don't indicate
+                                      S/MIME signed-data correctly,
+                                      e.g. they use foo.p7m even for
+                                      the name of signed data.  This
+                                      flag is used to keep track of
+                                      the actual message type.  It
+                                      gets set during the verification
+                                      (which is done if the encryption
+                                      try failed) and check by the
+                                      function to figure the type of
+                                      the message. */
+
+  bool goodsig : 1; /* good cryptographic signature */
+  bool warnsig : 1; /* maybe good signature */
+  bool badsig : 1; /* bad cryptographic signature (needed to check encrypted s/mime-signatures) */
+
+  bool collapsed : 1; /* used by recvattach */
+  bool attach_qualifies : 1;
+
+};
+
+#endif /* _MUTT_BODY_H */
index 5891bef5c4791dc7a31ebda0d08474e788926e8d..8f03f650091e728657d67bf40a9064fc6040ac5d 100644 (file)
--- a/browser.c
+++ b/browser.c
 #include <ctype.h>
 #include <dirent.h>
 #include <errno.h>
+#include <grp.h>
+#include <libintl.h>
+#include <limits.h>
 #include <locale.h>
+#include <pwd.h>
+#include <regex.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
+#include <time.h>
 #include <unistd.h>
 #include "mutt.h"
 #include "browser.h"
+#include "account.h"
 #include "attach.h"
 #include "buffy.h"
+#include "charset.h"
+#include "context.h"
+#include "format_flags.h"
+#include "globals.h"
+#include "keymap.h"
+#include "keymap_defs.h"
+#include "lib.h"
 #include "mailbox.h"
 #include "mapping.h"
+#include "mbyte.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
+#include "mutt_regex.h"
+#include "mutt_socket.h"
 #include "mx.h"
+#include "options.h"
+#include "protos.h"
 #include "sort.h"
+#include "url.h"
 #ifdef USE_IMAP
 #include "imap/imap.h"
 #endif
index 029db3f1d3a2612772c2a890d32d66128745d7cd..5b608f3789375fee14eb73fd19a0e7367b1a12d9 100644 (file)
--- a/browser.h
+++ b/browser.h
@@ -18,9 +18,9 @@
 #ifndef _MUTT_BROWSER_H
 #define _MUTT_BROWSER_H 1
 
-#ifdef USE_NNTP
-#include "nntp.h"
-#endif
+#include <stdbool.h>
+#include <sys/types.h>
+#include <time.h>
 
 struct folder_file
 {
index f418445f873190911dc668b5d705cfa560bc3501..2627587a9f52e3d5972d5299dbd541cd5fcbb21c 100644 (file)
--- a/buffer.c
+++ b/buffer.c
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "config.h"
+#include <ctype.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sys/types.h>
 #include "buffer.h"
 #include "filter.h"
 #include "lib.h"
index b73fd67b63c191e6c42e467c80eb50e870a50425..57d57c0b02c64f413c1de6fed408e51191ab4a86 100644 (file)
--- a/buffer.h
+++ b/buffer.h
@@ -16,7 +16,7 @@
 #ifndef _MUTT_BUFFER_H
 #define _MUTT_BUFFER_H 1
 
-#include <sys/types.h>
+#include <stddef.h>
 
 struct Buffer
 {
diff --git a/buffy.c b/buffy.c
index e4768cff4e4335e43e9924de271c9f54fc2ccd35..73bee2ed2da82dac90661ee1c082bbbf82c3977a 100644 (file)
--- a/buffy.c
+++ b/buffy.c
  */
 
 #include "config.h"
-#include <ctype.h>
 #include <dirent.h>
+#include <limits.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
-#include <unistd.h>
 #include <utime.h>
-#include "mutt.h"
 #include "buffy.h"
+#include "buffer.h"
+#include "context.h"
+#include "globals.h"
+#include "header.h"
+#include "lib.h"
 #include "mailbox.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
 #include "mx.h"
+#include "options.h"
+#include "protos.h"
 #ifdef USE_SIDEBAR
 #include "sidebar.h"
 #endif
diff --git a/buffy.h b/buffy.h
index f69678c884359d8a2220579890223c07ed67e5f2..a6dfd2bd85c8ee16f59899257df2b2307530d181 100644 (file)
--- a/buffy.h
+++ b/buffy.h
 #ifndef _MUTT_BUFFY_H
 #define _MUTT_BUFFY_H 1
 
+#include <limits.h>
+#include <stdbool.h>
+#include <sys/types.h>
+#include <time.h>
+#include "where.h"
+
+struct stat;
+
 /* parameter to mutt_parse_mailboxes */
 #define MUTT_MAILBOXES   1
 #define MUTT_UNMAILBOXES 2
index ccf06ceef10ae0403d37516f6253fe0a43ba6bc2..f4ff183e18cd47a254ac0c1b52fcd282eebeb8c6 100644 (file)
--- a/charset.c
+++ b/charset.c
 
 #include "config.h"
 #include <ctype.h>
-#include <dirent.h>
 #include <errno.h>
 #include <langinfo.h>
+#include <limits.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
-#include <sys/types.h>
-#include <unistd.h>
 #include "mutt.h"
 #include "charset.h"
+#include "ascii.h"
+#include "globals.h"
+#include "lib.h"
+#include "protos.h"
 
 #ifndef EILSEQ
 #define EILSEQ EINVAL
diff --git a/color.c b/color.c
index 684eccc9d598d0c35b9942f12d4516c787d79672..e04271127ae08769a753c780f1517a8981ce88a7 100644 (file)
--- a/color.c
+++ b/color.c
  */
 
 #include "config.h"
-#include <ctype.h>
+#include <regex.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include "mutt.h"
+#include "ascii.h"
+#include "buffer.h"
+#include "context.h"
+#include "globals.h"
+#include "header.h"
+#include "keymap.h"
+#include "lib.h"
 #include "mapping.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
+#include "mutt_regex.h"
+#include "options.h"
+#include "pattern.h"
+#include "protos.h"
 
 /* globals */
 int *ColorQuote;
index 40b1e789327343db44c9386c5cfa3fb47a0d00dd..e6869a3f823a67f52df3a0e634fdd5ba98ab7eb1 100644 (file)
 #include "config.h"
 #include <errno.h>
 #include <fcntl.h>
-#include <stdlib.h>
+#include <libintl.h>
+#include <limits.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <string.h>
 #include <sys/stat.h>
-#include <sys/stat.h>
-#include <sys/types.h>
 #include <sys/types.h>
-#include <sys/wait.h>
 #include <unistd.h>
-#include <utime.h>
 #include "mutt.h"
+#include "alias.h"
+#include "ascii.h"
+#include "body.h"
+#include "buffer.h"
 #include "buffy.h"
+#include "context.h"
 #include "copy.h"
+#include "envelope.h"
 #include "filter.h"
+#include "format_flags.h"
+#include "globals.h"
+#include "header.h"
+#include "keymap.h"
+#include "lib.h"
 #include "mailbox.h"
 #include "mime.h"
 #include "mutt_crypt.h"
 #include "mutt_idna.h"
 #include "mutt_menu.h"
 #include "mx.h"
+#include "options.h"
 #include "pager.h"
+#include "parameter.h"
+#include "protos.h"
+#include "rfc822.h"
 #include "sort.h"
 #ifdef USE_IMAP
 #include "imap/imap.h"
index 3f3a976b65f2770bff9c9851c06b6abbdc00c2c4..2e3502b27d3ad08943cdd658f2c9f54047f29e7c 100644 (file)
 #include "config.h"
 #include <dirent.h>
 #include <errno.h>
+#include <limits.h>
 #include <string.h>
 #include <sys/stat.h>
-#include <sys/types.h>
-#include "mutt.h"
+#include "globals.h"
+#include "lib.h"
+#include "options.h"
+#include "protos.h"
 #ifdef USE_IMAP
 #include "imap/imap.h"
 #include "mailbox.h"
index 71047576a543dc12d19156f5cec4d285fe73e7e1..d9680b1d40a6009d11e4d41090d5dbb48c15b011 100644 (file)
--- a/compose.c
+++ b/compose.c
 
 #include "config.h"
 #include <errno.h>
-#include <stdlib.h>
+#include <libintl.h>
+#include <limits.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <string.h>
 #include <sys/stat.h>
-#include <sys/wait.h>
 #include <unistd.h>
 #include "mutt.h"
+#include "alias.h"
 #include "attach.h"
-#include "charset.h"
+#include "body.h"
+#include "content.h"
+#include "context.h"
+#include "envelope.h"
+#include "format_flags.h"
+#include "globals.h"
+#include "header.h"
+#include "keymap.h"
+#include "keymap_defs.h"
+#include "lib.h"
+#include "list.h"
 #include "mailbox.h"
 #include "mapping.h"
 #include "mime.h"
+#include "mutt_crypt.h"
 #include "mutt_curses.h"
 #include "mutt_idna.h"
 #include "mutt_menu.h"
+#include "mutt_socket.h"
 #include "mx.h"
+#include "options.h"
+#include "protos.h"
 #include "rfc1524.h"
+#include "rfc822.h"
 #include "sort.h"
 #ifdef MIXMASTER
 #include "remailer.h"
@@ -42,6 +60,8 @@
 #include "nntp.h"
 #endif
 
+struct Address;
+
 static const char *There_are_no_attachments = N_("There are no attachments.");
 
 #define CHECK_COUNT                                                            \
@@ -126,9 +146,6 @@ static void snd_entry(char *b, size_t blen, struct Menu *menu, int num)
                     MUTT_FORMAT_STAT_FILE | MUTT_FORMAT_ARROWCURSOR);
 }
 
-
-#include "mutt_crypt.h"
-
 static void redraw_crypt_lines(struct Header *msg)
 {
   SETCOLOR(MT_COLOR_COMPOSE_HEADER);
index 44f3b129a458addca9889ce7dba1bc9f4b0756e2..94efd572504e514934a096d8b0b6b39d4ee651b9 100644 (file)
  */
 
 #include "config.h"
-#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
 #include <string.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include "mutt.h"
 #include "compress.h"
+#include "context.h"
+#include "format_flags.h"
+#include "globals.h"
+#include "lib.h"
 #include "mailbox.h"
 #include "mutt_curses.h"
 #include "mx.h"
+#include "options.h"
+#include "protos.h"
+
+struct Header;
 
 /* Notes:
  * Any references to compressed files also apply to encrypted files.
index 6c30da9f13b62aaaa3b881915326088209b75eff..6dec213f48345642e31184f595f6139503f28d88 100644 (file)
 #ifndef _MUTT_COMPRESS_H
 #define _MUTT_COMPRESS_H 1
 
+#include <stdbool.h>
+#include "mx.h"
+
+struct Context;
+
 bool mutt_comp_can_append(struct Context *ctx);
 bool mutt_comp_can_read(const char *path);
 int mutt_comp_valid_command(const char *cmd);
diff --git a/content.h b/content.h
new file mode 100644 (file)
index 0000000..4cf5928
--- /dev/null
+++ b/content.h
@@ -0,0 +1,38 @@
+/**
+ * Copyright (C) 2017 Richard Russon <rich@flatcap.org>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _MUTT_CONTENT_H
+#define _MUTT_CONTENT_H 1
+
+#include <stdbool.h>
+
+/* Information that helps in determining the Content-* of an attachment */
+struct Content
+{
+  long hibin;      /* 8-bit characters */
+  long lobin;      /* unprintable 7-bit chars (eg., control chars) */
+  long crlf;       /* '\r' and '\n' characters */
+  long ascii;      /* number of ascii chars */
+  long linemax;    /* length of the longest line in the file */
+  bool space : 1;  /* whitespace at the end of lines? */
+  bool binary : 1; /* long lines, or CR not in CRLF pair */
+  bool from : 1;   /* has a line beginning with "From "? */
+  bool dot : 1;    /* has a line consisting of a single dot? */
+  bool cr : 1;     /* has CR, even when in a CRLF pair */
+};
+
+#endif /* _MUTT_CONTENT_H */
diff --git a/context.h b/context.h
new file mode 100644 (file)
index 0000000..1f7ee52
--- /dev/null
+++ b/context.h
@@ -0,0 +1,98 @@
+/**
+ * Copyright (C) 2017 Richard Russon <rich@flatcap.org>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _MUTT_CONTEXT_H
+#define _MUTT_CONTEXT_H 1
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <time.h>
+
+/* ACL Rights */
+enum
+{
+  MUTT_ACL_LOOKUP = 0,
+  MUTT_ACL_READ,
+  MUTT_ACL_SEEN,
+  MUTT_ACL_WRITE,
+  MUTT_ACL_INSERT,
+  MUTT_ACL_POST,
+  MUTT_ACL_CREATE,
+  MUTT_ACL_DELMX,
+  MUTT_ACL_DELETE,
+  MUTT_ACL_EXPUNGE,
+  MUTT_ACL_ADMIN,
+
+  RIGHTSMAX
+};
+
+struct Context
+{
+  char *path;
+  char *realpath; /* used for buffy comparison and the sidebar */
+  FILE *fp;
+  time_t atime;
+  time_t mtime;
+  off_t size;
+  off_t vsize;
+  char *pattern;            /* limit pattern string */
+  struct Pattern *limit_pattern; /* compiled limit pattern */
+  struct Header **hdrs;
+  struct Header *last_tag;  /* last tagged msg. used to link threads */
+  struct MuttThread *tree;      /* top of thread tree */
+  struct Hash *id_hash;     /* hash table by msg id */
+  struct Hash *subj_hash;   /* hash table by subject */
+  struct Hash *thread_hash; /* hash table for threading */
+  struct Hash *label_hash;  /* hash table for x-labels */
+  int *v2r;          /* mapping from virtual to real msgno */
+  int hdrmax;        /* number of pointers in hdrs */
+  int msgcount;      /* number of messages in the mailbox */
+  int vcount;        /* the number of virtual messages */
+  int tagged;        /* how many messages are tagged? */
+  int new;           /* how many new messages? */
+  int unread;        /* how many unread messages? */
+  int deleted;       /* how many deleted messages */
+  int flagged;       /* how many flagged messages */
+  int msgnotreadyet; /* which msg "new" in pager, -1 if none */
+
+  struct Menu *menu; /* needed for pattern compilation */
+
+  short magic; /* mailbox type */
+
+  unsigned char rights[(RIGHTSMAX + 7) / 8]; /* ACL bits */
+
+  bool locked : 1;    /* is the mailbox locked? */
+  bool changed : 1;   /* mailbox has been modified */
+  bool readonly : 1;  /* don't allow changes to the mailbox */
+  bool dontwrite : 1; /* don't write the mailbox on close */
+  bool append : 1;    /* mailbox is opened in append mode */
+  bool quiet : 1;     /* inhibit status messages? */
+  bool collapsed : 1; /* are all threads collapsed? */
+  bool closing : 1;   /* mailbox is being closed */
+  bool peekonly : 1;  /* just taking a glance, revert atime */
+
+#ifdef USE_COMPRESSED
+  void *compress_info; /* compressed mbox module private data */
+#endif /* USE_COMPRESSED */
+
+  /* driver hooks */
+  void *data; /* driver specific data */
+  struct mx_ops *mx_ops;
+};
+
+#endif /* _MUTT_CONTEXT_H */
diff --git a/copy.c b/copy.c
index 367c3170e99154e78b9b0ecbfe03165dc8a7aa61..b881161700764769669c2bb14adaa80b6abf60c6 100644 (file)
--- a/copy.c
+++ b/copy.c
 
 #include "config.h"
 #include <ctype.h>
-#include <stdlib.h>
+#include <inttypes.h>
+#include <stdbool.h>
 #include <string.h>
-#include <unistd.h>
 #include "mutt.h"
 #include "copy.h"
+#include "address.h"
+#include "ascii.h"
+#include "body.h"
+#include "context.h"
+#include "envelope.h"
+#include "globals.h"
+#include "header.h"
+#include "lib.h"
+#include "list.h"
 #include "mailbox.h"
 #include "mime.h"
 #include "mutt_crypt.h"
 #include "mutt_curses.h"
 #include "mutt_idna.h"
 #include "mx.h"
+#include "options.h"
+#include "protos.h"
 #include "rfc2047.h"
+#include "rfc822.h"
+#include "state.h"
 #ifdef USE_NOTMUCH
 #include "mutt_notmuch.h"
 #endif
diff --git a/copy.h b/copy.h
index d1d2fe563149294d66bbbc7957e81d562137d5ad..4b24babdcf7cbf41ba38956d5f06396822759205 100644 (file)
--- a/copy.h
+++ b/copy.h
 #ifndef _MUTT_COPY_H
 #define _MUTT_COPY_H 1
 
+#include <stdio.h>
+
+struct Body;
+struct Header;
+struct Context;
+
 /* flags to _mutt_copy_message */
 #define MUTT_CM_NOHEADER (1 << 0) /* don't copy the message header */
 #define MUTT_CM_PREFIX   (1 << 1) /* quote the message */
diff --git a/crypt.c b/crypt.c
index ffcf3065dba7befa09d55ec82b9faf29aa23a0b8..7f6f846e98f665797f899c29083046702a8461ce 100644 (file)
--- a/crypt.c
+++ b/crypt.c
  */
 
 #include "config.h"
-#include <ctype.h>
-#include <errno.h>
+#include <limits.h>
 #include <locale.h>
-#include <stdlib.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <string.h>
-#include <sys/resource.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/wait.h>
-#include <unistd.h>
+#include <time.h>
 #include "mutt.h"
+#include "address.h"
+#include "alias.h"
+#include "ascii.h"
+#include "body.h"
+#include "content.h"
+#include "context.h"
 #include "copy.h"
+#include "envelope.h"
+#include "globals.h"
+#include "header.h"
+#include "lib.h"
 #include "mime.h"
 #include "mutt_crypt.h"
 #include "mutt_curses.h"
-
+#include "options.h"
+#include "protos.h"
+#include "rfc822.h"
+#include "state.h"
 
 /* print the current time to avoid spoofing of the signature output */
 void crypt_current_time(struct State *s, char *app_name)
@@ -75,6 +84,7 @@ void crypt_forget_passphrase(void)
 
 #if (!defined(DEBUG))
 
+#include <sys/resource.h>
 static void disable_coredumps(void)
 {
   struct rlimit rl = { 0, 0 };
index eca92df56ae5158fbce3619a9b1821bfd45af0d0..36ce99b71dbfb169335786ed5d3c60a45f41e549 100644 (file)
 #include "config.h"
 #include <ctype.h>
 #include <errno.h>
+#include <gpg-error.h>
 #include <gpgme.h>
 #include <langinfo.h>
+#include <libintl.h>
+#include <limits.h>
 #include <locale.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/resource.h>
 #include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/wait.h>
+#include <time.h>
 #include <unistd.h>
 #include "mutt.h"
-#include "copy.h"
+#include "address.h"
+#include "alias.h"
+#include "ascii.h"
+#include "body.h"
+#include "charset.h"
+#include "envelope.h"
+#include "format_flags.h"
+#include "globals.h"
+#include "header.h"
+#include "keymap.h"
+#include "keymap_defs.h"
+#include "lib.h"
+#include "list.h"
 #include "mime.h"
 #include "mutt_crypt.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
+#include "options.h"
 #include "pager.h"
+#include "protos.h"
+#include "rfc822.h"
 #include "sort.h"
+#include "state.h"
 
 #define PKA_NOTATION_NAME "pka-address@gnupg.org"
 #define is_pka_notation(notation)                                              \
@@ -4411,8 +4430,8 @@ static char *find_keys(struct Address *adrlist, unsigned int app, int oppenc_mod
     bypass_selection:
       keylist_size += mutt_strlen(keyID) + 4 + 1;
       safe_realloc(&keylist, keylist_size);
-      sprintf(keylist + keylist_used, "%s0x%s%s",
-              keylist_used ? " " : "", keyID, forced_valid ? "!" : "");
+      sprintf(keylist + keylist_used, "%s0x%s%s", keylist_used ? " " : "",
+              keyID, forced_valid ? "!" : "");
       keylist_used = mutt_strlen(keylist);
 
       key_selected = 1;
index 899e371332826976a908e517111b595e7a26c779..7d3118f683db140bcedf9e86712bd2c6d1aad0b6 100644 (file)
 #ifndef _MUTT_CRYPT_GPGME_H
 #define _MUTT_CRYPT_GPGME_H 1
 
-#include "mutt_crypt.h"
+#include <stdio.h>
+
+struct Address;
+struct Body;
+struct Header;
+struct State;
 
 void pgp_gpgme_init(void);
 void smime_gpgme_init(void);
index 4eaa7c4d9853436c1336b8c1ec644217aa1d36bc..022ee79765809d918f3579cab918a4db89cb44ee 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "config.h"
 #include "crypt_mod.h"
+#include "lib.h"
 
 /* A type of a variable to keep track of registered crypto modules. */
 struct CryptModule
index f5976a5fca7818384f68fbc62d035e027f2d663b..24256c0c8c2dcfded0e9d7018d4940c7a0c4029a 100644 (file)
 #ifndef _MUTT_CRYPT_MOD_H
 #define _MUTT_CRYPT_MOD_H 1
 
-#include "mutt.h"
+#include <stdio.h>
 #include "mutt_crypt.h"
 
-#define CRYPTO_SUPPORT(identifier) (WithCrypto & APPLICATION_##identifier)
+struct Address;
+struct Body;
+struct Envelope;
+struct Header;
+struct State;
 
+#define CRYPTO_SUPPORT(identifier) (WithCrypto & APPLICATION_##identifier)
 
 /*
     Type definitions for crypto module functions.
index 245cc406144e7474a0bd697a3931073645ab3a85..6b218d52f32c1da8a4959313cb33da992edffd43 100644 (file)
  */
 
 #include "config.h"
+#include <stdio.h>
 #include "crypt_mod.h"
+#include "mutt_crypt.h"
 #include "pgp.h"
 
+struct Address;
+struct Body;
+struct Header;
+struct State;
+
 static void crypt_mod_pgp_void_passphrase(void)
 {
   pgp_void_passphrase();
index 01306246731977816e6be4e9bd7b5f7e7a9a3298..cd1a07ca892a06caecfbf28f409723417e5939e2 100644 (file)
  */
 
 /*
-    This is a crytpo module wrapping the gpgme based pgp code.
+    This is a crypto module wrapping the gpgme based pgp code.
  */
 
 #include "config.h"
+#include <stdio.h>
 #include "crypt_gpgme.h"
 #include "crypt_mod.h"
+#include "mutt_crypt.h"
+
+struct Address;
+struct Body;
+struct Header;
+struct State;
 
 static void crypt_mod_pgp_init(void)
 {
@@ -102,28 +109,28 @@ static void crypt_mod_pgp_set_sender(const char *sender)
 }
 
 struct crypt_module_specs crypt_mod_pgp_gpgme = {
-    APPLICATION_PGP,
-    {
-        /* Common.  */
-        crypt_mod_pgp_init, crypt_mod_pgp_void_passphrase, crypt_mod_pgp_valid_passphrase,
-        crypt_mod_pgp_decrypt_mime, crypt_mod_pgp_application_handler,
-        crypt_mod_pgp_encrypted_handler, crypt_mod_pgp_findkeys, crypt_mod_pgp_sign_message,
-        crypt_mod_pgp_verify_one, crypt_mod_pgp_send_menu, crypt_mod_pgp_set_sender,
-
-        /* PGP specific.  */
-        crypt_mod_pgp_encrypt_message,
+  APPLICATION_PGP,
+  {
+      /* Common.  */
+      crypt_mod_pgp_init, crypt_mod_pgp_void_passphrase, crypt_mod_pgp_valid_passphrase,
+      crypt_mod_pgp_decrypt_mime, crypt_mod_pgp_application_handler,
+      crypt_mod_pgp_encrypted_handler, crypt_mod_pgp_findkeys, crypt_mod_pgp_sign_message,
+      crypt_mod_pgp_verify_one, crypt_mod_pgp_send_menu, crypt_mod_pgp_set_sender,
+
+      /* PGP specific.  */
+      crypt_mod_pgp_encrypt_message,
 #ifdef HAVE_GPGME_OP_EXPORT_KEYS
-        crypt_mod_pgp_make_key_attachment,
+      crypt_mod_pgp_make_key_attachment,
 #else
-        NULL,
+      NULL,
 #endif
-        crypt_mod_pgp_check_traditional, NULL, /* pgp_traditional_encryptsign  */
-        NULL,                                  /* pgp_invoke_getkeys  */
-        crypt_mod_pgp_invoke_import, NULL, /* pgp_extract_keys_from_attachment_list  */
-
-        NULL, /* smime_getkeys */
-        NULL, /* smime_verify_sender */
-        NULL, /* smime_build_smime_entity */
-        NULL, /* smime_invoke_import */
-    },
+      crypt_mod_pgp_check_traditional, NULL, /* pgp_traditional_encryptsign  */
+      NULL,                                  /* pgp_invoke_getkeys  */
+      crypt_mod_pgp_invoke_import, NULL, /* pgp_extract_keys_from_attachment_list  */
+
+      NULL, /* smime_getkeys */
+      NULL, /* smime_verify_sender */
+      NULL, /* smime_build_smime_entity */
+      NULL, /* smime_invoke_import */
+  },
 };
index cf8d3409e1d4114506c749df749eabf42630432d..eb54fcfbd0ba9d1a6211d36c757d32d11d04d13f 100644 (file)
  */
 
 #include "config.h"
+#include <stdio.h>
 #include "crypt_mod.h"
+#include "mutt_crypt.h"
 #include "smime.h"
 
+struct Address;
+struct Body;
+struct Envelope;
+struct Header;
+struct State;
+
 static void crypt_mod_smime_void_passphrase(void)
 {
   smime_void_passphrase();
index efc11c44f2ec9d4d3f327c80bf79da2e58f6cb66..cfa67d8281be5902cccbb193d6970ed83e198617 100644 (file)
  */
 
 /*
-    This is a crytpo module wrapping the gpgme based smime code.
+    This is a crypto module wrapping the gpgme based smime code.
  */
 
 #include "config.h"
+#include <stdio.h>
 #include "crypt_gpgme.h"
 #include "crypt_mod.h"
+#include "mutt_crypt.h"
+
+struct Address;
+struct Body;
+struct Header;
+struct State;
 
 static void crypt_mod_smime_init(void)
 {
index 6f757416a33d8ac0431b91f897a4bc5f1024cde3..7a0074d572f55b4ab2927b40722473f9f3b4772a 100644 (file)
    modules.  */
 
 #include "config.h"
-#include "mutt.h"
+#include <stdio.h>
 #include "crypt_mod.h"
+#include "globals.h"
+#include "lib.h"
 #include "mutt_crypt.h"
+#include "options.h"
+#include "protos.h"
+
+struct Address;
+struct Body;
+struct Envelope;
+struct Header;
+struct State;
 
 /*
 
index 6862fd8c35fdc18be8906e4008da4ee2f879e55a..545af1cc66a192546b7ac3bca3a7e84fae40c18d 100644 (file)
  */
 
 #include "config.h"
+#include <stddef.h>
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <langinfo.h>
+#include <libintl.h>
+#include <limits.h>
+#include <regex.h>
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/time.h>
-#include <sys/types.h>
 #include <termios.h>
-#include <time.h>
 #include <unistd.h>
+#include <wchar.h>
 #include "mutt.h"
+#include "enter_state.h"
+#include "globals.h"
+#include "keymap_defs.h"
+#include "lib.h"
 #include "mbyte.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
+#include "mutt_regex.h"
+#include "options.h"
 #include "pager.h"
+#include "protos.h"
 #ifdef HAVE_ISWBLANK
 #include <wctype.h>
 #endif
index 65924aab609372f2cfdc91c9f9cb6a4641fdd897..fe1bfd9f3f3750f9264727c9bcac0c435e94b41b 100644 (file)
 #include "config.h"
 #include <assert.h>
 #include <ctype.h>
-#include <errno.h>
+#include <libintl.h>
+#include <regex.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <unistd.h>
 #include "mutt.h"
+#include "alias.h"
+#include "body.h"
 #include "buffy.h"
+#include "context.h"
+#include "envelope.h"
+#include "format_flags.h"
+#include "globals.h"
+#include "hash.h"
+#include "header.h"
+#include "keymap.h"
+#include "keymap_defs.h"
+#include "lib.h"
+#include "list.h"
 #include "mailbox.h"
 #include "mapping.h"
 #include "mutt_crypt.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
+#include "mutt_socket.h"
 #include "mx.h"
-#include "mx.h"
+#include "options.h"
+#include "pattern.h"
+#include "protos.h"
 #include "sort.h"
+#include "thread.h"
 #ifdef USE_SIDEBAR
 #include "sidebar.h"
 #endif
@@ -1665,7 +1681,7 @@ int mutt_index_menu(void)
         }
         break;
 
-        /* --------------------------------------------------------------------
+/* --------------------------------------------------------------------
          * The following operations can be performed inside of the pager.
          */
 
diff --git a/date.c b/date.c
index 9d1f9d546cd405c9ea56ccec86b41752d6db69f4..b7573a639b628d047a00c7092fe0263bc48bf81f 100644 (file)
--- a/date.c
+++ b/date.c
@@ -17,7 +17,7 @@
 
 #include "config.h"
 #include <string.h>
-#include "mutt.h"
+#include <time.h>
 
 /* returns the seconds east of UTC given `g' and its corresponding gmtime()
    representation */
index d2506bea5915c8c2c9199a3180b5694744e0aa3d..30c5b34206a62117c5aef2cec5d4cc4bbe300293 100644 (file)
--- a/dotlock.c
+++ b/dotlock.c
  */
 
 #include "config.h"
-#include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/file.h>
 #include <sys/stat.h>
 #include <sys/utsname.h>
 #include <time.h>
diff --git a/edit.c b/edit.c
index 5c26736732680ff5479bd1f4bac7ddf5e9792a3c..6a1337f0135ca37ec7ecaf6e8a616208c83447dc 100644 (file)
--- a/edit.c
+++ b/edit.c
 #include "config.h"
 #include <ctype.h>
 #include <errno.h>
-#include <fcntl.h>
+#include <libintl.h>
 #include <locale.h>
+#include <stdbool.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
 #include "mutt.h"
+#include "alias.h"
+#include "body.h"
+#include "context.h"
+#include "envelope.h"
+#include "globals.h"
+#include "header.h"
+#include "lib.h"
 #include "mutt_curses.h"
 #include "mutt_idna.h"
+#include "options.h"
+#include "protos.h"
+#include "rfc822.h"
 
 /*
  * SLcurses_waddnstr() can't take a "const char *", so this is only
index 4c116c7b909083203616c969209b8eb0ec1cbabf..7027e2424703d9c9be8ebc62ff1e06a5743848d4 100644 (file)
--- a/editmsg.c
+++ b/editmsg.c
 
 #include "config.h"
 #include <errno.h>
+#include <limits.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
 #include <sys/stat.h>
 #include <time.h>
+#include <unistd.h>
 #include "mutt.h"
+#include "context.h"
 #include "copy.h"
+#include "globals.h"
+#include "header.h"
+#include "lib.h"
 #include "mailbox.h"
 #include "mx.h"
+#include "options.h"
+#include "protos.h"
 
 /*
  * return value:
diff --git a/enter.c b/enter.c
index cd932cc38c93d6468c2141ad23875e135c05dead..f07a336c548f90c311350c81e74da56d5efb789f 100644 (file)
--- a/enter.c
+++ b/enter.c
  */
 
 #include "config.h"
+#include <stddef.h>
+#include <limits.h>
 #include <string.h>
+#include <wchar.h>
+#include <wctype.h>
 #include "mutt.h"
+#include "enter_state.h"
+#include "globals.h"
 #include "history.h"
 #include "keymap.h"
+#include "keymap_defs.h"
+#include "lib.h"
+#include "mbyte.h"
 #include "mutt_curses.h"
-#include "mutt_menu.h"
+#include "options.h"
+#include "protos.h"
 
 /* redraw flags for mutt_enter_string() */
 enum
diff --git a/enter_state.h b/enter_state.h
new file mode 100644 (file)
index 0000000..a1fc46b
--- /dev/null
@@ -0,0 +1,39 @@
+/**
+ * Copyright (C) 2017 Richard Russon <rich@flatcap.org>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _MUTT_ENTER_STATE_H
+#define _MUTT_ENTER_STATE_H 1
+
+#include <stddef.h>
+#include "lib.h"
+
+struct EnterState
+{
+  wchar_t *wbuf;
+  size_t wbuflen;
+  size_t lastchar;
+  size_t curpos;
+  size_t begin;
+  int tabs;
+};
+
+static inline struct EnterState *mutt_new_enter_state(void)
+{
+  return safe_calloc(1, sizeof(struct EnterState));
+}
+
+#endif /* _MUTT_ENTER_STATE_H */
diff --git a/envelope.h b/envelope.h
new file mode 100644 (file)
index 0000000..07dced0
--- /dev/null
@@ -0,0 +1,65 @@
+/**
+ * Copyright (C) 2017 Richard Russon <rich@flatcap.org>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _MUTT_ENVELOPE_H
+#define _MUTT_ENVELOPE_H 1
+
+#include <stdbool.h>
+#include "lib.h"
+
+struct Envelope
+{
+  struct Address *return_path;
+  struct Address *from;
+  struct Address *to;
+  struct Address *cc;
+  struct Address *bcc;
+  struct Address *sender;
+  struct Address *reply_to;
+  struct Address *mail_followup_to;
+  struct Address *x_original_to;
+  char *list_post; /* this stores a mailto URL, or nothing */
+  char *subject;
+  char *real_subj; /* offset of the real subject */
+  char *disp_subj; /* display subject (modified copy of 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
+  struct Buffer *spam;
+  struct List *references;  /* message references (in reverse order) */
+  struct List *in_reply_to; /* in-reply-to header content */
+  struct List *userhdrs;    /* user defined headers */
+  int kwtypes;
+
+  bool irt_changed : 1;  /* In-Reply-To changed to link/break threads */
+  bool refs_changed : 1; /* References changed to break thread */
+};
+
+static inline struct Envelope *mutt_new_envelope(void)
+{
+  return safe_calloc(1, sizeof(struct Envelope));
+}
+
+#endif /* _MUTT_ENVELOPE_H */
index 8ecb67a8df19fddabd9cdf969f24e255dad157b2..4603bcb06d7ddb5469d2e7db9a093a6492359fe2 100644 (file)
--- a/filter.c
+++ b/filter.c
@@ -19,9 +19,9 @@
 #include <stdlib.h>
 #include <sys/wait.h>
 #include <unistd.h>
-#include "mutt.h"
 #include "filter.h"
 #include "mutt_curses.h"
+#include "protos.h"
 
 /* Invokes a command on a pipe and optionally connects its stdin and stdout
  * to the specified handles.
diff --git a/flags.c b/flags.c
index c76791d80af9c74571601181ca51720f26001366..959721a8fb15c858cc0fd491d27401ccb2f35477 100644 (file)
--- a/flags.c
+++ b/flags.c
  */
 
 #include "config.h"
+#include <stddef.h>
+#include <stdbool.h>
 #include "mutt.h"
+#include "context.h"
+#include "globals.h"
+#include "header.h"
+#include "lib.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
 #include "mx.h"
+#include "options.h"
+#include "protos.h"
 #include "sort.h"
+#include "thread.h"
 
 void _mutt_set_flag(struct Context *ctx, struct Header *h, int flag, int bf, int upd_ctx)
 {
diff --git a/format_flags.h b/format_flags.h
new file mode 100644 (file)
index 0000000..2de8861
--- /dev/null
@@ -0,0 +1,48 @@
+/**
+ * Copyright (C) 2017 Richard Russon <rich@flatcap.org>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _MUTT_FORMAT_FLAGS_H
+#define _MUTT_FORMAT_FLAGS_H 1
+
+#include <stddef.h>
+
+/* flags for mutt_FormatString() */
+typedef enum {
+  MUTT_FORMAT_FORCESUBJ   = (1 << 0), /* print the subject even if unchanged */
+  MUTT_FORMAT_TREE        = (1 << 1), /* draw the thread tree */
+  MUTT_FORMAT_MAKEPRINT   = (1 << 2), /* make sure that all chars are printable */
+  MUTT_FORMAT_OPTIONAL    = (1 << 3),
+  MUTT_FORMAT_STAT_FILE   = (1 << 4), /* used by mutt_attach_fmt */
+  MUTT_FORMAT_ARROWCURSOR = (1 << 5), /* reserve space for arrow_cursor */
+  MUTT_FORMAT_INDEX       = (1 << 6), /* this is a main index entry */
+  MUTT_FORMAT_NOFILTER    = (1 << 7)  /* do not allow filtering on this pass */
+} format_flag;
+
+typedef const char *format_t(char *, size_t, size_t, int, char, const char *,
+                             const char *, const char *, const char *,
+                             unsigned long, format_flag);
+
+void mutt_FormatString(char *dest,         /* output buffer */
+                       size_t destlen,     /* output buffer len */
+                       size_t col,         /* starting column (nonzero when called recursively) */
+                       int cols,           /* maximum columns */
+                       const char *src,    /* template string */
+                       format_t *callback, /* callback for processing */
+                       unsigned long data, /* callback data */
+                       format_flag flags); /* callback flags */
+
+#endif /* _MUTT_FORMAT_FLAGS_H */
diff --git a/from.c b/from.c
index 405bfc3b6455fcb02e41b4a9f83cce3c4b99c77d..ff8d6a06610d7b8a499ec01001c3184cbf6a34d4 100644 (file)
--- a/from.c
+++ b/from.c
 
 #include "config.h"
 #include <ctype.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <string.h>
-#include "mutt.h"
+#include <time.h>
+#include "ascii.h"
+#include "globals.h"
+#include "lib.h"
+#include "protos.h"
 
 static const char *next_word(const char *s)
 {
index 987c4a91349a56fd2b897e30a8f51f8fede6d2db..20f9263deccde3dd1b8bb50823ac12b520174045 100644 (file)
 #ifdef _MAKEDOC
 #include "config.h"
 #include "doc/makedoc_defs.h"
+#else
+#include <stddef.h>
+#include "keymap.h"
+#include "keymap_defs.h"
 #endif
 
 // clang-format off
index a8367c8a8f2b0bb621e7f6d4c90e95a8b195140f..cc719c0cb8c8b83df13fd1e2665db1e1f2b84ed7 100755 (executable)
--- a/gen_defs
+++ b/gen_defs
@@ -1,5 +1,8 @@
 #!/bin/sh
 
+echo '#ifndef _MUTT_KEYMAP_DEFS_H'
+echo '#define _MUTT_KEYMAP_DEFS_H 1'
+echo ''
 echo '/* Automatically generated by gen_defs.  Do not edit! */'
 echo ''
 
@@ -29,5 +32,6 @@ for mode in help defs; do
                echo ''
        fi
 done
+echo '#endif /* _MUTT_KEYMAP_DEFS_H */'
 
 exit 0
index 2dfebf77bb9ef046567ae87cd27d6196e5af0b3b..79cb81183a86efcb51887cc60f8ff497a4ddd5f2 100644 (file)
 #include <netdb.h>
 #include <string.h>
 #include <sys/socket.h>
-#include <sys/types.h>
+#include <time.h>
 #include <unistd.h>
-#include "mutt.h"
-
+#include "lib.h"
 
 int getdnsdomainname(char *d, size_t len)
 {
index ca4615cdee7576378ae0df6c0ad895d0096afc49..4124d4d03eccaa3f529d8f4d18981e92f56b1e04 100644 (file)
--- a/globals.h
+++ b/globals.h
 #ifndef _MUTT_GLOBALS_H
 #define _MUTT_GLOBALS_H 1
 
+#include <signal.h>
+#include "lib.h"
+#include "where.h"
+
+#ifdef MAIN_C
+/* so that global vars get included */
+#include "git_ver.h"
+#include "mutt_crypt.h"
+#include "mx.h"
+#include "sort.h"
+#endif /* MAIN_C */
+
 WHERE void (*mutt_error)(const char *, ...);
 WHERE void (*mutt_message)(const char *, ...);
 
@@ -212,13 +224,6 @@ WHERE struct RxList *NoSpamList INITVAL(0);
 WHERE struct ReplaceList *SubjectRxList INITVAL(0);
 
 
-/* bit vector for boolean variables */
-#ifdef MAIN_C
-unsigned char Options[(OPTMAX + 7) / 8];
-#else
-extern unsigned char Options[];
-#endif
-
 /* bit vector for the yes/no/ask variable type */
 #ifdef MAIN_C
 unsigned char QuadOptions[(OPT_MAX * 2 + 7) / 8];
@@ -357,14 +362,4 @@ extern const char *const Weekdays[];
 extern const char *const Months[];
 #endif
 
-#ifdef MAIN_C
-/* so that global vars get included */
-#include "buffy.h"
-#include "git_ver.h"
-#include "mutt_crypt.h"
-#include "mutt_regex.h"
-#include "mx.h"
-#include "sort.h"
-#endif /* MAIN_C */
-
 #endif /* _MUTT_GLOBALS_H */
index 4bc10cd8330c58f06e9385943da8c27e30122a14..d48dbebb9c90e4d3cbe869fc30c69113dd3f103b 100644 (file)
 #include "config.h"
 #include <ctype.h>
 #include <fcntl.h>
+#include <iconv.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
 #include <time.h>
 #include <unistd.h>
 #include "mutt.h"
 #include "charset.h"
 #include "filter.h"
+#include "globals.h"
+#include "lib.h"
 #include "mime.h"
+#include "mutt_crypt.h"
+#include "options.h"
 #include "pgp.h"
+#include "pgplib.h"
+#include "protos.h"
 
 /****************
  * Read the GNUPG keys.  For now we read the complete keyring by
@@ -373,7 +377,7 @@ struct PgpKeyInfo *pgp_get_candidates(pgp_ring_t keyring, struct List *hints)
   FILE *fp = NULL;
   pid_t thepid;
   char buf[LONG_STRING];
-  struct PgpKeyInfo *db = NULL, **kend, *k = NULL, *kk = NULL, *mainkey = NULL;
+  struct PgpKeyInfo *db = NULL, **kend = NULL, *k = NULL, *kk = NULL, *mainkey = NULL;
   int is_sub;
   int devnull;
 
diff --git a/group.c b/group.c
index 56c444b6c94b3435c81761b22ffe7317d90c9c54..afdd9c81b1dbf187c9ad5cfb1aeaa19b3fb9b888 100644 (file)
--- a/group.c
+++ b/group.c
  */
 
 #include "config.h"
-#include <ctype.h>
-#include <errno.h>
 #include <stdlib.h>
-#include <string.h>
-#include <sys/utsname.h>
-#include <sys/wait.h>
-#include <unistd.h>
 #include "mutt.h"
-#include "charset.h"
-#include "mbyte.h"
-#include "mutt_curses.h"
-#include "mutt_regex.h"
+#include "group.h"
+#include "address.h"
+#include "globals.h"
+#include "hash.h"
+#include "lib.h"
+#include "list.h"
+#include "protos.h"
+#include "rfc822.h"
 
 struct Group *mutt_pattern_group(const char *k)
 {
diff --git a/group.h b/group.h
index 9ce9f494956b5ca5fe42be86f455045a86ed7dca..1d509ea915e0aaca663dbdcdb191b21c3635a053 100644 (file)
--- a/group.h
+++ b/group.h
 #ifndef _MUTT_GROUP_H
 #define _MUTT_GROUP_H 1
 
+#include <stdbool.h>
+
+struct Address;
+struct Buffer;
+
 #define MUTT_GROUP   0
 #define MUTT_UNGROUP 1
 
+struct Group
+{
+  struct Address *as;
+  struct RxList *rs;
+  char *name;
+};
+
+struct GroupContext
+{
+  struct Group *g;
+  struct GroupContext *next;
+};
+
 void mutt_group_context_add(struct GroupContext **ctx, struct Group *group);
 void mutt_group_context_destroy(struct GroupContext **ctx);
 void mutt_group_context_add_adrlist(struct GroupContext *ctx, struct Address *a);
@@ -33,4 +51,6 @@ int mutt_group_context_clear(struct GroupContext **ctx);
 int mutt_group_context_remove_rx(struct GroupContext *ctx, const char *s);
 int mutt_group_context_remove_adrlist(struct GroupContext *ctx, struct Address *a);
 
+struct Group *mutt_pattern_group(const char *k);
+
 #endif /* _MUTT_GROUP_H */
index c488bef7099262ff85e1a7317f34e41e81fb784e..d0662ee10d5ebe9da783a8e72bf949414627398e 100644 (file)
--- a/handler.c
+++ b/handler.c
  */
 
 #include "config.h"
+#include <stddef.h>
 #include <ctype.h>
+#include <iconv.h>
+#include <libintl.h>
+#include <limits.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
-#include <sys/wait.h>
+#include <time.h>
 #include <unistd.h>
+#include <wchar.h>
+#include <wctype.h>
 #include "mutt.h"
+#include "ascii.h"
+#include "body.h"
 #include "charset.h"
 #include "copy.h"
 #include "filter.h"
+#include "globals.h"
 #include "keymap.h"
+#include "keymap_defs.h"
+#include "lib.h"
+#include "list.h"
 #include "mime.h"
 #include "mutt_crypt.h"
 #include "mutt_curses.h"
+#include "options.h"
+#include "protos.h"
 #include "rfc1524.h"
 #include "rfc3676.h"
+#include "state.h"
 
 #define BUFI_SIZE 1000
 #define BUFO_SIZE 2000
diff --git a/hash.c b/hash.c
index 004eb096f232f49f5303645bf062ea9724a79463..12a44c61f8a08fda2f4696c3b157e85bdec3d0aa 100644 (file)
--- a/hash.c
+++ b/hash.c
@@ -18,9 +18,8 @@
 #include "config.h"
 #include <ctype.h>
 #include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "mutt.h"
+#include "hash.h"
+#include "lib.h"
 
 #define SOMEPRIME 149711
 
diff --git a/hash.h b/hash.h
index dcb3746b45035c94e3ed0c4b80d5bd08fd8540cc..4965bdf60203bf0d92696015cad3d8dda2c83010 100644 (file)
--- a/hash.h
+++ b/hash.h
@@ -18,6 +18,8 @@
 #ifndef _MUTT_HASH_H
 #define _MUTT_HASH_H 1
 
+#include <stdbool.h>
+
 union hash_key {
   const char *strkey;
   unsigned int intkey;
index 26ffada34538d170181e1b4e2d77d71715bb7f21..c9683f4cedde564b3fc69ea5dacadaa62cedb34b 100644 (file)
 #include <db.h>
 #include <errno.h>
 #include <fcntl.h>
-#include "mutt.h"
+#include <limits.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
 #include "backend.h"
+#include "globals.h"
+#include "lib.h"
 #include "mx.h"
 
 struct HcacheDbCtx
index 305991da5397e5946ad3e1205b5fc8007007ef65..db527d8050e12cd40cf0fa16a4be16e403b6ceb4 100644 (file)
  */
 
 #include "config.h"
+#include <stddef.h>
 #include <gdbm.h>
-#include "mutt.h"
 #include "backend.h"
+#include "globals.h"
+#include "lib.h"
 
 static void *hcache_gdbm_open(const char *path)
 {
index 236b448c1e7cbe82c0906cbbee96a71b4a512453..9a85f80f4226fcdf1059b555b1d712e01bb3c822 100644 (file)
 #endif
 
 #include <errno.h>
+#include <limits.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
 #include <sys/time.h>
-#include "hcache.h"
+#include <unistd.h>
+#include "address.h"
 #include "backend.h"
+#include "body.h"
+#include "buffer.h"
+#include "charset.h"
+#include "envelope.h"
+#include "globals.h"
+#include "hcache.h"
 #include "hcversion.h"
+#include "header.h"
+#include "lib.h"
+#include "list.h"
+#include "mbyte.h"
 #include "md5.h"
+#include "mutt_regex.h"
+#include "parameter.h"
+#include "protos.h"
+#include "rfc822.h"
 
 static unsigned int hcachever = 0x0;
 
index a5b8c9f4cdbeb3d1d79902d4872c0e7c84fd4c5d..cbb92dfa0dc5fcf669d3da590a201cabb3acec71 100644 (file)
@@ -21,9 +21,9 @@
 #ifndef _MUTT_HCACHE_H
 #define _MUTT_HCACHE_H 1
 
-#include "mutt.h"
+#include <stddef.h>
 
-struct header_cache;
+struct Header;
 typedef struct header_cache header_cache_t;
 
 typedef int (*hcache_namer_t)(const char *path, char *dest, size_t dlen);
index 0f70762e570068352e79c85e7d8780d1f2c65a35..08be9be88907fd40dd59c9970d7c78c06d7025dc 100644 (file)
 
 #include "config.h"
 #include <kclangc.h>
-#include "mutt.h"
+#include <limits.h>
+#include <stdio.h>
 #include "backend.h"
+#include "lib.h"
+#include "options.h"
 
 static void *hcache_kyotocabinet_open(const char *path)
 {
index 5a64d70c58417d7ffb5b01574bd4195638560e38..29fef9dac730a5cc2d750d1860164f70ca374a62 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include "config.h"
+#include <stddef.h>
 #include <lmdb.h>
 #include "backend.h"
 #include "lib.h"
index d4918b2c4d0e76348295775376400ce4ac9f0b48..609fdd670160fb31073b61fc4c539902025418ea 100644 (file)
  */
 
 #include "config.h"
-#include <cabin.h>
+#include <stddef.h>
 #include <depot.h>
 #include <villa.h>
-#include "mutt.h"
 #include "backend.h"
+#include "lib.h"
+#include "options.h"
 
 static void *hcache_qdbm_open(const char *path)
 {
index c360b86f260e84c52170c3ad5792ef9c5da57a64..c7040648da25ee971a98801d11658f33e207c39d 100644 (file)
  */
 
 #include "config.h"
+#include <stddef.h>
 #include <tcbdb.h>
-#include "mutt.h"
+#include <tcutil.h>
 #include "backend.h"
+#include "lib.h"
+#include "options.h"
 
 static void *hcache_tokyocabinet_open(const char *path)
 {
index 0a275d5dcc20374c2b4203935339afecfde82f3c..b82dd1ea3799fea01db178a0feed175ef766e8d6 100644 (file)
--- a/hdrline.c
+++ b/hdrline.c
 #include "config.h"
 #include <ctype.h>
 #include <locale.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <time.h>
 #include "mutt.h"
-#include "charset.h"
+#include "address.h"
+#include "body.h"
+#include "buffer.h"
+#include "context.h"
+#include "envelope.h"
+#include "format_flags.h"
+#include "globals.h"
+#include "hash.h"
+#include "header.h"
+#include "lib.h"
+#include "mbyte_table.h"
 #include "mutt_crypt.h"
 #include "mutt_curses.h"
 #include "mutt_idna.h"
+#include "options.h"
+#include "protos.h"
+#include "rfc822.h"
 #include "sort.h"
+#include "thread.h"
 #ifdef USE_NOTMUCH
 #include "mutt_notmuch.h"
 #endif
diff --git a/header.h b/header.h
new file mode 100644 (file)
index 0000000..f2804c5
--- /dev/null
+++ b/header.h
@@ -0,0 +1,115 @@
+/**
+ * Copyright (C) 2017 Richard Russon <rich@flatcap.org>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _MUTT_HEADER_H
+#define _MUTT_HEADER_H 1
+
+#include <stddef.h>
+#include <stdbool.h>
+#include <time.h>
+#include "lib.h"
+
+struct Header
+{
+  unsigned int security : 12; /* bit 0-8: flags, bit 9,10: application.
+                                 see: mutt_crypt.h pgplib.h, smime.h */
+
+  bool mime            : 1; /* has a MIME-Version header? */
+  bool flagged         : 1; /* marked important? */
+  bool tagged          : 1;
+  bool deleted         : 1;
+  bool purge           : 1; /* skip trash folder when deleting */
+  bool quasi_deleted   : 1; /* deleted from mutt, but not modified on disk */
+  bool changed         : 1;
+  bool attach_del      : 1; /* has an attachment marked for deletion */
+  bool old             : 1;
+  bool read            : 1;
+  bool expired         : 1; /* already expired? */
+  bool superseded      : 1; /* got superseded? */
+  bool replied         : 1;
+  bool subject_changed : 1; /* used for threading */
+  bool threaded        : 1; /* used for threading */
+  bool display_subject : 1; /* used for threading */
+  bool recip_valid     : 1; /* is_recipient is valid */
+  bool active          : 1; /* message is not to be removed */
+  bool trash           : 1; /* message is marked as trashed on disk.
+                             * This flag is used by the maildir_trash
+                             * option.
+                             */
+  bool xlabel_changed  : 1; /* editable - used for syncing */
+
+  /* timezone of the sender of this message */
+  unsigned int zhours : 5;
+  unsigned int zminutes : 6;
+  bool zoccident : 1;
+
+  /* bits used for caching when searching */
+  bool searched : 1;
+  bool matched : 1;
+
+  /* tells whether the attachment count is valid */
+  bool attach_valid : 1;
+
+  /* the following are used to support collapsing threads  */
+  bool collapsed : 1; /* is this message part of a collapsed thread? */
+  bool limited : 1;   /* is this message in a limited view?  */
+  size_t num_hidden;  /* number of hidden messages in this view */
+
+  short recipient;    /* user_is_recipient()'s return value, cached */
+
+  int pair;           /* color-pair to use when displaying in the index */
+
+  time_t date_sent;   /* time when the message was sent (UTC) */
+  time_t received;    /* time when the message was placed in the mailbox */
+  LOFF_T offset;      /* where in the stream does this message begin? */
+  int lines;          /* how many lines in the body of this message? */
+  int index;          /* the absolute (unsorted) message number */
+  int msgno;          /* number displayed to the user */
+  int virtual;        /* virtual message number */
+  int score;
+  struct Envelope *env;      /* envelope information */
+  struct Body *content;      /* list of MIME parts */
+  char *path;
+
+  char *tree; /* character string to print thread tree */
+  struct MuttThread *thread;
+
+  /* Number of qualifying attachments in message, if attach_valid */
+  short attach_total;
+
+#ifdef MIXMASTER
+  struct List *chain;
+#endif
+
+#ifdef USE_POP
+  int refno; /* message number on server */
+#endif
+
+#if defined(USE_POP) || defined(USE_IMAP) || defined(USE_NNTP) || defined(USE_NOTMUCH)
+  void *data;                       /* driver-specific data */
+  void (*free_cb)(struct Header *); /* driver-specific data free function */
+#endif
+
+  char *maildir_flags; /* unknown maildir flags */
+};
+
+static inline struct Header *mutt_new_header(void)
+{
+  return safe_calloc(1, sizeof(struct Header));
+}
+
+#endif /* _MUTT_HEADER_H */
index dd12bc7b8bee8b42c9483baa8e40754be1209209..74045dc881650a1be09e7813b979b46d87182091 100644 (file)
--- a/headers.c
+++ b/headers.c
 
 #include "config.h"
 #include <ctype.h>
+#include <limits.h>
+#include <stdbool.h>
 #include <stdint.h>
-#include <string.h>
+#include <stdio.h>
 #include <sys/stat.h>
+#include <time.h>
 #include "mutt.h"
+#include "alias.h"
+#include "ascii.h"
+#include "body.h"
+#include "context.h"
+#include "envelope.h"
+#include "globals.h"
+#include "hash.h"
+#include "header.h"
+#include "lib.h"
+#include "list.h"
 #include "mutt_crypt.h"
 #include "mutt_idna.h"
+#include "options.h"
+#include "protos.h"
 
 void mutt_edit_headers(const char *editor, const char *body, struct Header *msg, char *fcc, size_t fcclen)
 {
diff --git a/help.c b/help.c
index e5b3313625455342a1f0d37bd719a80565f4c643..48c6e35f93734336769373560b22eb2a431e8fdc 100644 (file)
--- a/help.c
+++ b/help.c
 #define HELP_C
 
 #include "config.h"
+#include <stddef.h>
 #include <ctype.h>
+#include <limits.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <string.h>
-#include "mutt.h"
+#include <wchar.h>
+#include "globals.h"
 #include "keymap.h"
+#include "keymap_defs.h"
+#include "lib.h"
 #include "mapping.h"
+#include "mbyte.h"
 #include "mutt_curses.h"
+#include "options.h"
 #include "pager.h"
+#include "protos.h"
 
 static const struct binding_t *help_lookup_function(int op, int menu)
 {
index eb9307601f2b3188a7a9efbee441fb8ae9661071..11aaa92ab0be1860c8e40009c7121fc1b44bdd09 100644 (file)
--- a/history.c
+++ b/history.c
  */
 
 #include "config.h"
-#include "mutt.h"
+#include <limits.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
 #include "history.h"
+#include "charset.h"
+#include "globals.h"
+#include "lib.h"
+#include "protos.h"
 
 struct history
 {
index cd8610b5df825d544065d37383ae834f5c2e6a1b..0a8c46390da77ad359098c395466df78be6a71dd 100644 (file)
--- a/history.h
+++ b/history.h
@@ -18,7 +18,7 @@
 #ifndef _MUTT_HISTORY_H
 #define _MUTT_HISTORY_H 1
 
-enum history_class
+typedef enum history_class
 {
   HC_CMD,
   HC_ALIAS,
@@ -29,12 +29,10 @@ enum history_class
   HC_MBOX,
   /* insert new items here to keep history file working */
   HC_LAST
-};
+} history_class_t;
 
 #define HC_FIRST HC_CMD
 
-typedef enum history_class history_class_t;
-
 void mutt_init_history(void);
 void mutt_read_histfile(void);
 void mutt_history_add(history_class_t hclass, const char *s, int save);
diff --git a/hook.c b/hook.c
index 64a61fa4aca77e2f47d2c84e5621acf1d6db3269..76d4025d6f9e7ef8203c20b4a55cc8dc60661bbb 100644 (file)
--- a/hook.c
+++ b/hook.c
 #include "config.h"
 #include <ctype.h>
 #include <limits.h>
-#include <stdlib.h>
+#include <regex.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <string.h>
 #include <unistd.h>
 #include "mutt.h"
+#include "address.h"
+#include "buffer.h"
+#include "context.h"
+#include "envelope.h"
+#include "globals.h"
+#include "header.h"
+#include "lib.h"
+#include "list.h"
 #include "mailbox.h"
 #include "mutt_crypt.h"
+#include "mutt_regex.h"
+#include "options.h"
+#include "pattern.h"
+#include "protos.h"
 #ifdef USE_COMPRESSED
 #include "compress.h"
 #endif
index afca140f2653dc9b901f473488afa81f7e075319..6bd2cf8d6c32b629e9a1a254480a83af51d0703f 100644 (file)
 /* IMAP login/authentication code */
 
 #include "config.h"
-#include "imap_private.h"
-#include "mutt.h"
+#include <string.h>
 #include "auth.h"
+#include "ascii.h"
+#include "globals.h"
+#include "lib.h"
+#include "protos.h"
 
 static const struct ImapAuth imap_authenticators[] = {
   { imap_auth_plain, "plain" },
index 7edd7973c83c875d7966e20c23cda6fc7784a55c..bc50e3421e0c96b65ee3e1dd294af819ff377184 100644 (file)
 #ifndef _MUTT_IMAP_AUTH_H
 #define _MUTT_IMAP_AUTH_H 1
 
+struct ImapData;
+
 typedef enum {
   IMAP_AUTH_SUCCESS = 0,
   IMAP_AUTH_FAILURE,
   IMAP_AUTH_UNAVAIL
 } imap_auth_res_t;
 
-
 struct ImapAuth
 {
   /* do authentication, using named method or any available if method is NULL */
index c3d19f7e06f3d116319638daa3c90d533e309fd5..d71ce38c1a03b555a7b6d0b19b94c9542c3e8cdb 100644 (file)
 
 #include "config.h"
 #include "imap_private.h"
-#include "mutt.h"
+#include "account.h"
 #include "auth.h"
+#include "globals.h"
+#include "lib.h"
+#include "mutt_socket.h"
+#include "options.h"
+#include "protos.h"
 
 /* this is basically a stripped-down version of the cram-md5 method. */
 imap_auth_res_t imap_auth_anon(struct ImapData *idata, const char *method)
index 9bc19861528bb3f95c1ad9ec6b2f231ba66e2647..b51481d1b60b993b2a43e5beb6be194d199881da 100644 (file)
 /* IMAP login/authentication code */
 
 #include "config.h"
+#include <stdio.h>
+#include <string.h>
 #include "imap_private.h"
-#include "mutt.h"
+#include "account.h"
 #include "auth.h"
+#include "globals.h"
+#include "lib.h"
 #include "md5.h"
+#include "mutt_socket.h"
+#include "options.h"
+#include "protos.h"
 
 #define MD5_BLOCK_LEN 64
 #define MD5_DIGEST_LEN 16
index 81734991fa2a3732d3bfc56f56d9438edd0f7e32..0d74790e1cd1bf5f1fe0109d82e824ab861f26ac 100644 (file)
 
 #include "config.h"
 #include <netinet/in.h>
+#include <stdio.h>
+#include <string.h>
 #include "imap_private.h"
-#include "mutt.h"
+#include "account.h"
 #include "auth.h"
+#include "globals.h"
+#include "lib.h"
+#include "mutt_socket.h"
+#include "options.h"
+#include "protos.h"
 #ifdef HAVE_HEIMDAL
 #include <gssapi/gssapi.h>
 #define gss_nt_service_name GSS_C_NT_HOSTBASED_SERVICE
index b91ab4e93e04d149de24c5a3ea116fb703d20757..28f1c5e15de421399e1385f3d9205cafd28cc2b0 100644 (file)
 /* plain LOGIN support */
 
 #include "config.h"
+#include <stdio.h>
 #include "imap_private.h"
-#include "mutt.h"
+#include "account.h"
 #include "auth.h"
+#include "globals.h"
+#include "lib.h"
+#include "mutt_socket.h"
+#include "options.h"
+#include "protos.h"
 
 /* imap_auth_login: Plain LOGIN support */
 imap_auth_res_t imap_auth_login(struct ImapData *idata, const char *method)
index 9f7a85fdd5803b623904599804fc806678be39a1..ccf4994dcdbbb40410cdd8cf0d2cf4ce3f45ca39 100644 (file)
 
 #include "config.h"
 #include "imap_private.h"
-#include "mutt.h"
+#include "account.h"
 #include "auth.h"
+#include "globals.h"
+#include "lib.h"
 #include "mutt_sasl_plain.h"
+#include "mutt_socket.h"
+#include "protos.h"
 
 /* imap_auth_plain: SASL PLAIN support */
 imap_auth_res_t imap_auth_plain(struct ImapData *idata, const char *method)
index ba760393f0c776dc7998dbe35387fc992b0a8fe1..6a441e1a2c1d1f40991fdea396ad03d35cfc98be 100644 (file)
 #include <stddef.h>
 #include <sasl/sasl.h>
 #include <sasl/saslutil.h>
+#include <stdio.h>
+#include <string.h>
 #include "imap_private.h"
-#include "mutt.h"
+#include "account.h"
+#include "ascii.h"
 #include "auth.h"
+#include "globals.h"
+#include "lib.h"
 #include "mutt_sasl.h"
+#include "mutt_socket.h"
+#include "options.h"
+#include "protos.h"
 
 /* imap_auth_sasl: Default authenticator if available. */
 imap_auth_res_t imap_auth_sasl(struct ImapData *idata, const char *method)
index 90d3cfe45707111ec65d564120d4519a8bda3177..f93426b2c7a3f90fb34f759785120d6074a21a2a 100644 (file)
 /* Mutt browser support routines */
 
 #include "config.h"
-#include <ctype.h>
-#include <stdlib.h>
+#include <libintl.h>
+#include <regex.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
 #include "imap_private.h"
 #include "mutt.h"
+#include "account.h"
+#include "browser.h"
 #include "buffy.h"
+#include "context.h"
+#include "globals.h"
+#include "imap/imap.h"
+#include "lib.h"
+#include "mutt_regex.h"
+#include "options.h"
+#include "protos.h"
 
 /* imap_add_folder:
  * add a folder name to the browser list, formatting it as necessary.
index 6ceb96d335a898491e5fda5016bd13d6a12a93ef..7a36db3c628c71614de4b6822738065bed3f8b91 100644 (file)
 
 #include "config.h"
 #include <ctype.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
+#include <time.h>
 #include "imap_private.h"
-#include "mutt.h"
+#include "account.h"
+#include "ascii.h"
+#include "buffer.h"
 #include "buffy.h"
+#include "context.h"
+#include "globals.h"
+#include "hash.h"
+#include "header.h"
+#include "imap/imap.h"
+#include "lib.h"
+#include "mailbox.h"
+#include "message.h"
 #include "mutt_menu.h"
+#include "mutt_socket.h"
 #include "mx.h"
+#include "options.h"
+#include "protos.h"
+#include "url.h"
 
 #define IMAP_CMD_BUFSIZE 512
 
index 974257296cf766fc892ca98cd6d105994b208add..975de38d5b2f3bf52220a8e3b5eaf59bf65d9b95 100644 (file)
 
 #include "config.h"
 #include <ctype.h>
+#include <limits.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
+#include <time.h>
 #include <unistd.h>
 #include "imap_private.h"
 #include "mutt.h"
-#include "browser.h"
+#include "imap.h"
+#include "account.h"
+#include "ascii.h"
+#include "bcache.h"
+#include "body.h"
+#include "buffer.h"
 #include "buffy.h"
+#include "context.h"
+#include "envelope.h"
 #include "globals.h"
+#include "hash.h"
+#include "header.h"
+#include "imap/imap.h"
+#include "lib.h"
+#include "list.h"
 #include "mailbox.h"
+#include "message.h"
+#include "mutt_curses.h"
+#include "mutt_socket.h"
 #include "mx.h"
+#include "options.h"
+#include "pattern.h"
+#include "protos.h"
 #include "sort.h"
+#include "url.h"
 #ifdef USE_HCACHE
 #include "hcache/hcache.h"
 #endif
index 9052ffcc4d7fcf3edbb2f6f74484d95dd03ba8d8..816a5386adc6d18d9e7de08cfc9c34c511d1130e 100644 (file)
 #ifndef _MUTT_IMAP_H
 #define _MUTT_IMAP_H 1
 
+#include <stddef.h>
+#include <sys/types.h>
 #include "account.h"
-#include "browser.h"
-#include "mailbox.h"
+
+struct Header;
+struct Pattern;
+struct Context;
+struct Message;
+struct browser_state;
 
 /* -- data structures -- */
 struct ImapMbox
index e77c9c0f6179893072ee4641f7ca271d153fe203..8479fe095e23218b3b54a68a3373d21d2b156ecd 100644 (file)
 #ifndef _MUTT_IMAP_PRIVATE_H
 #define _MUTT_IMAP_PRIVATE_H 1
 
-#include "account.h"
-#include "bcache.h"
-#include "imap.h"
-#include "message.h"
-#include "mutt_curses.h"
-#include "mutt_socket.h"
+#include <stdbool.h>
+#include <stdio.h>
+#include <time.h>
 #ifdef USE_HCACHE
 #include "hcache/hcache.h"
 #endif
 
+struct Account;
+struct Buffer;
+struct Context;
+struct Header;
+struct ImapHeaderData;
+struct ImapMbox;
+struct List;
+struct Message;
+struct Progress;
+
 /* -- symbols -- */
 #define IMAP_PORT 143
 #define IMAP_SSL_PORT 993
index e55cfde860d9238b4d0bc391a228076847f46e14..15da1af3094e2fa94cfc2f0af6e1df62b1952c83 100644 (file)
 
 #include "config.h"
 #include <ctype.h>
-#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
 #include "imap_private.h"
 #include "mutt.h"
+#include "message.h"
+#include "account.h"
+#include "ascii.h"
 #include "bcache.h"
+#include "body.h"
+#include "buffer.h"
+#include "context.h"
+#include "envelope.h"
+#include "globals.h"
+#include "hash.h"
+#include "header.h"
+#include "imap/imap.h"
+#include "lib.h"
+#include "list.h"
+#include "mailbox.h"
+#include "mutt_curses.h"
+#include "mutt_socket.h"
 #include "mx.h"
+#include "options.h"
+#include "protos.h"
 #ifdef USE_HCACHE
 #include "hcache/hcache.h"
 #endif
index 086cb70f421091d111a6cf131ab20c093849e6cc..d16ec9ba70ab60aa7c9a0244920473a96b19fafc 100644 (file)
@@ -21,6 +21,9 @@
 #ifndef _MUTT_IMAP_MESSAGE_H
 #define _MUTT_IMAP_MESSAGE_H 1
 
+#include <stdbool.h>
+#include <time.h>
+
 /* -- data structures -- */
 /* IMAP-specific header data, stored as Header->data */
 struct ImapHeaderData
index e5ef686b2469648db6abe6fe6c7ce8ba814e3e64..7d98bcca7783c412bba9d9411aaba1f047a9f17c 100644 (file)
  */
 
 #include "config.h"
+#include <string.h>
 #include "imap_private.h"
-#include "mutt.h"
 #include "charset.h"
+#include "globals.h"
+#include "lib.h"
 
 // clang-format off
 static const int Index_64[128] = {
index c01a2167ccaaed440c530a1ff5b79c4af7549beb..34a985afa63b8dcebe382f8fb922e46610db6a0f 100644 (file)
 #include <netdb.h>
 #include <netinet/in.h>
 #include <signal.h>
+#include <stdio.h>
 #include <stdlib.h>
-#include <sys/types.h>
+#include <string.h>
 #include <sys/wait.h>
+#include <time.h>
+#include <unistd.h>
 #include "imap_private.h"
 #include "mutt.h"
+#include "account.h"
+#include "ascii.h"
+#include "bcache.h"
+#include "buffer.h"
+#include "context.h"
+#include "globals.h"
+#include "header.h"
+#include "imap/imap.h"
+#include "lib.h"
+#include "list.h"
+#include "mailbox.h"
+#include "message.h"
+#include "mutt_socket.h"
 #include "mx.h"
+#include "options.h"
+#include "protos.h"
 #include "url.h"
 #ifdef USE_HCACHE
 #include "hcache/hcache.h"
diff --git a/init.c b/init.c
index c3910b8359509850f09985c1cd172de7453de5fd..1a9390157cc02fc7a89b50770082af2648fa71dd 100644 (file)
--- a/init.c
+++ b/init.c
 #include "config.h"
 #include <ctype.h>
 #include <errno.h>
+#include <fcntl.h>
+#include <inttypes.h>
+#include <libgen.h>
+#include <limits.h>
+#include <pwd.h>
+#include <regex.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/time.h>
+#include <sys/stat.h>
 #include <sys/utsname.h>
-#include <sys/wait.h>
 #include <unistd.h>
+#include <wchar.h>
 #include "mutt.h"
 #include "init.h"
+#include "address.h"
+#include "alias.h"
+#include "ascii.h"
+#include "buffer.h"
 #include "charset.h"
+#include "context.h"
+#include "envelope.h"
 #include "filter.h"
 #include "group.h"
+#include "hash.h"
+#include "hcache/hcache.h"
+#include "header.h"
 #include "history.h"
 #include "keymap.h"
+#include "lib.h"
+#include "list.h"
 #include "mailbox.h"
 #include "mapping.h"
 #include "mbyte.h"
+#include "mbyte_table.h"
 #include "mutt_crypt.h"
 #include "mutt_curses.h"
 #include "mutt_idna.h"
 #include "mutt_regex.h"
 #include "mx.h"
 #include "myvar.h"
+#include "options.h"
+#include "pattern.h"
+#include "rfc822.h"
 #include "version.h"
-#ifdef USE_SSL
-#include "mutt_ssl.h"
-#endif
 #ifdef USE_NOTMUCH
 #include "mutt_notmuch.h"
 #endif
diff --git a/init.h b/init.h
index b9dde2e15acf44a5c772e174f15ba37a81d6fd81..29882d4a03539a47475ba9f9617048931d839cdb 100644 (file)
--- a/init.h
+++ b/init.h
 #include "config.h"
 #include "doc/makedoc_defs.h"
 #else
+#include <stddef.h>
+#include "mutt.h"
+#include "buffy.h"
+#include "globals.h"
+#include "group.h"
+#include "mapping.h"
+#include "mutt_commands.h"
+#include "mutt_options.h"
+#include "mutt_regex.h"
 #include "mx.h"
+#include "options.h"
+#include "protos.h"
 #include "sort.h"
 #ifdef USE_LUA
 #include "mutt_lua.h"
 #endif
 #endif
 
-#include "buffy.h"
+struct Buffer;
 
 #ifndef _MAKEDOC
-#include "group.h"
-#include "mutt_commands.h"
-#include "mutt_options.h"
-
 /* flags to parse_set() */
 #define MUTT_SET_INV   (1 << 0) /* default is to invert all vars */
 #define MUTT_SET_UNSET (1 << 1) /* default is to unset all vars */
index c531f67409d33f06651679204996f001e1c34e6f..d705d461d7eafbd1ecc79bd8dfc1c3150fe2efad 100644 (file)
--- a/keymap.c
+++ b/keymap.c
 
 #include "config.h"
 #include <ctype.h>
+#include <limits.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "mutt.h"
 #include "keymap.h"
+#include "ascii.h"
+#include "buffer.h"
 #include "functions.h"
+#include "globals.h"
+#include "keymap_defs.h"
+#include "lib.h"
 #include "mapping.h"
 #include "mutt_crypt.h"
 #include "mutt_curses.h"
-#include "mutt_menu.h"
+#include "options.h"
+#include "protos.h"
 #ifdef USE_IMAP
 #include "imap/imap.h"
 #endif
index 5de4a9cd8b90a46e2bf2bab9fe5446f3f26ab998..287305ebada19aaab16d6d3c8957b0b384587b4e 100644 (file)
--- a/keymap.h
+++ b/keymap.h
@@ -18,6 +18,7 @@
 #ifndef _MUTT_KEYMAP_H
 #define _MUTT_KEYMAP_H 1
 
+#include <stddef.h>
 #include "mapping.h"
 
 /* maximal length of a key binding sequence used for buffer in km_bindkey */
@@ -114,6 +115,4 @@ extern const struct binding_t OpSmime[];
 extern const struct binding_t OpMix[];
 #endif
 
-#include "keymap_defs.h"
-
 #endif /* _MUTT_KEYMAP_H */
diff --git a/lib.c b/lib.c
index e35663af3b5ee99a1be3ebdf16eca1e858a6b6f1..959f39f8e34213725436531daaa0b5714d2f8a02 100644 (file)
--- a/lib.c
+++ b/lib.c
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <pwd.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-#include <sys/wait.h>
+#include <time.h>
 #include <unistd.h>
 #include "lib.h"
 
diff --git a/lib.h b/lib.h
index 3b8c0627570170e1b6c8505de2f84393426227d7..ec3edd5aedd898e22e6a726846431b78e976f8a6 100644 (file)
--- a/lib.h
+++ b/lib.h
 
 #include <ctype.h>
 #include <limits.h>
-#include <signal.h>
-#include <stdarg.h>
-#include <stdbool.h>
 #include <stdio.h>
 #include <string.h>
-#include <sys/stat.h>
 #include <sys/types.h>
-#include <time.h>
-#include <unistd.h>
-#ifndef _POSIX_PATH_MAX
-#include <limits.h>
-#endif
 
 #ifdef ENABLE_NLS
 #include <libintl.h>
diff --git a/list.h b/list.h
new file mode 100644 (file)
index 0000000..d83bf73
--- /dev/null
+++ b/list.h
@@ -0,0 +1,34 @@
+/**
+ * Copyright (C) 2017 Richard Russon <rich@flatcap.org>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _MUTT_LIST_H
+#define _MUTT_LIST_H 1
+
+#include "lib.h"
+
+struct List
+{
+  char *data;
+  struct List *next;
+};
+
+static inline struct List *mutt_new_list(void)
+{
+  return safe_calloc(1, sizeof(struct List));
+}
+
+#endif /* _MUTT_LIST_H */
index fd7532d2437e1547b2091e63bad808966a456c4f..910cfee2443e1c032635d48d1cc911cb8b838d6f 100644 (file)
--- a/mailbox.h
+++ b/mailbox.h
 #ifndef _MUTT_MAILBOX_H
 #define _MUTT_MAILBOX_H 1
 
+#include <stdbool.h>
+#include <stdio.h>
+#include <time.h>
+
+struct Header;
+struct Context;
+
 /* flags for mutt_open_mailbox() */
 #define MUTT_NOSORT    (1 << 0) /* do not sort the mailbox after opening it */
 #define MUTT_APPEND    (1 << 1) /* open mailbox for appending messages */
diff --git a/main.c b/main.c
index ea3b4d97f0b52d02023c27b4ba9cd0eeebd2ae8c..7464ce417863654de434d500d19dacdf651bbc55 100644 (file)
--- a/main.c
+++ b/main.c
 
 #include "config.h"
 #include <errno.h>
+#include <libintl.h>
+#include <limits.h>
 #include <locale.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
-#include <sys/utsname.h>
 #include <unistd.h>
 #include "mutt.h"
+#include "address.h"
+#include "alias.h"
+#include "ascii.h"
+#include "body.h"
+#include "buffy.h"
+#include "envelope.h"
+#include "globals.h"
+#include "header.h"
 #include "keymap.h"
+#include "lib.h"
+#include "list.h"
 #include "mailbox.h"
 #include "mutt_crypt.h"
 #include "mutt_curses.h"
 #include "mutt_idna.h"
+#include "mutt_regex.h"
+#include "mutt_socket.h"
+#include "options.h"
+#include "protos.h"
+#include "rfc822.h"
 #include "url.h"
 #include "version.h"
 #ifdef USE_SIDEBAR
 #ifdef USE_IMAP
 #include "imap/imap.h"
 #endif
-#ifdef USE_HCACHE
-#include "hcache/hcache.h"
-#endif
 #ifdef USE_NNTP
 #include "nntp.h"
 #endif
 
-#ifdef HAVE_STRINGPREP_H
-#include <stringprep.h>
-#elif defined(HAVE_IDN_STRINGPREP_H)
-#include <idn/stringprep.h>
-#endif
-
 char **envlist;
 
 void mutt_exit(int code)
index f7cb5ac4719b41e9f2f447a43d5f73a5fe603448..91c85c746f151cfda6aed3ed5d45d405aa284b1a 100644 (file)
--- a/mapping.h
+++ b/mapping.h
@@ -18,7 +18,7 @@
 #ifndef _MUTT_MAPPING_H
 #define _MUTT_MAPPING_H 1
 
-#include <unistd.h>
+#include <stddef.h>
 
 struct mapping_t
 {
diff --git a/mbox.c b/mbox.c
index 4d5f9069fd8eb2050283ea132af1ef607b2f2b5e..c933254f5f2cbd127d77f1e94f0c861201a55654 100644 (file)
--- a/mbox.c
+++ b/mbox.c
 /* This file contains code to parse ``mbox'' and ``mmdf'' style mailboxes */
 
 #include "config.h"
-#include <dirent.h>
-#include <errno.h>
 #include <fcntl.h>
-#include <string.h>
-#include <sys/file.h>
+#include <inttypes.h>
+#include <limits.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <sys/stat.h>
+#include <time.h>
 #include <unistd.h>
 #include <utime.h>
 #include "mutt.h"
+#include "address.h"
+#include "body.h"
+#include "buffy.h"
+#include "context.h"
 #include "copy.h"
+#include "envelope.h"
+#include "globals.h"
+#include "hash.h"
+#include "header.h"
+#include "lib.h"
+#include "list.h"
 #include "mailbox.h"
 #include "mutt_curses.h"
 #include "mx.h"
+#include "options.h"
+#include "parameter.h"
+#include "protos.h"
+#include "rfc822.h"
 #include "sort.h"
+#include "thread.h"
 
 /* struct used by mutt_sync_mailbox() to store new offsets */
 struct m_update_t
diff --git a/mbyte.c b/mbyte.c
index af3ee2f591c4fe5c677a01a60aaf04df95fb7f42..9dba90170cb1083d85283a4d1695a62a376fa5c2 100644 (file)
--- a/mbyte.c
+++ b/mbyte.c
  */
 
 #include "config.h"
-#include <ctype.h>
 #include <errno.h>
+#include <limits.h>
 #include <stdbool.h>
-#include "mutt.h"
+#include <string.h>
+#include <wchar.h>
 #include "mbyte.h"
+#include "ascii.h"
 #include "buffer.h"
 #include "charset.h"
+#include "lib.h"
+#include "options.h"
+#include "protos.h"
 
 #ifndef EILSEQ
 #define EILSEQ EINVAL
diff --git a/mbyte.h b/mbyte.h
index 6ce1ad3e3c204e4f7b6e816c66aca92de4eca746..171d54dc52dd3539cdd3546d71c6105227f3b775 100644 (file)
--- a/mbyte.h
+++ b/mbyte.h
 #ifndef _MUTT_MBYTE_H
 #define _MUTT_MBYTE_H 1
 
+#include <stdbool.h>
+#include <stddef.h>
 #include <wchar.h>
 
-#ifdef HAVE_WC_FUNCS
-#include <wctype.h>
-#else
+#ifndef HAVE_WC_FUNCS
 #ifdef towupper
 #undef towupper
 #endif
@@ -54,10 +54,10 @@ wint_t towlower(wint_t wc);
 int wcwidth(wchar_t wc);
 #endif /* !HAVE_WC_FUNCS */
 
-
 void mutt_set_charset(char *charset);
 extern int Charset_is_utf8;
 wchar_t replacement_char(void);
 bool is_display_corrupting_utf8(wchar_t wc);
+int mutt_filter_unprintable(char **s);
 
 #endif /* _MUTT_MBYTE_H */
diff --git a/mbyte_table.h b/mbyte_table.h
new file mode 100644 (file)
index 0000000..b7f8d61
--- /dev/null
@@ -0,0 +1,33 @@
+/**
+ * Copyright (C) 2017 Richard Russon <rich@flatcap.org>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _MUTT_MBYTE_TABLE_H
+#define _MUTT_MBYTE_TABLE_H 1
+
+/* multibyte character table.
+ * Allows for direct access to the individual multibyte characters in a
+ * string.  This is used for the Flagchars, Fromchars, StChars and Tochars
+ * option types. */
+struct MbCharTable
+{
+  int len;             /* number of characters */
+  char **chars;        /* the array of multibyte character strings */
+  char *segmented_str; /* each chars entry points inside this string */
+  char *orig_str;
+};
+
+#endif /* _MUTT_MBYTE_TABLE_H */
diff --git a/md5.h b/md5.h
index fb8c03bc59601504c87d50682e10f6f676adcb3f..bb64fea765a6d45b25e6406d6467cf5cbb79b8cc 100644 (file)
--- a/md5.h
+++ b/md5.h
@@ -25,9 +25,8 @@
 #ifndef _MUTT_MD5_H
 #define _MUTT_MD5_H 1
 
-#include <inttypes.h>
+#include <stdint.h>
 #include <stdio.h>
-#include <sys/types.h>
 
 typedef uint32_t md5_uint32;
 
diff --git a/menu.c b/menu.c
index 5ec9549ca63540a65b127a94825e54481b70a4dc..a85ebc426a7d438830ba3af79b2d53a9d1673629 100644 (file)
--- a/menu.c
+++ b/menu.c
  */
 
 #include "config.h"
+#include <stddef.h>
+#include <libintl.h>
+#include <regex.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+#include <wchar.h>
 #include "mutt.h"
-#include "mbyte.h"
+#include "context.h"
+#include "globals.h"
+#include "hash.h"
+#include "keymap.h"
+#include "keymap_defs.h"
+#include "lib.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
+#include "mutt_regex.h"
+#include "mbyte.h"
+#include "options.h"
+#include "pattern.h"
+#include "protos.h"
 #ifdef USE_SIDEBAR
 #include "sidebar.h"
 #endif
diff --git a/mh.c b/mh.c
index 9cf8cc5b680382d203d42f8176a36a984861a4d5..9d77f76dc64f9e7eeb211efeb3dac4de5a59e99b 100644 (file)
--- a/mh.c
+++ b/mh.c
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <inttypes.h>
 #include <limits.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/time.h>
-#include <sys/types.h>
+#include <time.h>
 #include <unistd.h>
 #include <utime.h>
 #include "mutt.h"
+#include "body.h"
 #include "buffy.h"
+#include "context.h"
 #include "copy.h"
+#include "envelope.h"
+#include "globals.h"
+#include "hash.h"
+#include "header.h"
+#include "lib.h"
 #include "mailbox.h"
 #include "mutt_curses.h"
 #include "mx.h"
+#include "options.h"
+#include "protos.h"
 #include "sort.h"
-#ifdef USE_NOTMUCH
-#include "mutt_notmuch.h"
-#endif
+#include "thread.h"
 #ifdef USE_NOTMUCH
 #include "mutt_notmuch.h"
 #endif
diff --git a/mutt.h b/mutt.h
index c8efd903c5f9f2c1c2e89e3b70031fdc959cbd93..1d43de11ca4fd3d3208c169df094cd26999fe9d8 100644 (file)
--- a/mutt.h
+++ b/mutt.h
 #ifndef _MUTT_H
 #define _MUTT_H 1
 
-#include <grp.h>
-#include <libgen.h>
 #include <limits.h>
-#include <pwd.h>
-#include <signal.h>
-#include <stdarg.h>
+#include <regex.h>
 #include <stdbool.h>
+#include <stddef.h>
 #include <stdio.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <time.h>
-#include <unistd.h>
-#include "charset.h"
-#include "hash.h"
-#include "rfc822.h"
-#ifndef _POSIX_PATH_MAX
-#include <limits.h>
-#endif
+
+struct List;
+struct ReplaceList;
+struct RxList;
+struct State;
 
 /* On OS X 10.5.x, wide char functions are inlined by default breaking
  * --without-wc-funcs compilation
 #define _DONT_USE_CTYPE_INLINE_
 #endif
 
-#include <wchar.h>
-#ifdef HAVE_WC_FUNCS
-#include <wctype.h>
-#endif
-
 /* PATH_MAX is undefined on the hurd */
 #if !defined(PATH_MAX) && defined(_POSIX_PATH_MAX)
 #define PATH_MAX _POSIX_PATH_MAX
 #define fgetc fgetc_unlocked
 #endif
 
-/* nifty trick I stole from ELM 2.5alpha. */
-#ifdef MAIN_C
-#define WHERE
-#define INITVAL(x) = x
-#else
-#define WHERE extern
-#define INITVAL(x)
-#endif
-
-#include "buffer.h"
-#include "mutt_regex.h"
-
 /* flags for mutt_enter_string() */
 #define MUTT_ALIAS 1            /* do alias "completion" by calling up the alias-menu */
 #define MUTT_FILE     (1 << 1)  /* do file completion */
 /* flags for _mutt_system() */
 #define MUTT_DETACH_PROCESS 1 /* detach subprocess from group */
 
-/* flags for mutt_FormatString() */
-typedef enum {
-  MUTT_FORMAT_FORCESUBJ   = (1 << 0), /* print the subject even if unchanged */
-  MUTT_FORMAT_TREE        = (1 << 1), /* draw the thread tree */
-  MUTT_FORMAT_MAKEPRINT   = (1 << 2), /* make sure that all chars are printable */
-  MUTT_FORMAT_OPTIONAL    = (1 << 3),
-  MUTT_FORMAT_STAT_FILE   = (1 << 4), /* used by mutt_attach_fmt */
-  MUTT_FORMAT_ARROWCURSOR = (1 << 5), /* reserve space for arrow_cursor */
-  MUTT_FORMAT_INDEX       = (1 << 6), /* this is a main index entry */
-  MUTT_FORMAT_NOFILTER    = (1 << 7)  /* do not allow filtering on this pass */
-} format_flag;
-
 /* types for mutt_add_hook() */
 #define MUTT_FOLDERHOOK   (1 << 0)
 #define MUTT_MBOXHOOK     (1 << 1)
@@ -331,295 +293,6 @@ enum
 #define MUTT_X_MOZILLA_KEYS (1 << 2) /* tbird */
 #define MUTT_KEYWORDS       (1 << 3) /* rfc2822 */
 
-/* boolean vars */
-enum
-{
-  OPTALLOW8BIT,
-  OPTALLOWANSI,
-  OPTARROWCURSOR,
-  OPTASCIICHARS,
-  OPTASKBCC,
-  OPTASKCC,
-  OPTASKFOLLOWUP,
-  OPTASKXCOMMENTTO,
-  OPTATTACHSPLIT,
-  OPTAUTOEDIT,
-  OPTAUTOTAG,
-  OPTBEEP,
-  OPTBEEPNEW,
-  OPTBOUNCEDELIVERED,
-  OPTBRAILLEFRIENDLY,
-  OPTCHECKMBOXSIZE,
-  OPTCHECKNEW,
-  OPTCOLLAPSEALL,
-  OPTCOLLAPSEUNREAD,
-  OPTCONFIRMAPPEND,
-  OPTCONFIRMCREATE,
-  OPTDELETEUNTAG,
-  OPTDIGESTCOLLAPSE,
-  OPTDUPTHREADS,
-  OPTEDITHDRS,
-  OPTENCODEFROM,
-  OPTENVFROM,
-  OPTFASTREPLY,
-  OPTFCCCLEAR,
-  OPTFLAGSAFE,
-  OPTFOLLOWUPTO,
-  OPTFORCENAME,
-  OPTFORWDECODE,
-  OPTFORWQUOTE,
-  OPTFORWREF,
-#ifdef USE_HCACHE
-  OPTHCACHEVERIFY,
-#if defined(HAVE_QDBM) || defined(HAVE_TC) || defined(HAVE_KC)
-  OPTHCACHECOMPRESS,
-#endif /* HAVE_QDBM */
-#endif
-  OPTHDRS,
-  OPTHEADER,
-  OPTHEADERCOLORPARTIAL,
-  OPTHELP,
-  OPTHIDDENHOST,
-  OPTHIDELIMITED,
-  OPTHIDEMISSING,
-  OPTHIDETHREADSUBJECT,
-  OPTHIDETOPLIMITED,
-  OPTHIDETOPMISSING,
-  OPTHONORDISP,
-  OPTIGNORELWS,
-  OPTIGNORELISTREPLYTO,
-#ifdef USE_IMAP
-  OPTIMAPCHECKSUBSCRIBED,
-  OPTIMAPIDLE,
-  OPTIMAPLSUB,
-  OPTIMAPPASSIVE,
-  OPTIMAPPEEK,
-  OPTIMAPSERVERNOISE,
-#endif
-#ifdef USE_SSL
-#ifndef USE_SSL_GNUTLS
-  OPTSSLSYSTEMCERTS,
-  OPTSSLV2,
-#endif /* USE_SSL_GNUTLS */
-  OPTSSLV3,
-  OPTTLSV1,
-  OPTTLSV1_1,
-  OPTTLSV1_2,
-  OPTSSLFORCETLS,
-  OPTSSLVERIFYDATES,
-  OPTSSLVERIFYHOST,
-#if defined(USE_SSL_OPENSSL) && defined(HAVE_SSL_PARTIAL_CHAIN)
-  OPTSSLVERIFYPARTIAL,
-#endif /* USE_SSL_OPENSSL */
-#endif /* defined(USE_SSL) */
-  OPTIMPLICITAUTOVIEW,
-  OPTINCLUDEONLYFIRST,
-  OPTKEEPFLAGGED,
-  OPTKEYWORDSLEGACY,
-  OPTKEYWORDSSTANDARD,
-  OPTMAILCAPSANITIZE,
-  OPTMAILCHECKRECENT,
-  OPTMAILCHECKSTATS,
-  OPTMAILDIRTRASH,
-  OPTMAILDIRCHECKCUR,
-  OPTMARKERS,
-  OPTMARKOLD,
-  OPTMENUSCROLL,  /* scroll menu instead of implicit next-page */
-  OPTMENUMOVEOFF, /* allow menu to scroll past last entry */
-#if defined(USE_IMAP) || defined(USE_POP)
-  OPTMESSAGECACHECLEAN,
-#endif
-  OPTMETAKEY, /* interpret ALT-x as ESC-x */
-  OPTMETOO,
-  OPTMHPURGE,
-  OPTMIMEFORWDECODE,
-#ifdef USE_NNTP
-  OPTMIMESUBJECT, /* encode subject line with RFC2047 */
-#endif
-  OPTNARROWTREE,
-  OPTPAGERSTOP,
-  OPTPIPEDECODE,
-  OPTPIPESPLIT,
-#ifdef USE_POP
-  OPTPOPAUTHTRYALL,
-  OPTPOPLAST,
-#endif
-  OPTPOSTPONEENCRYPT,
-  OPTPRINTDECODE,
-  OPTPRINTSPLIT,
-  OPTPROMPTAFTER,
-  OPTREADONLY,
-  OPTREFLOWSPACEQUOTES,
-  OPTREFLOWTEXT,
-  OPTREPLYSELF,
-  OPTREPLYWITHXORIG,
-  OPTRESOLVE,
-  OPTRESUMEDRAFTFILES,
-  OPTRESUMEEDITEDDRAFTFILES,
-  OPTREVALIAS,
-  OPTREVNAME,
-  OPTREVREAL,
-  OPTRFC2047PARAMS,
-  OPTSAVEADDRESS,
-  OPTSAVEEMPTY,
-  OPTSAVENAME,
-  OPTSCORE,
-#ifdef USE_SIDEBAR
-  OPTSIDEBAR,
-  OPTSIDEBARFOLDERINDENT,
-  OPTSIDEBARNEWMAILONLY,
-  OPTSIDEBARNEXTNEWWRAP,
-  OPTSIDEBARSHORTPATH,
-  OPTSIDEBARONRIGHT,
-#endif
-  OPTSIGDASHES,
-  OPTSIGONTOP,
-  OPTSORTRE,
-  OPTSPAMSEP,
-  OPTSTATUSONTOP,
-  OPTSTRICTTHREADS,
-  OPTSUSPEND,
-  OPTTEXTFLOWED,
-  OPTTHOROUGHSRC,
-  OPTTHREADRECEIVED,
-  OPTTILDE,
-  OPTTSENABLED,
-  OPTUNCOLLAPSEJUMP,
-  OPTUNCOLLAPSENEW,
-  OPTUSE8BITMIME,
-  OPTUSEDOMAIN,
-  OPTUSEFROM,
-  OPTUSEGPGAGENT,
-#ifdef HAVE_LIBIDN
-  OPTIDNDECODE,
-  OPTIDNENCODE,
-#endif
-#ifdef HAVE_GETADDRINFO
-  OPTUSEIPV6,
-#endif
-  OPTWAITKEY,
-  OPTWEED,
-  OPTWRAP,
-  OPTWRAPSEARCH,
-  OPTWRITEBCC, /* write out a bcc header? */
-  OPTXMAILER,
-
-  OPTCRYPTUSEGPGME,
-  OPTCRYPTUSEPKA,
-
-  /* PGP options */
-
-  OPTCRYPTAUTOSIGN,
-  OPTCRYPTAUTOENCRYPT,
-  OPTCRYPTAUTOPGP,
-  OPTCRYPTAUTOSMIME,
-  OPTCRYPTCONFIRMHOOK,
-  OPTCRYPTOPPORTUNISTICENCRYPT,
-  OPTCRYPTREPLYENCRYPT,
-  OPTCRYPTREPLYSIGN,
-  OPTCRYPTREPLYSIGNENCRYPTED,
-  OPTCRYPTTIMESTAMP,
-  OPTSMIMEISDEFAULT,
-  OPTASKCERTLABEL,
-  OPTSDEFAULTDECRYPTKEY,
-  OPTPGPIGNORESUB,
-  OPTPGPCHECKEXIT,
-  OPTPGPLONGIDS,
-  OPTPGPAUTODEC,
-  OPTPGPRETAINABLESIG,
-  OPTPGPSTRICTENC,
-  OPTFORWDECRYPT,
-  OPTPGPSHOWUNUSABLE,
-  OPTPGPAUTOINLINE,
-  OPTPGPREPLYINLINE,
-
-/* news options */
-
-#ifdef USE_NNTP
-  OPTSHOWNEWNEWS,
-  OPTSHOWONLYUNREAD,
-  OPTSAVEUNSUB,
-  OPTLISTGROUP,
-  OPTLOADDESC,
-  OPTXCOMMENTTO,
-#endif
-
-  /* pseudo options */
-
-  OPTAUXSORT,           /* (pseudo) using auxiliary sort function */
-  OPTFORCEREFRESH,      /* (pseudo) refresh even during macros */
-  OPTLOCALES,           /* (pseudo) set if user has valid locale definition */
-  OPTNOCURSES,          /* (pseudo) when sending in batch mode */
-  OPTSEARCHREVERSE,     /* (pseudo) used by ci_search_command */
-  OPTMSGERR,            /* (pseudo) used by mutt_error/mutt_message */
-  OPTSEARCHINVALID,     /* (pseudo) used to invalidate the search pat */
-  OPTSIGNALSBLOCKED,    /* (pseudo) using by mutt_block_signals () */
-  OPTSYSSIGNALSBLOCKED, /* (pseudo) using by mutt_block_signals_system () */
-  OPTNEEDRESORT,        /* (pseudo) used to force a re-sort */
-  OPTRESORTINIT,        /* (pseudo) used to force the next resort to be from scratch */
-  OPTVIEWATTACH,        /* (pseudo) signals that we are viewing attachments */
-  OPTSORTSUBTHREADS,    /* (pseudo) used when $sort_aux changes */
-  OPTNEEDRESCORE,       /* (pseudo) set when the `score' command is used */
-  OPTATTACHMSG,         /* (pseudo) used by attach-message */
-  OPTHIDEREAD,          /* (pseudo) whether or not hide read messages */
-  OPTKEEPQUIET,         /* (pseudo) shut up the message and refresh
-                         *          functions while we are executing an
-                         *          external program.
-                         */
-  OPTMENUCALLER,        /* (pseudo) tell menu to give caller a take */
-  OPTREDRAWTREE,        /* (pseudo) redraw the thread tree */
-  OPTPGPCHECKTRUST,     /* (pseudo) used by pgp_select_key () */
-  OPTDONTHANDLEPGPKEYS, /* (pseudo) used to extract PGP keys */
-  OPTIGNOREMACROEVENTS, /* (pseudo) don't process macro/push/exec events while set */
-
-#ifdef USE_NNTP
-  OPTNEWS,              /* (pseudo) used to change reader mode */
-  OPTNEWSSEND,          /* (pseudo) used to change behavior when posting */
-#endif
-#ifdef USE_NOTMUCH
-  OPTVIRTSPOOLFILE,
-  OPTNOTMUCHRECORD,
-#endif
-
-  OPTMAX
-};
-
-#define mutt_bit_alloc(n)     calloc((n + 7) / 8, sizeof(char))
-#define mutt_bit_set(v, n)    v[n / 8] |= (1 << (n % 8))
-#define mutt_bit_unset(v, n)  v[n / 8] &= ~(1 << (n % 8))
-#define mutt_bit_toggle(v, n) v[n / 8] ^= (1 << (n % 8))
-#define mutt_bit_isset(v, n)  (v[n / 8] & (1 << (n % 8)))
-
-#define set_option(x) mutt_bit_set(Options, x)
-#define unset_option(x) mutt_bit_unset(Options, x)
-#define toggle_option(x) mutt_bit_toggle(Options, x)
-#define option(x) mutt_bit_isset(Options, x)
-
-struct List
-{
-  char *data;
-  struct List *next;
-};
-
-struct RxList
-{
-  struct Regex *rx;
-  struct RxList *next;
-};
-
-struct ReplaceList
-{
-  struct Regex *rx;
-  int nmatch;
-  char *template;
-  struct ReplaceList *next;
-};
-
-static inline struct List *mutt_new_list(void)
-{
-  return safe_calloc(1, sizeof(struct List));
-}
-
 void mutt_free_list(struct List **list);
 void mutt_free_rx_list(struct RxList **list);
 void mutt_free_replace_list(struct ReplaceList **list);
@@ -640,452 +313,9 @@ const char *mutt_front_list(struct List *head);
 
 void mutt_init(int skip_sys_rc, struct List *commands);
 
-struct Alias
-{
-  struct Alias *self; /* XXX - ugly hack */
-  char *name;
-  struct Address *addr;
-  struct Alias *next;
-  bool tagged;
-  bool del;
-  short num;
-};
-
-struct Envelope
-{
-  struct Address *return_path;
-  struct Address *from;
-  struct Address *to;
-  struct Address *cc;
-  struct Address *bcc;
-  struct Address *sender;
-  struct Address *reply_to;
-  struct Address *mail_followup_to;
-  struct Address *x_original_to;
-  char *list_post; /* this stores a mailto URL, or nothing */
-  char *subject;
-  char *real_subj; /* offset of the real subject */
-  char *disp_subj; /* display subject (modified copy of 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
-  struct Buffer *spam;
-  struct List *references;  /* message references (in reverse order) */
-  struct List *in_reply_to; /* in-reply-to header content */
-  struct List *userhdrs;    /* user defined headers */
-  int kwtypes;
-
-  bool irt_changed : 1;  /* In-Reply-To changed to link/break threads */
-  bool refs_changed : 1; /* References changed to break thread */
-};
-
-static inline struct Envelope *mutt_new_envelope(void)
-{
-  return safe_calloc(1, sizeof(struct Envelope));
-}
-
-struct Parameter
-{
-  char *attribute;
-  char *value;
-  struct Parameter *next;
-};
-
-static inline struct Parameter *mutt_new_parameter(void)
-{
-  return safe_calloc(1, sizeof(struct Parameter));
-}
-
-/* Information that helps in determining the Content-* of an attachment */
-struct Content
-{
-  long hibin;      /* 8-bit characters */
-  long lobin;      /* unprintable 7-bit chars (eg., control chars) */
-  long crlf;       /* '\r' and '\n' characters */
-  long ascii;      /* number of ascii chars */
-  long linemax;    /* length of the longest line in the file */
-  bool space : 1;  /* whitespace at the end of lines? */
-  bool binary : 1; /* long lines, or CR not in CRLF pair */
-  bool from : 1;   /* has a line beginning with "From "? */
-  bool dot : 1;    /* has a line consisting of a single dot? */
-  bool cr : 1;     /* has CR, even when in a CRLF pair */
-};
-
-struct Body
-{
-  char *xtype;          /* content-type if x-unknown */
-  char *subtype;        /* content-type subtype */
-  struct Parameter *parameter; /* parameters of the content-type */
-  char *description;    /* content-description */
-  char *form_name;      /* Content-Disposition form-data name param */
-  long hdr_offset;      /* offset in stream where the headers begin.
-                         * this info is used when invoking metamail,
-                         * where we need to send the headers of the
-                         * attachment
-                         */
-  LOFF_T offset;        /* offset where the actual data begins */
-  LOFF_T length;        /* length (in bytes) of attachment */
-  char *filename;       /* when sending a message, this is the file
-                         * to which this structure refers
-                         */
-  char *d_filename;     /* filename to be used for the
-                         * content-disposition header.
-                         * If NULL, filename is used
-                         * instead.
-                         */
-  char *charset;        /* charset of attached file */
-  struct Content *content;     /* structure used to store detailed info about
-                         * the content of the attachment.  this is used
-                         * to determine what content-transfer-encoding
-                         * is required when sending mail.
-                         */
-  struct Body *next;    /* next attachment in the list */
-  struct Body *parts;   /* parts of a multipart or message/rfc822 */
-  struct Header *hdr;   /* header information for message/rfc822 */
-
-  struct AttachPtr *aptr; /* Menu information, used in recvattach.c */
-
-  signed short attach_count;
-
-  time_t stamp; /* time stamp of last
-                 * encoding update.
-                 */
-
-  unsigned int type : 4;        /* content-type primary type */
-  unsigned int encoding : 3;    /* content-transfer-encoding */
-  unsigned int disposition : 2; /* content-disposition */
-  bool use_disp : 1;            /* Content-Disposition uses filename= ? */
-  bool unlink : 1;              /* flag to indicate the file named by
-                                 * "filename" should be unlink()ed before
-                                 * free()ing this structure
-                                 */
-  bool tagged : 1;
-  bool deleted : 1; /* attachment marked for deletion */
-
-  bool noconv : 1; /* don't do character set conversion */
-  bool force_charset : 1;
-  /* send mode: don't adjust the character
-   * set when in send-mode.
-   */
-  bool is_signed_data : 1; /* A lot of MUAs don't indicate
-                                      S/MIME signed-data correctly,
-                                      e.g. they use foo.p7m even for
-                                      the name of signed data.  This
-                                      flag is used to keep track of
-                                      the actual message type.  It
-                                      gets set during the verification
-                                      (which is done if the encryption
-                                      try failed) and check by the
-                                      function to figure the type of
-                                      the message. */
-
-  bool goodsig : 1; /* good cryptographic signature */
-  bool warnsig : 1; /* maybe good signature */
-  bool badsig : 1; /* bad cryptographic signature (needed to check encrypted s/mime-signatures) */
-
-  bool collapsed : 1; /* used by recvattach */
-  bool attach_qualifies : 1;
-
-};
-
-struct Header
-{
-  unsigned int security : 12; /* bit 0-8: flags, bit 9,10: application.
-                                 see: mutt_crypt.h pgplib.h, smime.h */
-
-  bool mime            : 1; /* has a MIME-Version header? */
-  bool flagged         : 1; /* marked important? */
-  bool tagged          : 1;
-  bool deleted         : 1;
-  bool purge           : 1; /* skip trash folder when deleting */
-  bool quasi_deleted   : 1; /* deleted from mutt, but not modified on disk */
-  bool changed         : 1;
-  bool attach_del      : 1; /* has an attachment marked for deletion */
-  bool old             : 1;
-  bool read            : 1;
-  bool expired         : 1; /* already expired? */
-  bool superseded      : 1; /* got superseded? */
-  bool replied         : 1;
-  bool subject_changed : 1; /* used for threading */
-  bool threaded        : 1; /* used for threading */
-  bool display_subject : 1; /* used for threading */
-  bool recip_valid     : 1; /* is_recipient is valid */
-  bool active          : 1; /* message is not to be removed */
-  bool trash           : 1; /* message is marked as trashed on disk.
-                             * This flag is used by the maildir_trash
-                             * option.
-                             */
-  bool xlabel_changed  : 1; /* editable - used for syncing */
-
-  /* timezone of the sender of this message */
-  unsigned int zhours : 5;
-  unsigned int zminutes : 6;
-  bool zoccident : 1;
-
-  /* bits used for caching when searching */
-  bool searched : 1;
-  bool matched : 1;
-
-  /* tells whether the attachment count is valid */
-  bool attach_valid : 1;
-
-  /* the following are used to support collapsing threads  */
-  bool collapsed : 1; /* is this message part of a collapsed thread? */
-  bool limited : 1;   /* is this message in a limited view?  */
-  size_t num_hidden;  /* number of hidden messages in this view */
-
-  short recipient;    /* user_is_recipient()'s return value, cached */
-
-  int pair;           /* color-pair to use when displaying in the index */
-
-  time_t date_sent;   /* time when the message was sent (UTC) */
-  time_t received;    /* time when the message was placed in the mailbox */
-  LOFF_T offset;      /* where in the stream does this message begin? */
-  int lines;          /* how many lines in the body of this message? */
-  int index;          /* the absolute (unsorted) message number */
-  int msgno;          /* number displayed to the user */
-  int virtual;        /* virtual message number */
-  int score;
-  struct Envelope *env;      /* envelope information */
-  struct Body *content;      /* list of MIME parts */
-  char *path;
-
-  char *tree; /* character string to print thread tree */
-  struct MuttThread *thread;
-
-  /* Number of qualifying attachments in message, if attach_valid */
-  short attach_total;
-
-#ifdef MIXMASTER
-  struct List *chain;
-#endif
-
-#ifdef USE_POP
-  int refno; /* message number on server */
-#endif
-
-#if defined(USE_POP) || defined(USE_IMAP) || defined(USE_NNTP) || defined(USE_NOTMUCH)
-  void *data;                       /* driver-specific data */
-  void (*free_cb)(struct Header *); /* driver-specific data free function */
-#endif
-
-  char *maildir_flags; /* unknown maildir flags */
-};
-
-static inline struct Header *mutt_new_header(void)
-{
-  return safe_calloc(1, sizeof(struct Header));
-}
-
-struct MuttThread
-{
-  bool fake_thread : 1;
-  bool duplicate_thread : 1;
-  bool sort_children : 1;
-  bool check_subject : 1;
-  bool visible : 1;
-  bool deep : 1;
-  unsigned int subtree_visible : 2;
-  bool next_subtree_visible : 1;
-  struct MuttThread *parent;
-  struct MuttThread *child;
-  struct MuttThread *next;
-  struct MuttThread *prev;
-  struct Header *message;
-  struct Header *sort_key;
-};
-
-
 /* flag to mutt_pattern_comp() */
 #define MUTT_FULL_MSG (1 << 0) /* enable body and header matching */
 
-typedef enum {
-  MUTT_MATCH_FULL_ADDRESS = 1
-} pattern_exec_flag;
-
-struct Group
-{
-  struct Address *as;
-  struct RxList *rs;
-  char *name;
-};
-
-struct GroupContext
-{
-  struct Group *g;
-  struct GroupContext *next;
-};
-
-struct Pattern
-{
-  short op;
-  bool not : 1;
-  bool alladdr : 1;
-  bool stringmatch : 1;
-  bool groupmatch : 1;
-  bool ign_case : 1; /* ignore case for local stringmatch searches */
-  bool isalias : 1;
-  int min;
-  int max;
-  struct Pattern *next;
-  struct Pattern *child; /* arguments to logical op */
-  union {
-    regex_t *rx;
-    struct Group *g;
-    char *str;
-  } p;
-};
-
-/* This is used when a message is repeatedly pattern matched against.
- * e.g. for color, scoring, hooks.  It caches a few of the potentially slow
- * operations.
- * Each entry has a value of 0 = unset, 1 = false, 2 = true
- */
-struct PatternCache
-{
-  int list_all;       /* ^~l */
-  int list_one;       /*  ~l */
-  int sub_all;        /* ^~u */
-  int sub_one;        /*  ~u */
-  int pers_recip_all; /* ^~p */
-  int pers_recip_one; /*  ~p */
-  int pers_from_all;  /* ^~P */
-  int pers_from_one;  /*  ~P */
-};
-
-/* ACL Rights */
-enum
-{
-  MUTT_ACL_LOOKUP = 0,
-  MUTT_ACL_READ,
-  MUTT_ACL_SEEN,
-  MUTT_ACL_WRITE,
-  MUTT_ACL_INSERT,
-  MUTT_ACL_POST,
-  MUTT_ACL_CREATE,
-  MUTT_ACL_DELMX,
-  MUTT_ACL_DELETE,
-  MUTT_ACL_EXPUNGE,
-  MUTT_ACL_ADMIN,
-
-  RIGHTSMAX
-};
-
-struct Context;
-struct Message;
-
-/*
- * struct mx_ops - a structure to store operations on a mailbox
- * The following operations are mandatory:
- *  - open
- *  - close
- *  - check
- *
- * Optional operations
- *  - open_new_msg
- */
-struct mx_ops
-{
-  int (*open)(struct Context *ctx);
-  int (*open_append)(struct Context *ctx, int flags);
-  int (*close)(struct Context *ctx);
-  int (*check)(struct Context *ctx, int *index_hint);
-  int (*sync)(struct Context *ctx, int *index_hint);
-  int (*open_msg)(struct Context *ctx, struct Message *msg, int msgno);
-  int (*close_msg)(struct Context *ctx, struct Message *msg);
-  int (*commit_msg)(struct Context *ctx, struct Message *msg);
-  int (*open_new_msg)(struct Message *msg, struct Context *ctx, struct Header *hdr);
-};
-
-#include "mutt_menu.h"
-
-struct Context
-{
-  char *path;
-  char *realpath; /* used for buffy comparison and the sidebar */
-  FILE *fp;
-  time_t atime;
-  time_t mtime;
-  off_t size;
-  off_t vsize;
-  char *pattern;            /* limit pattern string */
-  struct Pattern *limit_pattern; /* compiled limit pattern */
-  struct Header **hdrs;
-  struct Header *last_tag;  /* last tagged msg. used to link threads */
-  struct MuttThread *tree;      /* top of thread tree */
-  struct Hash *id_hash;     /* hash table by msg id */
-  struct Hash *subj_hash;   /* hash table by subject */
-  struct Hash *thread_hash; /* hash table for threading */
-  struct Hash *label_hash;  /* hash table for x-labels */
-  int *v2r;          /* mapping from virtual to real msgno */
-  int hdrmax;        /* number of pointers in hdrs */
-  int msgcount;      /* number of messages in the mailbox */
-  int vcount;        /* the number of virtual messages */
-  int tagged;        /* how many messages are tagged? */
-  int new;           /* how many new messages? */
-  int unread;        /* how many unread messages? */
-  int deleted;       /* how many deleted messages */
-  int flagged;       /* how many flagged messages */
-  int msgnotreadyet; /* which msg "new" in pager, -1 if none */
-
-  struct Menu *menu; /* needed for pattern compilation */
-
-  short magic; /* mailbox type */
-
-  unsigned char rights[(RIGHTSMAX + 7) / 8]; /* ACL bits */
-
-  bool locked : 1;    /* is the mailbox locked? */
-  bool changed : 1;   /* mailbox has been modified */
-  bool readonly : 1;  /* don't allow changes to the mailbox */
-  bool dontwrite : 1; /* don't write the mailbox on close */
-  bool append : 1;    /* mailbox is opened in append mode */
-  bool quiet : 1;     /* inhibit status messages? */
-  bool collapsed : 1; /* are all threads collapsed? */
-  bool closing : 1;   /* mailbox is being closed */
-  bool peekonly : 1;  /* just taking a glance, revert atime */
-
-#ifdef USE_COMPRESSED
-  void *compress_info; /* compressed mbox module private data */
-#endif /* USE_COMPRESSED */
-
-  /* driver hooks */
-  void *data; /* driver specific data */
-  struct mx_ops *mx_ops;
-};
-
-struct State
-{
-  FILE *fpin;
-  FILE *fpout;
-  char *prefix;
-  int flags;
-};
-
-/* used by enter.c */
-
-struct EnterState
-{
-  wchar_t *wbuf;
-  size_t wbuflen;
-  size_t lastchar;
-  size_t curpos;
-  size_t begin;
-  int tabs;
-};
-
-static inline struct EnterState *mutt_new_enter_state(void)
-{
-  return safe_calloc(1, sizeof(struct EnterState));
-}
-
 /* flags for the State struct */
 #define MUTT_DISPLAY       (1 << 0) /* output is displayed to the user */
 #define MUTT_VERIFY        (1 << 1) /* perform signature verification */
@@ -1116,23 +346,6 @@ struct AttachMatch
   regex_t minor_rx;
 };
 
-/* multibyte character table.
- * Allows for direct access to the individual multibyte characters in a
- * string.  This is used for the Flagchars, Fromchars, StChars and Tochars
- * option types. */
-struct MbCharTable
-{
-  int len;             /* number of characters */
-  char **chars;        /* the array of multibyte character strings */
-  char *segmented_str; /* each chars entry points inside this string */
-  char *orig_str;
-};
-
 #define MUTT_PARTS_TOPLEVEL (1 << 0) /* is the top-level part */
 
-#include "ascii.h"
-#include "globals.h"
-#include "lib.h"
-#include "protos.h"
-
 #endif /* _MUTT_H */
index 81c75e30d6919b8a38a642501e36a4fc499ba7c2..f1c17dd3a44b37bb8a9c3b64008806d1e82c3d53 100644 (file)
@@ -18,7 +18,7 @@
 #ifndef _MUTT_COMMANDS_H
 #define _MUTT_COMMANDS_H 1
 
-#include "mutt.h"
+struct Buffer;
 
 struct command_t
 {
index 38441a46a5ce19ee9bebaa49abeba1b346a35435..71fd8e47b1b5728042d6604bd77afc96b1206513 100644 (file)
 #ifndef _MUTT_CRYPT_H
 #define _MUTT_CRYPT_H 1
 
-#include "mutt.h"
+#include <stdbool.h>
+#include <stdio.h>
+
+struct Address;
+struct Body;
+struct Envelope;
+struct Header;
+struct State;
+
 /* FIXME: They should be pointer to anonymous structures for better
    information hiding. */
 
 
 #define KEYFLAG_ABILITIES (KEYFLAG_CANSIGN | KEYFLAG_CANENCRYPT | KEYFLAG_PREFER_ENCRYPTION | KEYFLAG_PREFER_SIGNING)
 
-enum pgp_ring
+typedef enum pgp_ring
 {
   PGP_PUBRING,
   PGP_SECRING
-};
-typedef enum pgp_ring pgp_ring_t;
+} pgp_ring_t;
 
 /* Some prototypes -- old crypt.h. */
 
index 61a94eb668ed1a2f6ba4bdd947642dec03a4e848..137fb284ab7974b91796728a52e34d9101564c80 100644 (file)
 #ifndef _MUTT_CURSES_H
 #define _MUTT_CURSES_H 1
 
+#include <regex.h>
+#include "lib.h"
+#include "options.h"
+
 #ifdef USE_SLANG_CURSES
 
 #ifndef unix /* this symbol is not defined by the hp-ux compiler (sigh) */
@@ -68,8 +72,6 @@
 
 #endif /* USE_SLANG_CURSES */
 
-#include "lib.h"
-
 /* AIX defines ``lines'' in <term.h>, but it's used as a var name in
  * various places in Mutt
  */
index 151b4c5f6a88e3b8703a01d308f6f9d239a8b536..5bb554f3fdea7e3400eccc528fbbcaf6fbe3f803 100644 (file)
  */
 
 #include "config.h"
-#include "mutt.h"
+#include <idna.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
 #include "mutt_idna.h"
+#include "address.h"
+#include "ascii.h"
 #include "charset.h"
+#include "envelope.h"
+#include "globals.h"
+#include "lib.h"
+#include "options.h"
 
 #ifdef HAVE_LIBIDN
 static bool check_idn(char *domain)
index d1db69bc204a46636e7334f500f7f860c647273a..ae125eae5daa674de1431b7757f74b5c841d1b2a 100644 (file)
 #ifndef _MUTT_IDNA_H
 #define _MUTT_IDNA_H 1
 
-#include "charset.h"
-#include "rfc822.h"
-
-#ifdef HAVE_IDNA_H
-#include <idna.h>
-#elif defined(HAVE_IDN_IDNA_H)
-#include <idn/idna.h>
-#endif
+struct Envelope;
+struct Address;
 
 #define MI_MAY_BE_IRREVERSIBLE (1 << 0)
 
index defbe458a9e70239fdd1e2cbbf83bb4f214500f9..725ccfb1a69c51beb1e2878474f7f9c52af56f62 100644 (file)
 #include <lua.h>
 #include <lualib.h>
 #include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
 #include "mutt.h"
 #include "mutt_lua.h"
+#include "buffer.h"
+#include "globals.h"
+#include "lib.h"
+#include "mailbox.h"
+#include "mbyte_table.h"
 #include "mutt_commands.h"
 #include "mutt_options.h"
-#include "mx.h"
+#include "options.h"
+#include "protos.h"
+#include "rfc822.h"
 
 static int _handle_panic(lua_State *l)
 {
index fee32c9b5a3da55f2be362171f226a06a3a820e6..f63e89088443352f379fcab437ee67b9a65824cb 100644 (file)
@@ -18,7 +18,7 @@
 #ifndef _MUTT_LUA_H
 #define _MUTT_LUA_H 1
 
-#include "mutt.h"
+struct Buffer;
 
 int mutt_lua_parse(struct Buffer *tmp, struct Buffer *s, unsigned long data, struct Buffer *err);
 int mutt_lua_source_file(struct Buffer *tmp, struct Buffer *s, unsigned long data, struct Buffer *err);
index b92d2c8415a78ea6a5e200afa4baf9123423d21b..ec14acfd4e8cea8a7d5a36d0daa4c90c310fc951 100644 (file)
@@ -22,9 +22,9 @@
 #ifndef _MUTT_MENU_H
 #define _MUTT_MENU_H 1
 
-#include "keymap.h"
-#include "mutt_curses.h"
-#include "mutt_regex.h"
+#include <regex.h>
+#include <stdbool.h>
+#include <stdio.h>
 
 #define REDRAW_INDEX          (1 << 0)
 #define REDRAW_MOTION         (1 << 1)
@@ -136,6 +136,4 @@ int mutt_menu_loop(struct Menu *menu);
 void index_make_entry(char *s, size_t l, struct Menu *menu, int num);
 int index_color(int index_no);
 
-bool mutt_limit_current_thread(struct Header *h);
-
 #endif /* _MUTT_MENU_H */
index 0b0f101168fafdcd0a16baf4e541e6a7425eb0e9..3cfaf5aa30d961b59547c675c5e75cbeb002f85e 100644 (file)
 
 #include "config.h"
 #include <ctype.h>
-#include <dirent.h>
 #include <errno.h>
-#include <fcntl.h>
+#include <limits.h>
 #include <notmuch.h>
 #include <stdbool.h>
-#include <stdlib.h>
+#include <stdio.h>
 #include <string.h>
-#include <sys/file.h>
 #include <sys/stat.h>
+#include <sys/sysmacros.h>
+#include <time.h>
 #include <unistd.h>
-#include <utime.h>
 #include "mutt.h"
 #include "mutt_notmuch.h"
+#include "body.h"
 #include "buffy.h"
-#include "copy.h"
-#include "keymap.h"
+#include "context.h"
+#include "envelope.h"
+#include "globals.h"
+#include "hash.h"
+#include "header.h"
+#include "lib.h"
 #include "mailbox.h"
 #include "mutt_curses.h"
 #include "mx.h"
-#include "rfc2047.h"
-#include "sort.h"
+#include "protos.h"
+#include "thread.h"
 #include "url.h"
 
 #ifdef LIBNOTMUCH_CHECK_VERSION
index 4fd09ee46655e805756856ffc33783a7842b9f76..ef755078bccf459fd8e218b142252b2577573649 100644 (file)
 #ifndef _MUTT_NOTMUCH_H
 #define _MUTT_NOTMUCH_H 1
 
+#include <stddef.h>
 #include <stdbool.h>
+#include "mx.h"
+
+struct Context;
+struct Header;
 
 int nm_read_entire_thread(struct Context *ctx, struct Header *h);
 
index 8fccb21fbffd527b38b162b8e61955cd18e0b689..0c4399909b49656cdcdbae76a6b4020699948d19 100644 (file)
@@ -18,7 +18,9 @@
 #ifndef _MUTT_OPTIONS_H
 #define _MUTT_OPTIONS_H 1
 
-#include "mutt.h"
+#include <stddef.h>
+
+struct Buffer;
 
 #define DT_MASK      0x0f
 #define DT_BOOL      1    /* boolean option */
index 08b779bd3c4e7617bc2cf26267fd311b263e7972..1ffb4e99495f3ded25f9d9145a816640af53658a 100644 (file)
@@ -23,6 +23,7 @@
 #define _MUTT_REGEX_H 1
 
 #include <regex.h>
+#include "where.h"
 
 /* this is a non-standard option supported by Solaris 2.5.x which allows
  * patterns of the form \<...\>
@@ -41,6 +42,20 @@ struct Regex
   int not;       /* do not match */
 };
 
+struct RxList
+{
+  struct Regex *rx;
+  struct RxList *next;
+};
+
+struct ReplaceList
+{
+  struct Regex *rx;
+  int nmatch;
+  char *template;
+  struct ReplaceList *next;
+};
+
 WHERE struct Regex Mask;
 WHERE struct Regex QuoteRegexp;
 WHERE struct Regex ReplyRegexp;
index a0df246865caac296d2b5766eb712b1db43b0157..2a3fc9ab4270b30d31ac337f6b6de9d1e1baa503 100644 (file)
 #include "config.h"
 #include <errno.h>
 #include <netdb.h>
-#include <netinet/in.h>
 #include <sasl/sasl.h>
+#include <stdio.h>
+#include <string.h>
 #include <sys/socket.h>
-#include "mutt.h"
 #include "mutt_sasl.h"
 #include "account.h"
+#include "lib.h"
 #include "mutt_socket.h"
+#include "options.h"
+#include "protos.h"
 
 static int getnameinfo_err(int ret)
 {
index 2afc8974448b178f7141574ce6c0b3b7c3bcf27e..6230ebff17f8919aac5a8eae28a74b004f8cb1e2 100644 (file)
 #ifndef _MUTT_SASL_H
 #define _MUTT_SASL_H 1
 
+#include <stddef.h>
 #include <sasl/sasl.h>
 
-#include "mutt_socket.h"
+typedef struct sasl_conn sasl_conn_t;
+typedef struct sasl_interact  sasl_interact_t;
+typedef unsigned sasl_ssf_t;
+struct Connection;
 
 int mutt_sasl_client_new(struct Connection *conn, sasl_conn_t **saslconn);
 int mutt_sasl_interact(sasl_interact_t *interaction);
index 41ff5aa01358e0dd93022bf30797f8056b4cf8ef..ec12a4b24bf70641a549266c8d6c632ef6c043cb 100644 (file)
  */
 
 #include "config.h"
-#include "mutt.h"
+#include <stdio.h>
 #include "mutt_sasl_plain.h"
+#include "lib.h"
+#include "protos.h"
 
 size_t mutt_sasl_plain_msg(char *buf, size_t buflen, const char *cmd,
                            const char *authz, const char *user, const char *pass)
index d60858aab245c463655d4a694c55702955282ef7..dbdd323f019d529d2959a9b61544b9e457b44858 100644 (file)
 #include "config.h"
 #include <errno.h>
 #include <fcntl.h>
+#include <idna.h>
 #include <netdb.h>
 #include <netinet/in.h>
-#include <stdlib.h>
+#include <stdio.h>
 #include <string.h>
 #include <sys/select.h>
 #include <sys/socket.h>
-#include <sys/time.h>
-#include <sys/types.h>
 #include <unistd.h>
-#include "mutt.h"
 #include "mutt_socket.h"
-#include "mutt_idna.h"
+#include "globals.h"
 #include "mutt_tunnel.h"
+#include "options.h"
+#include "protos.h"
+#include "url.h"
 #ifdef USE_SSL
 #include "mutt_ssl.h"
 #endif
index d603d8bf9071782c262b979f36bf3695137ebda8..6d18e4e6a8791672e91064a43fccc8cd68c3b7b0 100644 (file)
@@ -19,6 +19,7 @@
 #ifndef _MUTT_SOCKET_H
 #define _MUTT_SOCKET_H 1
 
+#include <stddef.h>
 #include "account.h"
 #include "lib.h"
 
index bc81499b92577e16b53081df55d32915ebf32057..bd9ae02967f8c17df581392de9ab7a5ed723546d 100644 (file)
  */
 
 #include "config.h"
+#include <errno.h>
+#include <idna.h>
+#include <limits.h>
+#include <openssl/asn1.h>
+#include <openssl/bio.h>
 #include <openssl/err.h>
 #include <openssl/evp.h>
+#include <openssl/obj_mac.h>
+#include <openssl/ossl_typ.h>
+#include <openssl/pem.h>
 #include <openssl/rand.h>
 #include <openssl/ssl.h>
+#include <openssl/ssl3.h>
 #include <openssl/x509.h>
 #include <openssl/x509_vfy.h>
 #include <openssl/x509v3.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
 #include "mutt.h"
 #include "mutt_ssl.h"
-#include "mutt_curses.h"
-#include "mutt_idna.h"
+#include "account.h"
+#include "globals.h"
+#include "keymap.h"
+#include "keymap_defs.h"
+#include "lib.h"
 #include "mutt_menu.h"
 #include "mutt_socket.h"
+#include "options.h"
+#include "protos.h"
 
 /* Just in case OpenSSL doesn't define DEVRANDOM */
 #ifndef DEVRANDOM
index b7fa549126a59571f2a9026396b4e3afc0df66aa..3a9eecf6d0c4ae7e3289cb71753468f84082ffdc 100644 (file)
@@ -18,9 +18,9 @@
 #ifndef _MUTT_SSL_H
 #define _MUTT_SSL_H 1
 
-#include "mutt_socket.h"
-
 #ifdef USE_SSL
+struct Connection;
+
 int mutt_ssl_starttls(struct Connection *conn);
 int mutt_ssl_socket_setup(struct Connection *conn);
 #endif
index 4f4462600ee58d5baac3b70fb3f49f57cb87bba1..5b11abae0a8cc9e3296ee297cbb6db8f9c1b79d7 100644 (file)
 #include "config.h"
 #include <gnutls/gnutls.h>
 #include <gnutls/x509.h>
+#include <regex.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <time.h>
 #include "mutt.h"
-#include "mutt_curses.h"
+#include "account.h"
+#include "globals.h"
+#include "keymap.h"
+#include "keymap_defs.h"
+#include "lib.h"
 #include "mutt_menu.h"
 #include "mutt_regex.h"
 #include "mutt_socket.h"
-#include "mutt_ssl.h"
+#include "options.h"
+#include "protos.h"
 
 /* certificate error bitmap values */
 #define CERTERR_VALID 0
index 47fd3f8275abea79a4621ec4638f6d0b8955bb64..77716283b038ca4db82cb9c8323ce4122a64e886 100644 (file)
 #include <errno.h>
 #include <fcntl.h>
 #include <netinet/in.h>
+#include <string.h>
 #include <sys/socket.h>
 #include <sys/types.h>
 #include <sys/wait.h>
+#include <unistd.h>
 #include "mutt.h"
 #include "mutt_tunnel.h"
+#include "account.h"
+#include "globals.h"
+#include "lib.h"
 #include "mutt_socket.h"
+#include "protos.h"
 
 /* -- data types -- */
 struct TunnelData
index a017e1cab0c075d17fbc224b233317d414f8ea51..bc1980dfef84e118b5b9e5bcc44f12df58d5c471 100644 (file)
@@ -16,7 +16,7 @@
 #ifndef _MUTT_TUNNEL_H
 #define _MUTT_TUNNEL_H 1
 
-#include "mutt_socket.h"
+struct Connection;
 
 int mutt_tunnel_socket_setup(struct Connection *conn);
 
index 797beba70e2824881af47c96178b0eaacadc3409..eaef0fbbb33f79687c47e89dbb98d4e035d971c8 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
  */
 
 #include "config.h"
+#include <stddef.h>
 #include <ctype.h>
 #include <errno.h>
-#include <fcntl.h>
+#include <inttypes.h>
+#include <libintl.h>
+#include <limits.h>
+#include <pwd.h>
+#include <regex.h>
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/wait.h>
 #include <time.h>
 #include <unistd.h>
 #include <utime.h>
+#include <wchar.h>
 #include "mutt.h"
+#include "address.h"
+#include "alias.h"
+#include "ascii.h"
+#include "body.h"
 #include "buffer.h"
+#include "charset.h"
+#include "envelope.h"
 #include "filter.h"
+#include "format_flags.h"
+#include "globals.h"
+#include "header.h"
+#include "lib.h"
+#include "list.h"
 #include "mailbox.h"
 #include "mime.h"
 #include "mutt_crypt.h"
 #include "mutt_curses.h"
+#include "mutt_regex.h"
 #include "mx.h"
+#include "options.h"
+#include "parameter.h"
+#include "protos.h"
+#include "rfc822.h"
+#include "state.h"
 #include "url.h"
 #ifdef USE_IMAP
 #include "imap/imap.h"
 #endif
-#ifdef USE_NOTMUCH
-#include "mutt_notmuch.h"
-#endif
 #ifdef HAVE_SYS_SYSCALL_H
 #include <sys/syscall.h>
 #endif
@@ -1102,13 +1124,13 @@ int mutt_check_overwrite(const char *attname, const char *path, char *fname,
         case 3: /* all */
           mutt_str_replace(directory, fname);
           break;
-        case 1:            /* yes */
+        case 1: /* yes */
           FREE(directory);
           break;
-        case -1:           /* abort */
+        case -1: /* abort */
           FREE(directory);
           return -1;
-        case 2:            /* no */
+        case 2: /* no */
           FREE(directory);
           return 1;
       }
diff --git a/mx.c b/mx.c
index c33cb04944d35bddf58c425d626df0dd2f91ca32..a60fdb250d8707df16e253766971859a79f6cd50 100644 (file)
--- a/mx.c
+++ b/mx.c
  */
 
 #include "config.h"
-#include <ctype.h>
-#include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <limits.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/file.h>
 #include <sys/stat.h>
+#include <time.h>
 #include <unistd.h>
 #include <utime.h>
 #include "mutt.h"
 #include "mx.h"
+#include "address.h"
+#include "ascii.h"
+#include "body.h"
 #include "buffy.h"
+#include "context.h"
 #include "copy.h"
+#include "envelope.h"
+#include "globals.h"
+#include "hash.h"
+#include "header.h"
 #include "keymap.h"
+#include "keymap_defs.h"
+#include "lib.h"
 #include "mailbox.h"
 #include "mutt_crypt.h"
-#include "rfc2047.h"
+#include "options.h"
+#include "pattern.h"
+#include "protos.h"
 #include "sort.h"
+#include "thread.h"
 #include "url.h"
 #ifdef USE_SIDEBAR
 #include "sidebar.h"
@@ -1051,10 +1064,6 @@ int mx_close_mailbox(struct Context *ctx, int *index_hint)
   return 0;
 }
 
-#ifdef USE_NOTMUCH
-#include "mutt_notmuch.h"
-#endif
-
 /* update a Context structure's internal tables. */
 void mx_update_tables(struct Context *ctx, int committing)
 {
diff --git a/mx.h b/mx.h
index a11c1da8c20b21effa12b7a952c5ff8fee2f4210..f2ea8e4c1c12dc209e1b6227fc9828a40c21c877 100644 (file)
--- a/mx.h
+++ b/mx.h
 #ifndef _MUTT_MX_H
 #define _MUTT_MX_H 1
 
-#include "buffy.h"
-#include "mailbox.h"
+#include <stdbool.h>
+#include <stdio.h>
+#include "where.h"
+#ifdef USE_HCACHE
+#include "hcache/hcache.h"
+#endif
+
+struct Header;
+struct Context;
+struct Message;
+struct stat;
+
+/*
+ * struct mx_ops - a structure to store operations on a mailbox
+ * The following operations are mandatory:
+ *  - open
+ *  - close
+ *  - check
+ *
+ * Optional operations
+ *  - open_new_msg
+ */
+struct mx_ops
+{
+  int (*open)(struct Context *ctx);
+  int (*open_append)(struct Context *ctx, int flags);
+  int (*close)(struct Context *ctx);
+  int (*check)(struct Context *ctx, int *index_hint);
+  int (*sync)(struct Context *ctx, int *index_hint);
+  int (*open_msg)(struct Context *ctx, struct Message *msg, int msgno);
+  int (*close_msg)(struct Context *ctx, struct Message *msg);
+  int (*commit_msg)(struct Context *ctx, struct Message *msg);
+  int (*open_new_msg)(struct Message *msg, struct Context *ctx, struct Header *hdr);
+};
 
 /* supported mailbox formats */
 enum
@@ -60,7 +92,6 @@ bool maildir_update_flags(struct Context *ctx, struct Header *o, struct Header *
 void maildir_flags(char *dest, size_t destlen, struct Header *hdr);
 
 #ifdef USE_HCACHE
-#include "hcache/hcache.h"
 int mh_sync_mailbox_message(struct Context *ctx, int msgno, header_cache_t *hc);
 #else
 int mh_sync_mailbox_message(struct Context *ctx, int msgno);
diff --git a/myvar.h b/myvar.h
index 911c853777d7fba926225bb75ec0272d5874850b..6d602341bf01ceecf1fdfdcd39e3cc3ba2f801fb 100644 (file)
--- a/myvar.h
+++ b/myvar.h
@@ -16,7 +16,7 @@
 #ifndef _MUTT_MYVAR_H
 #define _MUTT_MYVAR_H 1
 
-#include <sys/types.h>
+#include <stddef.h>
 
 const char *myvar_get(const char *var);
 int var_to_string(int idx, char *val, size_t len);
index b4a2e4cc89f93217a977a78aef482314b5e6123c..e63c53bd61172a8b44bf4aac3780feccb99fdb2e 100644 (file)
--- a/newsrc.c
+++ b/newsrc.c
  */
 
 #include "config.h"
-#include <ctype.h>
 #include <dirent.h>
 #include <errno.h>
-#include <stdlib.h>
+#include <limits.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <string.h>
 #include <sys/stat.h>
-#include <sys/types.h>
+#include <time.h>
 #include <unistd.h>
 #include "mutt.h"
+#include "account.h"
 #include "bcache.h"
-#include "mailbox.h"
-#include "mime.h"
+#include "context.h"
+#include "format_flags.h"
+#include "globals.h"
+#include "hash.h"
+#include "header.h"
+#include "lib.h"
 #include "mutt_curses.h"
+#include "mutt_socket.h"
 #include "mx.h"
 #include "nntp.h"
-#include "rfc1524.h"
-#include "rfc2047.h"
-#include "rfc822.h"
+#include "options.h"
+#include "protos.h"
 #include "sort.h"
+#include "url.h"
 #ifdef USE_HCACHE
 #include "hcache/hcache.h"
 #endif
 
+struct BodyCache;
+
 /* Find NntpData for given newsgroup or add it */
 static struct NntpData *nntp_data_find(struct NntpServer *nserv, const char *group)
 {
diff --git a/nntp.c b/nntp.c
index f6a79da3bcd366f71a0ac092b10696dbce70c084..dd116a2ceded073854534e6ccd3f2a229859429c 100644 (file)
--- a/nntp.c
+++ b/nntp.c
 
 #include "config.h"
 #include <ctype.h>
-#include <stdlib.h>
+#include <limits.h>
 #include <string.h>
 #include <unistd.h>
 #include "mutt.h"
 #include "nntp.h"
+#include "account.h"
+#include "bcache.h"
+#include "body.h"
+#include "context.h"
+#include "envelope.h"
+#include "globals.h"
+#include "hash.h"
+#include "header.h"
+#include "lib.h"
 #include "mailbox.h"
-#include "mime.h"
 #include "mutt_crypt.h"
 #include "mutt_curses.h"
+#include "mutt_socket.h"
 #include "mx.h"
-#include "rfc1524.h"
-#include "rfc2047.h"
-#include "sort.h"
+#include "options.h"
+#include "protos.h"
+#include "thread.h"
+#include "url.h"
 #ifdef USE_SSL
 #include "mutt_ssl.h"
 #endif
diff --git a/nntp.h b/nntp.h
index d5715486f3d405d97f710cd3d720542b3bb3892d..63deab7f2e6a7b8f5cd7efdbe0c659da67a4627d 100644 (file)
--- a/nntp.h
+++ b/nntp.h
 #ifndef _MUTT_NNTP_H
 #define _MUTT_NNTP_H 1
 
+#include <stdbool.h>
 #include <stdint.h>
+#include <stdio.h>
 #include <sys/types.h>
 #include <time.h>
-#include "bcache.h"
-#include "mailbox.h"
-#include "mutt_socket.h"
+#include "format_flags.h"
+#include "where.h"
+#include "mx.h"
 #ifdef USE_HCACHE
 #include "hcache/hcache.h"
 #endif
 
+struct Account;
+struct Header;
+struct Context;
+
 #define NNTP_PORT 119
 #define NNTP_SSL_PORT 563
 
diff --git a/options.h b/options.h
new file mode 100644 (file)
index 0000000..cff3bb6
--- /dev/null
+++ b/options.h
@@ -0,0 +1,292 @@
+/**
+ * Copyright (C) 2017 Richard Russon <rich@flatcap.org>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _MUTT_OPTIONS_H_
+#define _MUTT_OPTIONS_H_ 1
+
+/* boolean vars */
+enum
+{
+  OPTALLOW8BIT,
+  OPTALLOWANSI,
+  OPTARROWCURSOR,
+  OPTASCIICHARS,
+  OPTASKBCC,
+  OPTASKCC,
+  OPTASKFOLLOWUP,
+  OPTASKXCOMMENTTO,
+  OPTATTACHSPLIT,
+  OPTAUTOEDIT,
+  OPTAUTOTAG,
+  OPTBEEP,
+  OPTBEEPNEW,
+  OPTBOUNCEDELIVERED,
+  OPTBRAILLEFRIENDLY,
+  OPTCHECKMBOXSIZE,
+  OPTCHECKNEW,
+  OPTCOLLAPSEALL,
+  OPTCOLLAPSEUNREAD,
+  OPTCONFIRMAPPEND,
+  OPTCONFIRMCREATE,
+  OPTDELETEUNTAG,
+  OPTDIGESTCOLLAPSE,
+  OPTDUPTHREADS,
+  OPTEDITHDRS,
+  OPTENCODEFROM,
+  OPTENVFROM,
+  OPTFASTREPLY,
+  OPTFCCCLEAR,
+  OPTFLAGSAFE,
+  OPTFOLLOWUPTO,
+  OPTFORCENAME,
+  OPTFORWDECODE,
+  OPTFORWQUOTE,
+  OPTFORWREF,
+#ifdef USE_HCACHE
+  OPTHCACHEVERIFY,
+#if defined(HAVE_QDBM) || defined(HAVE_TC) || defined(HAVE_KC)
+  OPTHCACHECOMPRESS,
+#endif /* HAVE_QDBM */
+#endif
+  OPTHDRS,
+  OPTHEADER,
+  OPTHEADERCOLORPARTIAL,
+  OPTHELP,
+  OPTHIDDENHOST,
+  OPTHIDELIMITED,
+  OPTHIDEMISSING,
+  OPTHIDETHREADSUBJECT,
+  OPTHIDETOPLIMITED,
+  OPTHIDETOPMISSING,
+  OPTHONORDISP,
+  OPTIGNORELWS,
+  OPTIGNORELISTREPLYTO,
+#ifdef USE_IMAP
+  OPTIMAPCHECKSUBSCRIBED,
+  OPTIMAPIDLE,
+  OPTIMAPLSUB,
+  OPTIMAPPASSIVE,
+  OPTIMAPPEEK,
+  OPTIMAPSERVERNOISE,
+#endif
+#ifdef USE_SSL
+#ifndef USE_SSL_GNUTLS
+  OPTSSLSYSTEMCERTS,
+  OPTSSLV2,
+#endif /* USE_SSL_GNUTLS */
+  OPTSSLV3,
+  OPTTLSV1,
+  OPTTLSV1_1,
+  OPTTLSV1_2,
+  OPTSSLFORCETLS,
+  OPTSSLVERIFYDATES,
+  OPTSSLVERIFYHOST,
+#if defined(USE_SSL_OPENSSL) && defined(HAVE_SSL_PARTIAL_CHAIN)
+  OPTSSLVERIFYPARTIAL,
+#endif /* USE_SSL_OPENSSL */
+#endif /* defined(USE_SSL) */
+  OPTIMPLICITAUTOVIEW,
+  OPTINCLUDEONLYFIRST,
+  OPTKEEPFLAGGED,
+  OPTKEYWORDSLEGACY,
+  OPTKEYWORDSSTANDARD,
+  OPTMAILCAPSANITIZE,
+  OPTMAILCHECKRECENT,
+  OPTMAILCHECKSTATS,
+  OPTMAILDIRTRASH,
+  OPTMAILDIRCHECKCUR,
+  OPTMARKERS,
+  OPTMARKOLD,
+  OPTMENUSCROLL,  /* scroll menu instead of implicit next-page */
+  OPTMENUMOVEOFF, /* allow menu to scroll past last entry */
+#if defined(USE_IMAP) || defined(USE_POP)
+  OPTMESSAGECACHECLEAN,
+#endif
+  OPTMETAKEY, /* interpret ALT-x as ESC-x */
+  OPTMETOO,
+  OPTMHPURGE,
+  OPTMIMEFORWDECODE,
+#ifdef USE_NNTP
+  OPTMIMESUBJECT, /* encode subject line with RFC2047 */
+#endif
+  OPTNARROWTREE,
+  OPTPAGERSTOP,
+  OPTPIPEDECODE,
+  OPTPIPESPLIT,
+#ifdef USE_POP
+  OPTPOPAUTHTRYALL,
+  OPTPOPLAST,
+#endif
+  OPTPOSTPONEENCRYPT,
+  OPTPRINTDECODE,
+  OPTPRINTSPLIT,
+  OPTPROMPTAFTER,
+  OPTREADONLY,
+  OPTREFLOWSPACEQUOTES,
+  OPTREFLOWTEXT,
+  OPTREPLYSELF,
+  OPTREPLYWITHXORIG,
+  OPTRESOLVE,
+  OPTRESUMEDRAFTFILES,
+  OPTRESUMEEDITEDDRAFTFILES,
+  OPTREVALIAS,
+  OPTREVNAME,
+  OPTREVREAL,
+  OPTRFC2047PARAMS,
+  OPTSAVEADDRESS,
+  OPTSAVEEMPTY,
+  OPTSAVENAME,
+  OPTSCORE,
+#ifdef USE_SIDEBAR
+  OPTSIDEBAR,
+  OPTSIDEBARFOLDERINDENT,
+  OPTSIDEBARNEWMAILONLY,
+  OPTSIDEBARNEXTNEWWRAP,
+  OPTSIDEBARSHORTPATH,
+  OPTSIDEBARONRIGHT,
+#endif
+  OPTSIGDASHES,
+  OPTSIGONTOP,
+  OPTSORTRE,
+  OPTSPAMSEP,
+  OPTSTATUSONTOP,
+  OPTSTRICTTHREADS,
+  OPTSUSPEND,
+  OPTTEXTFLOWED,
+  OPTTHOROUGHSRC,
+  OPTTHREADRECEIVED,
+  OPTTILDE,
+  OPTTSENABLED,
+  OPTUNCOLLAPSEJUMP,
+  OPTUNCOLLAPSENEW,
+  OPTUSE8BITMIME,
+  OPTUSEDOMAIN,
+  OPTUSEFROM,
+  OPTUSEGPGAGENT,
+#ifdef HAVE_LIBIDN
+  OPTIDNDECODE,
+  OPTIDNENCODE,
+#endif
+#ifdef HAVE_GETADDRINFO
+  OPTUSEIPV6,
+#endif
+  OPTWAITKEY,
+  OPTWEED,
+  OPTWRAP,
+  OPTWRAPSEARCH,
+  OPTWRITEBCC, /* write out a bcc header? */
+  OPTXMAILER,
+
+  OPTCRYPTUSEGPGME,
+  OPTCRYPTUSEPKA,
+
+  /* PGP options */
+
+  OPTCRYPTAUTOSIGN,
+  OPTCRYPTAUTOENCRYPT,
+  OPTCRYPTAUTOPGP,
+  OPTCRYPTAUTOSMIME,
+  OPTCRYPTCONFIRMHOOK,
+  OPTCRYPTOPPORTUNISTICENCRYPT,
+  OPTCRYPTREPLYENCRYPT,
+  OPTCRYPTREPLYSIGN,
+  OPTCRYPTREPLYSIGNENCRYPTED,
+  OPTCRYPTTIMESTAMP,
+  OPTSMIMEISDEFAULT,
+  OPTASKCERTLABEL,
+  OPTSDEFAULTDECRYPTKEY,
+  OPTPGPIGNORESUB,
+  OPTPGPCHECKEXIT,
+  OPTPGPLONGIDS,
+  OPTPGPAUTODEC,
+  OPTPGPRETAINABLESIG,
+  OPTPGPSTRICTENC,
+  OPTFORWDECRYPT,
+  OPTPGPSHOWUNUSABLE,
+  OPTPGPAUTOINLINE,
+  OPTPGPREPLYINLINE,
+
+/* news options */
+
+#ifdef USE_NNTP
+  OPTSHOWNEWNEWS,
+  OPTSHOWONLYUNREAD,
+  OPTSAVEUNSUB,
+  OPTLISTGROUP,
+  OPTLOADDESC,
+  OPTXCOMMENTTO,
+#endif
+
+  /* pseudo options */
+
+  OPTAUXSORT,           /* (pseudo) using auxiliary sort function */
+  OPTFORCEREFRESH,      /* (pseudo) refresh even during macros */
+  OPTLOCALES,           /* (pseudo) set if user has valid locale definition */
+  OPTNOCURSES,          /* (pseudo) when sending in batch mode */
+  OPTSEARCHREVERSE,     /* (pseudo) used by ci_search_command */
+  OPTMSGERR,            /* (pseudo) used by mutt_error/mutt_message */
+  OPTSEARCHINVALID,     /* (pseudo) used to invalidate the search pat */
+  OPTSIGNALSBLOCKED,    /* (pseudo) using by mutt_block_signals () */
+  OPTSYSSIGNALSBLOCKED, /* (pseudo) using by mutt_block_signals_system () */
+  OPTNEEDRESORT,        /* (pseudo) used to force a re-sort */
+  OPTRESORTINIT,        /* (pseudo) used to force the next resort to be from scratch */
+  OPTVIEWATTACH,        /* (pseudo) signals that we are viewing attachments */
+  OPTSORTSUBTHREADS,    /* (pseudo) used when $sort_aux changes */
+  OPTNEEDRESCORE,       /* (pseudo) set when the `score' command is used */
+  OPTATTACHMSG,         /* (pseudo) used by attach-message */
+  OPTHIDEREAD,          /* (pseudo) whether or not hide read messages */
+  OPTKEEPQUIET,         /* (pseudo) shut up the message and refresh
+                         *          functions while we are executing an
+                         *          external program.
+                         */
+  OPTMENUCALLER,        /* (pseudo) tell menu to give caller a take */
+  OPTREDRAWTREE,        /* (pseudo) redraw the thread tree */
+  OPTPGPCHECKTRUST,     /* (pseudo) used by pgp_select_key () */
+  OPTDONTHANDLEPGPKEYS, /* (pseudo) used to extract PGP keys */
+  OPTIGNOREMACROEVENTS, /* (pseudo) don't process macro/push/exec events while set */
+
+#ifdef USE_NNTP
+  OPTNEWS,              /* (pseudo) used to change reader mode */
+  OPTNEWSSEND,          /* (pseudo) used to change behavior when posting */
+#endif
+#ifdef USE_NOTMUCH
+  OPTVIRTSPOOLFILE,
+  OPTNOTMUCHRECORD,
+#endif
+
+  OPTMAX
+};
+
+#define mutt_bit_alloc(n)     calloc((n + 7) / 8, sizeof(char))
+#define mutt_bit_set(v, n)    v[n / 8] |= (1 << (n % 8))
+#define mutt_bit_unset(v, n)  v[n / 8] &= ~(1 << (n % 8))
+#define mutt_bit_toggle(v, n) v[n / 8] ^= (1 << (n % 8))
+#define mutt_bit_isset(v, n)  (v[n / 8] & (1 << (n % 8)))
+
+/* bit vector for boolean variables */
+#ifdef MAIN_C
+unsigned char Options[(OPTMAX + 7) / 8];
+#else
+extern unsigned char Options[];
+#endif
+
+#define set_option(x) mutt_bit_set(Options, x)
+#define unset_option(x) mutt_bit_unset(Options, x)
+#define toggle_option(x) mutt_bit_toggle(Options, x)
+#define option(x) mutt_bit_isset(Options, x)
+
+#endif /* _MUTT_OPTIONS_H_ */
diff --git a/pager.c b/pager.c
index 30efceb52626fb2ed8c284ee0ddb37fe66cef456..0282a346cb4c7f9b3fcabcc51bdc6ea8f3c5bc65 100644 (file)
--- a/pager.c
+++ b/pager.c
  */
 
 #include "config.h"
+#include <stddef.h>
 #include <ctype.h>
 #include <errno.h>
-#include <stdlib.h>
+#include <inttypes.h>
+#include <libintl.h>
+#include <limits.h>
+#include <regex.h>
+#include <stdbool.h>
 #include <string.h>
 #include <sys/stat.h>
 #include <unistd.h>
+#include <wchar.h>
 #include "mutt.h"
 #include "pager.h"
+#include "alias.h"
 #include "attach.h"
+#include "body.h"
+#include "context.h"
+#include "envelope.h"
+#include "format_flags.h"
+#include "globals.h"
+#include "header.h"
 #include "keymap.h"
+#include "keymap_defs.h"
+#include "lib.h"
 #include "mailbox.h"
 #include "mapping.h"
 #include "mbyte.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
 #include "mutt_regex.h"
+#include "mx.h"
+#include "options.h"
+#include "pattern.h"
+#include "protos.h"
 #include "sort.h"
 #ifdef USE_SIDEBAR
 #include "sidebar.h"
 #endif
+#ifdef USE_NNTP
+#include "nntp.h"
+#endif
 
 #define ISHEADER(x) ((x) == MT_COLOR_HEADER || (x) == MT_COLOR_HDEFAULT)
 
@@ -1156,12 +1178,6 @@ static int fill_buffer(FILE *f, LOFF_T *last_pos, LOFF_T offset, unsigned char *
   return b_read;
 }
 
-#ifdef USE_NNTP
-#include "mx.h"
-#include "nntp.h"
-#endif
-
-
 static int format_line(struct line_t **lineInfo, int n, unsigned char *buf,
                        int flags, struct AnsiAttr *pa, int cnt, int *pspace, int *pvch,
                        int *pcol, int *pspecial, struct MuttWindow *pager_window)
diff --git a/pager.h b/pager.h
index cc59ef5d1b60fcba6d39b9d3365f36f70d78fcb7..81759c3ba80d2a267445f0ec3b1235750402271b 100644 (file)
--- a/pager.h
+++ b/pager.h
 #ifndef _MUTT_PAGER_H
 #define _MUTT_PAGER_H 1
 
-#include "attach.h"
+#include <stdio.h>
+
+struct Context;
+struct Menu;
 
 /* dynamic internal flags */
 #define MUTT_SHOWFLAT  (1 << 0)
diff --git a/parameter.h b/parameter.h
new file mode 100644 (file)
index 0000000..21b7856
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+ * Copyright (C) 2017 Richard Russon <rich@flatcap.org>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _MUTT_PARAMETER_H
+#define _MUTT_PARAMETER_H 1
+
+#include "lib.h"
+
+struct Parameter
+{
+  char *attribute;
+  char *value;
+  struct Parameter *next;
+};
+
+static inline struct Parameter *mutt_new_parameter(void)
+{
+  return safe_calloc(1, sizeof(struct Parameter));
+}
+
+#endif /* _MUTT_PARAMETER_H */
diff --git a/parse.c b/parse.c
index df9a2860b13f5de6d2c64612fe32ef001cbdfc1f..34594404712d8fc36a60d5c7eddedc7efb1fec82 100644 (file)
--- a/parse.c
+++ b/parse.c
 
 #include "config.h"
 #include <ctype.h>
+#include <regex.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/stat.h>
+#include <time.h>
 #include "mutt.h"
+#include "ascii.h"
+#include "body.h"
 #include "buffer.h"
+#include "charset.h"
+#include "envelope.h"
+#include "globals.h"
+#include "header.h"
+#include "lib.h"
+#include "list.h"
 #include "mailbox.h"
 #include "mime.h"
 #include "mutt_crypt.h"
 #include "mutt_regex.h"
+#include "options.h"
+#include "parameter.h"
+#include "protos.h"
 #include "rfc2047.h"
 #include "rfc2231.h"
+#include "rfc822.h"
 #include "url.h"
 
+struct Address;
+struct Context;
+
 /* Reads an arbitrarily long header field, and looks ahead for continuation
  * lines.  ``line'' must point to a dynamically allocated string; it is
  * increased if more space is required to fit the whole line.
index 9fe9c9eef4887dcb84868914d97758db576b9328..54f3833756f0167ffb4153a8c52e5c3dd498c6db 100644 (file)
--- a/pattern.c
+++ b/pattern.c
  */
 
 #include "config.h"
+#include <stddef.h>
 #include <ctype.h>
+#include <libintl.h>
+#include <limits.h>
+#include <regex.h>
 #include <stdarg.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
+#include <time.h>
 #include <unistd.h>
+#include <wchar.h>
+#include <wctype.h>
 #include "mutt.h"
+#include "pattern.h"
+#include "address.h"
+#include "ascii.h"
+#include "body.h"
+#include "buffer.h"
+#include "context.h"
 #include "copy.h"
+#include "envelope.h"
+#include "globals.h"
 #include "group.h"
-#include "keymap.h"
+#include "header.h"
+#include "keymap_defs.h"
+#include "lib.h"
+#include "list.h"
 #include "mailbox.h"
-#include "mapping.h"
 #include "mutt_crypt.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
+#include "mutt_regex.h"
+#include "options.h"
+#include "protos.h"
+#include "state.h"
+#include "thread.h"
 #ifdef USE_IMAP
 #include "imap/imap.h"
 #include "mx.h"
diff --git a/pattern.h b/pattern.h
new file mode 100644 (file)
index 0000000..aaaa2a2
--- /dev/null
+++ b/pattern.h
@@ -0,0 +1,91 @@
+/**
+ * Copyright (C) 2017 Richard Russon <rich@flatcap.org>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _MUTT_PATTERN_H
+#define _MUTT_PATTERN_H 1
+
+#include <regex.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include "lib.h"
+
+struct Address;
+struct Buffer;
+struct Header;
+struct Context;
+
+struct Pattern
+{
+  short op;
+  bool not : 1;
+  bool alladdr : 1;
+  bool stringmatch : 1;
+  bool groupmatch : 1;
+  bool ign_case : 1; /* ignore case for local stringmatch searches */
+  bool isalias : 1;
+  int min;
+  int max;
+  struct Pattern *next;
+  struct Pattern *child; /* arguments to logical op */
+  union {
+    regex_t *rx;
+    struct Group *g;
+    char *str;
+  } p;
+};
+
+typedef enum {
+  MUTT_MATCH_FULL_ADDRESS = 1
+} pattern_exec_flag;
+
+/* This is used when a message is repeatedly pattern matched against.
+ * e.g. for color, scoring, hooks.  It caches a few of the potentially slow
+ * operations.
+ * Each entry has a value of 0 = unset, 1 = false, 2 = true
+ */
+struct PatternCache
+{
+  int list_all;       /* ^~l */
+  int list_one;       /*  ~l */
+  int sub_all;        /* ^~u */
+  int sub_one;        /*  ~u */
+  int pers_recip_all; /* ^~p */
+  int pers_recip_one; /*  ~p */
+  int pers_from_all;  /* ^~P */
+  int pers_from_one;  /*  ~P */
+};
+
+static inline struct Pattern *new_pattern(void)
+{
+  return safe_calloc(1, sizeof(struct Pattern));
+}
+
+int mutt_pattern_exec(struct Pattern *pat, pattern_exec_flag flags,
+                      struct Context *ctx, struct Header *h, struct PatternCache *cache);
+struct Pattern *mutt_pattern_comp(/* const */ char *s, int flags, struct Buffer *err);
+void mutt_check_simple(char *s, size_t len, const char *simple);
+void mutt_pattern_free(struct Pattern **pat);
+
+int mutt_which_case(const char *s);
+int mutt_is_list_recipient(int alladdr, struct Address *a1, struct Address *a2);
+int mutt_is_list_cc(int alladdr, struct Address *a1, struct Address *a2);
+int mutt_pattern_func(int op, char *prompt);
+int mutt_search_command(int cur, int op);
+
+bool mutt_limit_current_thread(struct Header *h);
+
+#endif /* _MUTT_PATTERN_H */
diff --git a/pgp.c b/pgp.c
index 4c23a90deaed1390b485f46be0de0a9063fbeb98..02e0bc8e25807a7ef15ddf5e82c0778c9e2e4f77 100644 (file)
--- a/pgp.c
+++ b/pgp.c
  */
 
 #include "config.h"
-#include <ctype.h>
-#include <errno.h>
-#include <locale.h>
-#include <stdlib.h>
+#include <libintl.h>
+#include <limits.h>
+#include <regex.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <string.h>
-#include <sys/resource.h>
 #include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/wait.h>
+#include <time.h>
 #include <unistd.h>
 #include "mutt.h"
 #include "pgp.h"
-#include "copy.h"
+#include "address.h"
+#include "ascii.h"
+#include "body.h"
+#include "charset.h"
 #include "filter.h"
+#include "globals.h"
+#include "header.h"
+#include "lib.h"
+#include "list.h"
 #include "mime.h"
 #include "mutt_crypt.h"
 #include "mutt_curses.h"
-#include "mutt_menu.h"
-
+#include "mutt_regex.h"
+#include "options.h"
+#include "pgplib.h"
+#include "protos.h"
+#include "rfc822.h"
+#include "state.h"
 
 char PgpPass[LONG_STRING];
 time_t PgpExptime = 0; /* when does the cached passphrase expire? */
@@ -1280,8 +1290,7 @@ char *pgp_find_keys(struct Address *adrlist, int oppenc_mode)
     bypass_selection:
       keylist_size += mutt_strlen(keyID) + 4;
       safe_realloc(&keylist, keylist_size);
-      sprintf(keylist + keylist_used, "%s0x%s", keylist_used ? " " : "",
-              keyID);
+      sprintf(keylist + keylist_used, "%s0x%s", keylist_used ? " " : "", keyID);
       keylist_used = mutt_strlen(keylist);
 
       key_selected = 1;
diff --git a/pgp.h b/pgp.h
index edfb08a013cd41d91be606c71c294f8acfb1977e..99f1e60571befb0be24eeef0c45deed816a86fb3 100644 (file)
--- a/pgp.h
+++ b/pgp.h
 
 #ifdef CRYPT_BACKEND_CLASSIC_PGP
 
+#include <stdio.h>
+#include <stdbool.h>
+#include <unistd.h>
 #include "mutt_crypt.h"
-#include "pgplib.h"
 
-
-/* prototypes */
+struct Address;
+struct Body;
+struct Header;
+struct List;
+struct PgpKeyInfo;
+struct State;
 
 bool pgp_use_gpg_agent(void);
 
index 224fbe472e9141486ce43988dc1f3ee366be0697..b887fc6a5a9dd6f6a374bfb5c78dd019df28be3e 100644 (file)
 
 #include "config.h"
 #include <fcntl.h>
+#include <limits.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <time.h>
 #include <unistd.h>
-#include "mutt.h"
+#include "address.h"
 #include "filter.h"
+#include "format_flags.h"
+#include "globals.h"
+#include "lib.h"
+#include "list.h"
+#include "mutt_crypt.h"
 #include "mutt_curses.h"
 #include "mutt_idna.h"
 #include "pgp.h"
+#include "protos.h"
 #include "rfc822.h"
 
 /*
index a5e6fc88ef9c84564ffa67bb8c4575e2f752c289..965a2936f87f2753342fe30613bdb98199e86631 100644 (file)
--- a/pgpkey.c
+++ b/pgpkey.c
 
 #include "config.h"
 #include <ctype.h>
+#include <limits.h>
 #include <locale.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
-#include <sys/wait.h>
+#include <time.h>
 #include <unistd.h>
 #include "mutt.h"
+#include "address.h"
+#include "body.h"
 #include "filter.h"
+#include "format_flags.h"
+#include "globals.h"
+#include "keymap.h"
+#include "keymap_defs.h"
+#include "lib.h"
 #include "mime.h"
+#include "mutt_crypt.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
+#include "options.h"
 #include "pager.h"
 #include "pgp.h"
+#include "pgplib.h"
+#include "protos.h"
+#include "rfc822.h"
 #include "sort.h"
 
+struct List;
+
 struct pgp_cache
 {
   char *what;
index 14034e5a883ff49a47480048ebcd2e59ff4350e6..09230cd057c9f18482ab7ffaa086c2d6b257a800 100644 (file)
--- a/pgplib.c
+++ b/pgplib.c
 /* Generally useful, pgp-related functions. */
 
 #include "config.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-#include "mutt.h"
+#include <stdbool.h>
 #include "pgplib.h"
 #include "lib.h"
+#include "mutt_crypt.h"
 
 const char *pgp_pkalgbytype(unsigned char type)
 {
index cb29128b9b79bbbe89139f891a23e3c4d072f9ab..de82301193cc768df8af4b31ed6db5d2a7fc5624 100644 (file)
--- a/pgplib.h
+++ b/pgplib.h
@@ -21,8 +21,9 @@
 
 #ifdef CRYPT_BACKEND_CLASSIC_PGP
 
-#include "mutt_crypt.h"
-
+#include <stdbool.h>
+#include <time.h>
+#include "lib.h"
 
 struct PgpSignature
 {
index bc3c98665bc96948ba62ef455af9ee54a3397ab9..bda842c5bfbd0594d8ffc73597f6570f341163bb 100644 (file)
 
 #include "config.h"
 #include <ctype.h>
+#include <iconv.h>
+#include <limits.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 #include "mutt.h"
-#include "charset.h"
-#include "pgp.h"
+#include "lib.h"
 #include "pgppacket.h"
+#include "protos.h"
+#include "state.h"
 
 static const struct
 {
index 64bd6ae74736b956f5fce89b3c936bb0c1b5a5a0..c64ba2c67149cde6607c2e5fb22bedfadf6b0760 100644 (file)
 #include "config.h"
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-/* yuck, we were including this one somewhere below. */
-#include "mutt.h"
 #include "lib.h"
-#include "pgppacket.h"
 
 #define CHUNKSIZE 1024
 
index 967a46982a8fbc146dd9539b4567ce56bbe7feb0..1ee77c6f3a2f83e2b081d09afd1b40b69524988a 100644 (file)
@@ -23,6 +23,8 @@
 #ifndef _MUTT_PGPPACKET_H
 #define _MUTT_PGPPACKET_H 1
 
+#include <stdio.h>
+
 enum packet_tags
 {
   PT_RES0 = 0,   /* reserved */
index 00990561274acec1e522c2b8acbce22fcf0313e4..c295b45919806a224b12cef45665497c7263159b 100644 (file)
@@ -31,7 +31,8 @@
  */
 
 #include "config.h"
-#include <errno.h>
+#include <limits.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -39,6 +40,7 @@
 #include <unistd.h>
 #include "lib.h"
 #include "md5.h"
+#include "mutt_crypt.h"
 #include "pgplib.h"
 #include "pgppacket.h"
 #include "sha1.h"
diff --git a/pop.c b/pop.c
index 95d4209cc1be6f3ba8567f9b4f1355526a98cdfd..188114606d1f09aa54bd85830afc2f401e5355ac 100644 (file)
--- a/pop.c
+++ b/pop.c
 
 #include "config.h"
 #include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 #include "mutt.h"
 #include "pop.h"
+#include "account.h"
 #include "bcache.h"
+#include "body.h"
+#include "context.h"
+#include "envelope.h"
+#include "globals.h"
+#include "hash.h"
+#include "header.h"
+#include "lib.h"
+#include "mailbox.h"
 #include "mutt_crypt.h"
 #include "mutt_curses.h"
+#include "mutt_socket.h"
 #include "mx.h"
+#include "options.h"
+#include "protos.h"
+#include "url.h"
 #ifdef USE_HCACHE
 #include "hcache/hcache.h"
 #endif
diff --git a/pop.h b/pop.h
index 876d95b4f8de6927aafa415055899eb4141513b1..d25235a21cbba72e1c3adf1aa77ac1719feda1f5 100644 (file)
--- a/pop.h
+++ b/pop.h
 #ifndef _MUTT_POP_H
 #define _MUTT_POP_H 1
 
-#include "bcache.h"
-#include "mailbox.h"
-#include "mutt_curses.h"
-#include "mutt_socket.h"
+#include <stdbool.h>
+#include <time.h>
+#include "mx.h"
+
+struct Account;
+struct Context;
+struct Progress;
 
 #define POP_PORT 110
 #define POP_SSL_PORT 995
index 71e549874cd03d9516433217dd5ee8fb3b0dec3e..afe8902bc2267f906e72910ee80bdb6a28406f29 100644 (file)
  */
 
 #include "config.h"
+#include <stdbool.h>
+#include <stdio.h>
 #include <string.h>
-#include <unistd.h>
-#include "mutt.h"
+#include "account.h"
+#include "ascii.h"
+#include "globals.h"
+#include "lib.h"
 #include "md5.h"
-#include "mx.h"
+#include "mutt_socket.h"
+#include "options.h"
 #include "pop.h"
+#include "protos.h"
+#include "rfc822.h"
 #ifdef USE_SASL
 #include <sasl/sasl.h>
 #include <sasl/saslutil.h>
index 0fc6b2dabebb66e0d765e2036ea07a57aabf8d1f..cbd9044fb0f4d22ecf0adfbb766eb1bdbc6d99a0 100644 (file)
--- a/pop_lib.c
+++ b/pop_lib.c
  */
 
 #include "config.h"
-#include <ctype.h>
 #include <errno.h>
 #include <netdb.h>
 #include <netinet/in.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 #include "mutt.h"
-#include "mx.h"
+#include "account.h"
+#include "ascii.h"
+#include "context.h"
+#include "globals.h"
+#include "header.h"
+#include "lib.h"
+#include "mutt_curses.h"
+#include "mutt_socket.h"
+#include "options.h"
 #include "pop.h"
+#include "protos.h"
 #include "url.h"
 #ifdef USE_SSL
 #include "mutt_ssl.h"
index bbb05128d8d523b67971e98a8f9d4778c8f0ffc1..3f58a4f9cbe05d091779b2621f0dfce1f82ae391 100644 (file)
  */
 
 #include "config.h"
-#include <ctype.h>
+#include <limits.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <string.h>
 #include <sys/stat.h>
+#include <time.h>
 #include <unistd.h>
 #include "mutt.h"
+#include "ascii.h"
+#include "body.h"
+#include "context.h"
+#include "envelope.h"
+#include "format_flags.h"
+#include "globals.h"
+#include "hash.h"
+#include "header.h"
+#include "keymap.h"
+#include "keymap_defs.h"
+#include "lib.h"
+#include "list.h"
 #include "mailbox.h"
 #include "mapping.h"
 #include "mime.h"
 #include "mutt_crypt.h"
 #include "mutt_menu.h"
+#include "options.h"
+#include "protos.h"
 #include "sort.h"
+#include "state.h"
+#include "thread.h"
 #ifdef USE_IMAP
 #include "imap/imap.h"
 #endif
index 01784b0c62527f5fe36ac1d402d0ebd0fb5532a4..0f6144b508eabb741e8b4f7bfd3922dde5ee2ada 100644 (file)
--- a/protos.h
+++ b/protos.h
 #ifndef _MUTT_PROTOS_H
 #define _MUTT_PROTOS_H 1
 
-#include <inttypes.h>
-#include "mbyte.h"
+#include <stddef.h>
+#include <ctype.h>
+#include <iconv.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <time.h>
+#include <wctype.h>
+#include "format_flags.h"
+#include "options.h"
+
+struct Address;
+struct Alias;
+struct Body;
+struct Buffer;
+struct Context;
+struct EnterState;
+struct Envelope;
+struct Header;
+struct List;
+struct Parameter;
+struct Regex;
+struct ReplaceList;
+struct RxList;
+struct State;
+
+struct stat;
+struct passwd;
 
 #define MoreArgs(p) (*p->dptr && *p->dptr != ';' && *p->dptr != '#')
 
@@ -45,34 +71,8 @@ void mutt_make_string_info(char *dst, size_t dstlen, int cols, const char *s,
 
 void mutt_free_opts(void);
 
-#define mutt_system(x) _mutt_system(x, 0)
 int _mutt_system(const char *cmd, int flags);
-
-#define mutt_next_thread(x) _mutt_aside_thread(x, 1, 0)
-#define mutt_previous_thread(x) _mutt_aside_thread(x, 0, 0)
-#define mutt_next_subthread(x) _mutt_aside_thread(x, 1, 1)
-#define mutt_previous_subthread(x) _mutt_aside_thread(x, 0, 1)
-int _mutt_aside_thread(struct Header *hdr, short dir, short subthreads);
-
-#define mutt_collapse_thread(x, y) _mutt_traverse_thread(x, y, MUTT_THREAD_COLLAPSE)
-#define mutt_uncollapse_thread(x, y) _mutt_traverse_thread(x, y, MUTT_THREAD_UNCOLLAPSE)
-#define mutt_get_hidden(x, y) _mutt_traverse_thread(x, y, MUTT_THREAD_GET_HIDDEN)
-#define mutt_thread_contains_unread(x, y) _mutt_traverse_thread(x, y, MUTT_THREAD_UNREAD)
-#define mutt_thread_next_unread(x, y) _mutt_traverse_thread(x, y, MUTT_THREAD_NEXT_UNREAD)
-int _mutt_traverse_thread(struct Context *ctx, struct Header *cur, int flag);
-
-typedef const char *format_t(char *, size_t, size_t, int, char, const char *,
-                             const char *, const char *, const char *,
-                             unsigned long, format_flag);
-
-void mutt_FormatString(char *dest,         /* output buffer */
-                       size_t destlen,     /* output buffer len */
-                       size_t col,         /* starting column (nonzero when called recursively) */
-                       int cols,           /* maximum columns */
-                       const char *src,    /* template string */
-                       format_t *callback, /* callback for processing */
-                       unsigned long data, /* callback data */
-                       format_flag flags); /* callback flags */
+#define mutt_system(x) _mutt_system(x, 0)
 
 void mutt_parse_content_type(char *s, struct Body *ct);
 void mutt_generate_boundary(struct Parameter **parm);
@@ -93,11 +93,8 @@ int quadoption(int opt);
 char *mutt_extract_message_id(const char *s, const char **saveptr);
 
 struct Address *mutt_default_from(void);
-struct Address *mutt_get_address(struct Envelope *env, char **pfxp);
-struct Address *mutt_lookup_alias(const char *s);
 struct Address *mutt_remove_duplicates(struct Address *addr);
 struct Address *mutt_remove_xrefs(struct Address *a, struct Address *b);
-struct Address *mutt_expand_aliases(struct Address *a);
 struct Address *mutt_parse_adrlist(struct Address *p, const char *s);
 
 struct Body *mutt_make_file_attach(const char *path);
@@ -111,8 +108,6 @@ struct Body *mutt_read_mime_header(FILE *fp, int digest);
 
 struct Content *mutt_get_content_info(const char *fname, struct Body *b);
 
-struct Hash *mutt_make_id_hash(struct Context *ctx);
-
 char *mutt_read_rfc822_line(FILE *f, char *line, size_t *linelen);
 struct Envelope *mutt_read_rfc822_header(FILE *f, struct Header *hdr, short user_hdrs, short weed);
 
@@ -137,7 +132,6 @@ char *_mutt_expand_path(char *s, size_t slen, int rx);
 char *mutt_find_hook(int type, const char *pat);
 char *mutt_gecos_name(char *dest, size_t destlen, struct passwd *pw);
 char *mutt_get_body_charset(char *d, size_t dlen, struct Body *b);
-const char *mutt_get_name(struct Address *a);
 char *mutt_get_parameter(const char *s, struct Parameter *p);
 struct List *mutt_crypt_hook(struct Address *adr);
 char *mutt_make_date(char *s, size_t len);
@@ -149,8 +143,6 @@ const char *mutt_make_version(void);
 
 const char *mutt_fqdn(short may_hide_host);
 
-struct Group *mutt_pattern_group(const char *k);
-
 struct Regex *mutt_compile_regexp(const char *s, int flags);
 
 void mutt_account_hook(const char *url);
@@ -164,7 +156,6 @@ void mutt_block_signals(void);
 void mutt_block_signals_system(void);
 int mutt_body_handler(struct Body *b, struct State *s);
 int mutt_bounce_message(FILE *fp, struct Header *h, struct Address *to);
-void mutt_break_thread(struct Header *hdr);
 void mutt_buffy(char *s, size_t slen);
 int mutt_buffy_list(void);
 void mutt_canonical_charset(char *dest, size_t dlen, const char *name);
@@ -172,7 +163,6 @@ int mutt_count_body_parts(struct Context *ctx, struct Header *hdr);
 void mutt_check_rescore(struct Context *ctx);
 void mutt_clear_error(void);
 void mutt_clear_pager_position(void);
-void mutt_create_alias(struct Envelope *cur, struct Address *iadr);
 void mutt_decode_attachment(struct Body *b, struct State *s);
 void mutt_decode_base64(struct State *s, long len, int istext, iconv_t cd);
 void mutt_default_save(char *path, size_t pathlen, struct Header *hdr);
@@ -184,7 +174,6 @@ void mutt_edit_headers(const char *editor, const char *body, struct Header *msg,
                        char *fcc, size_t fcclen);
 char **mutt_envlist(void);
 void mutt_envlist_set(const char *name, const char *value, bool overwrite);
-int mutt_filter_unprintable(char **s);
 int mutt_label_message(struct Header *hdr);
 void mutt_make_label_hash(struct Context *ctx);
 void mutt_label_hash_add(struct Context *ctx, struct Header *hdr);
@@ -195,7 +184,6 @@ void mutt_curses_message(const char *fmt, ...);
 void mutt_encode_descriptions(struct Body *b, short recurse);
 void mutt_encode_path(char *dest, size_t dlen, const char *src);
 void mutt_enter_command(void);
-void mutt_expand_aliases_env(struct Envelope *env);
 void mutt_expand_file_fmt(char *dest, size_t destlen, const char *fmt, const char *src);
 void mutt_expand_fmt(char *dest, size_t destlen, const char *fmt, const char *src);
 void mutt_fix_reply_recipients(struct Envelope *env);
@@ -215,7 +203,6 @@ void mutt_free_header(struct Header **h);
 void mutt_free_parameter(struct Parameter **p);
 void mutt_free_regexp(struct Regex **pp);
 void mutt_help(int menu);
-void mutt_draw_tree(struct Context *ctx);
 void mutt_check_lookup_list(struct Body *b, char *type, int len);
 void mutt_make_attribution(struct Context *ctx, struct Header *cur, FILE *out);
 void mutt_make_forward_subject(struct Envelope *env, struct Context *ctx, struct Header *cur);
@@ -263,7 +250,6 @@ void mutt_update_encoding(struct Body *a);
 void mutt_version(void);
 void mutt_view_attachments(struct Header *hdr);
 void mutt_write_address_list(struct Address *adr, FILE *fp, int linelen, int display);
-void mutt_set_virtual(struct Context *ctx);
 int mutt_add_to_rx_list(struct RxList **list, const char *s, int flags, struct Buffer *err);
 bool mutt_addr_is_user(struct Address *addr);
 int mutt_addwch(wchar_t wc);
@@ -303,7 +289,6 @@ int mutt_fetch_recips(struct Envelope *out, struct Envelope *in, int flags);
 int mutt_chscmp(const char *s, const char *chs);
 #define mutt_is_utf8(a) mutt_chscmp(a, "utf-8")
 #define mutt_is_us_ascii(a) mutt_chscmp(a, "us-ascii")
-int mutt_parent_message(struct Context *ctx, struct Header *hdr, int find_root);
 int mutt_prepare_template(FILE *fp, struct Context *ctx, struct Header *newhdr, struct Header *hdr, short resend);
 int mutt_resend_message(FILE *fp, struct Context *ctx, struct Header *cur);
 int mutt_compose_to_sender(struct Header *hdr);
@@ -328,15 +313,11 @@ int mutt_invoke_sendmail(struct Address *from, struct Address *to, struct Addres
                          const char *msg, int eightbit);
 bool mutt_is_mail_list(struct Address *addr);
 bool mutt_is_message_type(int type, const char *subtype);
-int mutt_is_list_cc(int alladdr, struct Address *a1, struct Address *a2);
-int mutt_is_list_recipient(int alladdr, struct Address *a1, struct Address *a2);
 bool mutt_is_subscribed_list(struct Address *addr);
 bool mutt_is_text_part(struct Body *b);
-int mutt_link_threads(struct Header *cur, struct Header *last, struct Context *ctx);
 int mutt_lookup_mime_type(struct Body *att, const char *path);
 bool mutt_match_rx_list(const char *s, struct RxList *l);
 bool mutt_match_spam_list(const char *s, struct ReplaceList *l, char *text, int textsize);
-int mutt_messages_in_thread(struct Context *ctx, struct Header *hdr, int flag);
 int mutt_multi_choice(char *prompt, char *letters);
 bool mutt_needs_mailcap(struct Body *m);
 int mutt_num_postponed(int force);
@@ -356,7 +337,6 @@ int mutt_parse_rfc822_line(struct Envelope *e, struct Header *hdr, char *line, c
 int mutt_parse_score(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err);
 int mutt_parse_unscore(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err);
 int mutt_parse_unhook(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err);
-int mutt_pattern_func(int op, char *prompt);
 int mutt_pipe_attachment(FILE *fp, struct Body *b, const char *path, char *outfile);
 int mutt_print_attachment(FILE *fp, struct Body *a);
 int mutt_query_complete(char *buf, size_t buflen);
@@ -364,7 +344,6 @@ int mutt_query_variables(struct List *queries);
 int mutt_save_attachment(FILE *fp, struct Body *m, char *path, int flags, struct Header *hdr);
 int _mutt_save_message(struct Header *h, struct Context *ctx, int delete, int decode, int decrypt);
 int mutt_save_message(struct Header *h, int delete, int decode, int decrypt);
-int mutt_search_command(int cur, int op);
 #ifdef USE_SMTP
 int mutt_smtp_send(const struct Address *from, const struct Address *to, const struct Address *cc,
                    const struct Address *bcc, const char *msgfile, int eightbit);
@@ -376,7 +355,6 @@ int mutt_strwidth(const char *s);
 int mutt_compose_menu(struct Header *msg, char *fcc, size_t fcclen, struct Header *cur, int flags);
 int mutt_thread_set_flag(struct Header *hdr, int flag, int bf, int subthread);
 void mutt_update_num_postponed(void);
-int mutt_which_case(const char *s);
 int mutt_write_fcc(const char *path, struct Header *hdr, const char *msgid, int post,
                    char *fcc, char **finalpath);
 int mutt_write_multiple_fcc(const char *path, struct Header *hdr, const char *msgid,
@@ -420,17 +398,6 @@ int mutt_wctoutf8(char *s, unsigned int c, size_t buflen);
 #define IsWPrint(wc) (iswprint(wc) || (option(OPTLOCALES) ? 0 : (wc >= 0xa0)))
 #endif
 
-static inline struct Pattern *new_pattern(void)
-{
-  return safe_calloc(1, sizeof(struct Pattern));
-}
-
-int mutt_pattern_exec(struct Pattern *pat, pattern_exec_flag flags,
-                      struct Context *ctx, struct Header *h, struct PatternCache *cache);
-struct Pattern *mutt_pattern_comp(/* const */ char *s, int flags, struct Buffer *err);
-void mutt_check_simple(char *s, size_t len, const char *simple);
-void mutt_pattern_free(struct Pattern **pat);
-
 int getdnsdomainname(char *, size_t);
 
 /* unsorted */
diff --git a/query.c b/query.c
index 66c94aa0787edf4329acb4a0d2cc608d30b2e1b2..c71afa13c6d232d35f894c09d454f70dbb70a078 100644 (file)
--- a/query.c
+++ b/query.c
  */
 
 #include "config.h"
-#include <ctype.h>
-#include <stdlib.h>
+#include <libintl.h>
+#include <limits.h>
+#include <regex.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <string.h>
+#include <sys/types.h>
 #include "mutt.h"
+#include "address.h"
+#include "alias.h"
+#include "envelope.h"
 #include "filter.h"
+#include "format_flags.h"
+#include "globals.h"
+#include "header.h"
+#include "keymap.h"
+#include "keymap_defs.h"
+#include "lib.h"
 #include "mapping.h"
+#include "mutt_curses.h"
 #include "mutt_idna.h"
 #include "mutt_menu.h"
+#include "protos.h"
+#include "rfc822.h"
 
 struct Query
 {
index 781fb03bbad419f64def67f547b6937d1597f952..fd31fe8e6097653d8bbdc20682cab02aa4c121e7 100644 (file)
  */
 
 #include "config.h"
-#include <ctype.h>
-#include <errno.h>
-#include <stdlib.h>
+#include <libintl.h>
+#include <limits.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <string.h>
 #include <sys/stat.h>
-#include <sys/wait.h>
 #include <unistd.h>
 #include "mutt.h"
+#include "ascii.h"
 #include "attach.h"
+#include "body.h"
+#include "context.h"
+#include "envelope.h"
 #include "filter.h"
+#include "format_flags.h"
+#include "globals.h"
+#include "header.h"
+#include "keymap.h"
+#include "keymap_defs.h"
+#include "lib.h"
 #include "mailbox.h"
 #include "mapping.h"
 #include "mime.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
 #include "mx.h"
+#include "options.h"
+#include "protos.h"
 #include "rfc1524.h"
+#include "state.h"
 
 static const char *Mailbox_is_read_only = N_("Mailbox is read-only.");
 
index 3411971c7d32fccd900677b57f22eb9e605712ef..b4ff7cd8b5694788ef89cdf0137c86bb621ad1c2 100644 (file)
--- a/recvcmd.c
+++ b/recvcmd.c
  */
 
 #include "config.h"
+#include <limits.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
 #include "mutt.h"
+#include "alias.h"
 #include "attach.h"
+#include "body.h"
 #include "copy.h"
-#include "mapping.h"
+#include "envelope.h"
+#include "globals.h"
+#include "header.h"
+#include "lib.h"
 #include "mutt_curses.h"
 #include "mutt_idna.h"
-#include "mutt_menu.h"
+#include "options.h"
+#include "protos.h"
+#include "rfc822.h"
+#include "state.h"
 
 /* some helper functions to verify that we are exclusively operating
  * on message/rfc822 attachments
index c172d0bee3f07fac6612911d0ab84b5b98985eb6..c147931572c1bca73584dbeac84ab5400042cb65 100644 (file)
 
 #include "config.h"
 #include <fcntl.h>
+#include <limits.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
-#include <sys/file.h>
-#include <sys/types.h>
+#include <unistd.h>
 #include "mutt.h"
 #include "remailer.h"
+#include "address.h"
+#include "ascii.h"
+#include "envelope.h"
 #include "filter.h"
+#include "format_flags.h"
+#include "globals.h"
+#include "header.h"
+#include "keymap.h"
+#include "keymap_defs.h"
+#include "lib.h"
+#include "list.h"
 #include "mapping.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
-#include "mutt_regex.h"
+#include "options.h"
+#include "protos.h"
+#include "rfc822.h"
 
 struct coord
 {
index e627e179193b5dd109ba6152c558b06d0c7d4101..34fb263de856d247d9299e9ea662a4813e0c71b5 100644 (file)
 #ifndef _MUTT_REMAILER_H
 #define _MUTT_REMAILER_H 1
 
+#include <stddef.h>
+
+struct List;
+struct Header;
+
 #ifdef MIXMASTER
 
 #define MIX_CAP_COMPRESS  (1 << 0)
index 02c350abfe35307b04077c3edfd9e272534856f4..ff287d49230422f11739ee6772bea0a4e97e6a17 100644 (file)
--- a/resize.c
+++ b/resize.c
 
 #include "config.h"
 #include <fcntl.h>
+#include <stdbool.h>
 #include <stdlib.h>
-#include <termios.h>
 #include <unistd.h>
-#include "mutt.h"
+#include "lib.h"
 #include "mutt_curses.h"
 #ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
index c677c13928c58b18b479ee48c101b85c0a5d1b47..d2727e450249193fc47acf222c3a64304042d810 100644 (file)
--- a/rfc1524.c
+++ b/rfc1524.c
  */
 
 #include "config.h"
-#include <ctype.h>
-#include <errno.h>
-#include <stdlib.h>
+#include <limits.h>
+#include <stdio.h>
 #include <string.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
 #include <unistd.h>
 #include "mutt.h"
 #include "rfc1524.h"
+#include "ascii.h"
+#include "body.h"
+#include "globals.h"
+#include "lib.h"
+#include "options.h"
+#include "protos.h"
 
 /* The command semantics include the following:
  * %s is the filename that contains the mail body data
index 6e5fd7d660f315be5892b4363e7d15d589280921..6d4f586397272a9ecf0f739d0566063ea93dfda7 100644 (file)
--- a/rfc1524.h
+++ b/rfc1524.h
 #ifndef _MUTT_RFC1524_H
 #define _MUTT_RFC1524_H 1
 
+#include <stdbool.h>
+#include <stddef.h>
+
+struct Body;
+
 struct Rfc1524MailcapEntry
 {
   char *command;
index 2f3c386073608a88eb3476444c443d77ef0bec1d..f4986e17a5ec8bac7ee4224e4201f3900b073106 100644 (file)
--- a/rfc2047.c
+++ b/rfc2047.c
 #include "config.h"
 #include <ctype.h>
 #include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
+#include <iconv.h>
 #include <string.h>
-#include "mutt.h"
 #include "rfc2047.h"
+#include "address.h"
+#include "ascii.h"
 #include "charset.h"
+#include "globals.h"
+#include "lib.h"
+#include "mbyte.h"
 #include "mime.h"
+#include "options.h"
+#include "protos.h"
 
 /* If you are debugging this file, comment out the following line. */
 /* #define NDEBUG */
index 28152b6c42f3d1ba5ca8a4e01ccef5bf5522617d..4b122b2af532911747ec2bd461862ad677cea80e 100644 (file)
--- a/rfc2047.h
+++ b/rfc2047.h
 #ifndef _MUTT_RFC2047_H
 #define _MUTT_RFC2047_H 1
 
+#include <stddef.h>
+
+struct Address;
+
 char *mutt_choose_charset(const char *fromcode, const char *charsets, char *u,
                           size_t ulen, char **d, size_t *dlen);
 int convert_nonmime_string(char **ps);
index c934bcf0d89dc538dcfd0d4f90a7ab9ea4f8f52b..13cc3f54ec91b2ab66670ae033e04715b5350432 100644 (file)
--- a/rfc2231.c
+++ b/rfc2231.c
 
 #include "config.h"
 #include <ctype.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "mutt.h"
 #include "rfc2231.h"
 #include "charset.h"
+#include "globals.h"
+#include "lib.h"
+#include "mbyte.h"
 #include "mime.h"
+#include "options.h"
+#include "parameter.h"
+#include "protos.h"
 #include "rfc2047.h"
 
 struct rfc2231_parameter
index e9e3d4c66201717e2c92ea4f9b33efb9d0764889..353f84fb1d00bc71b9b86451459ec8769d1f9896 100644 (file)
--- a/rfc2231.h
+++ b/rfc2231.h
@@ -18,6 +18,8 @@
 #ifndef _MUTT_RFC2231_H
 #define _MUTT_RFC2231_H 1
 
+struct Parameter;
+
 void rfc2231_decode_parameters(struct Parameter **headp);
 int rfc2231_encode_string(char **pd);
 
index 9d9ed969a5d5e84ec45f30a3b53765735fc5f591..97a34259a4e6de746965cc60e0c4da23267b36d7 100644 (file)
--- a/rfc3676.c
+++ b/rfc3676.c
 /* This file was originally part of mutt-ng */
 
 #include "config.h"
-#include <ctype.h>
-#include <stdlib.h>
+#include <limits.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <string.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
 #include <unistd.h>
 #include "mutt.h"
 #include "ascii.h"
+#include "body.h"
+#include "globals.h"
+#include "header.h"
 #include "lib.h"
 #include "mutt_curses.h"
+#include "options.h"
+#include "protos.h"
+#include "state.h"
 
 #define FLOWED_MAX 72
 
index 8c57def8fddf66bb4498e46d4a632c82f2261309..0d473e6a3ee76b1ae73be2ea1923c532decc679d 100644 (file)
--- a/rfc3676.h
+++ b/rfc3676.h
@@ -22,7 +22,9 @@
 #ifndef _MUTT_RFC3676_H
 #define _MUTT_RFC3676_H 1
 
-#include "mutt.h"
+struct Body;
+struct Header;
+struct State;
 
 /* body handler implementing RfC 3676 for format=flowed */
 int rfc3676_handler(struct Body *a, struct State *s);
index b41a95279400312ee270cb75c966258e136941e9..37b60f6b96d869e052c14fda0aa2422044501965 100644 (file)
--- a/rfc822.c
+++ b/rfc822.c
  */
 
 #include "config.h"
-#include <stdlib.h>
+#include <stdio.h>
 #include <string.h>
+#include "rfc822.h"
+#include "ascii.h"
 
-#ifndef TESTING
-#include "mutt.h"
-#else
+#ifdef TESTING
 #define safe_strdup strdup
 #define safe_malloc malloc
 #define FREE(x) safe_free(x)
index 7a985a70ec4d3a1fe789de6130083cadcaf583f3..b648b836c25ec01864ce71bb398a0ee306318d7c 100644 (file)
--- a/rfc822.h
+++ b/rfc822.h
@@ -19,6 +19,9 @@
 #ifndef _MUTT_RFC822_H
 #define _MUTT_RFC822_H 1
 
+#include <stddef.h>
+#include <stdbool.h>
+#include "address.h"
 #include "lib.h"
 
 /* possible values for RFC822Error */
@@ -32,19 +35,6 @@ enum
   ERR_BAD_ADDR_SPEC
 };
 
-struct Address
-{
-#ifdef EXACT_ADDRESS
-  char *val;      /* value of address as parsed */
-#endif
-  char *personal; /* real name of address */
-  char *mailbox;  /* mailbox and host address */
-  int group;      /* group mailbox? */
-  struct Address *next;
-  bool is_intl : 1;
-  bool intl_checked : 1;
-};
-
 void rfc822_dequote_comment(char *s);
 void rfc822_free_address(struct Address **p);
 void rfc822_qualify(struct Address *addr, const char *host);
index c498f8b5360c275cf3c756ab3c9a208525d5d7d3..36c7cf8465abd0c8a5db302ee56845e580757aa1 100644 (file)
@@ -15,6 +15,7 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <stdarg.h>
 #include <stdio.h>
 #include "lib.h"
 
@@ -78,7 +79,7 @@ int safe_asprintf(char **strp, const char *fmt, ...)
       /* reduce space to just that which was used.  note that 'n' does not
        * include the terminal nul char.
        */
-      if (n == 0)   /* convention is to use NULL for zero-length strings. */
+      if (n == 0) /* convention is to use NULL for zero-length strings. */
         FREE(strp);
       else if (n != rlen - 1)
         safe_realloc(strp, n + 1);
diff --git a/score.c b/score.c
index 2d035f088df9c2ce8b6c4f6d67c43de139204f71..b56cfb12eed6bba7e71c418b6b5426c84a07e4f1 100644 (file)
--- a/score.c
+++ b/score.c
 #include <stdlib.h>
 #include <string.h>
 #include "mutt.h"
+#include "buffer.h"
+#include "context.h"
+#include "globals.h"
+#include "header.h"
+#include "keymap.h"
+#include "lib.h"
 #include "mutt_menu.h"
+#include "options.h"
+#include "pattern.h"
+#include "protos.h"
 #include "sort.h"
 
 struct Score
diff --git a/send.c b/send.c
index 0e02cf40cddf1347e3db0f7b2b072e0bda063521..1743eb0f7f4bd3337aef46d92e850c973f0fd7f3 100644 (file)
--- a/send.c
+++ b/send.c
 
 #include "config.h"
 #include <ctype.h>
-#include <dirent.h>
 #include <errno.h>
+#include <limits.h>
 #include <locale.h>
-#include <stdlib.h>
+#include <regex.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <string.h>
 #include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/wait.h>
 #include <time.h>
 #include <unistd.h>
-#include <utime.h>
 #include "mutt.h"
+#include "address.h"
+#include "alias.h"
+#include "ascii.h"
+#include "body.h"
+#include "context.h"
 #include "copy.h"
+#include "envelope.h"
 #include "filter.h"
-#include "keymap.h"
+#include "globals.h"
+#include "header.h"
+#include "lib.h"
+#include "list.h"
 #include "mailbox.h"
 #include "mime.h"
 #include "mutt_crypt.h"
 #include "mutt_curses.h"
 #include "mutt_idna.h"
+#include "mutt_regex.h"
+#include "options.h"
+#include "pattern.h"
+#include "protos.h"
 #include "rfc2047.h"
 #include "rfc3676.h"
+#include "rfc822.h"
+#include "sort.h"
 #include "url.h"
 #ifdef USE_NNTP
 #include "mx.h"
index 4e91ef42811bf6569e6078d47591bd1993352d0f..33bbec121af8b430d302fa3d95f6504f2899dbd2 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
 #define _SENDLIB_C 1
 
 #include "config.h"
+#include <stddef.h>
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <iconv.h>
+#include <inttypes.h>
+#include <limits.h>
 #include <signal.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
+#include <time.h>
 #include <unistd.h>
+#include <wchar.h>
 #include "mutt.h"
+#include "address.h"
+#include "ascii.h"
+#include "body.h"
 #include "buffy.h"
 #include "charset.h"
+#include "content.h"
+#include "context.h"
 #include "copy.h"
+#include "envelope.h"
+#include "format_flags.h"
+#include "globals.h"
+#include "header.h"
+#include "lib.h"
+#include "list.h"
 #include "mailbox.h"
 #include "mime.h"
 #include "mutt_crypt.h"
 #include "mutt_curses.h"
 #include "mutt_idna.h"
 #include "mx.h"
+#include "options.h"
 #include "pager.h"
+#include "parameter.h"
+#include "protos.h"
 #include "rfc2047.h"
 #include "rfc2231.h"
+#include "rfc822.h"
+#include "state.h"
 #ifdef USE_NNTP
 #include "nntp.h"
 #endif
diff --git a/sha1.h b/sha1.h
index 9f51a7120a5885d4dff50e0c0e5abdb94cf798ad..dcaeb12abc0a589deab44bc2408c6674cf922f66 100644 (file)
--- a/sha1.h
+++ b/sha1.h
@@ -8,7 +8,7 @@
 #ifndef _MUTT_SHA1_H
 #define _MUTT_SHA1_H 1
 
-#include <inttypes.h>
+#include <stdint.h>
 
 struct Sha1Ctx
 {
index d24fbd22de919971085ed1d8f4d159136a40f9c9..16047c72ff4136d282818b467b3fff2d268787e5 100644 (file)
--- a/sidebar.c
+++ b/sidebar.c
  */
 
 #include "config.h"
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include "mutt.h"
 #include "sidebar.h"
 #include "buffy.h"
-#include "keymap.h"
+#include "context.h"
+#include "format_flags.h"
+#include "globals.h"
+#include "keymap_defs.h"
+#include "lib.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
 #include "mx.h"
+#include "options.h"
+#include "protos.h"
 #include "sort.h"
 #ifdef USE_NOTMUCH
 #include "mutt_notmuch.h"
index 40d970ea04d893b17fd8b7fa7c350b6d79ad6420..fc3360dca99cbeb4327551d1357553476180decc 100644 (file)
--- a/sidebar.h
+++ b/sidebar.h
@@ -20,8 +20,8 @@
 #ifndef _MUTT_SIDEBAR_H
 #define _MUTT_SIDEBAR_H 1
 
-#include "mutt.h"
-#include "buffy.h"
+struct Context;
+struct Buffy;
 
 void mutt_sb_change_mailbox(int op);
 void mutt_sb_draw(void);
index fe8a09bfb08511632d73ef2bcde5be4c118f53b8..c7ff83ec5e86de2df0c027b5d87a7bbf85b3a92e 100644 (file)
--- a/signal.c
+++ b/signal.c
 #include "config.h"
 #include <errno.h>
 #include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
-#include <sys/wait.h>
-#include "mutt.h"
+#include "globals.h"
+#include "lib.h"
 #include "mutt_curses.h"
+#include "options.h"
 
 static sigset_t Sigset;
 static sigset_t SigsetSys;
@@ -35,7 +38,7 @@ static void exit_handler(int sig)
   curs_set(1);
   endwin(); /* just to be safe */
 
-  /*
+/*
    * if sys_siglist is not defined, HAVE_DECL_SYS_SIGLIST will be set to 0
    * so we must check it with #if and not #ifdef
    */
diff --git a/smime.c b/smime.c
index 56270263f636e6c8bd1ebeb516978aaac74bef56..9e242c4e3c8f14bcbe71b8d5062f8e8bcc81d978 100644 (file)
--- a/smime.c
+++ b/smime.c
  */
 
 #include "config.h"
-#include <ctype.h>
-#include <errno.h>
-#include <locale.h>
-#include <stdlib.h>
+#include <libintl.h>
+#include <limits.h>
+#include <stdbool.h>
+#include <stdio.h>
 #include <string.h>
 #include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/wait.h>
-#include <unistd.h>
+#include <time.h>
 #include "mutt.h"
 #include "smime.h"
+#include "address.h"
+#include "alias.h"
+#include "ascii.h"
+#include "body.h"
 #include "copy.h"
+#include "envelope.h"
 #include "filter.h"
+#include "format_flags.h"
+#include "globals.h"
+#include "header.h"
+#include "keymap.h"
+#include "keymap_defs.h"
+#include "lib.h"
 #include "mime.h"
 #include "mutt_crypt.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
+#include "options.h"
+#include "protos.h"
+#include "rfc822.h"
+#include "state.h"
 
 struct smime_command_context
 {
diff --git a/smime.h b/smime.h
index 0065c7f56648fc6ea9604b7640fa3ba0b54e4721..1ab132444f6f180033cd54883fbe22a6d1317d14 100644 (file)
--- a/smime.h
+++ b/smime.h
 
 #ifdef CRYPT_BACKEND_CLASSIC_SMIME
 
-#include "mutt_crypt.h"
+#include <stdio.h>
+
+struct Address;
+struct Body;
+struct Envelope;
+struct Header;
+struct State;
 
 struct SmimeKey
 {
diff --git a/smtp.c b/smtp.c
index 0842e3cc582d2b7da6c8e2be0755fd5174e170db..e0fccffe593f1682a0eead46d2751f0eacd775f2 100644 (file)
--- a/smtp.c
+++ b/smtp.c
 #include "config.h"
 #include <netdb.h>
 #include <netinet/in.h>
+#include <stdbool.h>
 #include <stdio.h>
+#include <string.h>
 #include <sys/stat.h>
+#include <unistd.h>
 #include "mutt.h"
+#include "account.h"
+#include "address.h"
+#include "ascii.h"
+#include "globals.h"
+#include "lib.h"
 #include "mutt_curses.h"
 #include "mutt_socket.h"
+#include "options.h"
+#include "protos.h"
+#include "url.h"
 #ifdef USE_SSL
 #include "mutt_ssl.h"
 #endif
diff --git a/sort.c b/sort.c
index ca50f708b7d0104f8ba27840f82a63e84271a330..730397e596bde7290a99796f2e223f503c6f6db2 100644 (file)
--- a/sort.c
+++ b/sort.c
  */
 
 #include "config.h"
-#include <ctype.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 #include "mutt.h"
 #include "sort.h"
+#include "address.h"
+#include "body.h"
+#include "buffer.h"
+#include "context.h"
+#include "envelope.h"
+#include "globals.h"
+#include "header.h"
+#include "lib.h"
 #include "mutt_idna.h"
+#include "options.h"
+#include "protos.h"
+#include "thread.h"
 #ifdef USE_NNTP
 #include "mx.h"
 #include "nntp.h"
diff --git a/sort.h b/sort.h
index 2257791c2bf7c42eaf3760f7d732ec6a94a0d1e0..a08fcebf04a415d5febd4ce013c26704cd20ec98 100644 (file)
--- a/sort.h
+++ b/sort.h
 #ifndef _MUTT_SORT_H
 #define _MUTT_SORT_H 1
 
+#include "mapping.h"
+#include "where.h"
+
+struct Address;
+struct Context;
+
 #define SORT_DATE     1 /* the date the mail was sent. */
 #define SORT_SIZE     2
 #define SORT_SUBJECT  3
 typedef int sort_t(const void *, const void *);
 sort_t *mutt_get_sort_func(int method);
 
-void mutt_clear_threads(struct Context *ctx);
 void mutt_sort_headers(struct Context *ctx, int init);
-void mutt_sort_threads(struct Context *ctx, int init);
 int mutt_select_sort(int reverse);
-struct MuttThread *mutt_sort_subthreads(struct MuttThread *thread, int init);
 
 WHERE short BrowserSort INITVAL(SORT_SUBJECT);
 WHERE short Sort INITVAL(SORT_DATE);
@@ -74,7 +77,8 @@ WHERE short SidebarSortMethod INITVAL(SORT_ORDER);
 /* FIXME: This one does not belong to here */
 WHERE short PgpSortKeys INITVAL(SORT_ADDRESS);
 
-#include "mapping.h"
 extern const struct mapping_t SortMethods[];
 
+const char *mutt_get_name(struct Address *a);
+
 #endif /* _MUTT_SORT_H */
diff --git a/state.h b/state.h
new file mode 100644 (file)
index 0000000..2885b0d
--- /dev/null
+++ b/state.h
@@ -0,0 +1,31 @@
+/**
+ * Copyright (C) 2017 Richard Russon <rich@flatcap.org>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _MUTT_STATE_H
+#define _MUTT_STATE_H 1
+
+#include <stdio.h>
+
+struct State
+{
+  FILE *fpin;
+  FILE *fpout;
+  char *prefix;
+  int flags;
+};
+
+#endif /* _MUTT_STATE_H */
index c15f87a83ce7c1bc7e2f9aa25a944e01caf853c9..d793a500deff1b197b71888585b9fd153e7de26b 100644 (file)
--- a/status.c
+++ b/status.c
  */
 
 #include "config.h"
-#include <ctype.h>
-#include <string.h>
-#include <unistd.h>
-#include "mutt.h"
+#include <stdio.h>
+#include "context.h"
+#include "format_flags.h"
+#include "globals.h"
+#include "lib.h"
 #include "mapping.h"
+#include "mbyte_table.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
 #include "mx.h"
+#include "options.h"
+#include "protos.h"
 #include "sort.h"
 #ifdef USE_NOTMUCH
 #include "mutt_notmuch.h"
index 44844984c3504891d0e566a9a15fc213fedf7ed7..23b20f06e52efc34322b81e2f92645a0307e1fd7 100644 (file)
--- a/system.c
+++ b/system.c
  */
 
 #include "config.h"
+#include <limits.h>
 #include <signal.h>
 #include <stdlib.h>
-#include <string.h>
-#include <sys/wait.h>
 #include <unistd.h>
 #include "mutt.h"
+#include "protos.h"
 #ifdef USE_IMAP
-#include <errno.h>
 #include "imap/imap.h"
 #endif
+#include <sys/types.h>
+#include <sys/wait.h>
 
 int _mutt_system(const char *cmd, int flags)
 {
index 49f3b2ba9653f356b46bc2e62b56f0cbe6b30b99..5a0935a74975a4cd703af2cd057232bd4b3db443 100644 (file)
--- a/thread.c
+++ b/thread.c
  */
 
 #include "config.h"
-#include <ctype.h>
+#include <limits.h>
+#include <stdlib.h>
 #include <string.h>
+#include <time.h>
 #include "mutt.h"
+#include "thread.h"
+#include "body.h"
+#include "context.h"
+#include "envelope.h"
+#include "globals.h"
+#include "hash.h"
+#include "header.h"
+#include "lib.h"
+#include "list.h"
+#include "options.h"
+#include "protos.h"
 #include "sort.h"
 
 #define VISIBLE(hdr, ctx)                                                      \
diff --git a/thread.h b/thread.h
new file mode 100644 (file)
index 0000000..86d59a7
--- /dev/null
+++ b/thread.h
@@ -0,0 +1,69 @@
+/**
+ * Copyright (C) 2017 Richard Russon <rich@flatcap.org>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _MUTT_THREAD_H
+#define _MUTT_THREAD_H 1
+
+#include <stdbool.h>
+
+struct Context;
+struct Header;
+
+struct MuttThread
+{
+  bool fake_thread : 1;
+  bool duplicate_thread : 1;
+  bool sort_children : 1;
+  bool check_subject : 1;
+  bool visible : 1;
+  bool deep : 1;
+  unsigned int subtree_visible : 2;
+  bool next_subtree_visible : 1;
+  struct MuttThread *parent;
+  struct MuttThread *child;
+  struct MuttThread *next;
+  struct MuttThread *prev;
+  struct Header *message;
+  struct Header *sort_key;
+};
+
+int _mutt_aside_thread(struct Header *hdr, short dir, short subthreads);
+#define mutt_next_thread(x)        _mutt_aside_thread(x, 1, 0)
+#define mutt_previous_thread(x)    _mutt_aside_thread(x, 0, 0)
+#define mutt_next_subthread(x)     _mutt_aside_thread(x, 1, 1)
+#define mutt_previous_subthread(x) _mutt_aside_thread(x, 0, 1)
+
+int _mutt_traverse_thread(struct Context *ctx, struct Header *cur, int flag);
+#define mutt_collapse_thread(x, y)        _mutt_traverse_thread(x, y, MUTT_THREAD_COLLAPSE)
+#define mutt_uncollapse_thread(x, y)      _mutt_traverse_thread(x, y, MUTT_THREAD_UNCOLLAPSE)
+#define mutt_get_hidden(x, y)             _mutt_traverse_thread(x, y, MUTT_THREAD_GET_HIDDEN)
+#define mutt_thread_contains_unread(x, y) _mutt_traverse_thread(x, y, MUTT_THREAD_UNREAD)
+#define mutt_thread_next_unread(x, y)     _mutt_traverse_thread(x, y, MUTT_THREAD_NEXT_UNREAD)
+
+void mutt_break_thread(struct Header *hdr);
+int mutt_link_threads(struct Header *cur, struct Header *last, struct Context *ctx);
+int mutt_messages_in_thread(struct Context *ctx, struct Header *hdr, int flag);
+void mutt_draw_tree(struct Context *ctx);
+
+void mutt_clear_threads(struct Context *ctx);
+struct MuttThread *mutt_sort_subthreads(struct MuttThread *thread, int init);
+void mutt_sort_threads(struct Context *ctx, int init);
+int mutt_parent_message(struct Context *ctx, struct Header *hdr, int find_root);
+void mutt_set_virtual(struct Context *ctx);
+struct Hash *mutt_make_id_hash(struct Context *ctx);
+
+#endif /* _MUTT_THREAD_H */
diff --git a/url.c b/url.c
index 19da9618cdc6a6462030c839af048040a2a4cb6a..55216f925af33d822e2c8a7402f70da5ba401fb3 100644 (file)
--- a/url.c
+++ b/url.c
 
 #include "config.h"
 #include <ctype.h>
+#include <stdio.h>
+#include <string.h>
 #include "mutt.h"
 #include "url.h"
+#include "ascii.h"
+#include "envelope.h"
+#include "globals.h"
+#include "lib.h"
 #include "mapping.h"
 #include "mime.h"
+#include "protos.h"
 #include "rfc2047.h"
+#include "rfc822.h"
 
 static const struct mapping_t UrlMap[] = {
   { "file", U_FILE },       { "imap", U_IMAP },     { "imaps", U_IMAPS },
diff --git a/url.h b/url.h
index a0ddaf25b844f3293c01f7de527dc12ef4ae5c9b..e76f7272df19447fe73352e6963950cd7c1d01b0 100644 (file)
--- a/url.h
+++ b/url.h
@@ -16,7 +16,9 @@
 #ifndef _MUTT_URL_H
 #define _MUTT_URL_H 1
 
-#include "mutt.h"
+#include <stddef.h>
+
+struct Envelope;
 
 typedef enum url_scheme {
   U_FILE,
diff --git a/utf8.c b/utf8.c
index 84398e3a277d69c98150907f5d1f4cc55be07355..73b9fcd48fb7d4a7201508f02b11e5c8da5c86a4 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -14,8 +14,8 @@
  */
 
 #include "config.h"
+#include <stddef.h>
 #include <errno.h>
-#include <sys/types.h>
 
 #ifndef EILSEQ
 #define EILSEQ EINVAL
index e1aa8ab4fe45da8dd29322ec4694b4a109ede4c1..c1645fbea03e4f50b11625265cece828abb0ca74 100644 (file)
--- a/version.c
+++ b/version.c
  */
 
 #include "config.h"
+#include <stdbool.h>
 #include <stdio.h>
 #include <string.h>
 #include <sys/utsname.h>
+#include <unistd.h>
 #include "lib.h"
 #ifdef HAVE_STRINGPREP_H
 #include <stringprep.h>
index bd71b6fae346ce3456db26d463f464847b2f29ac..674c5d354e12477741c220d3962c4f9f0b336e31 100644 (file)
--- a/version.h
+++ b/version.h
@@ -18,6 +18,8 @@
 #ifndef _MUTT_VERSION_H
 #define _MUTT_VERSION_H 1
 
+#include <stdbool.h>
+
 void print_version(void);
 void print_copyright(void);
 bool feature_enabled(const char *name);
index 9510a9944e11f7c7a2c6f12b859d5d6f66ec47b3..8c8fce7328569df30958e8d97a1bb5138e769974 100644 (file)
@@ -16,8 +16,8 @@
  */
 
 #include "config.h"
-#include "mutt.h"
-#include "mbyte.h"
+#include <stddef.h>
+#include <wctype.h>
 
 int wcscasecmp(const wchar_t *a, const wchar_t *b)
 {
index e40d49a3e5eec5f06c546d856d9f45c4018381a5..f5c6080cdfb4775d383b2b2a4f58de585c6f6781 100644 (file)
--- a/wcwidth.c
+++ b/wcwidth.c
@@ -21,9 +21,7 @@
  */
 
 #include "config.h"
-#include <ctype.h>
-#include "mutt.h"
-#include "mbyte.h"
+#include <stddef.h>
 
 /* The following two functions define the column width of an ISO 10646
  * character as follows:
diff --git a/where.h b/where.h
new file mode 100644 (file)
index 0000000..7e59f01
--- /dev/null
+++ b/where.h
@@ -0,0 +1,29 @@
+/**
+ * Copyright (C) 2017 Richard Russon <rich@flatcap.org>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _MUTT_WHERE_H
+#define _MUTT_WHERE_H 1
+
+#ifdef MAIN_C
+#define WHERE
+#define INITVAL(x) = x
+#else
+#define WHERE extern
+#define INITVAL(x)
+#endif
+
+#endif /* _MUTT_WHERE_H */