diff -ur qpopper4.0.8-happy/popper/pop_config.c qpopper4.0.8-happy-jmpl6/popper/pop_config.c
--- qpopper4.0.8-happy/popper/pop_config.c	Thu May 26 14:47:53 2005
+++ qpopper4.0.8-happy-jmpl6/popper/pop_config.c	Thu Mar  9 22:48:39 2006
@@ -272,6 +272,8 @@
     kHM_FREE,		    /* -h base+secs:bytes@FREE/max */
     kHM_MAX,		    /* -h base+secs:bytes@free/MAX */
     kHM_BUFSIZ,		    /* -z bufsiz        */
+    kHM_SLEEP,              /*    (no flag)     */
+    kHM_SLEEP_SLICE,        /*    (no flag)     */
 #endif /* HAPPYMAIL */
 
 
@@ -308,12 +310,14 @@
     { "group-no-server-mode"         , CfgStr  , CfgResUser, kGRP_NO_SERV_MODE   },
     { "group-server-mode"            , CfgStr  , CfgResUser, kGRP_SERV_MODE      },
 #ifdef HAPPYMAIL
-    { "happymail-base"               , CfgIntTime , CfgResInit, kHM_BASE         },
-    { "happymail-rate-seconds"       , CfgIntTime , CfgResInit, kHM_RATE_S       },
-    { "happymail-rate-bytes"         , CfgIntSpace , CfgResInit, kHM_RATE_B      },
-    { "happymail-free"               , CfgIntSpace , CfgResInit, kHM_FREE        },
-    { "happymail-max"                , CfgIntTime , CfgResInit, kHM_MAX          },
-    { "happymail-bufsiz"             , CfgIntSpace , CfgResInit, kHM_BUFSIZ      },
+    { "happymail-base"               , CfgIntTime  , CfgResNone, kHM_BASE        },
+    { "happymail-rate-seconds"       , CfgIntTime  , CfgResNone, kHM_RATE_S      },
+    { "happymail-rate-bytes"         , CfgIntSpace , CfgResNone, kHM_RATE_B      },
+    { "happymail-free"               , CfgIntSpace , CfgResNone, kHM_FREE        },
+    { "happymail-max"                , CfgIntTime  , CfgResNone, kHM_MAX         },
+    { "happymail-bufsiz"             , CfgIntSpace , CfgResNone, kHM_BUFSIZ      },
+    { "happymail-sleep"              , CfgIntTime  , CfgResNone, kHM_SLEEP       },
+    { "happymail-sleep-slice"        , CfgIntTime  , CfgResNone, kHM_SLEEP_SLICE },
 #endif /* HAPPYMAIL */
     { "hash-spool"                   , CfgInt  , CfgResUser, kHASH_SPOOL         },
     { "home-dir-mail"                , CfgStr  , CfgResUser, kHOME_DIR_MAIL      },
@@ -993,6 +997,8 @@
 	case kHM_FREE:             R__INT ( &p->happymail_free );
 	case kHM_MAX:              R__INT ( &p->happymail_max );
 	case kHM_BUFSIZ:           R__INT ( &p->happymail_bufsiz );
+	case kHM_SLEEP:            R__INT ( &p->happymail_sleep );
+	case kHM_SLEEP_SLICE:      R__INT ( &p->happymail_sleep_slice );
 #endif /* HAPPYMAIL */
 
         default:                   R__PTR ( NULL );
