simplify mutt_parse_references
[apps/madmutt.git] / init.h
diff --git a/init.h b/init.h
index e50a9f3..ac29376 100644 (file)
--- a/init.h
+++ b/init.h
@@ -18,6 +18,8 @@
 #endif
 
 #include "buffy.h"
+#include "mutt.h"
+#include "version.h"
 #include "lib/debug.h"
 
 #ifndef _MAKEDOC
@@ -32,7 +34,8 @@
 #define DT_MAGIC        8       /* mailbox type */
 #define DT_SYN          9       /* synonym for another variable */
 #define DT_ADDR         10      /* e-mail address */
-#define DT_USER         11      /* user defined viar $user_ */
+#define DT_USER         11      /* user defined via $user_ */
+#define DT_SYS          12      /* pre-defined via $muttng_ */
 
 #define DTYPE(x) ((x) & DT_MASK)
 
 #define R_RESORT_BOTH   (R_RESORT|R_RESORT_SUB)
 
 struct option_t {
-  char *option;
+  const char *option;
   short type;
   short flags;
   unsigned long data;
-  char* init;
-};
-
-struct feature_t {
-  char *name;
-  short builtin;
+  const char *init;
 };
 
 #define UL (unsigned long)
@@ -83,21 +81,12 @@ struct feature_t {
 /* build complete documentation */
 
 #ifdef _MAKEDOC
-# ifndef USE_IMAP
-#  define USE_IMAP
-# endif
 # ifndef MIXMASTER
 #  define MIXMASTER "mixmaster"
 # endif
-# ifndef USE_POP
-#  define USE_POP
-# endif
 # ifndef USE_SSL
 #  define USE_SSL
 # endif
-# ifndef USE_SOCKET
-#  define USE_SOCKET
-# endif
 # ifndef USE_LIBESMTP
 #  define USE_LIBESMTP
 # endif
@@ -110,9 +99,6 @@ struct feature_t {
 # ifndef USE_DOTLOCK
 #  define USE_DOTLOCK
 # endif
-# ifndef DL_STANDALONE
-#  define DL_STANDALONE
-# endif
 # ifndef USE_HCACHE
 #  define USE_HCACHE
 # endif
@@ -245,7 +231,6 @@ struct option_t MuttVars[] = {
    ** This variable is valid only if $$strict_mime is unset.
    */
 #ifdef USE_NNTP
-  {"ask_followup_to", DT_SYN, R_NONE, UL "nntp_ask_followup_to", 0},
   {"nntp_ask_followup_to", DT_BOOL, R_NONE, OPTASKFOLLOWUP, "no" },
   /*
    ** .pp
@@ -255,7 +240,6 @@ struct option_t MuttVars[] = {
    ** If \fIset\fP, Mutt-ng will prompt you for the \fTFollowup-To:\fP header
    ** field before editing the body of an outgoing news article.
    */
-  {"ask_x_comment_to", DT_SYN, R_NONE, UL "nntp_ask_x_comment_to", 0},
   {"nntp_ask_x_comment_to", DT_BOOL, R_NONE, OPTASKXCOMMENTTO, "no" },
   /*
    ** .pp
@@ -283,10 +267,12 @@ struct option_t MuttVars[] = {
    ** .dt %m  .dd major MIME type
    ** .dt %M  .dd MIME subtype
    ** .dt %n  .dd attachment number
+   ** .dt %Q  .dd "Q", if MIME part qualifies for attachment counting
    ** .dt %s  .dd size
    ** .dt %t  .dd tagged flag
    ** .dt %T  .dd graphic tree characters
    ** .dt %u  .dd unlink (=to delete) flag
+   ** .dt %X  .dd number of qualifying MIME parts in this part and its children
    ** .dt %>X .dd right justify the rest of the string and pad with character "X"
    ** .dt %|X .dd pad to the end of the line with character "X"
    ** .de
@@ -378,7 +364,6 @@ struct option_t MuttVars[] = {
    ** visual terminals don't permit making the cursor invisible.
    */
 #ifdef USE_NNTP
-  {"catchup_newsgroup", DT_SYN, R_NONE, UL "nntp_catchup", 0},
   {"nntp_catchup", DT_QUAD, R_NONE, OPT_CATCHUP, "ask-yes" },
   /*
    ** .pp
@@ -412,6 +397,18 @@ struct option_t MuttVars[] = {
    ** When \fIunset\fP, Mutt-ng will not collapse a thread if it contains any
    ** unread messages.
    */
+  {"count_attachments", DT_BOOL, R_NONE, OPTCOUNTATTACH, "yes"},
+  /*
+   ** .pp
+   ** This variable controls whether attachments should be counted for $$$index_format
+   ** and its \fT%X\fP expando or not. As for scoring, this variable can be used to
+   ** selectively turn counting on or off instead of removing and re-adding rules as
+   ** prefered because counting requires full loading of messages.
+   ** .pp
+   ** If it is \fIset\fP and rules were defined via the \fTattachments\fP and/or
+   ** \fTunattachments\fP commands, counting will be done. If it is \fIunset\fP no
+   ** counting will be done regardless whether rules were defined or not.
+   */
   {"uncollapse_jump", DT_BOOL, R_NONE, OPTUNCOLLAPSEJUMP, "no" },
   /*
    ** .pp
@@ -516,7 +513,7 @@ struct option_t MuttVars[] = {
    ** English).
    */
 #ifdef DEBUG
-  {"debug_level", DT_NUM, R_NONE, UL &DebugLevel, "0" },
+  {"debug_level", DT_NUM, R_NONE, UL &DebugLevel, "1" },
   /*
    ** .pp
    ** Availability: debug
@@ -588,11 +585,11 @@ struct option_t MuttVars[] = {
    ** is viewed it is passed as standard input to $$display_filter, and the
    ** filtered message is read from the standard output.
    */
-#if defined(DL_STANDALONE) && defined(USE_DOTLOCK)
-  {"dotlock_program", DT_PATH, R_NONE, UL &MuttDotlock, BINDIR "/muttng_dotlock"},
+#if defined(USE_DOTLOCK)
+  {"dotlock_program", DT_PATH, R_NONE, UL &MuttDotlock, "$muttng_bindir/muttng_dotlock"},
   /*
    ** .pp
-   ** Availability: Standalone and Dotlock
+   ** Availability: Dotlock
    **
    ** .pp
    ** Contains the path of the \fTmuttng_dotlock(1)\fP binary to be used by
@@ -630,7 +627,7 @@ struct option_t MuttVars[] = {
   /*
    ** .pp
    ** This variable controls whether Mutt-ng, when sorting by threads, threads
-   ** messages with the same \fTMessage-Id:\fP header field together.
+   ** messages with the same \fTMessage-ID:\fP header field together.
    ** If it is \fIset\fP, it will indicate that it thinks they are duplicates
    ** of each other with an equals sign in the thread diagram.
    */
@@ -675,27 +672,31 @@ struct option_t MuttVars[] = {
    ** delivery and transport agents tend to do with messages.
    **
    ** .pp
-   ** \fBNote:\fP as mutt-ng currently violates RfC3676 defining
+   ** \fBNote:\fP as Mutt-ng currently violates RfC3676 defining
    ** \fTformat=flowed\fP, it's <em/strongly/ advised to \fIset\fP
    ** this option although discouraged by the standard. Alternatively,
    ** you must take care of space-stuffing <tt/From / lines (with a trailing
    ** space) yourself.
    */
-  {"envelope_from", DT_BOOL, R_NONE, OPTENVFROM, "no" },
+  {"envelope_from", DT_SYN, R_NONE, UL "use_envelope_from", 0 },
+  {"use_envelope_from", DT_BOOL, R_NONE, OPTENVFROM, "no" },
   /*
    ** .pp
-   ** When \fIset\fP, Mutt-ng will try to derive the message's \fIenvelope\fP
-   ** sender from the ``\fTFrom:\fP'' header field. Note that this information is passed 
-   ** to the sendmail command using the ``\fT-f\fP" command line switch, so don't set this
-   ** option if you are using that switch in $$sendmail yourself,
-   ** or if the sendmail on your machine doesn't support that command
-   ** line switch.
-   */
-  {"escape", DT_STR, R_NONE, UL &EscChar, "~"},
-  /*
+   ** When \fIset\fP, Mutt-ng will use ``$$envelope_from_address'' as the
+   ** \fIenvelope\fP sender if that is set, otherwise it will attempt to
+   ** derive it from the "From:" header.
+   **
    ** .pp
-   ** Escape character to use for functions in the builtin editor.
+   ** \fBNote:\fP This information is passed
+   ** to sendmail command using the "-f" command line switch and
+   ** passed to the SMTP server for libESMTP (if support is compiled in).
    */
+  {"envelope_from_address", DT_ADDR, R_NONE, UL &EnvFrom, "" },
+  /*
+  ** .pp
+  ** Manually sets the \fIenvelope\fP sender for outgoing messages.
+  ** This value is ignored if ``$$use_envelope_from'' is unset.
+  */
   {"fast_reply", DT_BOOL, R_NONE, OPTFASTREPLY, "no" },
   /*
    ** .pp
@@ -787,7 +788,6 @@ struct option_t MuttVars[] = {
    ** of the same email for you.
    */
 #ifdef USE_NNTP
-  {"followup_to_poster", DT_SYN, R_NONE, UL "nntp_followup_to_poster", 0},
   {"nntp_followup_to_poster", DT_QUAD, R_NONE, OPT_FOLLOWUPTOPOSTER, "ask-yes" },
   /*
    ** .pp
@@ -857,7 +857,7 @@ struct option_t MuttVars[] = {
    ** .pp
    ** E.g. you can use 
    ** \fTsend-hook Mutt-ng-devel@lists.berlios.de 'my_hdr From: Foo Bar <foo@bar.fb>'\fP
-   ** when replying to the mutt-ng developer's mailing list and Mutt-ng takes this email address.
+   ** when replying to the Mutt-ng developer's mailing list and Mutt-ng takes this email address.
    ** .pp
    ** Defaults to the contents of the environment variable \fT$$$EMAIL\fP.
    */
@@ -877,7 +877,6 @@ struct option_t MuttVars[] = {
    ** ``Franklin'' to ``Franklin, Steve''.
    */
 #ifdef USE_NNTP
-  {"group_index_format", DT_SYN, R_NONE, UL "nntp_group_index_format", 0},
   {"nntp_group_index_format", DT_STR, R_BOTH, UL &GroupFormat, "%4C %M%N %5s  %-45.45f %d"},
   /*
    ** .pp
@@ -960,7 +959,7 @@ struct option_t MuttVars[] = {
    ** .pp
    ** When \fIset\fP, Mutt-ng will not show the presence of messages that are hidden
    ** by limiting, at the top of threads in the thread tree.  Note that when
-   ** $$hide_missing is set, this option will have no effect.
+   ** $$hide_missing is \fIset\fP, this option will have no effect.
    */
   {"hide_top_missing", DT_BOOL, R_TREE|R_INDEX, OPTHIDETOPMISSING, "yes" },
   /*
@@ -986,7 +985,7 @@ struct option_t MuttVars[] = {
   /*
    ** .pp
    ** Specifies the hostname to use after the ``\fT@\fP'' in local e-mail
-   ** addresses and during generation of \fTMessage-Id:\fP headers.
+   ** addresses and during generation of \fTMessage-ID:\fP headers.
    ** .pp
    ** Please be sure to really know what you are doing when changing this variable
    ** to configure a custom domain part of Message-IDs.
@@ -1002,13 +1001,11 @@ struct option_t MuttVars[] = {
    ** mailing list when this option is set, use the \fIlist-reply\fP
    ** function; \fIgroup-reply\fP will reply to both the sender and the
    ** list.
+   ** Remember: This option works only for mailing lists which are explicitly set in your muttngrc
+   ** configuration file.
    */
-#ifdef USE_IMAP
   {"imap_authenticators", DT_STR, R_NONE, UL &ImapAuthenticators, "" },
   /*
-   ** .pp
-   ** Availability: IMAP
-   **
    ** .pp
    ** This is a colon-delimited list of authentication methods Mutt-ng may
    ** attempt to use to log in to an IMAP server, in the order Mutt-ng should
@@ -1033,12 +1030,8 @@ struct option_t MuttVars[] = {
    ** your server on connection, and add them to the set of mailboxes
    ** it polls for new mail. See also the ``$mailboxes'' command.
    */
-  
   {"imap_delim_chars", DT_STR, R_NONE, UL &ImapDelimChars, "/."},
   /*
-   ** .pp
-   ** Availability: IMAP
-   **
    ** .pp
    ** This contains the list of characters which you would like to treat
    ** as folder separators for displaying IMAP paths. In particular it
@@ -1046,9 +1039,6 @@ struct option_t MuttVars[] = {
    */
   {"imap_headers", DT_STR, R_INDEX, UL &ImapHeaders, "" },
   /*
-   ** .pp
-   ** Availability: IMAP
-   **
    ** .pp
    ** Mutt-ng requests these header fields in addition to the default headers
    ** (``DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES CONTENT-TYPE
@@ -1060,9 +1050,6 @@ struct option_t MuttVars[] = {
    */
   {"imap_home_namespace", DT_STR, R_NONE, UL &ImapHomeNamespace, "" },
   /*
-   ** .pp
-   ** Availability: IMAP
-   **
    ** .pp
    ** You normally want to see your personal folders alongside
    ** your \fTINBOX\fP in the IMAP browser. If you see something else, you may set
@@ -1070,9 +1057,6 @@ struct option_t MuttVars[] = {
    */
   {"imap_keepalive", DT_NUM, R_NONE, UL &ImapKeepalive, "900" },
   /*
-   ** .pp
-   ** Availability: IMAP
-   **
    ** .pp
    ** This variable specifies the maximum amount of time in seconds that Mutt-ng
    ** will wait before polling open IMAP connections, to prevent the server
@@ -1088,9 +1072,6 @@ struct option_t MuttVars[] = {
    */
   {"imap_login", DT_STR, R_NONE, UL &ImapLogin, "" },
   /*
-   ** .pp
-   ** Availability: IMAP
-   **
    ** .pp
    ** Your login name on the IMAP server.
    ** .pp
@@ -1098,9 +1079,6 @@ struct option_t MuttVars[] = {
    */
   {"imap_list_subscribed", DT_BOOL, R_NONE, OPTIMAPLSUB, "no" },
   /*
-   ** .pp
-   ** Availability: IMAP
-   **
    ** .pp
    ** This variable configures whether IMAP folder browsing will look for
    ** only subscribed folders or all folders.  This can be toggled in the
@@ -1115,9 +1093,6 @@ struct option_t MuttVars[] = {
    */
   {"imap_pass", DT_STR, R_NONE, UL &ImapPass, "" },
   /*
-   ** .pp
-   ** Availability: IMAP
-   **
    ** .pp
    ** Specifies the password for your IMAP account.  If \fIunset\fP, Mutt-ng will
    ** prompt you for your password when you invoke the fetch-mail function.
@@ -1128,9 +1103,6 @@ struct option_t MuttVars[] = {
    */
   {"imap_passive", DT_BOOL, R_NONE, OPTIMAPPASSIVE, "yes" },
   /*
-   ** .pp
-   ** Availability: IMAP
-   **
    ** .pp
    ** When \fIset\fP, Mutt-ng will not open new IMAP connections to check for new
    ** mail.  Mutt-ng will only check for new mail over existing IMAP
@@ -1140,9 +1112,6 @@ struct option_t MuttVars[] = {
    */
   {"imap_peek", DT_BOOL, R_NONE, OPTIMAPPEEK, "yes" },
   /*
-   ** .pp
-   ** Availability: IMAP
-   **
    ** .pp
    ** If \fIset\fP, Mutt-ng will avoid implicitly marking your mail as read whenever
    ** you fetch a message from the server. This is generally a good thing,
@@ -1151,18 +1120,12 @@ struct option_t MuttVars[] = {
    */
   {"imap_reconnect", DT_QUAD, R_NONE, OPT_IMAPRECONNECT, "ask-yes" },
   /*
-   ** .pp
-   ** Availability: IMAP
-   **
    ** .pp
    ** Controls whether or not Mutt-ng will try to reconnect to IMAP server when
    ** the connection is lost.
    */
   {"imap_servernoise", DT_BOOL, R_NONE, OPTIMAPSERVERNOISE, "yes" },
   /*
-   ** .pp
-   ** Availability: IMAP
-   **
    ** .pp
    ** When \fIset\fP, Mutt-ng will display warning messages from the IMAP
    ** server as error messages. Since these messages are often
@@ -1172,16 +1135,12 @@ struct option_t MuttVars[] = {
    */
   {"imap_user", DT_STR, R_NONE, UL &ImapUser, "" },
   /*
-   ** .pp
-   ** Availability: IMAP
-   **
    ** .pp
    ** The name of the user whose mail you intend to access on the IMAP
    ** server.
    ** .pp
    ** This variable defaults to your user name on the local machine.
    */
-#endif
   {"implicit_autoview", DT_BOOL, R_NONE, OPTIMPLICITAUTOVIEW, "no" },
   /*
    ** .pp
@@ -1256,6 +1215,7 @@ struct option_t MuttVars[] = {
    ** .dt %u .dd user (login) name of the author
    ** .dt %v .dd first name of the author, or the recipient if the message is from you
    ** .dt %W .dd name of organization of author (`organization:' field)
+   ** .dt %X .dd number of attachments
    ** .dt %y .dd `x-label:' field, if present
    ** .dt %Y .dd `x-label' field, if present, and (1) not at part of a thread tree,
    **            (2) at the top of a thread, or (3) `x-label' is different from
@@ -1279,7 +1239,6 @@ struct option_t MuttVars[] = {
    ** See also: ``$$to_chars''.
    */
 #ifdef USE_NNTP
-  {"inews", DT_SYN, R_NONE, UL "nntp_inews", 0},
   {"nntp_inews", DT_PATH, R_NONE, UL &Inews, ""},
   /*
    ** .pp
@@ -1315,12 +1274,12 @@ struct option_t MuttVars[] = {
    ** The locale used by \fTstrftime(3)\fP to format dates. Legal values are
    ** the strings your system accepts for the locale variable \fTLC_TIME\fP.
    */
-  {"list_reply", DT_QUAD, R_NONE, OPT_LISTREPLY, "no" },
+  {"force_list_reply", DT_QUAD, R_NONE, OPT_LISTREPLY, "ask-no" },
   /*
    ** .pp
-   ** When \fIset\fP, address replies to the mailing list the original message came
-   ** from (instead to the author only). Setting this option to ``\fIask-yes\fP'' or
-   ** ``\fIask-no\fP'' will ask if you really intended to reply to the author only.
+   ** This variable controls what effect ordinary replies have on mailing list
+   ** messages: if \fIset\fP, a normal reply will be interpreted as list-reply
+   ** while if it's \fIunset\fP the reply functions work as usual.
    */
   {"max_display_recips", DT_NUM, R_PAGER, UL &MaxDispRecips, "0" },
   /*
@@ -1454,6 +1413,85 @@ struct option_t MuttVars[] = {
    ** This specifies the folder into which read mail in your ``$$spoolfile''
    ** folder will be appended.
    */
+  {"muttng_version", DT_SYS, R_NONE, 0, VERSION },
+  /*
+   ** .pp
+   ** \fIThis is a read-only system property and specifies muttng's
+   ** version string.\fP
+   */
+  {"muttng_revision", DT_SYS, R_NONE, 0, MUTT_REVISION },
+  /*
+   ** .pp
+   ** \fIThis is a read-only system property and specifies muttng's
+   ** subversion revision string.\fP
+   */
+  {"muttng_sysconfdir", DT_SYS, R_NONE, 0, SYSCONFDIR },
+  /*
+   ** .pp
+   ** \fIThis is a read-only system property and specifies the
+   ** directory containing the muttng system-wide configuration.\fP
+   */
+  {"muttng_bindir", DT_SYS, R_NONE, 0, BINDIR },
+  /*
+   ** .pp
+   ** \fIThis is a read-only system property and specifies the
+   ** directory containing the muttng binary.\fP
+   */
+  {"muttng_docdir", DT_SYS, R_NONE, 0, PKGDOCDIR },
+  /*
+   ** .pp
+   ** \fIThis is a read-only system property and specifies the
+   ** directory containing the muttng documentation.\fP
+   */
+#ifdef USE_HCACHE
+#if HAVE_QDBM
+  {"muttng_hcache_backend", DT_SYS, R_NONE, 0, "qdbm" },
+#elif HAVE_GDBM
+  {"muttng_hcache_backend", DT_SYS, R_NONE, 0, "gdbm" },
+#elif HAVE_DB4
+  {"muttng_hcache_backend", DT_SYS, R_NONE, 0, "db4" },
+#else
+  {"muttng_hcache_backend", DT_SYS, R_NONE, 0, "unknown" },
+#endif
+  /*
+   ** .pp
+   ** \fIThis is a read-only system property and specifies the
+   ** header chaching's database backend.\fP
+   */
+#endif
+  {"muttng_folder_path", DT_SYS, R_NONE, 0, "" },
+  /*
+   ** .pp
+   ** \fIThis is a read-only system property and, at runtime,
+   ** specifies the full path or URI of the folder currently
+   ** open (if any).\fP
+   */
+  {"muttng_folder_name", DT_SYS, R_NONE, 0, "" },
+  /*
+   ** .pp
+   ** \fIThis is a read-only system property and, at runtime,
+   ** specifies the actual name of the folder as far as it could
+   ** be detected.\fP
+   ** .pp
+   ** For detection, $$$folder is first taken into account
+   ** and simply stripped to form the result when a match is found. For
+   ** example, with $$$folder being \fTimap://host\fP and the folder is
+   ** \fTimap://host/INBOX/foo\fP, $$$muttng_folder_name will be just
+   ** \fTINBOX/foo\fP.)
+   ** .pp
+   ** Second, if the initial portion of a name is not $$$folder,
+   ** the result will be everything after the last ``/''.
+   ** .pp
+   ** Third and last, the result will be just the name if neither
+   ** $$$folder nor a ``/'' were found in the name.
+   */
+  {"muttng_pwd", DT_SYS, R_NONE, 0, "" },
+  /*
+   ** .pp
+   ** \fIThis is a read-only system property and, at runtime,
+   ** specifies the current working directory of the muttng
+   ** binary.\fP
+   */
   {"operating_system", DT_STR, R_NONE, UL &OperatingSystem, "" },
   /*
    ** .pp
@@ -1497,7 +1535,7 @@ struct option_t MuttVars[] = {
    ** .pp
    ** This variable controls how message counts are printed when the sidebar
    ** is enabled. If this variable is \fIempty\fP (\fIand only if\fP), no numbers
-   ** will be printed \fIand\fP mutt-ng won't frequently count mail (which
+   ** will be printed \fIand\fP Mutt-ng won't frequently count mail (which
    ** may be a great speedup esp. with mbox-style mailboxes.)
    ** .pp
    ** The following \fTprintf(3)\fP-like sequences are supported all of which
@@ -1510,6 +1548,7 @@ struct option_t MuttVars[] = {
    ** .dt %M .dd Total number of messages shown, i.e. not hidden by a limit. 1)
    ** .dt %n .dd Number of new messages.
    ** .dt %t .dd Number of tagged messages. 1)
+   ** .dt %u .dd Number of unread messages.
    ** .de
    ** .pp
    ** 1) These expandos only have a non-zero value for the current mailbox and
@@ -1567,9 +1606,9 @@ struct option_t MuttVars[] = {
    ** If \fIset\fP, forces Mutt-ng to interpret keystrokes with the high bit (bit 8)
    ** set as if the user had pressed the \fTESC\fP key and whatever key remains
    ** after having the high bit removed.  For example, if the key pressed
-   ** has an ASCII value of \fT0xf4\fP, then this is treated as if the user had
+   ** has an ASCII value of \fT0xf8\fP, then this is treated as if the user had
    ** pressed \fTESC\fP then ``\fTx\fP''.  This is because the result of removing the
-   ** high bit from ``\fT0xf4\fP'' is ``\fT0x74\fP'', which is the ASCII character
+   ** high bit from ``\fT0xf8\fP'' is ``\fT0x78\fP'', which is the ASCII character
    ** ``\fTx\fP''.
    */
   {"mh_purge", DT_BOOL, R_NONE, OPTMHPURGE, "no" },
@@ -1625,7 +1664,6 @@ struct option_t MuttVars[] = {
    */
 
 #ifdef USE_NNTP
-  {"mime_subject", DT_SYN, R_NONE, UL "nntp_mime_subject", 0},
   {"nntp_mime_subject", DT_BOOL, R_NONE, OPTMIMESUBJECT, "yes" },
   /*
    ** .pp
@@ -1686,8 +1724,8 @@ struct option_t MuttVars[] = {
   {"msgid_format", DT_STR, R_NONE, UL &MsgIdFormat, "%Y%m%d%h%M%s.G%P%p"},
   /*
    ** .pp
-   ** This is the format for the ``local part'' of the \fTMessage-Id:\fP header
-   ** field generated by Mutt-ng. If this variable is empty, no \fTMessage-Id:\fP
+   ** This is the format for the ``local part'' of the \fTMessage-ID:\fP header
+   ** field generated by Mutt-ng. If this variable is empty, no \fTMessage-ID:\fP
    ** headers will be generated. The '%'
    ** character marks that certain data will be added to the string, similar to
    ** \fTprintf(3)\fP. The following characters are allowed:
@@ -1720,7 +1758,6 @@ struct option_t MuttVars[] = {
    ** deeper threads to fit on the screen.
    */
 #ifdef USE_NNTP
-  {"news_cache_dir", DT_SYN, R_NONE, UL "nntp_cache_dir", 0},
   {"nntp_cache_dir", DT_PATH, R_NONE, UL &NewsCacheDir, "~/.muttng"},
   /*
    ** .pp
@@ -1734,7 +1771,6 @@ struct option_t MuttVars[] = {
    ** As for the header caching in connection with IMAP and/or Maildir,
    ** this drastically increases speed and lowers traffic.
    */
-  {"news_server", DT_SYN, R_NONE, UL "nntp_host", 0 },
   {"nntp_host", DT_STR, R_NONE, UL &NewsServer, "" },
   /*
    ** .pp
@@ -1756,7 +1792,6 @@ struct option_t MuttVars[] = {
    ** presents a security risk since the superuser of your machine may read it
    ** regardless of the file's permissions.
    */
-  {"newsrc", DT_SYN, R_NONE, UL "nntp_newsrc", 0},
   {"nntp_newsrc", DT_PATH, R_NONE, UL &NewsRc, "~/.newsrc"},
   /*
    ** .pp
@@ -1816,7 +1851,6 @@ struct option_t MuttVars[] = {
    ** presents a security risk since the superuser of your machine may read it
    ** regardless of the file's permissions.
    */
-  {"nntp_poll", DT_SYN, R_NONE, UL "nntp_mail_check", 0},
   {"nntp_mail_check", DT_NUM, R_NONE, UL &NewsPollTimeout, "60" },
   /*
    ** .pp
@@ -1837,6 +1871,15 @@ struct option_t MuttVars[] = {
    ** was connection lost.
    */
 #endif
+  { "net_inc", DT_NUM, R_NONE, UL &NetInc, "10" },
+  /*
+  ** .pp
+  ** Operations that expect to transfer a large amount of data over the
+  ** network will update their progress every \fInet_inc\fP kilobytes.
+  ** If set to 0, no progress messages will be displayed.
+  ** .pp
+  ** See also ``$$read_inc'' and ``$$write_inc''.
+  */
   {"pager", DT_PATH, R_NONE, UL &Pager, "builtin"},
   /*
    ** .pp
@@ -2463,20 +2506,8 @@ struct option_t MuttVars[] = {
    ** presents a security risk since the superuser of your machine may read it
    ** regardless of the file's permissions.  
    */
-  {"smtp_envelope", DT_STR, R_NONE, UL &SmtpEnvFrom, "" },
-  /*
-   ** .pp
-   ** Availability: SMTP
-   **
-   ** .pp
-   ** If this variable is non-empty, it'll be used as the envelope sender. If it's empty
-   ** (the default), the value of the regular \fTFrom:\fP header will be used.
-   **
-   ** .pp
-   ** This may be necessary as some providers don't allow for arbitrary values
-   ** as the envelope sender but only a particular one which may not be the same as the
-   ** user's desired \fTFrom:\fP header.
-   */
+  {"smtp_envelope", DT_SYN, R_NONE, UL "envelope_from_address", 0 },
+
   {"smtp_host", DT_STR, R_NONE, UL &SmtpHost, "" },
   /*
    ** .pp
@@ -2529,7 +2560,7 @@ struct option_t MuttVars[] = {
   {"ssl_force_tls", DT_BOOL, R_NONE, OPTSSLFORCETLS, "no" },
   /*
    ** .pp
-   ** If this variable is \fIset\fP, mutt-ng will require that all connections
+   ** If this variable is \fIset\fP, Mutt-ng will require that all connections
    ** to remote servers be encrypted. Furthermore it will attempt to
    ** negotiate TLS even if the server does not advertise the capability,
    ** since it would otherwise have to abort the connection anyway. This
@@ -2583,7 +2614,7 @@ struct option_t MuttVars[] = {
    ** The file which includes random data that is used to initialize SSL
    ** library functions.
    */
-  {"ssl_use_sslv2", DT_BOOL, R_NONE, OPTSSLV2, "yes" },
+  {"ssl_use_sslv2", DT_BOOL, R_NONE, OPTSSLV2, "no" },
   /*
    ** .pp
    ** Availability: SSL
@@ -2658,12 +2689,8 @@ struct option_t MuttVars[] = {
    ** The separator to add between messages when piping a list of tagged
    ** messages to an external Unix command.
    */
-#ifdef USE_POP
   {"pop_authenticators", DT_STR, R_NONE, UL &PopAuthenticators, "" },
   /*
-   ** .pp
-   ** Availability: POP
-   **
    ** .pp
    ** This is a colon-delimited list of authentication methods Mutt-ng may
    ** attempt to use to log in to an POP server, in the order Mutt-ng should
@@ -2678,9 +2705,6 @@ struct option_t MuttVars[] = {
    */
   {"pop_auth_try_all", DT_BOOL, R_NONE, OPTPOPAUTHTRYALL, "yes" },
   /*
-   ** .pp
-   ** Availability: POP
-   **
    ** .pp
    ** If \fIset\fP, Mutt-ng will try all available methods. When \fIunset\fP, Mutt-ng will
    ** only fall back to other authentication methods if the previous
@@ -2691,17 +2715,11 @@ struct option_t MuttVars[] = {
   {"pop_mail_check", DT_NUM, R_NONE, UL &PopCheckTimeout, "60" },
   /*
    ** .pp
-   ** Availability: POP
-   **
-   ** .pp
-   ** This variable configures how often (in seconds) POP should look for
+   ** This variable configures how often (in seconds) Mutt-ng should look for
    ** new mail.
    */
   {"pop_delete", DT_QUAD, R_NONE, OPT_POPDELETE, "ask-no" },
   /*
-   ** .pp
-   ** Availability: POP
-   **
    ** .pp
    ** If \fIset\fP, Mutt-ng will delete successfully downloaded messages from the POP
    ** server when using the ``fetch-mail'' function.  When \fIunset\fP, Mutt-ng will
@@ -2709,9 +2727,6 @@ struct option_t MuttVars[] = {
    */
   {"pop_host", DT_STR, R_NONE, UL &PopHost, ""},
   /*
-   ** .pp
-   ** Availability: POP
-   **
    ** .pp
    ** The name of your POP server for the ``fetch-mail'' function.  You
    ** can also specify an alternative port, username and password, i.e.:
@@ -2724,9 +2739,6 @@ struct option_t MuttVars[] = {
    */
   {"pop_last", DT_BOOL, R_NONE, OPTPOPLAST, "no" },
   /*
-   ** .pp
-   ** Availability: POP
-   **
    ** .pp
    ** If this variable is \fIset\fP, Mutt-ng will try to use the ``\fTLAST\fP'' POP command
    ** for retrieving only unread messages from the POP server when using
@@ -2735,17 +2747,11 @@ struct option_t MuttVars[] = {
   {"pop_reconnect", DT_QUAD, R_NONE, OPT_POPRECONNECT, "ask-yes" },
   /*
    ** .pp
-   ** Availability: POP
-   **
-   ** .pp
-   ** Controls whether or not Mutt-ng will try to reconnect to a POP server when the
+   ** Controls whether or not Mutt-ng will try to reconnect to a POP server if the
    ** connection is lost.
    */
   {"pop_user", DT_STR, R_NONE, UL &PopUser, "" },
   /*
-   ** .pp
-   ** Availability: POP
-   **
    ** .pp
    ** Your login name on the POP server.
    ** .pp
@@ -2753,9 +2759,6 @@ struct option_t MuttVars[] = {
    */
   {"pop_pass", DT_STR, R_NONE, UL &PopPass, ""},
   /*
-   ** .pp
-   ** Availability: POP
-   **
    ** .pp
    ** Specifies the password for your POP account.  If \fIunset\fP, Mutt-ng will
    ** prompt you for your password when you open POP mailbox.
@@ -2764,7 +2767,6 @@ struct option_t MuttVars[] = {
    ** presents a security risk since the superuser of your machine may read it
    ** regardless of the file's permissions.
    */
-#endif /* USE_POP */
   {"post_indent_string", DT_STR, R_NONE, UL &PostIndentString, ""},
   /*
    ** .pp
@@ -2772,7 +2774,6 @@ struct option_t MuttVars[] = {
    ** string after the inclusion of a message which is being replied to.
    */
 #ifdef USE_NNTP
-  {"post_moderated", DT_SYN, R_NONE, UL "nntp_post_moderated", 0 },
   {"nntp_post_moderated", DT_QUAD, R_NONE, OPT_TOMODERATED, "ask-yes" },
   /*
    ** .pp
@@ -2801,7 +2802,6 @@ struct option_t MuttVars[] = {
    ** in the mailbox specified by this variable.  Also see the ``$$postpone''
    ** variable.
    */
-#ifdef USE_SOCKET
   {"preconnect", DT_STR, R_NONE, UL &Preconnect, "" },
   /*
    ** .pp
@@ -2819,7 +2819,6 @@ struct option_t MuttVars[] = {
    ** \fBNote:\fP For this example to work, you must be able to log in to the
    ** remote machine without having to enter a password.
    */
-#endif /* USE_SOCKET */
   {"print", DT_QUAD, R_NONE, OPT_PRINT, "ask-no" },
   /*
    ** .pp
@@ -3148,7 +3147,6 @@ struct option_t MuttVars[] = {
    ** shell from \fT/etc/passwd\fP is used.
    */
 #ifdef USE_NNTP
-  {"save_unsubscribed", DT_SYN, R_NONE, UL "nntp_save_unsubscribed", 0 },
   {"nntp_save_unsubscribed", DT_BOOL, R_NONE, OPTSAVEUNSUB, "no" },
   /*
    ** .pp
@@ -3160,7 +3158,6 @@ struct option_t MuttVars[] = {
    */
 #endif
 #ifdef USE_NNTP
-  {"show_new_news", DT_SYN, R_NONE, UL "nntp_show_new_news", 0 },
   {"nntp_show_new_news", DT_BOOL, R_NONE, OPTSHOWNEWNEWS, "yes" },
   /*
    ** .pp
@@ -3172,7 +3169,6 @@ struct option_t MuttVars[] = {
    ** Also controls whether or not the number of new articles of subscribed
    ** newsgroups will be checked.
    */
-  {"show_only_unread", DT_SYN, R_NONE, UL "nntp_show_only_unread", 0 },
   {"nntp_show_only_unread", DT_BOOL, R_NONE, OPTSHOWONLYUNREAD, "no" },
   /*
    ** .pp
@@ -3458,7 +3454,7 @@ struct option_t MuttVars[] = {
    ** if ``$$edit_headers'' is unset.
    **
    ** .pp
-   ** If this variable is \fIset\fP, mutt-ng is strict and allows anything to be
+   ** If this variable is \fIset\fP, Mutt-ng is strict and allows anything to be
    ** changed. If it's \fIunset\fP, all headers given will be prefixed with
    ** ``X-Mailto-'' and the message including headers will be shown in the editor
    ** regardless of what ``$$edit_headers'' is set to.
@@ -3484,19 +3480,21 @@ struct option_t MuttVars[] = {
    ** default, messages with the same subject are grouped together in
    ** ``pseudo threads.''  This may not always be desirable, such as in a
    ** personal mailbox where you might have several unrelated messages with
-   ** the subject ``hi'' which will get grouped together.
+   ** the subject ``hi'' which will get grouped together. See also
+   ** ``$$sort_re'' for a less drastic way of controlling this
+   ** behaviour.
    */
   {"strip_was", DT_BOOL, R_NONE, OPTSTRIPWAS, "no" },
   /**
   ** .pp
-  ** When \fIset\fP, mutt-ng will remove the trailing part of the ``\fTSubject:\fP''
+  ** When \fIset\fP, Mutt-ng will remove the trailing part of the ``\fTSubject:\fP''
   ** line which matches $$strip_was_regex when replying. This is useful to
   ** properly react on subject changes and reduce ``subject noise.'' (esp. in Usenet)
   **/
   {"strip_was_regex", DT_RX, R_NONE, UL &StripWasRegexp, "\\([Ww][Aa][RrSs]: .*\\)[ ]*$"},
   /**
   ** .pp
-  ** When non-empty and $$strip_was is \fIset\fP, mutt-ng will remove this
+  ** When non-empty and $$strip_was is \fIset\fP, Mutt-ng will remove this
   ** trailing part of the ``Subject'' line when replying if it won't be empty
   ** afterwards.
   **/
@@ -3584,7 +3582,6 @@ struct option_t MuttVars[] = {
    ** \fBNote\fP: When you delete a message in the trash folder, it is really
    ** deleted, so that there is no way to recover mail.
    */
-#ifdef USE_SOCKET
   {"tunnel", DT_STR, R_NONE, UL &Tunnel, "" },
   /*
    ** .pp
@@ -3597,7 +3594,6 @@ struct option_t MuttVars[] = {
    ** \fBNote:\fP For this example to work you must be able to log in to the remote
    ** machine without having to enter a password.
    */
-#endif
   {"umask", DT_NUM, R_NONE, UL &Umask, "0077" },
   /*
    ** .pp
@@ -3661,12 +3657,6 @@ struct option_t MuttVars[] = {
    ** messages, indicating which version of Mutt-ng was used for composing
    ** them.
    */
-  {"visual", DT_PATH, R_NONE, UL &Visual, "" },
-  /*
-   ** .pp
-   ** Specifies the visual editor to invoke when the \fI~v\fP command is
-   ** given in the builtin editor.
-   */
   {"wait_key", DT_BOOL, R_NONE, OPTWAITKEY, "yes" },
   /*
    ** .pp
@@ -3734,8 +3724,8 @@ struct option_t MuttVars[] = {
   /*
    ** .pp
    ** If $$xterm_set_titles is \fIset\fP, this string will be used to
-   ** set the title when leaving mutt-ng. For terminal-based programs,
-   ** there's no easy and portable way to read the current title so mutt-ng
+   ** set the title when leaving Mutt-ng. For terminal-based programs,
+   ** there's no easy and portable way to read the current title so Mutt-ng
    ** cannot read it upon startup and restore it when exiting.
    **
    ** .pp
@@ -3752,7 +3742,6 @@ struct option_t MuttVars[] = {
    ** to the one used by ``$$status_format''.
    */
 #ifdef USE_NNTP
-  {"x_comment_to", DT_SYN, R_NONE, UL "nntp_x_comment_to", 0},
   {"nntp_x_comment_to", DT_BOOL, R_NONE, OPTXCOMMENTTO, "no" },
   /*
    ** .pp
@@ -3765,151 +3754,60 @@ struct option_t MuttVars[] = {
    */
 #endif
   /*--*/
-  { NULL }
+  { NULL, -1, R_NONE, -1, NULL }
 };
 
-const struct feature_t Features[] = {
-  {"ncurses",
+static const char* Features[] = {
 #ifdef NCURSES_VERSION
-   1
-#else
-   0
+  "ncurses",
 #endif
-   }, {"slang",
 #ifdef USE_SLANG_CURSES
-   1
-#else
-   0
+  "slang",
 #endif
-   }, {"iconv",
 #ifdef _LIBICONV_VERSION
-   1
-#else
-   0
+  "iconv",
 #endif
-   }, {"idn",
 #ifdef HAVE_LIBIDN
-   1
-#else
-   0
+  "idn",
 #endif
-   }, {"dotlock",
 #ifdef USE_DOTLOCK
-   1
-#else
-   0
+  "dotlock",
 #endif
-   }, {"standalone",
-#ifdef DL_STANDALONE
-   1
-#else
-   0
-#endif
-   }, {"pop",
-#ifdef USE_POP
-   1
-#else
-   0
-#endif
-   }, {"nntp",
 #ifdef USE_NNTP
-   1
-#else
-   0
+  "nntp",
 #endif
-   }, {"imap",
-#ifdef USE_IMAP
-   1
-#else
-   0
-#endif
-   }, {"ssl",
 #ifdef USE_SSL
-   1
-#else
-   0
+  "ssl",
 #endif
-   }, {"gnutls",
 #ifdef USE_GNUTLS
-   1
-#else
-   0
+  "gnutls",
 #endif
-   }, {"sasl",
 #ifdef USE_SASL
-   1
-#else
-   0
+  "sasl",
 #endif
-   }, {"sasl2",
-#ifdef USE_SASL2
-   1
-#else
-   0
-#endif
-   }, {"libesmtp",
 #ifdef USE_LIBESMTP
-   1
-#else
-   0
+  "libesmtp",
 #endif
-   }, {"compressed",
-#ifdef USE_COMPRESSED
-   1
-#else
-   0
-#endif
-   }, {"color",
 #ifdef HAVE_COLOR
-   1
-#else
-   0
+  "color",
 #endif
-   }, {"classic_pgp",
-#ifdef CRYPT_BACKEND_CLASSIC_PGP
-   1
-#else
-   0
-#endif
-   }, {"classic_smime",
-#ifdef CRYPT_BACKEND_CLASSIC_SMIME
-   1
-#else
-   0
-#endif
-   }, {"gpgme",
 #ifdef CRYPT_BACKEND_GPGME
-   1
-#else
-   0
+  "gpgme",
 #endif
-   }, {"header_cache",
 #ifdef USE_HCACHE
-   1
-#else
-   0
+  "header_cache",
 #endif
-   }, {"qdbm",
 #ifdef HAVE_QDBM
-   1
-#else
-   0
+  "qdbm",
 #endif
-   }, {"gdbm",
 #ifdef HAVE_GDBM
-   1
-#else
-   0
+  "gdbm",
 #endif
-   }, {"db4",
 #ifdef HAVE_DB4
-   1
-#else
-   0
+  "db4",
 #endif
-   },
   /* last */
-  {NULL, 0}
+  NULL
 };
 
 const struct mapping_t SortMethods[] = {
@@ -3952,14 +3850,14 @@ const struct mapping_t SortBrowserMethods[] = {
   {"date", SORT_DATE},
   {"size", SORT_SIZE},
   {"unsorted", SORT_ORDER},
-  {NULL}
+  {NULL, 0}
 };
 
 const struct mapping_t SortAliasMethods[] = {
   {"alias", SORT_ALIAS},
   {"address", SORT_ADDRESS},
   {"unsorted", SORT_ORDER},
-  {NULL}
+  {NULL, 0}
 };
 
 const struct mapping_t SortKeyMethods[] = {
@@ -3967,7 +3865,7 @@ const struct mapping_t SortKeyMethods[] = {
   {"date", SORT_DATE},
   {"keyid", SORT_KEYID},
   {"trust", SORT_TRUST},
-  {NULL}
+  {NULL, 0}
 };
 
 
@@ -3976,7 +3874,8 @@ const struct mapping_t SortKeyMethods[] = {
 static int parse_list (BUFFER *, BUFFER *, unsigned long, BUFFER *);
 static int parse_spam_list (BUFFER *, BUFFER *, unsigned long, BUFFER *);
 static int parse_unlist (BUFFER *, BUFFER *, unsigned long, BUFFER *);
-
+static int parse_attachments (BUFFER *, BUFFER *, unsigned long, BUFFER *);
+static int parse_unattachments (BUFFER *, BUFFER *, unsigned long, BUFFER *);
 static int parse_lists (BUFFER *, BUFFER *, unsigned long, BUFFER *);
 static int parse_unlists (BUFFER *, BUFFER *, unsigned long, BUFFER *);
 static int parse_alias (BUFFER *, BUFFER *, unsigned long, BUFFER *);
@@ -3995,18 +3894,17 @@ static int parse_alternates (BUFFER *, BUFFER *, unsigned long, BUFFER *);
 static int parse_unalternates (BUFFER *, BUFFER *, unsigned long, BUFFER *);
 
 struct command_t {
-  char *name;
+  const char *name;
   int (*func) (BUFFER *, BUFFER *, unsigned long, BUFFER *);
   unsigned long data;
-  unsigned long data1;
 };
 
 struct command_t Commands[] = {
   {"alternates", parse_alternates, 0},
+  {"attachments", parse_attachments, 0 },
+  {"unattachments",parse_unattachments,0 },
   {"unalternates", parse_unalternates, 0},
-#ifdef USE_SOCKET
   {"account-hook", mutt_parse_hook, M_ACCOUNTHOOK},
-#endif
   {"alias", parse_alias, 0},
   {"auto_view", parse_list, UL &AutoViewList},
   {"alternative_order", parse_list, UL &AlternativeOrderList},
@@ -4020,11 +3918,9 @@ struct command_t Commands[] = {
   {"fcc-hook", mutt_parse_hook, M_FCCHOOK},
   {"fcc-save-hook", mutt_parse_hook, M_FCCHOOK|M_SAVEHOOK},
   {"folder-hook", mutt_parse_hook, M_FOLDERHOOK},
-#ifdef USE_COMPRESSED
   {"open-hook", mutt_parse_hook, M_OPENHOOK},
   {"close-hook", mutt_parse_hook, M_CLOSEHOOK},
   {"append-hook", mutt_parse_hook, M_APPENDHOOK},
-#endif
   {"hdr_order", parse_list, UL &HeaderOrderList},
   {"ifdef", parse_ifdef, 1},
   {"ifndef", parse_ifdef, 0},
@@ -4069,5 +3965,5 @@ struct command_t Commands[] = {
   {"unscore", mutt_parse_unscore, 0},
   {"unset", parse_set, M_SET_UNSET},
   {"unsubscribe", parse_unsubscribe, 0},
-  {NULL}
+  {NULL, NULL, 0}
 };