From: Art Cancro Date: Fri, 15 Feb 2002 04:28:57 +0000 (+0000) Subject: * Wrote the expire/purge routine for the new use table X-Git-Tag: v7.86~6539 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=9811a5c8f40b54a132fac0f441c19169b33e5a57 * Wrote the expire/purge routine for the new use table --- diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 40b29ca72..603df6859 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,7 @@ $Log$ + Revision 590.115 2002/02/15 04:28:57 ajc + * Wrote the expire/purge routine for the new use table + Revision 590.114 2002/02/15 04:05:08 ajc * Began implementation of a networker use table that doesn't chew up oodles of CPU time. (It uses a cdb instead.) @@ -3348,4 +3351,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import - diff --git a/citadel/serv_expire.c b/citadel/serv_expire.c index 10eb54e76..05d5843a1 100644 --- a/citadel/serv_expire.c +++ b/citadel/serv_expire.c @@ -63,6 +63,7 @@ #include "msgbase.h" #include "user_ops.h" #include "control.h" +#include "serv_network.h" #include "tools.h" @@ -542,6 +543,35 @@ int PurgeVisits(void) { return(purged); } +/* + * Purge the use table of old entries. + * + */ +int PurgeUseTable(void) { + int purged = 0; + struct cdbdata *cdbut; + struct UseTable ut; + + /* Traverse through the table, purging old records... */ + cdb_rewind(CDB_USETABLE); + while(cdbut = cdb_next_item(CDB_USETABLE), cdbut != NULL) { + + memcpy(&ut, cdbut->ptr, + ((cdbut->len > sizeof(struct UseTable)) ? + sizeof(struct UseTable) : cdbut->len)); + cdb_free(cdbut); + + if ( (time(NULL) - ut.ut_timestamp) > USETABLE_RETAIN ) { + cdb_delete(CDB_USETABLE, ut.ut_msgid, + strlen(ut.ut_msgid) ); + ++purged; + } + + } + + return(purged); +} + void cmd_expi(char *argbuf) { char cmd[SIZ]; @@ -569,6 +599,11 @@ void cmd_expi(char *argbuf) { retval = PurgeVisits(); cprintf("%d Purged %d visits.\n", OK, retval); } + else if (!strcasecmp(cmd, "usetable")) { + retval = PurgeUseTable(); + cprintf("%d Purged %d entries from the use table.\n", + OK, retval); + } else if (!strcasecmp(cmd, "defrag")) { defrag_databases(); cprintf("%d Defragmented the databases.\n", OK); diff --git a/citadel/serv_network.c b/citadel/serv_network.c index 717c95815..7bdf2c4d2 100644 --- a/citadel/serv_network.c +++ b/citadel/serv_network.c @@ -85,7 +85,7 @@ int network_usetable(struct CtdlMessage *msg) { char msgid[SIZ]; struct cdbdata *cdbut; - time_t timestamp; + struct UseTable ut; /* Bail out if we can't generate a message ID */ if (msg == NULL) { @@ -117,9 +117,10 @@ int network_usetable(struct CtdlMessage *msg) { } /* If we got to this point, it's unique: add it. */ - timestamp = time(NULL); + strcpy(ut.ut_msgid, msgid); + ut.ut_timestamp = time(NULL); cdb_store(CDB_USETABLE, msgid, strlen(msgid), - ×tamp, sizeof(timestamp) ); + &ut, sizeof(struct UseTable) ); return(0); } diff --git a/citadel/serv_network.h b/citadel/serv_network.h index 0c01df98c..14ab8b288 100644 --- a/citadel/serv_network.h +++ b/citadel/serv_network.h @@ -21,3 +21,8 @@ struct NetMap { char nexthop[SIZ]; }; + +struct UseTable { + char ut_msgid[SIZ]; + time_t ut_timestamp; +}; diff --git a/citadel/techdoc/roadmap.txt b/citadel/techdoc/roadmap.txt index 6e3660a14..88471c075 100644 --- a/citadel/techdoc/roadmap.txt +++ b/citadel/techdoc/roadmap.txt @@ -14,10 +14,10 @@ Goals for 6.00 * Multiple recipients allowed in Citadel protocol. Rework the code to feed all deliveries through the same set of functions, regardless of whether a message is submitted through Citadel protocol, SMTP, or from the networker. - (Done. Needs to be tested more extensively.) - + (Done.) +* Get the Global Address Book working (Done, just need some polish) * Optimize the IMAP server and add the search command -* Get the Global Address Book working +* Nested folders ... at least in IMAP * LDAP directory support? @@ -26,3 +26,4 @@ Goals for beyond 6.00 * Calendar server * Address book server * Integration with Evolution, Mozilla Calendar, etc. +* NNTP