remove typedef from struct recptypes
[citadel.git] / citadel / modules / smtp / serv_smtpclient.c
index 9e1226ac87be67f8ed24139b161a0cad1629d4c8..e528015eb4202fa72e6f2bd50bcd071137bc6ec5 100644 (file)
@@ -3,7 +3,7 @@
  *
  * This is the new, exciting, clever version that makes libcurl do all the work  :)
  *
- * Copyright (c) 1997-2018 by the citadel.org team
+ * Copyright (c) 1997-2020 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 as published
 #include <unistd.h>
 #include <stdio.h>
 #include <sysconfig.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 <errno.h>
@@ -58,7 +47,6 @@ struct smtpmsgsrc {           // Data passed in and out of libcurl for message upload
        int bytes_sent;
 };
 
-struct CitContext smtp_client_CC;
 static int doing_smtpclient = 0;
 long *smtpq = NULL;            // array of msgnums containing queue instructions
 int smtpq_count = 0;           // number of queue messages in smtpq
@@ -94,7 +82,7 @@ void smtp_init_spoolout(void)
  * not happen because the delivery instructions message does not
  * contain a recipient.
  */
-int smtp_aftersave(struct CtdlMessage *msg, recptypes * recps)
+int smtp_aftersave(struct CtdlMessage *msg, struct recptypes *recps)
 {
        if ((recps != NULL) && (recps->num_internet > 0)) {
                struct CtdlMessage *imsg = NULL;
@@ -142,7 +130,7 @@ int smtp_aftersave(struct CtdlMessage *msg, recptypes * recps)
                CM_SetField(imsg, eAuthor, HKEY("Citadel"));
                CM_SetField(imsg, eJournal, HKEY("do not journal"));
                CM_SetAsFieldSB(imsg, eMesageText, &SpoolMsg);
-               CtdlSubmitMsg(imsg, NULL, SMTP_SPOOLOUT_ROOM, QP_EADDR);
+               CtdlSubmitMsg(imsg, NULL, SMTP_SPOOLOUT_ROOM);
                CM_Free(imsg);
        }
        return 0;
@@ -361,7 +349,7 @@ void smtp_process_one_msg(long qmsgnum)
        int delete_this_queue = 0;
        char server_response[SIZ];
 
-       msg = CtdlFetchMessage(qmsgnum, 1, 1);
+       msg = CtdlFetchMessage(qmsgnum, 1);
        if (msg == NULL) {
                syslog(LOG_WARNING, "smtpclient: %ld does not exist", qmsgnum);
                return;
@@ -500,7 +488,7 @@ void smtp_process_one_msg(long qmsgnum)
                        // replace the old queue entry with the new one
                        syslog(LOG_DEBUG, "smtpclient: %ld rewriting", qmsgnum);
                        msg = convert_internet_message_buf(&NewInstr);  // This function will free NewInstr for us
-                       CtdlSubmitMsg(msg, NULL, SMTP_SPOOLOUT_ROOM, 0);
+                       CtdlSubmitMsg(msg, NULL, SMTP_SPOOLOUT_ROOM);
                        CM_Free(msg);
                        CtdlDeleteMessages(SMTP_SPOOLOUT_ROOM, &qmsgnum, 1, "");
                }
@@ -555,7 +543,6 @@ void smtp_do_queue(void)
        doing_smtpclient = 1;
 
        syslog(LOG_DEBUG, "smtpclient: start queue run");
-       pthread_setspecific(MyConKey, (void *) &smtp_client_CC);
 
        if (CtdlGetRoom(&CC->room, SMTP_SPOOLOUT_ROOM) != 0) {
                syslog(LOG_WARNING, "Cannot find room <%s>", SMTP_SPOOLOUT_ROOM);
@@ -582,7 +569,6 @@ void smtp_do_queue(void)
 CTDL_MODULE_INIT(smtpclient)
 {
        if (!threading) {
-               CtdlFillSystemContext(&smtp_client_CC, "SMTP_Send");
                CtdlRegisterMessageHook(smtp_aftersave, EVT_AFTERSAVE);
                CtdlRegisterSessionHook(smtp_do_queue, EVT_TIMER, PRIO_AGGR + 50);
                smtp_init_spoolout();