Move various structs out of mutt.h into their own header files.
Then run IWYU (include-what-you-use) on all files.
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)
/* 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) */
#ifndef _MUTT_ACCOUNT_H
#define _MUTT_ACCOUNT_H 1
-#include "url.h"
+struct CissUrl;
/* account types */
enum
*/
#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
--- /dev/null
+/**
+ * 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 */
*/
#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)
{
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;
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 */
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))
{
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));
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.
--- /dev/null
+/**
+ * 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 */
#include "config.h"
#include <stdio.h>
-#include <stdlib.h>
#include "ascii.h"
int ascii_strcasecmp(const char *a, const char *b)
*/
#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)
{
#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
{
*/
#include "config.h"
-#include "mutt.h"
+#include <stddef.h>
#include "mime.h"
#define BAD -1
#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);
#ifndef _MUTT_BCACHE_H
#define _MUTT_BCACHE_H 1
-#include "account.h"
-
-/*
- * support for body cache
- */
+#include <stdio.h>
+struct Account;
struct BodyCache;
/*
--- /dev/null
+/**
+ * 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 */
#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
#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
{
* 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"
#ifndef _MUTT_BUFFER_H
#define _MUTT_BUFFER_H 1
-#include <sys/types.h>
+#include <stddef.h>
struct Buffer
{
*/
#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
#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
#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
*/
#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;
#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"
#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"
#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"
#include "nntp.h"
#endif
+struct Address;
+
static const char *There_are_no_attachments = N_("There are no attachments.");
#define CHECK_COUNT \
MUTT_FORMAT_STAT_FILE | MUTT_FORMAT_ARROWCURSOR);
}
-
-#include "mutt_crypt.h"
-
static void redraw_crypt_lines(struct Header *msg)
{
SETCOLOR(MT_COLOR_COMPOSE_HEADER);
*/
#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.
#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);
--- /dev/null
+/**
+ * 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 */
--- /dev/null
+/**
+ * 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 */
#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
#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 */
*/
#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)
#if (!defined(DEBUG))
+#include <sys/resource.h>
static void disable_coredumps(void)
{
struct rlimit rl = { 0, 0 };
#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) \
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;
#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);
#include "config.h"
#include "crypt_mod.h"
+#include "lib.h"
/* A type of a variable to keep track of registered crypto modules. */
struct CryptModule
#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.
*/
#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();
*/
/*
- 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)
{
}
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 */
+ },
};
*/
#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();
*/
/*
- 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)
{
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;
/*
*/
#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
#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
}
break;
- /* --------------------------------------------------------------------
+/* --------------------------------------------------------------------
* The following operations can be performed inside of the pager.
*/
#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 */
*/
#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>
#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
#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:
*/
#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
--- /dev/null
+/**
+ * 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 */
--- /dev/null
+/**
+ * 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 */
#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.
*/
#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)
{
--- /dev/null
+/**
+ * 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 */
#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)
{
#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
#!/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 ''
echo ''
fi
done
+echo '#endif /* _MUTT_KEYMAP_DEFS_H */'
exit 0
#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)
{
#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 *, ...);
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];
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 */
#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
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;
*/
#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)
{
#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);
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 */
*/
#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
#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
#ifndef _MUTT_HASH_H
#define _MUTT_HASH_H 1
+#include <stdbool.h>
+
union hash_key {
const char *strkey;
unsigned int intkey;
#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
*/
#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)
{
#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;
#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);
#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)
{
*/
#include "config.h"
+#include <stddef.h>
#include <lmdb.h>
#include "backend.h"
#include "lib.h"
*/
#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)
{
*/
#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)
{
#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
--- /dev/null
+/**
+ * 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 */
#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)
{
#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)
{
*/
#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
{
#ifndef _MUTT_HISTORY_H
#define _MUTT_HISTORY_H 1
-enum history_class
+typedef enum history_class
{
HC_CMD,
HC_ALIAS,
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);
#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
/* 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" },
#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 */
#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)
/* 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
#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
/* 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)
#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)
#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)
/* 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.
#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
#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
#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
#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
#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
#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
*/
#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] = {
#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"
#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
#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 */
#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
#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 */
extern const struct binding_t OpMix[];
#endif
-#include "keymap_defs.h"
-
#endif /* _MUTT_KEYMAP_H */
#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"
#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>
--- /dev/null
+/**
+ * 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 */
#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 */
#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)
#ifndef _MUTT_MAPPING_H
#define _MUTT_MAPPING_H 1
-#include <unistd.h>
+#include <stddef.h>
struct mapping_t
{
/* 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
*/
#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
#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
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 */
--- /dev/null
+/**
+ * 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 */
#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;
*/
#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
#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
#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)
#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);
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 */
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 */
#ifndef _MUTT_COMMANDS_H
#define _MUTT_COMMANDS_H 1
-#include "mutt.h"
+struct Buffer;
struct command_t
{
#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. */
#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) */
#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
*/
*/
#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)
#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)
#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)
{
#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);
#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)
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 */
#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
#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);
#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 */
#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 \<...\>
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;
#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)
{
#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);
*/
#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)
#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
#ifndef _MUTT_SOCKET_H
#define _MUTT_SOCKET_H 1
+#include <stddef.h>
#include "account.h"
#include "lib.h"
*/
#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
#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
#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
#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
#ifndef _MUTT_TUNNEL_H
#define _MUTT_TUNNEL_H 1
-#include "mutt_socket.h"
+struct Connection;
int mutt_tunnel_socket_setup(struct Connection *conn);
*/
#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
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;
}
*/
#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"
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)
{
#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
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);
#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);
*/
#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)
{
#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
#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
--- /dev/null
+/**
+ * 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_ */
*/
#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)
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)
#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)
--- /dev/null
+/**
+ * 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 */
#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.
*/
#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"
--- /dev/null
+/**
+ * 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 */
*/
#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? */
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;
#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);
#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"
/*
#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;
/* 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)
{
#ifdef CRYPT_BACKEND_CLASSIC_PGP
-#include "mutt_crypt.h"
-
+#include <stdbool.h>
+#include <time.h>
+#include "lib.h"
struct PgpSignature
{
#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
{
#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
#ifndef _MUTT_PGPPACKET_H
#define _MUTT_PGPPACKET_H 1
+#include <stdio.h>
+
enum packet_tags
{
PT_RES0 = 0, /* reserved */
*/
#include "config.h"
-#include <errno.h>
+#include <limits.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "lib.h"
#include "md5.h"
+#include "mutt_crypt.h"
#include "pgplib.h"
#include "pgppacket.h"
#include "sha1.h"
#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
#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
*/
#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>
*/
#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"
*/
#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
#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 != '#')
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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,
#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 */
*/
#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
{
*/
#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.");
*/
#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
#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
{
#ifndef _MUTT_REMAILER_H
#define _MUTT_REMAILER_H 1
+#include <stddef.h>
+
+struct List;
+struct Header;
+
#ifdef MIXMASTER
#define MIX_CAP_COMPRESS (1 << 0)
#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>
*/
#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
#ifndef _MUTT_RFC1524_H
#define _MUTT_RFC1524_H 1
+#include <stdbool.h>
+#include <stddef.h>
+
+struct Body;
+
struct Rfc1524MailcapEntry
{
char *command;
#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 */
#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);
#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
#ifndef _MUTT_RFC2231_H
#define _MUTT_RFC2231_H 1
+struct Parameter;
+
void rfc2231_decode_parameters(struct Parameter **headp);
int rfc2231_encode_string(char **pd);
/* 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
#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);
*/
#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)
#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 */
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);
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <stdarg.h>
#include <stdio.h>
#include "lib.h"
/* 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);
#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
#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"
#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
#ifndef _MUTT_SHA1_H
#define _MUTT_SHA1_H 1
-#include <inttypes.h>
+#include <stdint.h>
struct Sha1Ctx
{
*/
#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"
#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);
#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;
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
*/
*/
#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
{
#ifdef CRYPT_BACKEND_CLASSIC_SMIME
-#include "mutt_crypt.h"
+#include <stdio.h>
+
+struct Address;
+struct Body;
+struct Envelope;
+struct Header;
+struct State;
struct SmimeKey
{
#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
*/
#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"
#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);
/* 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 */
--- /dev/null
+/**
+ * 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 */
*/
#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"
*/
#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)
{
*/
#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) \
--- /dev/null
+/**
+ * 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 */
#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 },
#ifndef _MUTT_URL_H
#define _MUTT_URL_H 1
-#include "mutt.h"
+#include <stddef.h>
+
+struct Envelope;
typedef enum url_scheme {
U_FILE,
*/
#include "config.h"
+#include <stddef.h>
#include <errno.h>
-#include <sys/types.h>
#ifndef EILSEQ
#define EILSEQ EINVAL
*/
#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>
#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);
*/
#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)
{
*/
#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:
--- /dev/null
+/**
+ * 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 */