simplify parse_parameters tokenizer
[apps/madmutt.git] / init.h
diff --git a/init.h b/init.h
index 0797555..ac29376 100644 (file)
--- a/init.h
+++ b/init.h
 #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;
+  const char *init;
 };
 
 #define UL (unsigned long)
@@ -81,21 +81,12 @@ struct option_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
@@ -108,9 +99,6 @@ struct option_t {
 # ifndef USE_DOTLOCK
 #  define USE_DOTLOCK
 # endif
-# ifndef DL_STANDALONE
-#  define DL_STANDALONE
-# endif
 # ifndef USE_HCACHE
 #  define USE_HCACHE
 # endif
@@ -597,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)
+#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
@@ -709,11 +697,6 @@ struct option_t MuttVars[] = {
   ** 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
-   ** Escape character to use for functions in the builtin editor.
-   */
   {"fast_reply", DT_BOOL, R_NONE, OPTFASTREPLY, "no" },
   /*
    ** .pp
@@ -1021,12 +1004,8 @@ struct option_t MuttVars[] = {
    ** 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
@@ -1051,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
@@ -1064,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
@@ -1078,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
@@ -1088,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
@@ -1106,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
@@ -1116,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
@@ -1133,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.
@@ -1146,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
@@ -1158,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,
@@ -1169,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
@@ -1190,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
@@ -1529,9 +1470,20 @@ struct option_t MuttVars[] = {
   /*
    ** .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
+   ** 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, "" },
   /*
@@ -1596,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
@@ -1918,7 +1871,6 @@ struct option_t MuttVars[] = {
    ** was connection lost.
    */
 #endif
-#ifdef USE_SOCKET
   { "net_inc", DT_NUM, R_NONE, UL &NetInc, "10" },
   /*
   ** .pp
@@ -1928,7 +1880,6 @@ struct option_t MuttVars[] = {
   ** .pp
   ** See also ``$$read_inc'' and ``$$write_inc''.
   */
-#endif 
   {"pager", DT_PATH, R_NONE, UL &Pager, "builtin"},
   /*
    ** .pp
@@ -2663,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
@@ -2738,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
@@ -2758,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
@@ -2770,18 +2714,12 @@ struct option_t MuttVars[] = {
   {"pop_checkinterval", DT_SYN, R_NONE, UL "pop_mail_check", 0},
   {"pop_mail_check", DT_NUM, R_NONE, UL &PopCheckTimeout, "60" },
   /*
-   ** .pp
-   ** Availability: POP
-   **
    ** .pp
    ** 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
@@ -2789,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.:
@@ -2804,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
@@ -2814,18 +2746,12 @@ 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 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
@@ -2833,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.
@@ -2844,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
@@ -2880,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
@@ -2898,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
@@ -3662,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
@@ -3675,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
@@ -3739,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
@@ -3842,7 +3754,7 @@ struct option_t MuttVars[] = {
    */
 #endif
   /*--*/
-  { NULL }
+  { NULL, -1, R_NONE, -1, NULL }
 };
 
 static const char* Features[] = {
@@ -3861,18 +3773,9 @@ static const char* Features[] = {
 #ifdef USE_DOTLOCK
   "dotlock",
 #endif
-#ifdef DL_STANDALONE
-  "standalone",
-#endif
-#ifdef USE_POP
-  "pop",
-#endif
 #ifdef USE_NNTP
   "nntp",
 #endif
-#ifdef USE_IMAP
-  "imap",
-#endif
 #ifdef USE_SSL
   "ssl",
 #endif
@@ -3885,18 +3788,9 @@ static const char* Features[] = {
 #ifdef USE_LIBESMTP
   "libesmtp",
 #endif
-#ifdef USE_COMPRESSED
-  "compessed",
-#endif
 #ifdef HAVE_COLOR
   "color",
 #endif
-#ifdef CRYPT_BACKEND_CLASSIC_PGP
-  "classic_pgp",
-#endif
-#ifdef CRYPT_BACKEND_CLASSIC_SMIME
-  "class_smime",
-#endif
 #ifdef CRYPT_BACKEND_GPGME
   "gpgme",
 #endif
@@ -3956,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[] = {
@@ -3971,7 +3865,7 @@ const struct mapping_t SortKeyMethods[] = {
   {"date", SORT_DATE},
   {"keyid", SORT_KEYID},
   {"trust", SORT_TRUST},
-  {NULL}
+  {NULL, 0}
 };
 
 
@@ -4000,10 +3894,9 @@ 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[] = {
@@ -4011,9 +3904,7 @@ struct command_t Commands[] = {
   {"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},
@@ -4027,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},
@@ -4076,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}
 };