X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Flistdeliver%2Fserv_listdeliver.c;h=039937e678cda81c0f176b587c14b73b6b4c2495;hb=53d8e6f8d1f18b0085dcfd46d1fc8640381513bc;hp=7591822bd7784f3b1af31820848078b3d82eb5c0;hpb=325ec75a28c593fc183eb3447089ed18b24b9026;p=citadel.git diff --git a/citadel/modules/listdeliver/serv_listdeliver.c b/citadel/modules/listdeliver/serv_listdeliver.c index 7591822bd..039937e67 100644 --- a/citadel/modules/listdeliver/serv_listdeliver.c +++ b/citadel/modules/listdeliver/serv_listdeliver.c @@ -104,6 +104,7 @@ void listdeliver_do_msg(long msgnum, void *userdata) { */ void listdeliver_sweep_room(char *roomname) { char *netconfig = NULL; + char *newnetconfig = NULL; long lastsent = 0; char buf[SIZ]; int config_lines; @@ -145,16 +146,30 @@ void listdeliver_sweep_room(char *roomname) { if (number_of_messages_processed > 0) { syslog(LOG_DEBUG, "listdeliver: new lastsent is %ld", ld.msgnum); - // FIXME write lastsent back to netconfig - syslog(LOG_DEBUG, "\033[31mBEFORE:<%s>\033[0m", netconfig); - syslog(LOG_DEBUG, "\033[32mAFTER:<%s>\033[0m", netconfig); - + // Update this room's netconfig with the updated lastsent + netconfig = LoadRoomNetConfigFile(CC->room.QRnumber); + if (!netconfig) { + netconfig = strdup(""); + } + // The new netconfig begins with the new lastsent directive + newnetconfig = malloc(strlen(netconfig) + 1024); + sprintf(newnetconfig, "lastsent|%ld\n", ld.msgnum); + // And then we append all of the old netconfig, minus the old lastsent. Also omit blank lines. + config_lines = num_tokens(netconfig, '\n'); + for (i=0; iroom.QRnumber, newnetconfig); + free(newnetconfig); } } - free(netconfig); }