+ /*
+ ** .pp
+ ** This variable allows you to specify where Madmutt will place its
+ ** temporary files needed for displaying and composing messages. If
+ ** this variable is not set, the environment variable \fT$$$TMPDIR\fP is
+ ** used. If \fT$$$TMPDIR\fP is not set then "\fT/tmp\fP" is used.
+ */
+ path_t tmpdir = m_strdup(getenv("TMPDIR") ?: "/tmp");
+ /*
+ ** .pp
+ ** A regular expression used by Madmutt to parse the GECOS field of a password
+ ** entry when expanding the alias. By default the regular expression is set
+ ** to ``\fT^[^,]*\fP'' which will return the string up to the first ``\fT,\fP'' encountered.
+ ** If the GECOS field contains a string like "lastname, firstname" then you
+ ** should do: \fTset gecos_mask=".*"\fP.
+ ** .pp
+ ** This can be useful if you see the following behavior: you address a e-mail
+ ** to user ID stevef whose full name is Steve Franklin. If Madmutt expands
+ ** stevef to ``Franklin'' stevef@foo.bar then you should set the gecos_mask to
+ ** a regular expression that will match the whole name so Madmutt will expand
+ ** ``Franklin'' to ``Franklin, Steve''.
+ */
+ rx_t gecos_mask = luaM_rxnew("^[^,]*");
+
+ /*
+ ** .pp
+ ** This variable controls whether ``quit'' and ``exit'' actually quit
+ ** from Madmutt. If it set to \fIyes\fP, they do quit, if it is set to \fIno\fP, they
+ ** have no effect, and if it is set to \fIask-yes\fP or \fIask-no\fP, you are
+ ** prompted for confirmation when you try to quit.
+ */
+ quadopt_t quit = M_YES;
+ /*
+ ** .pp
+ ** When this variable is \fIset\fP, Madmutt will beep when an error occurs.
+ */
+ bool beep = 1;
+ /*
+ ** .pp
+ ** When this variable is \fIset\fP, Madmutt will beep whenever it prints a message
+ ** notifying you of new mail. This is independent of the setting of the
+ ** ``$$beep'' variable.
+ */
+ bool beep_new = 0;
+
+ /*
+ ** .pp
+ ** When \fIset\fP, Madmutt will qualify all local addresses (ones without the
+ ** @host portion) with the value of ``$$hostname''. If \fIunset\fP, no
+ ** addresses will be qualified.
+ */
+ bool use_domain = 1;
+
+ /*
+ ** .pp
+ ** \fIThis is a read-only system property and, at runtime,
+ ** specifies the current working directory of the madmutt
+ ** binary.\fP
+ */
+ const string_t pwd(void) {
+ char path[_POSIX_PATH_MAX];
+ getcwd(path, sizeof(path));
+ RETURN(path);
+ };
+
+ /*
+ ** .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
+ */
+ const string_t folder_path(void) {
+ RETURN(CurrentFolder);
+ };
+
+ /*
+ ** .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, $$$madmutt_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.
+ */
+ const string_t folder_name(void) {
+ const char *p;
+
+ if (!m_strisempty(Maildir)
+ && m_strstart(CurrentFolder, Maildir, &p) && *p) {
+ while (*p == '/')
+ p++;
+ RETURN(p);
+ } else {
+ p = strchr(CurrentFolder ?: "", '/');
+ RETURN(p ? p + 1 : (CurrentFolder ?: ""));
+ }
+ };
+};