comparison src/database.c @ 105:1a54e1702ea2 noffle

[svn] Use new Cfg_expire(grp)
author bears
date Tue, 13 Jun 2000 07:36:26 +0100
parents be450ac830b2
children 2bedacfe1ba7
comparison
equal deleted inserted replaced
104:402300614185 105:1a54e1702ea2
1 /* 1 /*
2 database.c 2 database.c
3 3
4 $Id: database.c 113 2000-05-19 15:15:45Z bears $ 4 $Id: database.c 144 2000-06-13 06:36:26Z bears $
5 5
6 Uses GNU gdbm library. Using Berkeley db (included in libc6) was 6 Uses GNU gdbm library. Using Berkeley db (included in libc6) was
7 cumbersome. It is based on Berkeley db 1.85, which has severe bugs 7 cumbersome. It is based on Berkeley db 1.85, which has severe bugs
8 (e.g. it is not recommended to delete or overwrite entries with 8 (e.g. it is not recommended to delete or overwrite entries with
9 overflow pages). 9 overflow pages).
25 #include "configfile.h" 25 #include "configfile.h"
26 #include "itemlist.h" 26 #include "itemlist.h"
27 #include "log.h" 27 #include "log.h"
28 #include "protocol.h" 28 #include "protocol.h"
29 #include "util.h" 29 #include "util.h"
30 #include "wildmat.h"
31 #include "portable.h" 30 #include "portable.h"
32 31
33 static struct Db 32 static struct Db
34 { 33 {
35 GDBM_FILE dbf; 34 GDBM_FILE dbf;
583 582
584 res = -1; 583 res = -1;
585 refs = new_Itl( xref, " :" ); 584 refs = new_Itl( xref, " :" );
586 for ( ref = Itl_first( refs ); ref != NULL; ref = Itl_next( refs ) ) 585 for ( ref = Itl_first( refs ); ref != NULL; ref = Itl_next( refs ) )
587 { 586 {
588 Str pattern;
589 int days; 587 int days;
590 588
591 Cfg_beginExpireEnum(); 589 days = Cfg_expire( ref );
592 while ( ( days = Cfg_nextExpire( pattern ) ) != -1 ) 590 if ( days == 0
593 if ( Wld_match( ref, pattern ) 591 || ( days > res && res != 0 ) )
594 && ( ( days > res && res != 0 ) || 592 res = days;
595 days == 0 ) )
596 {
597 res = days;
598 Log_dbg ( "Custom expiry %d for %s in group %s",
599 days, msgId, ref );
600 break;
601 }
602 593
603 Itl_next( refs ); /* Throw away group number */ 594 Itl_next( refs ); /* Throw away group number */
604 } 595 }
605 596
606 if ( res == -1 )
607 res = Cfg_expire();
608 return res; 597 return res;
609 } 598 }
610 599
611 Bool 600 Bool
612 Db_expire( void ) 601 Db_expire( void )