X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-lua%2Fmadmutt.cpkg;h=5c2ebe7f21d0af7dd56a9f8751133515e914c793;hp=d083405b8bbaacd2400ac636efec04da9303b9cf;hb=378ab81aa9abf4db714638c3e2e786e6cc58d2b1;hpb=b6980caf7b13994c57957872876cdecc21e54a82 diff --git a/lib-lua/madmutt.cpkg b/lib-lua/madmutt.cpkg index d083405..5c2ebe7 100644 --- a/lib-lua/madmutt.cpkg +++ b/lib-lua/madmutt.cpkg @@ -54,10 +54,16 @@ static char *madmutt_init_shorthost(void) /* some systems report the FQDN instead of just the hostname */ uname(&utsname); - p = strchrnul(utsname.nodename, '.'); + p = m_strchrnul(utsname.nodename, '.'); return p_dupstr(utsname.nodename, p - utsname.nodename); } +static char *madmutt_init_os(void) +{ + struct utsname un; + return m_strdup(uname(&un) < 0 ? "Unix" : un.sysname); +} + static char *madmutt_init_hostname(void) { char buffer[STRING]; @@ -66,13 +72,13 @@ static char *madmutt_init_hostname(void) return m_strdup("@"); if (*buffer != '@') { - int len = m_strlen(buffer) + m_strlen(MCore.shorthost) + 2; + int len = m_strlen(buffer) + m_strlen(mod_core.shorthost) + 2; char *res = p_new(char, len); - snprintf(res, len, "%s.%s", NONULL(MCore.shorthost), buffer); + snprintf(res, len, "%s.%s", NONULL(mod_core.shorthost), buffer); return res; } - return m_strdup(NONULL(MCore.shorthost)); + return m_strdup(NONULL(mod_core.shorthost)); } #if defined(HAVE_QDBM) @@ -85,7 +91,7 @@ static char *madmutt_init_hostname(void) # define HCACHE_BACKEND NULL #endif -@package MCore { +@package mod_core { /* ** .pp ** \fIThis is a read-only system property and specifies madmutt's @@ -137,6 +143,16 @@ static char *madmutt_init_hostname(void) */ path_t shell = madmutt_init_shell(); + /* + ** .pp + ** This specifies the operating system name for the \fTUser-Agent:\fP header field. If + ** this is \fIunset\fP, it will be set to the operating system name that \fTuname(2)\fP + ** returns. If \fTuname(2)\fP fails, ``UNIX'' will be used. + ** .pp + ** It may, for example, look as: ``\fTMadmutt 1.5.9i (Linux)\fP''. + */ + string_t operating_system = madmutt_init_os(); + path_t username = madmutt_init_username(); path_t homedir = madmutt_init_homedir();