* Wrote the expire/purge routine for the new use table
authorArt Cancro <ajc@citadel.org>
Fri, 15 Feb 2002 04:28:57 +0000 (04:28 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 15 Feb 2002 04:28:57 +0000 (04:28 +0000)
citadel/ChangeLog
citadel/serv_expire.c
citadel/serv_network.c
citadel/serv_network.h
citadel/techdoc/roadmap.txt

index 40b29ca725fc8c27a5b4b4e5718a2a3650a7babf..603df6859621c60b477db26c9d73dc00477ae32f 100644 (file)
@@ -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 <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import 
-
index 10eb54e76832c374ee7551e3be5b0fdb945a4784..05d5843a1fa421b97341bc302013a4056d398852 100644 (file)
@@ -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);
index 717c95815117d1cabe1c8b59c835daa2787e71d2..7bdf2c4d203923384bd9cfc839f29b0e13a63bb0 100644 (file)
@@ -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),
-               &timestamp, sizeof(timestamp) );
+               &ut, sizeof(struct UseTable) );
        return(0);
 }
 
index 0c01df98c8dde255893a8ad75a4df72b3d82f550..14ab8b288bcd911585cce01cbfd80b5b7470e167 100644 (file)
@@ -21,3 +21,8 @@ struct NetMap {
        char nexthop[SIZ];
 };
 
+
+struct UseTable {
+       char ut_msgid[SIZ];
+       time_t ut_timestamp;
+};
index 6e3660a1450786253fba1de8e520fc80a31267c3..88471c0756a9242f25cc4c2c71445b0911cb6f8f 100644 (file)
@@ -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