Deal with $hostname and $shorthost
[apps/madmutt.git] / sendlib.c
index 838b850..1802e1d 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -767,10 +767,10 @@ CONTENT *mutt_get_content_info (const char *fname, BODY * b)
 
   if (b != NULL && b->type == TYPETEXT && (!b->noconv && !b->force_charset)) {
     const char *chs = parameter_getval(b->parameter, "charset");
-    char *fchs = b->use_disp ? ((FileCharset && *FileCharset) ?
-                                FileCharset : Charset) : Charset;
-    if (Charset && (chs || SendCharset) &&
-        convert_file_from_to (fp, fchs, chs ? chs : SendCharset,
+    char *fchs = b->use_disp && !m_strisempty(MCharset.file_charset)
+        ? FileCharset : MCharset.charset;
+    if (MCharset.charset && (chs || MCharset.send_charset) &&
+        convert_file_from_to (fp, fchs, chs ? chs : MCharset.send_charset,
                               &fromcode, &tocode, info) != -1) {
       if (!chs) {
         charset_canonicalize (chsbuf, sizeof (chsbuf), tocode);
@@ -793,7 +793,8 @@ CONTENT *mutt_get_content_info (const char *fname, BODY * b)
   if (b != NULL && b->type == TYPETEXT && (!b->noconv && !b->force_charset))
     parameter_setval(&b->parameter, "charset",
                      (!info->hibin ? "us-ascii"
-                      : Charset && !charset_is_us_ascii(Charset) ? Charset : "unknown-8bit"));
+                      : MCharset.charset && !charset_is_us_ascii(MCharset.charset)
+                                         ? MCharset.charset : "unknown-8bit"));
 
   return info;
 }
@@ -1538,22 +1539,22 @@ static void encode_headers (string_list_t * h)
   }
 }
 
-const char *mutt_fqdn (short may_hide_host)
+const char *mutt_fqdn(short may_hide_host)
 {
   char *p = NULL, *q;
 
-  if (Fqdn && Fqdn[0] != '@') {
-    p = Fqdn;
+  if (MCore.hostname && MCore.hostname[0] != '@') {
+    p = MCore.hostname;
 
     if (may_hide_host && option (OPTHIDDENHOST)) {
-      if ((p = strchr (Fqdn, '.')))
+      if ((p = strchr(MCore.hostname, '.')))
         p++;
 
       /* sanity check: don't hide the host if
          the fqdn is something like detebe.org.  */
 
-      if (!p || !(q = strchr (p, '.')))
-        p = Fqdn;
+      if (!p || !(q = strchr(p, '.')))
+        p = MCore.hostname;
     }
   }
 
@@ -1656,7 +1657,7 @@ static char *mutt_gen_msgid (void)
     const char *fqdn;
 
     if (!(fqdn = mutt_fqdn(0)))
-        fqdn = NONULL(Hostname);
+        fqdn = NONULL(MCore.shorthost);
 
     mutt_gen_localpart(localpart, sizeof(localpart), MsgIdFormat);
     snprintf(buf, sizeof(buf), "<%s@%s>", localpart, fqdn);