]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/network/serv_network.c
destroy_network_queue_room() is now called via the cleanup hook mechanism.
[citadel.git] / citadel / modules / network / serv_network.c
index 8885e5d812360db07701ea09186de91735f830e5..8ceba0d11bc93ff412056cf93f4b896624d9b604 100644 (file)
@@ -454,7 +454,7 @@ void network_deliver_digest(struct SpoolControl *sc) {
        snprintf(buf, sizeof buf, "[%s]", CC->room.QRname);
        msg->cm_fields['U'] = strdup(buf);
        sprintf(buf, "room_%s@%s", CC->room.QRname, config.c_fqdn);
-       for (i=0; i<strlen(buf); ++i) {
+       for (i=0; !IsEmptyStr(&buf[i]); ++i) {
                if (isspace(buf[i])) buf[i]='_';
                buf[i] = tolower(buf[i]);
        }
@@ -612,7 +612,7 @@ void network_spool_msg(long msgnum, void *userdata) {
                        snprintf(msg->cm_fields['R'], 256,
                                "room_%s@%s", CC->room.QRname,
                                config.c_fqdn);
-                       for (i=0; i<strlen(msg->cm_fields['R']); ++i) {
+                       for (i=0; !IsEmptyStr(&msg->cm_fields['R'][i]); ++i) {
                                if (isspace(msg->cm_fields['R'][i])) {
                                        msg->cm_fields['R'][i] = '_';
                                }
@@ -702,7 +702,7 @@ void network_spool_msg(long msgnum, void *userdata) {
                                snprintf(msg->cm_fields['F'], SIZ,
                                        "room_%s@%s", CC->room.QRname,
                                        config.c_fqdn);
-                               for (i=0; i<strlen(msg->cm_fields['F']); ++i) {
+                               for (i=0; !IsEmptyStr(&msg->cm_fields['F'][i]); ++i) {
                                        if (isspace(msg->cm_fields['F'][i])) {
                                                msg->cm_fields['F'][i] = '_';
                                        }
@@ -973,7 +973,7 @@ void network_spoolout_room(char *room_to_spool) {
        /* If we wrote a digest, deliver it and then close it */
        snprintf(buf, sizeof buf, "room_%s@%s",
                CC->room.QRname, config.c_fqdn);
-       for (i=0; i<strlen(buf); ++i) {
+       for (i=0; !IsEmptyStr(&buf[i]); ++i) {
                buf[i] = tolower(buf[i]);
                if (isspace(buf[i])) buf[i] = '_';
        }
@@ -2077,6 +2077,8 @@ CTDL_MODULE_INIT(network)
        CtdlRegisterProtoHook(cmd_nsyn, "NSYN", "Synchronize room to node");
        CtdlRegisterSessionHook(network_do_queue, EVT_TIMER);
         CtdlRegisterRoomHook(network_room_handler);
+       CtdlRegisterCleanupHook(destroy_network_queue_room);
+       
 
        /* return our Subversion id for the Log */
        return "$Id$";