$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.)
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
-
#include "msgbase.h"
#include "user_ops.h"
#include "control.h"
+#include "serv_network.h"
#include "tools.h"
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];
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);
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) {
}
/* 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);
}
char nexthop[SIZ];
};
+
+struct UseTable {
+ char ut_msgid[SIZ];
+ time_t ut_timestamp;
+};
* 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?
* Calendar server
* Address book server
* Integration with Evolution, Mozilla Calendar, etc.
+* NNTP