]> code.citadel.org Git - citadel.git/blobdiff - citadel/journaling.c
Add timeout facility for event contexts
[citadel.git] / citadel / journaling.c
index 9ea593bd827f9615e620a51b807d786b8704e8b3..8af9afdca80668f96c3ddf8bea509c9d485fe9da 100644 (file)
@@ -1,52 +1,29 @@
 /*
  * Message journaling functions.
+ *
+ * Copyright (c) 1987-2015 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.
  */
 
-#include "sysdep.h"
-#include <stdlib.h>
-#include <unistd.h>
 #include <stdio.h>
-#include <fcntl.h>
-
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
-#endif
-
-
-#include <ctype.h>
-#include <string.h>
-#include <limits.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <sys/stat.h>
 #include <libcitadel.h>
-#include "citadel.h"
-#include "server.h"
-#include "database.h"
-#include "msgbase.h"
-#include "support.h"
-#include "sysdep_decls.h"
+
+#include "ctdl_module.h"
+
 #include "citserver.h"
-#include "room_ops.h"
-#include "user_ops.h"
-#include "file_ops.h"
 #include "config.h"
-#include "control.h"
-#include "genstamp.h"
-#include "internet_addressing.h"
+#include "user_ops.h"
 #include "serv_vcard.h"                        /* Needed for vcard_getuser and extract_inet_email_addrs */
+#include "internet_addressing.h"
 #include "journaling.h"
 
-#include "ctdl_module.h"
-#include "threads.h"
-
 struct jnlq *jnlq = NULL;      /* journal queue */
 
 /*
@@ -54,7 +31,7 @@ struct jnlq *jnlq = NULL;     /* journal queue */
  */
 void JournalBackgroundSubmit(struct CtdlMessage *msg,
                        StrBuf *saved_rfc822_version,
-                       struct recptypes *recps) {
+                       recptypes *recps) {
 
        struct jnlq *jptr = NULL;
 
@@ -70,7 +47,7 @@ void JournalBackgroundSubmit(struct CtdlMessage *msg,
                return;
        }
        memset(jptr, 0, sizeof(struct jnlq));
-       if (recps != NULL) memcpy(&jptr->recps, recps, sizeof(struct recptypes));
+       if (recps != NULL) memcpy(&jptr->recps, recps, sizeof(recptypes));
        if (!CM_IsEmpty(msg, eAuthor)) jptr->from = strdup(msg->cm_fields[eAuthor]);
        if (!CM_IsEmpty(msg, eNodeName)) jptr->node = strdup(msg->cm_fields[eNodeName]);
        if (!CM_IsEmpty(msg, erFc822Addr)) jptr->rfca = strdup(msg->cm_fields[erFc822Addr]);
@@ -122,7 +99,7 @@ void local_to_inetemail(char *inetemail, char *localuser, size_t inetemail_len)
 void JournalRunQueueMsg(struct jnlq *jmsg) {
 
        struct CtdlMessage *journal_msg = NULL;
-       struct recptypes *journal_recps = NULL;
+       recptypes *journal_recps = NULL;
        StrBuf *message_text = NULL;
        char mime_boundary[256];
        long mblen;
@@ -134,7 +111,7 @@ void JournalRunQueueMsg(struct jnlq *jmsg) {
 
        if (jmsg == NULL)
                return;
-       journal_recps = validate_recipients(config.c_journal_dest, NULL, 0);
+       journal_recps = validate_recipients(CtdlGetConfigStr("c_journal_dest"), NULL, 0);
        if (journal_recps != NULL) {
 
                if (  (journal_recps->num_local > 0)
@@ -162,7 +139,7 @@ void JournalRunQueueMsg(struct jnlq *jmsg) {
                                         "--Citadel-Journal-%08lx-%04x--", time(NULL), ++seq);
                        rfc822len = strlen(jmsg->rfc822);
                       
-                       message_text = NewStrBufPlain(NULL, rfc822len + sizeof(struct recptypes) + 1024);
+                       message_text = NewStrBufPlain(NULL, rfc822len + sizeof(recptypes) + 1024);
 
                        /*
                         * Here is where we begin to compose the journalized message.
@@ -287,7 +264,7 @@ void JournalRunQueueMsg(struct jnlq *jmsg) {
                        
                        /* Submit journal message */
                        CtdlSubmitMsg(journal_msg, journal_recps, "", 0);
-                       CtdlFreeMessage(journal_msg);
+                       CM_Free(journal_msg);
                }
 
                free_recipients(journal_recps);