]> code.citadel.org Git - citadel.git/blobdiff - citadel/server/modules/listdeliver/serv_listdeliver.c
Still working on sixel
[citadel.git] / citadel / server / modules / listdeliver / serv_listdeliver.c
index c342b0799d087cf6054f7115ba7ca32cb27a37f4..a6cb74ad40da811b5bbf406b5e674930e070abb1 100644 (file)
@@ -1,14 +1,6 @@
 // This module delivers messages to mailing lists.
 // This module delivers messages to mailing lists.
-//
-// Copyright (c) 2002-2023 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.
-//  
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
+// Copyright (c) 2002-2024 by the citadel.org team (Art Cancro et al.)
+// This program is open source software.  Use, duplication, or disclosure are subject to the GNU General Public License v3.
 
 #include "../../sysdep.h"
 #include <stdlib.h>
 
 #include "../../sysdep.h"
 #include <stdlib.h>
@@ -40,7 +32,6 @@
 
 int doing_listdeliver = 0;
 
 
 int doing_listdeliver = 0;
 
-
 // data passed back and forth between listdeliver_do_msg() and listdeliver_sweep_room()
 struct lddata {
        long msgnum;            // number of most recent message processed
 // data passed back and forth between listdeliver_do_msg() and listdeliver_sweep_room()
 struct lddata {
        long msgnum;            // number of most recent message processed
@@ -48,7 +39,6 @@ struct lddata {
 };
 
 
 };
 
 
-
 void listdeliver_do_msg(long msgnum, void *userdata) {
        struct lddata *ld = (struct lddata *) userdata;
        if (!ld) return;
 void listdeliver_do_msg(long msgnum, void *userdata) {
        struct lddata *ld = (struct lddata *) userdata;
        if (!ld) return;
@@ -63,6 +53,8 @@ void listdeliver_do_msg(long msgnum, void *userdata) {
        struct CtdlMessage *TheMessage = CtdlFetchMessage(msgnum, 1);
        if (!TheMessage) return;
 
        struct CtdlMessage *TheMessage = CtdlFetchMessage(msgnum, 1);
        if (!TheMessage) return;
 
+       // FIXME add the list unsubscribe instructions directly to the message text.  Do it right here.
+
        // 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]);
        // 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]);
@@ -78,6 +70,13 @@ void listdeliver_do_msg(long msgnum, void *userdata) {
        CM_SetField(TheMessage, erFc822Addr, buf);
        CM_SetField(TheMessage, eReplyTo, buf);
 
        CM_SetField(TheMessage, erFc822Addr, buf);
        CM_SetField(TheMessage, eReplyTo, buf);
 
+       // To: likewise needs to have something in it, definitely not the name of an actual mailing list member.
+       // Let's use the address and name of the room.
+       strcat(buf, " (");
+       strcat(buf, CC->room.QRname);
+       strcat(buf, " )");
+       CM_SetField(TheMessage, eRecipient, 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));
        if (recipients) {
        // With that out of the way, let's figure out who this message needs to be sent to.
        char *recipients = malloc(strlen(ld->netconf));
        if (recipients) {
@@ -245,5 +244,5 @@ char *ctdl_module_init_listdeliver(void) {
        }
        
        // return our module name for the log
        }
        
        // return our module name for the log
-       return "listsub";
+       return "listdeliver";
 }
 }