]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/network/serv_network.c
Implemented RFC2919, the 'List-ID' field for mailing
[citadel.git] / citadel / modules / network / serv_network.c
index 2d3d8e3ca91aed859f10370f1e7670322f84663e..b71d95a5f8d81f40454c1f0dd4ceb1556f00d9e8 100644 (file)
@@ -478,6 +478,15 @@ void network_deliver_digest(SpoolControl *sc) {
        msg->cm_fields['F'] = strdup(buf);
        msg->cm_fields['R'] = strdup(buf);
 
+       /* Set the 'List-ID' header */
+       msg->cm_fields['L'] = malloc(1024);
+       snprintf(msg->cm_fields['L'], 1024,
+               "%s <%ld.list-id.%s>",
+               CC->room.QRname,
+               CC->room.QRnumber,
+               config.c_fqdn
+       );
+
        /*
         * Go fetch the contents of the digest
         */
@@ -610,6 +619,18 @@ void network_spool_msg(long msgnum, void *userdata) {
                msg = CtdlFetchMessage(msgnum, 1);
                if (msg != NULL) {
 
+                       /* Set the 'List-ID' header */
+                       if (msg->cm_fields['L'] != NULL) {
+                               free(msg->cm_fields['L']);
+                       }
+                       msg->cm_fields['L'] = malloc(1024);
+                       snprintf(msg->cm_fields['L'], 1024,
+                               "%s <%ld.list-id.%s>",
+                               CC->room.QRname,
+                               CC->room.QRnumber,
+                               config.c_fqdn
+                       );
+
                        /* Prepend "[List name]" to the subject */
                        if (msg->cm_fields['U'] == NULL) {
                                msg->cm_fields['U'] = strdup("(no subject)");
@@ -2083,7 +2104,7 @@ void *network_do_queue(void *args) {
        struct CitContext networkerCC;
 
        /* Give the networker its own private CitContext */
-       CtdlFillPrivateContext(&networkerCC, "network");
+       CtdlFillSystemContext(&networkerCC, "network");
        citthread_setspecific(MyConKey, (void *)&networkerCC );
 
        /*