X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Flistdeliver%2Fserv_listdeliver.c;h=7dd34630a0750c5fc5977fcf4f663163a50d18b9;hb=2d108c1f33c86b501a2540ba48eaedded8894f20;hp=793291b44d16cdd9000d32660533ffabaaa065f9;hpb=882ff5a53c3b4e440520a073cf07dc60b2671876;p=citadel.git diff --git a/citadel/modules/listdeliver/serv_listdeliver.c b/citadel/modules/listdeliver/serv_listdeliver.c index 793291b44..7dd34630a 100644 --- a/citadel/modules/listdeliver/serv_listdeliver.c +++ b/citadel/modules/listdeliver/serv_listdeliver.c @@ -53,17 +53,40 @@ struct lddata { void listdeliver_do_msg(long msgnum, void *userdata) { struct lddata *ld = (struct lddata *) userdata; - ld->msgnum = msgnum; + if (!ld) return; char buf[SIZ]; - struct CtdlMessage *TheMessage = CtdlFetchMessage(msgnum, 1); + ld->msgnum = msgnum; + if (msgnum <= 0) return; - int config_lines = num_tokens(ld->netconf, '\n'); - for (int i=0; inetconf, i, '\n', sizeof buf); - if ( (!strncasecmp(buf, "listrecp|", 9)) || (!strncasecmp(buf, "digestrecp|", 11)) ) { - syslog(LOG_DEBUG, "\033[32mDeliver %ld to %s\033[0m", msgnum, buf); - // FIXME + struct CtdlMessage *TheMessage = CtdlFetchMessage(msgnum, 1); + if (!TheMessage) return; + + char *recipients = malloc(strlen(ld->netconf)); + if (recipients) { + recipients[0] = 0; + + int config_lines = num_tokens(ld->netconf, '\n'); + for (int i=0; inetconf, i, '\n', sizeof buf); + if (!strncasecmp(buf, "listrecp|", 9)) { + if (recipients[0] != 0) { + strcat(recipients, ","); + } + strcat(recipients, &buf[9]); + } + if (!strncasecmp(buf, "digestrecp|", 11)) { + if (recipients[0] != 0) { + strcat(recipients, ","); + } + strcat(recipients, &buf[11]); + } + } + syslog(LOG_DEBUG, "\033[33m%s\033[0m", recipients); + struct recptypes *valid = validate_recipients(recipients, NULL, 0); + if (valid) { + long new_msgnum = CtdlSubmitMsg(TheMessage, valid, ""); + free_recipients(valid); } } CM_Free(TheMessage);