From: Pierre Habouzit Date: Mon, 26 Mar 2007 23:50:48 +0000 (+0200) Subject: Reinstate some lost functions. X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=e80bef3a43b0f679b6fff30cbecce56539b7980e;p=apps%2Fmadmutt.git Reinstate some lost functions. Signed-off-by: Pierre Habouzit --- diff --git a/lib-lua/madmutt.cpkg b/lib-lua/madmutt.cpkg index 10cb39f..65ad756 100644 --- a/lib-lua/madmutt.cpkg +++ b/lib-lua/madmutt.cpkg @@ -176,6 +176,48 @@ static char *madmutt_init_homedir(void) 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 ?: "")); + } + }; }; @package MTransport {