dammit, learn to spell
[citadel.git] / citadel / server / journaling.c
index 931169efb5c981e04874e181719413eefeea808f..cce21fa24412b04c189a8c812fbb115362ed516b 100644 (file)
@@ -1,10 +1,9 @@
 // Message journaling functions.
 //
-// Copyright (c) 1987-2022 by the citadel.org team
+// Copyright (c) 1987-2024 by the citadel.org team
 //
 // This program is open source software.  Use, duplication, or disclosure
 // is subject to the terms of the GNU General Public License, version 3.
-// The program is distributed without any warranty, expressed or implied.
 
 #include <stdio.h>
 #include <libcitadel.h>
 #include "citserver.h"
 #include "config.h"
 #include "user_ops.h"
-#include "serv_vcard.h"                        /* Needed for vcard_getuser and extract_inet_email_addrs */
+#include "serv_vcard.h"                        // Needed for vcard_getuser and extract_inet_email_addrs
 #include "internet_addressing.h"
 #include "journaling.h"
 
-struct jnlq *jnlq = NULL;      /* journal queue */
-
-/*
- * Hand off a copy of a message to be journalized.
- */
-void JournalBackgroundSubmit(struct CtdlMessage *msg,
-                       StrBuf *saved_rfc822_version,
-                       struct recptypes *recps) {
+struct jnlq *jnlq = NULL;      // journal queue
 
+// Hand off a copy of a message to be journalized.
+void JournalBackgroundSubmit(struct CtdlMessage *msg, StrBuf *saved_rfc822_version, struct recptypes *recps) {
        struct jnlq *jptr = NULL;
 
-       /* Avoid double journaling! */
+       // Avoid double journaling!
        if (!CM_IsEmpty(msg, eJournal)) {
                FreeStrBuf(&saved_rfc822_version);
                return;
@@ -46,7 +40,7 @@ void JournalBackgroundSubmit(struct CtdlMessage *msg,
        if (!CM_IsEmpty(msg, emessageId)) jptr->msgn = strdup(msg->cm_fields[emessageId]);
        jptr->rfc822 = SmashStrBuf(&saved_rfc822_version);
 
-       /* Add to the queue */
+       // Add to the queue
        begin_critical_section(S_JOURNAL_QUEUE);
        jptr->next = jnlq;
        jnlq = jptr;
@@ -54,10 +48,8 @@ void JournalBackgroundSubmit(struct CtdlMessage *msg,
 }
 
 
-/*
- * Convert a local user name to an internet email address for the journal
- * FIXME - grab the user's Internet email address from the user record, not from vCard !!!!
- */
+// Convert a local user name to an internet email address for the journal
+// FIXME - grab the user's Internet email address from the user record, not from vCard !!!!
 void local_to_inetemail(char *inetemail, char *localuser, size_t inetemail_len) {
        struct ctdluser us;
        struct vCard *v;
@@ -77,9 +69,7 @@ void local_to_inetemail(char *inetemail, char *localuser, size_t inetemail_len)
 }
 
 
-/*
- * Called by JournalRunQueue() to send an individual message.
- */
+// Called by JournalRunQueue() to send an individual message.
 void JournalRunQueueMsg(struct jnlq *jmsg) {
 
        struct CtdlMessage *journal_msg = NULL;
@@ -102,28 +92,25 @@ void JournalRunQueueMsg(struct jnlq *jmsg) {
                   || (journal_recps->num_internet > 0)
                   || (journal_recps->num_room > 0)
                ) {
-
-                       /*
-                        * Construct journal message.
-                        * Note that we are transferring ownership of some of the memory here.
-                        */
+                       // Construct journal message.
+                       // Note that we are transferring ownership of some of the memory here.
                        journal_msg = malloc(sizeof(struct CtdlMessage));
                        memset(journal_msg, 0, sizeof(struct CtdlMessage));
                        journal_msg->cm_magic = CTDLMESSAGE_MAGIC;
                        journal_msg->cm_anon_type = MES_NORMAL;
                        journal_msg->cm_format_type = FMT_RFC822;
-                       CM_SetField(journal_msg, eJournal, HKEY("is journal"));
+                       CM_SetField(journal_msg, eJournal, "is journal");
 
                        if (!IsEmptyStr(jmsg->from)) {
-                               CM_SetField(journal_msg, eAuthor, jmsg->from, -1);
+                               CM_SetField(journal_msg, eAuthor, jmsg->from);
                        }
 
                        if (!IsEmptyStr(jmsg->rfca)) {
-                               CM_SetField(journal_msg, erFc822Addr, jmsg->rfca, -1);
+                               CM_SetField(journal_msg, erFc822Addr, jmsg->rfca);
                        }
 
                        if (!IsEmptyStr(jmsg->subj)) {
-                               CM_SetField(journal_msg, eMsgSubject, jmsg->subj, -1);
+                               CM_SetField(journal_msg, eMsgSubject, jmsg->subj);
                        }
 
                        mblen = snprintf(mime_boundary, sizeof(mime_boundary),
@@ -138,10 +125,8 @@ void JournalRunQueueMsg(struct jnlq *jmsg) {
 
                        message_text = NewStrBufPlain(NULL, rfc822len + sizeof(struct recptypes) + 1024);
 
-                       /*
-                        * Here is where we begin to compose the journalized message.
-                        * (The "ExJournalReport" header is consumed by some email retention services which assume the journaling agent is Exchange.)
-                        */
+                       // Here is where we begin to compose the journalized message.
+                       // (The "ExJournalReport" header is consumed by some email retention services which assume the journaling agent is Exchange.)
                        StrBufAppendBufPlain(
                                message_text, 
                                HKEY("Content-type: multipart/mixed; boundary=\""),
@@ -210,13 +195,13 @@ void JournalRunQueueMsg(struct jnlq *jmsg) {
                        StrBufAppendBufPlain(message_text, mime_boundary, mblen, 0);
                        StrBufAppendBufPlain(message_text, HKEY("--\r\n"), 0);
 
-                       CM_SetAsFieldSB(journal_msg, eMesageText, &message_text);
+                       CM_SetAsFieldSB(journal_msg, eMessageText, &message_text);
                        free(jmsg->rfc822);
                        free(jmsg->msgn);
                        jmsg->rfc822 = NULL;
                        jmsg->msgn = NULL;
                        
-                       /* Submit journal message */
+                       // Submit journal message
                        CtdlSubmitMsg(journal_msg, journal_recps, "");
                        CM_Free(journal_msg);
                }
@@ -224,14 +209,12 @@ void JournalRunQueueMsg(struct jnlq *jmsg) {
                free_recipients(journal_recps);
        }
 
-       /* We are responsible for freeing this memory. */
+       // We are responsible for freeing this memory.
        free(jmsg);
 }
 
 
-/*
- * Run the queue.
- */
+// Run the queue.
 void JournalRunQueue(void) {
        struct jnlq *jptr = NULL;