diff src/database.c @ 94:be450ac830b2 noffle

[svn] Observe Expires: header
author bears
date Fri, 19 May 2000 16:15:45 +0100
parents adf0af5152f7
children 1a54e1702ea2
line wrap: on
line diff
--- a/src/database.c	Fri May 19 16:14:41 2000 +0100
+++ b/src/database.c	Fri May 19 16:15:45 2000 +0100
@@ -1,7 +1,7 @@
 /*
   database.c
 
-  $Id: database.c 67 2000-05-12 17:19:38Z enz $
+  $Id: database.c 113 2000-05-19 15:15:45Z bears $
 
   Uses GNU gdbm library. Using Berkeley db (included in libc6) was
   cumbersome. It is based on Berkeley db 1.85, which has severe bugs
@@ -617,6 +617,8 @@
     Str name, tmpName;
     GDBM_FILE tmpDbf;
     datum key, val;
+    Str expires;
+    time_t texpires;
 
     if ( ! Db_open() )
         return FALSE;
@@ -638,6 +640,11 @@
         {
 	    expDays = calcExpireDays( msgId );
             lastAccess = Db_lastAccess( msgId );
+	    if ( Prt_searchHeader( Db_header( msgId ), "Expires", expires ) )
+		texpires = Utl_parseNewsDate( expires );
+	    else
+		texpires = (time_t) -1;
+	    
 	    if ( expDays == -1 )
 		Log_err( "Internal error: Failed expiry calculation on %s",
 			 msgId );
@@ -660,6 +667,12 @@
 #endif
                 ++cntDel;
             }
+	    else if ( ( texpires != (time_t) -1 )
+		      && nowTime > texpires )
+	    {
+		Log_dbg( "Expiring %s: Expires header activated", msgId );
+		++cntDel;
+	    }
             else
             {
                 ++cntLeft;