diff -ur qpopper4.0.8-happy/popper/pop_dropcopy.c qpopper4.0.8-happy-jmpl6/popper/pop_dropcopy.c
--- qpopper4.0.8-happy/popper/pop_dropcopy.c	Thu May 26 14:45:31 2005
+++ qpopper4.0.8-happy-jmpl6/popper/pop_dropcopy.c	Fri Mar 10 13:05:26 2006
@@ -1222,34 +1222,51 @@
 #ifdef HAPPYMAIL
     if (pwp->pw_uid >= 0 && pwp->pw_uid < 64*1024 &&
 	(p->happymail_base || p->happymail_free >= 0)) {
+	
+	int adjust, mydelay = happy_calcdelay(p, &adjust);
 
-	int mydelay, adjust = 0;
-
-	if (p->happymail_rate_s) {
-	    if (stat(p->drop_name, &mybuf) == 0) {
-		if (mybuf.st_size <= p->happymail_free)
-		    adjust = 0;
-		else
-		    adjust = (p->happymail_rate_s *
-			      ((mybuf.st_size - p->happymail_free)
-			       / p->happymail_rate_b));
-	    }
-	}
-
-	mydelay = (p->happymail_base + adjust);
-	mydelay -= mydelay % 60;	/* should be a round # of minutes */
-
+	if ( my_timer - p->happymail_tab[pwp->pw_uid] < mydelay ) {
+            p->happymail_delay = mydelay - ( my_timer - p->happymail_tab[pwp->pw_uid] );
+            if ( p->happymail_delay <= p->happymail_sleep) {
+                pop_log ( p, POP_NOTICE, HERE,
+#ifdef DEBUG
+			    "%s at localhost: "
+#else
+			    "%s at %s (%s): "
+#endif /* DEBUG */			    
+			    "[LOGIN-DELAY] Sleeping for %d %s "
+			    "[%d+%d:%d@%d!%d (%d) => %d + %d %s %d]",
+			    p->user ? p->user : "(null)",
+#ifndef DEBUG
+			    p->client, 
+			    p->ipaddr,
+#endif /* DEBUG */ 
+			    (p->happymail_delay % 60) ? p->happymail_delay : p->happymail_delay/60,
+			    (p->happymail_delay % 60) ? "second(s)" : "minute(s)", 
+			    p->happymail_base,
+			    p->happymail_rate_s,
+			    p->happymail_rate_b,
+			    p->happymail_free,
+			    p->happymail_max,
+			    mybuf.st_size,
+			    p->happymail_base,
+			    adjust,
+			    p->happymail_base + adjust > p->happymail_max ?
+				">" : "=>",
+			    mydelay
+			);		
+			/* sleep done in pop_msg.c */
+			    
+            }
 
-	/* don't allow mydelay to be larger than max */
-	if (p->happymail_max > 0 && mydelay > p->happymail_max)
-	    mydelay = p->happymail_max;
-
-	if (my_timer - p->happymail_tab[pwp->pw_uid] < mydelay - 30) {
-	    return (pop_msg(p, POP_FAILURE, HERE,
-			    "[HAPPYMAIL] Please wait at least %d minutes "
-			    "between checks. "
+            if (p->happymail_delay > p->happymail_sleep) {
+                 p->happymail_delay = p->happymail_sleep_slice ;
+                 return (pop_msg(p, POP_FAILURE, HERE,
+			    "[LOGIN-DELAY] Please wait at least %d %s "
+			    "between checking your email. "
 			    "[%d+%d:%d@%d!%d (%d) => %d + %d %s %d] ",
-			    mydelay/60,
+			    (mydelay % 60) ? mydelay : mydelay/60,
+			    (mydelay % 60) ? "second(s)" : "minute(s)", 
 			    p->happymail_base,
 			    p->happymail_rate_s,
 			    p->happymail_rate_b,
@@ -1262,8 +1279,10 @@
 				">" : "=>",
 			    mydelay
 			    ));
+            }
 	}
-	p->happymail_tab[pwp->pw_uid] = my_timer;
+	else
+		p->happymail_tab[pwp->pw_uid] = my_timer;
     }
 #endif /* HAPPYMAIL */
 
@@ -1980,4 +1999,5 @@
 
 #endif /* HAVE_USLEEP */
 }
+
 
diff -ur qpopper4.0.8-happy/popper/pop_extend.c qpopper4.0.8-happy-jmpl6/popper/pop_extend.c
--- qpopper4.0.8-happy/popper/pop_extend.c	Thu May 26 14:45:31 2005
+++ qpopper4.0.8-happy-jmpl6/popper/pop_extend.c	Fri Mar 10 13:20:51 2006
@@ -93,6 +93,15 @@
         POP_WRITE_LIT ( p, "USER\r\n" );
 #endif
 
+#ifdef HAPPYMAIL
+    if (p->happymail_base || p->happymail_free >= 0) {
+	int mydelay = happy_calcdelay(p); 
+	pop_write_fmt ( p, "LOGIN-DELAY %d%s\r\n", 
+	                mydelay ? mydelay : p->happymail_max,
+			p->drop_name && *(p->drop_name) ? "" : " USER");
+    }	
+    else
+#endif
     if ( p->login_delay != -1 )
         pop_write_fmt ( p, "LOGIN-DELAY %d\r\n", p->login_delay );
     if ( p->expire == -1 ) 
diff -ur qpopper4.0.8-happy/popper/pop_init.c qpopper4.0.8-happy-jmpl6/popper/pop_init.c
--- qpopper4.0.8-happy/popper/pop_init.c	Thu May 26 14:56:20 2005
+++ qpopper4.0.8-happy-jmpl6/popper/pop_init.c	Fri Mar 10 13:21:19 2006
@@ -502,6 +502,38 @@
 		n *= 60 * 60 * 24;
 	return n;
 }
+
+int
+happy_calcdelay(POP *p, int *adj)
+{
+	int mydelay = 0, adjust = 0;
+	struct stat mybuf;
+
+	if (!((p->drop_name) && *(p->drop_name)))
+		return 0; 
+
+	if (p->happymail_rate_s) {
+	    if (stat(p->drop_name, &mybuf) == 0) {
+		if (mybuf.st_size <= p->happymail_free)
+		    adjust = 0;
+		else
+		    adjust = (p->happymail_rate_s *
+			      ((mybuf.st_size - p->happymail_free)
+			       / p->happymail_rate_b));
+	    }
+	}
+
+	mydelay = (p->happymail_base + adjust);
+
+	/* don't allow mydelay to be larger than max */
+	if (p->happymail_max > 0 && mydelay > p->happymail_max)
+	    mydelay = p->happymail_max;
+
+	if (adj)
+		*adj = adjust;
+
+	return mydelay;
+}
 #endif /* HAPPYMAIL */
 
 
@@ -790,6 +822,9 @@
     p->happymail_max = 0;		/* no maximum */
     /* bulk copy blocksize */
     p->happymail_bufsiz = 0;		/* use the default, don't setvbuf() */
+    /* sleep instead of error if mydelay < happymail_sleep */
+    p->happymail_sleep = 0;
+    p->happymail_sleep_slice = 0;
 #endif /* HAPPYMAIL */
     /*  
      * Process command line arguments 
diff -ur qpopper4.0.8-happy/popper/pop_msg.c qpopper4.0.8-happy-jmpl6/popper/pop_msg.c
--- qpopper4.0.8-happy/popper/pop_msg.c	Mon Apr 25 23:14:39 2005
+++ qpopper4.0.8-happy-jmpl6/popper/pop_msg.c	Thu Mar  9 22:43:55 2006
@@ -136,6 +136,16 @@
      */
     strcat ( message, "\r\n" );
         
+#ifdef HAPPYMAIL
+    if ( p->happymail_delay && p->happymail_sleep ) {
+	int i = 0;
+	
+	i = ( p->happymail_delay < p->happymail_sleep_slice ? p->happymail_delay : p->happymail_sleep_slice ); 
+        sleep ( i ); 
+        p->happymail_delay -= i;
+    }
+#endif /* HAPPYMAIL */
+
     /*  
      * Send the message to the client 
      */
diff -ur qpopper4.0.8-happy/popper/pop_updt.c qpopper4.0.8-happy-jmpl6/popper/pop_updt.c
--- qpopper4.0.8-happy/popper/pop_updt.c	Thu May 26 14:45:31 2005
+++ qpopper4.0.8-happy-jmpl6/popper/pop_updt.c	Fri Mar 10 12:55:33 2006
@@ -263,6 +263,9 @@
     time_t                  my_timer    = time(0);  /*  For timing */
 
 
+    if ( !p->drop || !p->drop_name )
+   	   return ( POP_FAILURE ); 
+
     if ( p->bAuto_delete && p->bUpdate_on_abort == FALSE )
     {
         /* 
diff -ur qpopper4.0.8-happy/popper/popper.h qpopper4.0.8-happy-jmpl6/popper/popper.h
--- qpopper4.0.8-happy/popper/popper.h	Thu May 26 14:45:31 2005
+++ qpopper4.0.8-happy-jmpl6/popper/popper.h	Fri Mar 10 13:27:08 2006
@@ -102,7 +102,7 @@
 #define OUT_BUF_SIZE    512 /* Amount of output to buffer before forcing a write */
 
 #ifdef HAPPYMAIL
-# define HAPPYMAIL_PATCHLEVEL "pl8"
+# define HAPPYMAIL_PATCHLEVEL "pl8-jm-pl6"
 #endif /* HAPPYMAIL */
 
 #ifndef MAXHOSTNAMELEN
@@ -682,6 +682,9 @@
     int			happymail_max;		/* upper boundary on timer */
     time_t          *   happymail_tab;          /* per-uid shmem check table */
     int                 happymail_bufsiz;	/* buffer size for maildrops */
+    int                 happymail_sleep;        /* less than this sleep instead of error */
+    int                 happymail_sleep_slice;  /* slice to sleep for */ 
+    int                 happymail_delay;        /* store the total delay neccessary */					   
 #endif /* HAPPYMAIL */
 
     BOOL                bUser_opts;             /* Process ~/.qpopper-options */
@@ -850,6 +853,7 @@
 #ifdef HAPPYMAIL
 FILE *fopen_happy        (POP *p, char *path, char *mode);
 FILE *fdopen_happy       (POP *p, int fildes, char *mode);
+int   happy_calcdelay    (POP *p, int *adj);
 #endif /* HAPPYMAIL */
 
 int  qpopper ( int argc, char *argv[] );
