Simplify sidebar code
[apps/madmutt.git] / commands.c
index dc0a6f4..b649356 100644 (file)
@@ -8,25 +8,9 @@
  * please see the file GPL in the top level source directory.
  */
 
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/wait.h>
-#include <sys/stat.h>
-#include <sys/types.h>
+#include <lib-lib/lib-lib.h>
 #include <utime.h>
 
-#include <lib-lib/mem.h>
-#include <lib-lib/file.h>
-#include <lib-lib/macros.h>
-#include <lib-lib/ascii.h>
-#include <lib-lib/debug.h>
-
 #include <lib-mime/mime.h>
 
 #include <lib-sys/exit.h>
@@ -37,6 +21,7 @@
 #include <lib-ui/menu.h>
 
 #include "mutt.h"
+#include "alias.h"
 #include "recvattach.h"
 #include "sort.h"
 #include "copy.h"
@@ -44,7 +29,6 @@
 #include "pager.h"
 #include <lib-crypt/crypt.h>
 #include "mutt_idna.h"
-#include "rfc1524.h"
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -143,7 +127,6 @@ int mutt_display_message (HEADER * cur)
                              (option (OPTWEED) ? (CH_WEED | CH_REORDER) : 0) |
                              CH_DECODE | CH_FROM);
     if (res == 0 && (ferror(fpout) || feof(fpout))) {
-      debug_print (1, ("_mutt_copy_message failed to detect EOF!\n"));
       res = -1;
     }
 
@@ -828,7 +811,6 @@ void mutt_edit_content_type (HEADER * h, BODY * b, FILE * fp)
   char buf[LONG_STRING];
   char obuf[LONG_STRING];
   char tmp[STRING];
-  PARAMETER *p;
 
   char charset[STRING];
   char *cp;
@@ -836,13 +818,14 @@ void mutt_edit_content_type (HEADER * h, BODY * b, FILE * fp)
   short charset_changed = 0;
   short type_changed = 0;
 
-  cp = mutt_get_parameter ("charset", b->parameter);
+  cp = parameter_getval(b->parameter, "charset");
   m_strcpy(charset, sizeof(charset), NONULL(cp));
 
   snprintf (buf, sizeof (buf), "%s/%s", TYPE (b), b->subtype);
   m_strcpy(obuf, sizeof(obuf), buf);
   if (b->parameter) {
-    size_t l;
+    parameter_t *p;
+    ssize_t l;
 
     for (p = b->parameter; p; p = p->next) {
       l = m_strlen(buf);
@@ -866,7 +849,7 @@ void mutt_edit_content_type (HEADER * h, BODY * b, FILE * fp)
   snprintf (tmp, sizeof (tmp), "%s/%s", TYPE (b), NONULL (b->subtype));
   type_changed = ascii_strcasecmp (tmp, obuf);
   charset_changed =
-    ascii_strcasecmp (charset, mutt_get_parameter ("charset", b->parameter));
+    ascii_strcasecmp (charset, parameter_getval(b->parameter, "charset"));
 
   /* if in send mode, check for conversion - current setting is default. */
 
@@ -874,7 +857,7 @@ void mutt_edit_content_type (HEADER * h, BODY * b, FILE * fp)
     int r;
 
     snprintf (tmp, sizeof (tmp), _("Convert to %s upon sending?"),
-              mutt_get_parameter ("charset", b->parameter));
+              parameter_getval(b->parameter, "charset"));
     if ((r = mutt_yesorno (tmp, !b->noconv)) != -1)
       b->noconv = (r == M_NO);
   }
@@ -888,14 +871,14 @@ void mutt_edit_content_type (HEADER * h, BODY * b, FILE * fp)
     if (type_changed)
       mutt_sleep (1);
     mutt_message (_("Character set changed to %s; %s."),
-                  mutt_get_parameter ("charset", b->parameter),
+                  parameter_getval(b->parameter, "charset"),
                   b->noconv ? _("not converting") : _("converting"));
   }
 
   b->force_charset |= charset_changed ? 1 : 0;
 
   if (!is_multipart(b) && b->parts)
-    mutt_free_body (&b->parts);
+    body_list_wipe(&b->parts);
   if (!mutt_is_message_type (b->type, b->subtype) && b->hdr) {
     b->hdr->content = NULL;
     header_delete(&b->hdr);