From: Elimar Riesebieter
[apps/madmutt.git] / init.h
diff --git a/init.h b/init.h
index fd3d191..ef0068d 100644 (file)
--- a/init.h
+++ b/init.h
@@ -18,6 +18,9 @@
 #endif
 
 #include "buffy.h"
+#include "mutt.h"
+#include "version.h"
+#include "lib/debug.h"
 
 #ifndef _MAKEDOC
 #define DT_MASK         0x0f
@@ -31,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)
 
@@ -66,11 +70,6 @@ struct option_t {
   char* init;
 };
 
-struct feature_t {
-  char *name;
-  short builtin;
-};
-
 #define UL (unsigned long)
 
 #endif /* _MAKEDOC */
@@ -244,7 +243,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
@@ -254,7 +252,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
@@ -377,7 +374,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
@@ -514,6 +510,24 @@ struct option_t MuttVars[] = {
    ** rest of the string are expanded in the \fIC\fP locale (that is in US
    ** English).
    */
+#ifdef DEBUG
+  {"debug_level", DT_NUM, R_NONE, UL &DebugLevel, "1" },
+  /*
+   ** .pp
+   ** Availability: debug
+   **
+   ** .pp
+   ** This variable specifies the current debug level and
+   ** may be used to increase or decrease the verbosity level
+   ** during runtime. It overrides the level given with the
+   ** \fT-d\fP command line option.
+   **
+   ** .pp
+   ** Currently, this number must be >= 0 and <= 5 and muttng
+   ** must be started with \fT-d\fP to enable debugging at all;
+   ** enabling at runtime is not possible.
+   */
+#endif
   {"default_hook", DT_STR, R_NONE, UL &DefaultHook, "~f %s !~P | (~P ~C %s)"},
   /*
    ** .pp
@@ -570,7 +584,7 @@ struct option_t MuttVars[] = {
    ** 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"},
+  {"dotlock_program", DT_PATH, R_NONE, UL &MuttDotlock, "$muttng_bindir/muttng_dotlock"},
   /*
    ** .pp
    ** Availability: Standalone and Dotlock
@@ -620,6 +634,25 @@ struct option_t MuttVars[] = {
    ** .pp
    ** This option allows you to edit the header of your outgoing messages
    ** along with the body of your message.
+   **
+   ** .pp
+   ** Which empty header fields to show is controlled by the
+   ** $$editor_headers option.
+   */
+#ifdef USE_NNTP
+  {"editor_headers", DT_STR, R_NONE, UL &EditorHeaders, "From: To: Cc: Bcc: Subject: Reply-To: Newsgroups: Followup-To: X-Comment-To:" },
+#else
+  {"editor_headers", DT_STR, R_NONE, UL &EditorHeaders, "From: To: Cc: Bcc: Subject: Reply-To:" },
+#endif
+  /*
+   ** .pp
+   ** If $$edit_headers is \fIset\fP, this space-separated list specifies
+   ** which \fInon-empty\fP header fields to edit in addition to
+   ** user-defined headers.
+   **
+   ** .pp
+   ** Note: if $$edit_headers had to be turned on by force because
+   ** $$strict_mailto is \fIunset\fP, this option has no effect.
    */
   {"editor", DT_PATH, R_NONE, UL &Editor, "" },
   /*
@@ -637,22 +670,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.
+   ** 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
+   ** \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.
+  */
   {"escape", DT_STR, R_NONE, UL &EscChar, "~"},
   /*
    ** .pp
@@ -749,7 +791,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
@@ -819,7 +860,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.
    */
@@ -839,7 +880,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
@@ -922,7 +962,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" },
   /*
@@ -1241,7 +1281,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
@@ -1416,6 +1455,74 @@ 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 last part of the full path or URI of the
+   ** folder currently open (if any), i.e. everything after
+   ** the last ``/''.\fP
+   */
+  {"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
@@ -1459,7 +1566,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
@@ -1587,7 +1694,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
@@ -1682,7 +1788,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
@@ -1696,7 +1801,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
@@ -1718,7 +1822,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
@@ -1778,7 +1881,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
@@ -1799,6 +1901,17 @@ struct option_t MuttVars[] = {
    ** was connection lost.
    */
 #endif
+#ifdef USE_SOCKET
+  { "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''.
+  */
+#endif 
   {"pager", DT_PATH, R_NONE, UL &Pager, "builtin"},
   /*
    ** .pp
@@ -2425,20 +2538,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
@@ -2491,7 +2592,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
@@ -2734,7 +2835,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
@@ -3110,7 +3210,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
@@ -3122,7 +3221,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
@@ -3134,7 +3232,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
@@ -3420,7 +3517,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.
@@ -3446,19 +3543,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.
   **/
@@ -3696,8 +3795,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
@@ -3714,7 +3813,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
@@ -3730,148 +3828,75 @@ struct option_t MuttVars[] = {
   { 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
+  "standalone",
 #endif
-   }, {"pop",
 #ifdef USE_POP
-   1
-#else
-   0
+  "pop",
 #endif
-   }, {"nntp",
 #ifdef USE_NNTP
-   1
-#else
-   0
+  "nntp",
 #endif
-   }, {"imap",
 #ifdef USE_IMAP
-   1
-#else
-   0
+  "imap",
 #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
-#endif
-   }, {"sasl2",
-#ifdef USE_SASL2
-   1
-#else
-   0
+  "sasl",
 #endif
-   }, {"libesmtp",
 #ifdef USE_LIBESMTP
-   1
-#else
-   0
+  "libesmtp",
 #endif
-   }, {"compressed",
 #ifdef USE_COMPRESSED
-   1
-#else
-   0
+  "compessed",
 #endif
-   }, {"color",
 #ifdef HAVE_COLOR
-   1
-#else
-   0
+  "color",
 #endif
-   }, {"classic_pgp",
 #ifdef CRYPT_BACKEND_CLASSIC_PGP
-   1
-#else
-   0
+  "classic_pgp",
 #endif
-   }, {"classic_smime",
 #ifdef CRYPT_BACKEND_CLASSIC_SMIME
-   1
-#else
-   0
+  "class_smime",
 #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[] = {