fix dlen
[citadel.git] / citadel / server / modules / listdeliver / serv_listdeliver.c
index e3b1d23d7c625cb41436223ebfc6b5000eefbe0c..fd1356079f104eaa907075af27275336949b8442 100644 (file)
@@ -1,6 +1,6 @@
 // This module delivers messages to mailing lists.
 //
-// Copyright (c) 2002-2022 by the citadel.org team
+// Copyright (c) 2002-2024 by the citadel.org team
 //
 // This program is open source software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License version 3.
@@ -26,7 +26,7 @@
 #include <string.h>
 #include <limits.h>
 #include <libcitadel.h>
-#include "../../citadel.h"
+#include "../../citadel_defs.h"
 #include "../../server.h"
 #include "../../citserver.h"
 #include "../../support.h"
@@ -66,7 +66,7 @@ void listdeliver_do_msg(long msgnum, void *userdata) {
        // If the subject line does not contain the name of the room, add it now.
        if (!bmstrcasestr(TheMessage->cm_fields[eMsgSubject], CC->room.QRname)) {
                snprintf(buf, sizeof buf, "[%s] %s", CC->room.QRname, TheMessage->cm_fields[eMsgSubject]);
-               CM_SetField(TheMessage, eMsgSubject, buf, strlen(buf));
+               CM_SetField(TheMessage, eMsgSubject, buf);
        }
 
        // From: should be set to the list address because doing otherwise makes DKIM parsers angry.
@@ -75,8 +75,8 @@ void listdeliver_do_msg(long msgnum, void *userdata) {
        for (ch=buf; *ch; ++ch) {
                if (isspace(*ch)) *ch = '_';
        }
-       CM_SetField(TheMessage, erFc822Addr, buf, strlen(buf));
-       CM_SetField(TheMessage, eReplyTo, buf, strlen(buf));
+       CM_SetField(TheMessage, erFc822Addr, buf);
+       CM_SetField(TheMessage, eReplyTo, buf);
 
        // With that out of the way, let's figure out who this message needs to be sent to.
        char *recipients = malloc(strlen(ld->netconf));
@@ -104,7 +104,7 @@ void listdeliver_do_msg(long msgnum, void *userdata) {
                snprintf(bounce_to, sizeof bounce_to, "room_aide@%s", CtdlGetConfigStr("c_fqdn"));
 
                // Now submit the message
-               struct recptypes *valid = validate_recipients(recipients, NULL, 0);
+               struct recptypes *valid = validate_recipients(recipients, 0);
                if (valid) {
                        valid->bounce_to = strdup(bounce_to);
                        valid->envelope_from = strdup(bounce_to);
@@ -238,12 +238,12 @@ void listdeliver_sweep(void) {
 }
 
 
-// Module entry point
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_listdeliver(void) {
        if (!threading) {
                CtdlRegisterSessionHook(listdeliver_sweep, EVT_TIMER, PRIO_AGGR + 50);
        }
        
        // return our module name for the log
-       return "listsub";
+       return "listdeliver";
 }