X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-lua%2Fmadmutt.cpkg;fp=lib-lua%2Fmadmutt.cpkg;h=89ff6f2153b7e86b6558d01d51c6cc34d187af5e;hp=aefb74ff0612251fceec7ae294fd48e399a3cc2f;hb=558b0bd9de90a9dc28f409d8f46679bf48c72ded;hpb=892df7e70376da43374d834b8a825ea2d59efd06 diff --git a/lib-lua/madmutt.cpkg b/lib-lua/madmutt.cpkg index aefb74f..89ff6f2 100644 --- a/lib-lua/madmutt.cpkg +++ b/lib-lua/madmutt.cpkg @@ -31,6 +31,18 @@ static const char *madmutt_init_shell(void) return pw ? pw->pw_shell : (getenv("SHELL") ?: "/bin/sh"); } +static const char *madmutt_init_username(void) +{ + struct passwd *pw = getpwuid(getuid()); + return pw ? pw->pw_name : (getenv("USER") ?: "john_doe"); +} + +static const char *madmutt_init_homedir(void) +{ + struct passwd *pw = getpwuid(getuid()); + return pw ? pw->pw_dir : (getenv("HOME") ?: "/"); +} + static const char *madmutt_pwd(void) { char path[_POSIX_PATH_MAX]; @@ -87,6 +99,9 @@ static const char *luaM_path_post(const char *val) path_t dotlock = BINDIR "/mutt_dotlock"; path_t editor = getenv("VISUAL") ?: getenv("EDITOR") ?: "vi"; path_t shell = madmutt_init_shell(); + path_t username = madmutt_init_username(); + path_t homedir = madmutt_init_homedir(); + path_t tmpdir = getenv("TMPDIR") ?: "/tmp"; quadopt_t quit = M_YES; bool beep = 1; @@ -96,7 +111,7 @@ static const char *luaM_path_post(const char *val) } MCore; @package MTransport { - path_t sendmail = SENDMAIL " -eom -oi"; + path_t sendmail = SENDMAIL " -eom -oi"; string_t dsn_notify = NULL; string_t dsn_return = NULL;