Nico Golde:
[apps/madmutt.git] / sendlib.c
index 0766b2b..cade3dc 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -28,6 +28,7 @@
 #include "lib/mem.h"
 #include "lib/str.h"
 #include "lib/intl.h"
+#include "lib/debug.h"
 
 #include <string.h>
 #include <stdlib.h>
@@ -456,9 +457,7 @@ int mutt_write_mime_body (BODY * a, FILE * f)
   if (a->type == TYPEMULTIPART) {
     /* First, find the boundary to use */
     if (!(p = mutt_get_parameter ("boundary", a->parameter))) {
-      dprint (1,
-              (debugfile,
-               "mutt_write_mime_body(): no boundary parameter found!\n"));
+      debug_print (1, ("no boundary parameter found!\n"));
       mutt_error _("No boundary parameter found! [report this error]");
 
       return (-1);
@@ -486,9 +485,7 @@ int mutt_write_mime_body (BODY * a, FILE * f)
   }
 
   if ((fpin = fopen (a->filename, "r")) == NULL) {
-    dprint (1,
-            (debugfile, "write_mime_body: %s no longer exists!\n",
-             a->filename));
+    debug_print (1, ("%s no longer exists!\n", a->filename));
     mutt_error (_("%s no longer exists!"), a->filename);
     return -1;
   }
@@ -898,8 +895,7 @@ CONTENT *mutt_get_content_info (const char *fname, BODY * b)
   }
 
   if ((fp = fopen (fname, "r")) == NULL) {
-    dprint (1, (debugfile, "mutt_get_content_info: %s: %s (errno %d).\n",
-                fname, strerror (errno), errno));
+    debug_print (1, ("%s: %s (errno %d).\n", fname, strerror (errno), errno));
     return (NULL);
   }
 
@@ -974,16 +970,13 @@ int mutt_lookup_mime_type (BODY * att, const char *path)
       snprintf (buf, sizeof (buf), "%s/.mime.types", NONULL (Homedir));
       break;
     case 1:
-      strfcpy (buf, SYSCONFDIR "/mime.types", sizeof (buf));
+      strfcpy (buf, SYSCONFDIR "/muttng-mime.types", sizeof (buf));
       break;
     case 2:
       strfcpy (buf, PKGDATADIR "/mime.types", sizeof (buf));
       break;
     default:
-      dprint (1,
-              (debugfile,
-               "mutt_lookup_mime_type: Internal error, count = %d.\n",
-               count));
+      debug_print (1, ("Internal error, count = %d.\n", count));
       goto bye;                 /* shouldn't happen */
     }
 
@@ -1847,12 +1840,8 @@ char *mutt_gen_msgid (void)
   char buf[SHORT_STRING];
   char localpart[SHORT_STRING];
   unsigned int localpart_length;
-  time_t now;
-  struct tm *tm;
   const char *fqdn;
 
-  now = time (NULL);
-  tm = gmtime (&now);
   if (!(fqdn = mutt_fqdn (0)))
     fqdn = NONULL (Hostname);
 
@@ -2253,7 +2242,7 @@ void mutt_prepare_envelope (ENVELOPE * env, int final)
 
     mutt_set_followup_to (env);
 
-    if (!env->message_id)
+    if (!env->message_id && MsgIdFormat && *MsgIdFormat)
       env->message_id = mutt_gen_msgid ();
   }
 
@@ -2328,7 +2317,8 @@ static int _mutt_bounce_message (FILE * fp, HEADER * h, ADDRESS * to,
     fseek (fp, h->offset, 0);
     fprintf (f, "Resent-From: %s", resent_from);
     fprintf (f, "\nResent-%s", mutt_make_date (date, sizeof (date)));
-    fprintf (f, "Resent-Message-ID: %s\n", mutt_gen_msgid ());
+    if (MsgIdFormat && *MsgIdFormat)
+      fprintf (f, "Resent-Message-ID: %s\n", mutt_gen_msgid ());
     fputs ("Resent-To: ", f);
     mutt_write_address_list (to, f, 11, 0);
     mutt_copy_header (fp, h, f, ch_flags, NULL);
@@ -2397,8 +2387,7 @@ ADDRESS *mutt_remove_duplicates (ADDRESS * addr)
     }
 
     if (dup) {
-      dprint (2, (debugfile, "mutt_remove_duplicates: Removing %s\n",
-                  addr->mailbox));
+      debug_print (2, ("Removing %s\n", addr->mailbox));
 
       *last = addr->next;
 
@@ -2443,10 +2432,7 @@ int mutt_write_fcc (const char *path, HEADER * hdr, const char *msgid,
     set_noconv_flags (hdr->content, 1);
 
   if (mx_open_mailbox (path, M_APPEND | M_QUIET, &f) == NULL) {
-    dprint (1,
-            (debugfile,
-             "mutt_write_fcc(): unable to open mailbox %s in append-mode, aborting.\n",
-             path));
+    debug_print (1, ("unable to open mailbox %s in append-mode, aborting.\n", path));
     return (-1);
   }
 
@@ -2561,8 +2547,7 @@ int mutt_write_fcc (const char *path, HEADER * hdr, const char *msgid,
 
     fflush (tempfp);
     if (ferror (tempfp)) {
-      dprint (1,
-              (debugfile, "mutt_write_fcc(): %s: write failed.\n", tempfile));
+      debug_print (1, ("%s: write failed.\n", tempfile));
       fclose (tempfp);
       unlink (tempfile);
       mx_commit_message (msg, &f);      /* XXX - really? */