rationalize the hcache patch.
[apps/madmutt.git] / lib-mx / mx.c
index 96dab2c..b58a621 100644 (file)
 
 #include <utime.h>
 
 
 #include <utime.h>
 
+#include <lib-lua/lib-lua.h>
 #include <lib-sys/unix.h>
 #include <lib-mime/mime.h>
 #include <lib-ui/sidebar.h>
 
 #include "mutt.h"
 #include <lib-sys/unix.h>
 #include <lib-mime/mime.h>
 #include <lib-ui/sidebar.h>
 
 #include "mutt.h"
+#include "crypt.h"
 #include "pattern.h"
 #include "buffy.h"
 #include "mx.h"
 #include "pattern.h"
 #include "buffy.h"
 #include "mx.h"
@@ -36,8 +38,6 @@
 #include <nntp/nntp.h>
 #endif
 
 #include <nntp/nntp.h>
 #endif
 
-#include <lib-crypt/crypt.h>
-
 static mx_t const *mxfmts[] = {
     &mbox_mx,
     &mmdf_mx,
 static mx_t const *mxfmts[] = {
     &mbox_mx,
     &mmdf_mx,
@@ -69,15 +69,14 @@ static int invoke_dotlock (const char *path, int flags, int retry)
 
   mutt_quote_filename (f, sizeof (f), path);
 
 
   mutt_quote_filename (f, sizeof (f), path);
 
-  snprintf (cmd, sizeof (cmd),
-            "%s %s%s%s%s%s%s%s",
-            NONULL (MuttDotlock),
-            flags & DL_FL_TRY ? "-t " : "",
-            flags & DL_FL_UNLOCK ? "-u " : "",
-            flags & DL_FL_USEPRIV ? "-p " : "",
-            flags & DL_FL_FORCE ? "-f " : "",
-            flags & DL_FL_UNLINK ? "-d " : "",
-            flags & DL_FL_RETRY ? r : "", f);
+  snprintf(cmd, sizeof(cmd), "%s %s%s%s%s%s%s%s",
+           MCore.dotlock,
+           flags & DL_FL_TRY ? "-t " : "",
+           flags & DL_FL_UNLOCK ? "-u " : "",
+           flags & DL_FL_USEPRIV ? "-p " : "",
+           flags & DL_FL_FORCE ? "-f " : "",
+           flags & DL_FL_UNLINK ? "-d " : "",
+           flags & DL_FL_RETRY ? r : "", f);
 
   return mutt_system (cmd);
 }
 
   return mutt_system (cmd);
 }
@@ -553,9 +552,9 @@ void mx_fastclose_mailbox (CONTEXT * ctx)
   if (MX_IDX(ctx->magic-1) && mxfmts[ctx->magic-1]->mx_fastclose_mailbox)
     mxfmts[ctx->magic-1]->mx_fastclose_mailbox(ctx);
   if (ctx->subj_hash)
   if (MX_IDX(ctx->magic-1) && mxfmts[ctx->magic-1]->mx_fastclose_mailbox)
     mxfmts[ctx->magic-1]->mx_fastclose_mailbox(ctx);
   if (ctx->subj_hash)
-    hash_destroy (&ctx->subj_hash, NULL);
+    hash_delete (&ctx->subj_hash, NULL);
   if (ctx->id_hash)
   if (ctx->id_hash)
-    hash_destroy (&ctx->id_hash, NULL);
+    hash_delete (&ctx->id_hash, NULL);
   mutt_clear_threads (ctx);
   for (i = 0; i < ctx->msgcount; i++)
     header_delete(&ctx->hdrs[i]);
   mutt_clear_threads (ctx);
   for (i = 0; i < ctx->msgcount; i++)
     header_delete(&ctx->hdrs[i]);
@@ -907,10 +906,10 @@ void mx_update_tables (CONTEXT * ctx, int committing)
                       ctx->hdrs[i]->content->hdr_offset);
       /* remove message from the hash tables */
       if (ctx->subj_hash && ctx->hdrs[i]->env->real_subj)
                       ctx->hdrs[i]->content->hdr_offset);
       /* remove message from the hash tables */
       if (ctx->subj_hash && ctx->hdrs[i]->env->real_subj)
-        hash_delete (ctx->subj_hash, ctx->hdrs[i]->env->real_subj,
+        hash_remove (ctx->subj_hash, ctx->hdrs[i]->env->real_subj,
                      ctx->hdrs[i], NULL);
       if (ctx->id_hash && ctx->hdrs[i]->env->message_id)
                      ctx->hdrs[i], NULL);
       if (ctx->id_hash && ctx->hdrs[i]->env->message_id)
-        hash_delete (ctx->id_hash, ctx->hdrs[i]->env->message_id,
+        hash_remove (ctx->id_hash, ctx->hdrs[i]->env->message_id,
                      ctx->hdrs[i], NULL);
       header_delete(&ctx->hdrs[i]);
     }
                      ctx->hdrs[i], NULL);
       header_delete(&ctx->hdrs[i]);
     }
@@ -1081,7 +1080,7 @@ MESSAGE *mx_open_new_message (CONTEXT * dest, HEADER * hdr, int flags)
           p = hdr->env->from;
       }
 
           p = hdr->env->from;
       }
 
-      fprintf (msg->fp, "From %s %s", p ? p->mailbox : NONULL (Username),
+      fprintf (msg->fp, "From %s %s", p ? p->mailbox : NONULL(MCore.username),
                ctime (&msg->received));
     }
   }
                ctime (&msg->received));
     }
   }
@@ -1270,10 +1269,10 @@ void mx_update_context (CONTEXT * ctx, int new_messages)
 
     /* add this message to the hash tables */
     if (ctx->id_hash && h->env->message_id)
 
     /* add this message to the hash tables */
     if (ctx->id_hash && h->env->message_id)
-      hash_insert (ctx->id_hash, h->env->message_id, h, 0);
+      hash_insert (ctx->id_hash, h->env->message_id, h);
     if (!ctx->counting) {
       if (ctx->subj_hash && h->env->real_subj)
     if (!ctx->counting) {
       if (ctx->subj_hash && h->env->real_subj)
-        hash_insert (ctx->subj_hash, h->env->real_subj, h, 1);
+        hash_insert (ctx->subj_hash, h->env->real_subj, h);
 
       if (option (OPTSCORE))
         mutt_score_message (ctx, h, 0);
 
       if (option (OPTSCORE))
         mutt_score_message (ctx, h, 0);