* Currently working through a bug that's preventing wiki history pages from being...
authorArt Cancro <ajc@citadel.org>
Tue, 17 Nov 2009 04:27:39 +0000 (04:27 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 17 Nov 2009 04:27:39 +0000 (04:27 +0000)
citadel/modules/network/serv_network.c
citadel/modules/wiki/serv_wiki.c

index 0f1d371834cd942a58c4834bf612898fa666b318..c20712142f8a8529532ba24b0644a35128f01fbc 100644 (file)
@@ -217,14 +217,14 @@ int network_usetable(struct CtdlMessage *msg) {
        cdbut = cdb_fetch(CDB_USETABLE, msgid, strlen(msgid));
        if (cdbut != NULL) {
                cdb_free(cdbut);
+               CtdlLogPrintf(CTDL_DEBUG, "network_usetable() : we already have %s\n", msgid);
                return(1);
        }
 
        /* If we got to this point, it's unique: add it. */
        strcpy(ut.ut_msgid, msgid);
        ut.ut_timestamp = time(NULL);
-       cdb_store(CDB_USETABLE, msgid, strlen(msgid),
-               &ut, sizeof(struct UseTable) );
+       cdb_store(CDB_USETABLE, msgid, strlen(msgid), &ut, sizeof(struct UseTable) );
        return(0);
 }
 
@@ -1484,6 +1484,8 @@ void network_process_buffer(char *buffer, long size) {
        unsigned char firstbyte;
        unsigned char lastbyte;
 
+       CtdlLogPrintf(CTDL_DEBUG, "network_process_buffer() processing %ld bytes\n", size);
+
        /* Validate just a little bit.  First byte should be FF and * last byte should be 00. */
        firstbyte = buffer[0];
        lastbyte = buffer[size-1];
@@ -1582,17 +1584,14 @@ void network_process_buffer(char *buffer, long size) {
 
        /* Learn network topology from the path */
        if ((msg->cm_fields['N'] != NULL) && (msg->cm_fields['P'] != NULL)) {
-               network_learn_topology(msg->cm_fields['N'], 
-                                       msg->cm_fields['P']);
+               network_learn_topology(msg->cm_fields['N'], msg->cm_fields['P']);
        }
 
        /* Is the sending node giving us a very persuasive suggestion about
         * which room this message should be saved in?  If so, go with that.
         */
        if (msg->cm_fields['C'] != NULL) {
-               safestrncpy(target_room,
-                       msg->cm_fields['C'],
-                       sizeof target_room);
+               safestrncpy(target_room, msg->cm_fields['C'], sizeof target_room);
        }
 
        /* Otherwise, does it have a recipient?  If so, validate it... */
@@ -1604,6 +1603,7 @@ void network_process_buffer(char *buffer, long size) {
                                "Please check the address and try sending the message again.\n");
                        msg = NULL;
                        free_recipients(recp);
+                       CtdlLogPrintf(CTDL_DEBUG, "Bouncing message due to invalid recipient address.\n");
                        return;
                }
                strcpy(target_room, "");        /* no target room if mail */
@@ -1613,9 +1613,7 @@ void network_process_buffer(char *buffer, long size) {
         * it has the O field (Originating room) set.
         */
        else if (msg->cm_fields['O'] != NULL) {
-               safestrncpy(target_room,
-                       msg->cm_fields['O'],
-                       sizeof target_room);
+               safestrncpy(target_room, msg->cm_fields['O'], sizeof target_room);
        }
 
        /* Strip out fields that are only relevant during transit */
index b9e3ad45456f538cecaaac7add6495662a3cbff3..2904c653b2a4a837027b85089e90df527ed88177 100644 (file)
@@ -234,7 +234,14 @@ int wiki_upload_beforesave(struct CtdlMessage *msg) {
 
        /* Update the history message (regardless of whether it's new or existing) */
 
-       /* First, figure out the boundary string.  We do this even when we generated the
+       /* Remove the Message-ID from the old version of the history message.  This will cause a brand
+        * new one to be generated, avoiding an uninitentional hit of the loop zapper when we replicate.
+        */
+       if (history_msg->cm_fields['I'] != NULL) {
+               free(history_msg->cm_fields['I']);
+       }
+
+       /* Figure out the boundary string.  We do this even when we generated the
         * boundary string in the above code, just to be safe and consistent.
         */
        strcpy(boundary, "");