]> granicus.if.org Git - mutt/commitdiff
Introduce the $mh_purge option.
authorThomas Roessler <roessler@does-not-exist.org>
Tue, 22 Sep 1998 17:50:26 +0000 (17:50 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Tue, 22 Sep 1998 17:50:26 +0000 (17:50 +0000)
init.h
mh.c
mutt.h

diff --git a/init.h b/init.h
index 178a0178adde63a2891a6d0566f47c6ee2009c16..02c7acf9c20681ddb88f886e7b966624646f66d7 100644 (file)
--- a/init.h
+++ b/init.h
@@ -144,6 +144,7 @@ struct option_t MuttVars[] = {
   { "metoo",           DT_BOOL, R_NONE, OPTMETOO, 0 },
   { "menu_scroll",     DT_BOOL, R_NONE, OPTMENUSCROLL, 0 },
   { "meta_key",                DT_BOOL, R_NONE, OPTMETAKEY, 0 },
+  { "mh_purge",                DT_BOOL, R_NONE, OPTMHPURGE, 0 },
   { "mime_forward",    DT_QUAD, R_NONE, OPT_MIMEFWD, 0 },
   { "mime_forward_decode", DT_BOOL, R_NONE, OPTMIMEFORWDECODE, 0 },
   { "mime_fwd",                DT_SYN,  R_NONE, UL "mime_forward", 0 },
diff --git a/mh.c b/mh.c
index 3ea7f1581f48e35541f15a045fab2b07bc5a44fa..b8a90132ef1676a648e441c28c8d9c28dc22e4a2 100644 (file)
--- a/mh.c
+++ b/mh.c
@@ -131,7 +131,7 @@ void mh_parse_message (CONTEXT *ctx,
 /*
  * Mark all the mails in ctx read.
  */
-void tag_all_read (CONTEXT * ctx)
+static void tag_all_read (CONTEXT * ctx)
 {
   int i;
 
@@ -148,7 +148,7 @@ void tag_all_read (CONTEXT * ctx)
 /*
  * Mark one mail as unread
  */
-int tag_unread (CONTEXT * ctx, char *name)
+static int tag_unread (CONTEXT * ctx, char *name)
 {
   int i;
 
@@ -621,14 +621,18 @@ int mh_sync_mailbox (CONTEXT * ctx)
     if (ctx->hdrs[i]->deleted)
     {
       snprintf (path, sizeof (path), "%s/%s", ctx->path, ctx->hdrs[i]->path);
-      if (ctx->magic == M_MAILDIR)
+      if (ctx->magic == M_MAILDIR || (option (OPTMHPURGE) && ctx->magic == M_MH))
        unlink (path);
-      else
+      else if (ctx->magic == M_MH)
       {
        /* MH just moves files out of the way when you delete them */
-       snprintf (tmp, sizeof (tmp), "%s/,%s", ctx->path, ctx->hdrs[i]->path);
-       unlink (tmp);
-       rename (path, tmp);
+       if(*ctx->hdrs[i]->path != ',')
+       {
+         snprintf (tmp, sizeof (tmp), "%s/,%s", ctx->path, ctx->hdrs[i]->path);
+         unlink (tmp);
+         rename (path, tmp);
+       }
+         
       }
     }
     else if (ctx->hdrs[i]->changed || ctx->hdrs[i]->attach_del)
diff --git a/mutt.h b/mutt.h
index bc89caf83acecfd0ae8d9219847c7546bd1c4eee..9f3d647c1bca6b5867fa39cb7a4148f0e5393291 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -270,6 +270,7 @@ enum
   OPTMENUSCROLL,       /* scroll menu instead of implicit next-page */
   OPTMETAKEY,          /* interpret ALT-x as ESC-x */
   OPTMETOO,
+  OPTMHPURGE,
   OPTMIMEFORWDECODE,
   OPTPAGERSTOP,
   OPTPIPEDECODE,