Subject: [PATCH] update for pine maildir support

From: Dean Gaudet <[email-masked]>
Date: Sun, 8 Feb 1998 11:23:51 -0800 (PST)

This patch to the Bloodhounds International maildir module for pine
<http://www.imaxx.net/bh/Info/downloads.html#pine> makes it properly deal
with new mail... the bh patch works great if you've only got one inbox. 
But if you're using multiple inboxes and TAB to move to the next new inbox
it will stop you at every inbox.  This fixes that problem. 

Dean

--- maildir.module-970707/maildir.c	Mon Jul  7 16:47:40 1997
+++ pine3.96/imap/ANSI/c-client/maildir.c	Sat Feb  7 20:31:52 1998
@@ -441,6 +441,8 @@
   stream->sequence++;		/* bump sequence number */
   stream->nmsgs = stream->recent = 0;
 
+  /* do it twice so that we can check for new messages correctly */
+  maildir_ping_core(stream);
   if (maildir_ping (stream) && !(stream->nmsgs || stream->silent))
     mm_log ("Mailbox is empty",(long) NIL);
 
@@ -826,7 +830,7 @@
  * Note: this depends on qmail naming of messages
  */
 
-long maildir_ping (MAILSTREAM *stream)
+long maildir_ping_core (MAILSTREAM *stream)
 {
   char tmp[MAILTMPLEN];
   MESSAGECACHE *elt;
@@ -840,8 +844,6 @@
   char *s;
   mailcache_t mc = (mailcache_t) mail_parameters (NIL,GET_CACHE,NIL);
 
-  maildir_copynew (LOCAL->dir);
-  
   if (stat (LOCAL->dir,&sbuf) < 0) {
     sprintf (tmp,"Unable to open maildir: %s",strerror (errno));
     mm_log (tmp,ERROR);
@@ -912,6 +914,12 @@
   return T;			/* return that we are alive */
 }
 
+long maildir_ping (MAILSTREAM *stream)
+{
+  maildir_copynew (LOCAL->dir);
+  return maildir_ping_core(stream);
+}
+  
 
 /* Maildir check mailbox
  * Accepts: MAIL stream