]> granicus.if.org Git - mutt/commitdiff
MH buffy.
authorThomas Roessler <roessler@does-not-exist.org>
Fri, 3 Aug 2001 08:05:30 +0000 (08:05 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Fri, 3 Aug 2001 08:05:30 +0000 (08:05 +0000)
buffy.c
mh.c
mx.h

diff --git a/buffy.c b/buffy.c
index cb5e35fb0e4669d7a14d73eb06fb2b700041efc5..997ac70c7cdc71c160e4aecabac930b22adac9e3 100644 (file)
--- a/buffy.c
+++ b/buffy.c
@@ -336,12 +336,8 @@ int mutt_buffy_check (int force)
        break;
 
       case M_MAILDIR:
-      case M_MH:
 
-       if(tmp->magic == M_MAILDIR)
-         snprintf (path, sizeof (path), "%s/new", tmp->path);
-       else
-         strfcpy (path, tmp->path, sizeof(path));
+       snprintf (path, sizeof (path), "%s/new", tmp->path);
        if ((dirp = opendir (path)) == NULL)
        {
          tmp->magic = 0;
@@ -360,6 +356,10 @@ int mutt_buffy_check (int force)
        closedir (dirp);
        break;
 
+      case M_MH:
+       tmp->new = mh_buffy (tmp->path);
+       break;
+       
 #ifdef USE_IMAP
       case M_IMAP:
        if ((tmp->new = imap_mailbox_check (tmp->path, 1)) > 0)
diff --git a/mh.c b/mh.c
index ff79084d2e503aeb1124bbfddf963d2eacd799af..38ec7146a50864591b7ce5befafbc3539599e5a8 100644 (file)
--- a/mh.c
+++ b/mh.c
@@ -120,7 +120,7 @@ static void mh_read_token (char *t, int *first, int *last)
     *first = *last = atoi (t);
 }
 
-static void mh_read_sequences (struct mh_sequences *mhs, char *path)
+static void mh_read_sequences (struct mh_sequences *mhs, const char *path)
 {
   FILE *fp;
   int line = 1;
@@ -163,6 +163,20 @@ static void mh_read_sequences (struct mh_sequences *mhs, char *path)
   safe_fclose (&fp);
 }
 
+int mh_buffy (const char *path)
+{
+  int i, r = 0;
+  struct mh_sequences mhs;
+  memset (&mhs, 0, sizeof (mhs));
+  
+  mh_read_sequences (&mhs, path);
+  for (i = 0; !r && i <= mhs.max; i++)
+    if (mhs_check (&mhs, i) & MH_SEQ_UNSEEN)
+      r = 1;
+  mhs_free_sequences (&mhs);
+  return r;
+}
+
 static int mh_mkstemp (CONTEXT *dest, FILE **fp, char **tgt)
 {
   int fd;
diff --git a/mx.h b/mx.h
index 2b643632b4dc9d062ceecf5d30b37db6ad2686b5..10ef9c503b41c68f93e3e1ebcc0e8e6b79e08de1 100644 (file)
--- a/mx.h
+++ b/mx.h
@@ -61,7 +61,7 @@ void mbox_unlock_mailbox (CONTEXT *);
 int mh_read_dir (CONTEXT *, const char *);
 int mh_sync_mailbox (CONTEXT *, int *);
 int mh_check_mailbox (CONTEXT *, int *);
-int mh_parse_sequences (CONTEXT *, const char *);
+int mh_buffy (const char *);
 
 int maildir_read_dir (CONTEXT *);