From: Thomas Roessler Date: Fri, 3 Aug 2001 08:05:30 +0000 (+0000) Subject: MH buffy. X-Git-Tag: mutt-1-3-21-rel~16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ed7b814a504df9032b44ad73d75e6f4304c5a322;p=mutt MH buffy. --- diff --git a/buffy.c b/buffy.c index cb5e35fb..997ac70c 100644 --- 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 ff79084d..38ec7146 100644 --- 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 2b643632..10ef9c50 100644 --- 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 *);