* new algorithm to load the use table
authorArt Cancro <ajc@citadel.org>
Mon, 26 Nov 2001 03:27:08 +0000 (03:27 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 26 Nov 2001 03:27:08 +0000 (03:27 +0000)
citadel/ChangeLog
citadel/serv_network.c

index 08bd1563d18762df7eef90e40b4b6b8620382137..82ae6cb8ffc2104be9cdb4a719b73e4909162a7f 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 580.78  2001/11/26 03:27:08  ajc
+ * new algorithm to load the use table
+
  Revision 580.77  2001/11/17 19:55:08  ajc
  * Updated some of the documentation
 
@@ -2871,3 +2874,4 @@ 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 d902433fefbd0feee72c4b46b99b1eb57d60f780..a66f577c280c739cde9231e2de536dbcb7d545de 100644 (file)
@@ -86,6 +86,7 @@ int network_usetable(int operation, struct CtdlMessage *msg) {
        static struct UseTable *ut = NULL;
        struct UseTable *uptr = NULL;
        char *serialized_table = NULL;
+       char *ptr;
        char msgid[SIZ];
        char buf[SIZ];
        int i;
@@ -97,17 +98,34 @@ int network_usetable(int operation, struct CtdlMessage *msg) {
                        serialized_table = CtdlGetSysConfig(USETABLE);
                        if (serialized_table == NULL) return(0);
 
-                       for (i=0; i<num_tokens(serialized_table, '\n'); ++i) {
-                               extract_token(buf, serialized_table, i, '\n');
-                               uptr = (struct UseTable *)
-                                       mallok(sizeof(struct UseTable));
-                               if (uptr != NULL) {
-                                       uptr->next = ut;
-                                       extract(msgid, buf, 0);
-                                       uptr->message_id = strdoop(msgid);
-                                       uptr->timestamp = extract_long(buf, 1);
-                                       ut = uptr;
+                       ptr = serialized_table;
+                       i = 0;
+                       buf[0] = 0;
+                       while (ptr[0] != 0) {
+                               buf[i] = *ptr;
+               
+                               if (buf[i]=='\n') {
+                                       buf[i] = 0;
+                                       if (strlen(buf) > 0) {
+
+                                               uptr = (struct UseTable *)
+                                                       mallok(sizeof(struct UseTable));
+                                               if (uptr != NULL) {
+                                                       uptr->next = ut;
+                                                       extract(msgid, buf, 0);
+                                                       uptr->message_id = strdoop(msgid);
+                                                       uptr->timestamp = extract_long(buf, 1);
+                                                       ut = uptr;
+                                               }
+                                       }
+
+                                       i = 0;
+                                       buf[0] = 0;
+                               }
+                               else {
+                                       ++i;
                                }
+                               ++ptr;
                        }
 
                        phree(serialized_table);