* Don't allow polls during network processing
*/
+/*
+ * Duration of time (in seconds) after which pending list subscribe/unsubscribe
+ * requests that have not been confirmed will be deleted.
+ */
+#define EXP 259200 /* three days */
+
#include "sysdep.h"
#include <stdlib.h>
#include <unistd.h>
struct namelist *nptr;
size_t miscsize = 0;
size_t linesize = 0;
+ int skipthisline = 0;
+ int i;
lprintf(7, "Spooling <%s>\n", room_to_spool);
if (getroom(&CC->quickroom, room_to_spool) != 0) {
sc.ignet_push_shares = nptr;
}
else {
- linesize = strlen(buf);
- sc.misc = realloc(sc.misc,
- (miscsize + linesize + 2) );
- sprintf(&sc.misc[miscsize], "%s\n", buf);
- miscsize = miscsize + linesize + 1;
+ /* Preserve 'other' lines ... *unless* they happen to
+ * be subscribe/unsubscribe pendings with expired
+ * timestamps.
+ */
+ skipthisline = 0;
+ if (!strncasecmp(buf, "subpending|", 11)) {
+ if (time(NULL) - extract_long(buf, 4) > EXP) {
+ skipthisline = 1;
+ }
+ }
+ if (!strncasecmp(buf, "unsubpending|", 13)) {
+ if (time(NULL) - extract_long(buf, 3) > EXP) {
+ skipthisline = 1;
+ }
+ }
+
+ if (skipthisline == 0) {
+ linesize = strlen(buf);
+ sc.misc = realloc(sc.misc,
+ (miscsize + linesize + 2) );
+ sprintf(&sc.misc[miscsize], "%s\n", buf);
+ miscsize = miscsize + linesize + 1;
+ }
}
network_spool_msg, &sc);
/* If we wrote a digest, deliver it and then close it */
+ snprintf(buf, sizeof buf, "room_%s@%s",
+ CC->quickroom.QRname, config.c_fqdn);
+ for (i=0; i<strlen(buf); ++i) {
+ buf[i] = tolower(buf[i]);
+ if (isspace(buf[i])) buf[i] = '_';
+ }
if (sc.digestfp != NULL) {
fprintf(sc.digestfp, " -----------------------------------"
"------------------------------------"
"-------\n"
"You are subscribed to the '%s' "
- "list.\n",
- CC->quickroom.QRname
+ "list.\n"
+ "To post to the list: %s\n",
+ CC->quickroom.QRname, buf
);
network_deliver_digest(&sc); /* deliver and close */
}