simplify build system
[apps/madmutt.git] / mx.c
diff --git a/mx.c b/mx.c
index 28ba348..a63b28f 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -48,7 +48,7 @@
 #include "dotlock.h"
 #endif
 
-#include "mutt_crypt.h"
+#include <lib-crypt/crypt.h>
 
 #include "lib/list.h"
 #include "lib/debug.h"
@@ -592,7 +592,7 @@ void mx_fastclose_mailbox (CONTEXT * ctx)
     hash_destroy (&ctx->id_hash, NULL);
   mutt_clear_threads (ctx);
   for (i = 0; i < ctx->msgcount; i++)
-    mutt_free_header (&ctx->hdrs[i]);
+    header_delete(&ctx->hdrs[i]);
   p_delete(&ctx->hdrs);
   p_delete(&ctx->v2r);
 
@@ -947,7 +947,7 @@ void mx_update_tables (CONTEXT * ctx, int committing)
       if (ctx->id_hash && ctx->hdrs[i]->env->message_id)
         hash_delete (ctx->id_hash, ctx->hdrs[i]->env->message_id,
                      ctx->hdrs[i], NULL);
-      mutt_free_header (&ctx->hdrs[i]);
+      header_delete(&ctx->hdrs[i]);
     }
   }
 #undef this_body
@@ -1423,3 +1423,27 @@ int mx_rebuild_cache (void) {
   return (0);
 #endif
 }
+
+void mutt_parse_mime_message (CONTEXT * ctx, HEADER * cur)
+{
+  MESSAGE *msg;
+  int flags = 0;
+
+  do {
+    if (cur->content->type != TYPEMESSAGE
+        && cur->content->type != TYPEMULTIPART)
+      break;                     /* nothing to do */
+
+    if (cur->content->parts)
+      break;                     /* The message was parsed earlier. */
+
+    if ((msg = mx_open_message (ctx, cur->msgno))) {
+      mutt_parse_part (msg->fp, cur->content);
+
+      cur->security = crypt_query (cur->content);
+
+      mx_close_message (&msg);
+    }
+  } while (0);
+  mutt_count_body_parts (cur, flags | M_PARTS_RECOUNT);
+}